Lines 2704-2707
Link Here
|
2704 |
elements |
2704 |
elements |
2705 |
); |
2705 |
); |
2706 |
} |
2706 |
} |
|
|
2707 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=230830 |
2708 |
public void test0117() throws Exception { |
2709 |
this.workingCopies = new ICompilationUnit[2]; |
2710 |
this.workingCopies[0] = getWorkingCopy( |
2711 |
"/Resolve/src/test/Test.java", |
2712 |
"package test;\n" + |
2713 |
"\n" + |
2714 |
"public class Test {\n" + |
2715 |
" public void foo() {\n" + |
2716 |
" @A(n=) String str;\n" + |
2717 |
" }\n" + |
2718 |
"}"); |
2719 |
|
2720 |
this.workingCopies[1] = getWorkingCopy( |
2721 |
"/Resolve/src/test/A.java", |
2722 |
"package test;\n" + |
2723 |
"\n" + |
2724 |
"public @interface A {\n" + |
2725 |
" public String n();\n" + |
2726 |
"}"); |
2727 |
|
2728 |
|
2729 |
String str = this.workingCopies[0].getSource(); |
2730 |
int start = str.lastIndexOf("str"); |
2731 |
int length = "str".length(); |
2732 |
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); |
2733 |
|
2734 |
assertElementsEqual( |
2735 |
"Unexpected elements", |
2736 |
"str [in foo() [in Test [in [Working copy] Test.java [in test [in src [in Resolve]]]]]]", |
2737 |
elements |
2738 |
); |
2739 |
} |
2740 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=230830 |
2741 |
public void test0118() throws Exception { |
2742 |
this.workingCopies = new ICompilationUnit[2]; |
2743 |
this.workingCopies[0] = getWorkingCopy( |
2744 |
"/Resolve/src/test/Test.java", |
2745 |
"package test;\n" + |
2746 |
"\n" + |
2747 |
"public class Test {\n" + |
2748 |
" public void foo() {\n" + |
2749 |
" @A(n=) String str;\n" + |
2750 |
" }\n" + |
2751 |
"}"); |
2752 |
|
2753 |
this.workingCopies[1] = getWorkingCopy( |
2754 |
"/Resolve/src/test/A.java", |
2755 |
"package test;\n" + |
2756 |
"\n" + |
2757 |
"public @interface A {\n" + |
2758 |
" public String n();\n" + |
2759 |
"}"); |
2760 |
|
2761 |
|
2762 |
String str = this.workingCopies[0].getSource(); |
2763 |
int start = str.lastIndexOf("str"); |
2764 |
int length = "str".length(); |
2765 |
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); |
2766 |
|
2767 |
if (elements != null && |
2768 |
elements.length > 0 && |
2769 |
elements[0] instanceof IAnnotatable) { |
2770 |
IAnnotation[] annotations = ((IAnnotatable)elements[0]).getAnnotations(); |
2771 |
assertAnnotationsEqual( |
2772 |
"@A(n=<null>)\n", |
2773 |
annotations); |
2774 |
} else { |
2775 |
assertTrue("Unexpected elements", false); |
2776 |
} |
2777 |
} |
2707 |
} |
2778 |
} |