Skip to content

Commit

Permalink
Fix a crash on c-style arrays in parameters
Browse files Browse the repository at this point in the history
Fixes #374

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=286467734
  • Loading branch information
cushon authored and kluever committed Dec 20, 2019
1 parent 81aaab9 commit ed40e47
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2542,18 +2542,20 @@ private void visitToDeclare(
String equals,
Optional<String> trailing) {
sync(node);
TypeWithDims extractedDims = DimensionHelpers.extractDims(node.getType(), SortedDims.YES);
Optional<TypeWithDims> typeWithDims = Optional.of(extractedDims);
declareOne(
kind,
annotationsDirection,
Optional.of(node.getModifiers()),
node.getType(),
extractedDims.node,
node.getName(),
"",
equals,
initializer,
trailing,
/* receiverExpression= */ Optional.empty(),
/* typeWithDims= */ Optional.empty());
typeWithDims);
}

/** Does not omit the leading '<', which should be associated with the type name. */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
@interface MyTypeAnno {}

public class GjfFailure {
void m(int a @MyTypeAnno []) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
@interface MyTypeAnno {}

public class GjfFailure {
void m(int a @MyTypeAnno []) {}
}

0 comments on commit ed40e47

Please sign in to comment.