Lines 47-53
Link Here
|
47 |
} |
47 |
} |
48 |
|
48 |
|
49 |
static { |
49 |
static { |
50 |
// TESTS_NUMBERS = new int[] { 342, 343 }; |
50 |
// TESTS_NUMBERS = new int[] { 344 }; |
51 |
// TESTS_RANGE = new int[] { 325, -1 }; |
51 |
// TESTS_RANGE = new int[] { 325, -1 }; |
52 |
// TESTS_NAMES = new String[] {"test0204"}; |
52 |
// TESTS_NAMES = new String[] {"test0204"}; |
53 |
} |
53 |
} |
Lines 10990-10993
Link Here
|
10990 |
annotations = binding.getAnnotations(); |
10990 |
annotations = binding.getAnnotations(); |
10991 |
assertEquals("Wrong size", 1, annotations.length); |
10991 |
assertEquals("Wrong size", 1, annotations.length); |
10992 |
} |
10992 |
} |
|
|
10993 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=223225 |
10994 |
public void test344() throws JavaModelException { |
10995 |
String contents = |
10996 |
"public class X {\r\n" + |
10997 |
" private @interface Strings {\r\n" + |
10998 |
" String[] value() default \"default element\";\r\n" + |
10999 |
" }\r\n" + |
11000 |
" @Strings\r\n" + |
11001 |
" public void marker() {\r\n" + |
11002 |
" // nothing\r\n" + |
11003 |
" }\r\n" + |
11004 |
" @Strings(\"single element\")\r\n" + |
11005 |
" public void single() {\r\n" + |
11006 |
" // nothing\r\n" + |
11007 |
" }\r\n" + |
11008 |
" @Strings(value = \"single element\")\r\n" + |
11009 |
" public void singleValue() {\r\n" + |
11010 |
" // nothing\r\n" + |
11011 |
" }\r\n" + |
11012 |
" @Strings({\"single element\"})\r\n" + |
11013 |
" public void singleArray() {\r\n" + |
11014 |
" // nothing\r\n" + |
11015 |
" }\r\n" + |
11016 |
" @Strings(value = {\"single element\"})\r\n" + |
11017 |
" public void singleArrayValue() {\r\n" + |
11018 |
" // nothing\r\n" + |
11019 |
" }\r\n" + |
11020 |
" @Strings({\"one\", \"two\", \"three\"})\r\n" + |
11021 |
" public void multi() {\r\n" + |
11022 |
" // nothing\r\n" + |
11023 |
" }\r\n" + |
11024 |
" @Strings(value = {\"one\", \"two\", \"three\"})\r\n" + |
11025 |
" public void multiValue() {\r\n" + |
11026 |
" // nothing\r\n" + |
11027 |
" }\r\n" + |
11028 |
"}"; |
11029 |
this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); |
11030 |
CompilationUnit unit= (CompilationUnit) buildAST( |
11031 |
contents, |
11032 |
this.workingCopy, |
11033 |
true, |
11034 |
true, |
11035 |
true); |
11036 |
unit.accept(new ASTVisitor() { |
11037 |
public boolean visit(MarkerAnnotation node) { |
11038 |
return checkAnnotationBinding(node); |
11039 |
} |
11040 |
private boolean checkAnnotationBinding(Annotation annotation) { |
11041 |
final IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding(); |
11042 |
final IMemberValuePairBinding[] allMemberValuePairs = annotationBinding.getAllMemberValuePairs(); |
11043 |
assertEquals("Wrong size", 1, allMemberValuePairs.length); |
11044 |
IMemberValuePairBinding memberValuePairBinding = allMemberValuePairs[0]; |
11045 |
final Object value = memberValuePairBinding.getValue(); |
11046 |
assertTrue("Not an array", value.getClass().isArray()); |
11047 |
return false; |
11048 |
} |
11049 |
public boolean visit(SingleMemberAnnotation node) { |
11050 |
return checkAnnotationBinding(node); |
11051 |
} |
11052 |
public boolean visit(NormalAnnotation node) { |
11053 |
return checkAnnotationBinding(node); |
11054 |
} |
11055 |
}); |
11056 |
AnnotationTypeDeclaration annotationTypeDeclaration = (AnnotationTypeDeclaration) ((AbstractTypeDeclaration) unit.types().get(0)).bodyDeclarations().get(0); |
11057 |
AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration = (AnnotationTypeMemberDeclaration) annotationTypeDeclaration.bodyDeclarations().get(0); |
11058 |
final IMethodBinding binding = annotationTypeMemberDeclaration.resolveBinding(); |
11059 |
final Object defaultValue = binding.getDefaultValue(); |
11060 |
assertTrue("Not an array", !defaultValue.getClass().isArray()); |
11061 |
} |
10993 |
} |
11062 |
} |