Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 64989 Details for
Bug 158985
Code completion engine hints annotations on wrong places
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix for issue 1)
bug158985_007.txt (text/plain), 89.27 KB, created by
David Audel
on 2007-04-26 05:17:48 EDT
(
hide
)
Description:
Proposed fix for issue 1)
Filename:
MIME Type:
Creator:
David Audel
Created:
2007-04-26 05:17:48 EDT
Size:
89.27 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: JCL/jclMin1.5src.zip >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/JCL/jclMin1.5src.zip,v >retrieving revision 1.4 >diff -u -r1.4 jclMin1.5src.zip >Binary files /tmp/cvslJAjMp and jclMin1.5src.zip differ >Index: JCL/jclMin1.5.jar >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/JCL/jclMin1.5.jar,v >retrieving revision 1.4 >diff -u -r1.4 jclMin1.5.jar >Binary files /tmp/cvsN05AcO and jclMin1.5.jar differ >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.105 >diff -u -r1.105 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 24 Apr 2007 09:00:28 -0000 1.105 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 26 Apr 2007 09:02:47 -0000 >@@ -2949,7 +2949,8 @@ > "java.lang.IllegalMonitorStateException\n" + > "java.lang.InterruptedException\n" + > "java.lang.RuntimeException\n" + >- "java.lang.annotation.Annotation", >+ "java.lang.annotation.Annotation\n" + >+ "java.lang.annotation.Retention", > requestor); > } > public void testBug92264c() throws CoreException { >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java,v >retrieving revision 1.83 >diff -u -r1.83 CompletionTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 6 Mar 2007 04:43:19 -0000 1.83 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 26 Apr 2007 09:02:46 -0000 >@@ -2111,7 +2111,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void test0076() throws JavaModelException { >@@ -2135,7 +2135,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void test0077() throws JavaModelException { >@@ -2186,7 +2186,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void test0079() throws JavaModelException { >@@ -2211,7 +2211,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void test0080() throws JavaModelException { >@@ -2236,7 +2236,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void test0081() throws JavaModelException { >@@ -2261,7 +2261,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void test0082() throws JavaModelException { >@@ -2287,7 +2287,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void test0083() throws JavaModelException { >@@ -2367,7 +2367,7 @@ > this.wc.codeComplete(cursorLocation, requestor); > > assertResults( >- "TestAnnotation[TYPE_REF]{TestAnnotation, test0085, Ltest0085.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", >+ "TestAnnotation[TYPE_REF]{TestAnnotation, test0085, Ltest0085.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=85290 >@@ -2388,7 +2388,7 @@ > this.wc.codeComplete(cursorLocation, requestor); > > assertResults( >- "TestAnnotation[TYPE_REF]{TestAnnotation, , LTestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", >+ "TestAnnotation[TYPE_REF]{TestAnnotation, , LTestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=85402 >@@ -2415,7 +2415,7 @@ > requestor.getResults()); > } else { > assertResults( >- "TestAnnotation[TYPE_REF]{TestAnnotation, test0087, Ltest0087.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", >+ "TestAnnotation[TYPE_REF]{TestAnnotation, test0087, Ltest0087.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", > requestor.getResults()); > } > } >@@ -6634,7 +6634,7 @@ > result.context); > > assertResults( >- "ZZType.ZZAnnotation[TYPE_REF]{p.ZZType.ZZAnnotation, p, Lp.ZZType$ZZAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "ZZType.ZZAnnotation[TYPE_REF]{p.ZZType.ZZAnnotation, p, Lp.ZZType$ZZAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > result.proposals); > } finally { > if(aType != null) { >@@ -9007,7 +9007,7 @@ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=123225 >@@ -9437,6 +9437,1189 @@ > "Top<java.lang.Object>.IZZException[TYPE_REF]{test.Top.IZZException, test, Ltest.Top<Ljava.lang.Object;>.IZZException;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0301() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0302() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0303() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/TOPZZZ1.java", >+ "package p;\n" + >+ "public class TOPZZZ1 {\n" + >+ " @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ " public @interface ZZZ1 {\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/TOPZZZ2.java", >+ "package p;\n" + >+ "public class TOPZZZ2 {\n" + >+ " public @interface ZZZ2 {\n" + >+ " }\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "TOPZZZ1.ZZZ1[TYPE_REF]{p.TOPZZZ1.ZZZ1, p, Lp.TOPZZZ1$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "TOPZZZ2.ZZZ2[TYPE_REF]{p.TOPZZZ2.ZZZ2, p, Lp.TOPZZZ2$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0304() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "@interface ZZZ1 {\n" + >+ "}\n" + >+ "@interface ZZZ2 {\n" + >+ "}\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{ZZZ1, test, Ltest.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{ZZZ2, test, Ltest.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0305() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "class TOPZZZ1 {\n" + >+ " @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ " public @interface ZZZ1 {\n" + >+ " }\n" + >+ "}\n" + >+ "class TOPZZZ2 {\n" + >+ " public @interface ZZZ2 {\n" + >+ " }\n" + >+ "}\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "TOPZZZ1.ZZZ1[TYPE_REF]{test.TOPZZZ1.ZZZ1, test, Ltest.TOPZZZ1$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "TOPZZZ2.ZZZ2[TYPE_REF]{test.TOPZZZ2.ZZZ2, test, Ltest.TOPZZZ2$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0306() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public static class TOPZZZ1 {\n" + >+ " @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ " public @interface ZZZ1 {\n" + >+ " }\n" + >+ " }\n" + >+ " public static class TOPZZZ2 {\n" + >+ " public @interface ZZZ2 {\n" + >+ " }\n" + >+ " }\n" + >+ " public class TOPZZZ3 {\n" + >+ " public @interface ZZZ3 {\n" + >+ " }\n" + >+ " }\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "Test.TOPZZZ1.ZZZ1[TYPE_REF]{test.Test.TOPZZZ1.ZZZ1, test, Ltest.Test$TOPZZZ1$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "Test.TOPZZZ2.ZZZ2[TYPE_REF]{test.Test.TOPZZZ2.ZZZ2, test, Ltest.Test$TOPZZZ2$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0307() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ " public @interface ZZZ1 {\n" + >+ " }\n" + >+ " public @interface ZZZ2 {\n" + >+ " }\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "Test.ZZZ1[TYPE_REF]{ZZZ1, test, Ltest.Test$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "Test.ZZZ2[TYPE_REF]{ZZZ2, test, Ltest.Test$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0308() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public void method() {\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0309() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public class TestInner {\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0310() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public int field;\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0311() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void foo(@ZZZ int param){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.PARAMETER})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0312() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public Test(){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.CONSTRUCTOR})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+// When the completion is inside a method body the annotation cannot be accuratly attached to the correct node by completino recovery. >+// So relevance based on annotation target are ignored. >+public void test0313() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " {\n" + >+ " @ZZZ\n" + >+ " int var = 0;\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.LOCAL_VARIABLE})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0314() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public @interface TestInner {}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.ANNOTATION_TYPE})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0315() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "@ZZZ package test;\n" + >+ "public class Test {\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.PACKAGE})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0316() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public Test(){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.CONSTRUCTOR})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0317() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " public @interface TestInner {}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.ANNOTATION_TYPE})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0318() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "@ZZZ\n" + >+ "import test.*;\n" + >+ "public class Test {\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0319() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " {}\n" + >+ " public void foo() {}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0320() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[5]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ\n" + >+ " {\n" + >+ " int var = 0;\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.PARAMETER})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.LOCAL_VARIABLE})\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ this.workingCopies[4] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ4.java", >+ "package p;\n" + >+ "public @interface ZZZ4 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ4[TYPE_REF]{p.ZZZ4, p, Lp.ZZZ4;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0321() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ({})\n" + >+ " int var = 0;\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0321b() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ(value={})\n" + >+ " int var = 0;\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0322() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ @Annot\n" + >+ " int var = 0;\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0323() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @ZZZ @Annot({})\n" + >+ " int var = 0;\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0324() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void foo(@ZZZ int param){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.PARAMETER})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0325() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @p.Annot(@ZZZ)\n" + >+ " public void foo(){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/Annot.java", >+ "package p;\n" + >+ "public @interface Annot {\n" + >+ " ZZZ2 value();\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0326() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @p.Annot(@ZZZ(value=0))\n" + >+ " public void foo(){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/Annot.java", >+ "package p;\n" + >+ "public @interface Annot {\n" + >+ " ZZZ2 value();\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0327() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @p.Annot(@ZZZ(value=0\n" + >+ " public void foo(){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/Annot.java", >+ "package p;\n" + >+ "public @interface Annot {\n" + >+ " ZZZ2 value();\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0328() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " @p.Annot(@ZZZ(value=\n" + >+ " public void foo(){}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/p/Annot.java", >+ "package p;\n" + >+ "public @interface Annot {\n" + >+ " ZZZ2 value();\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985 >+public void test0329() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[4]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "@ZZZ\n" + >+ "public class Test {\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ1.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" + >+ "public @interface ZZZ1 {\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ2.java", >+ "package p;\n" + >+ "@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" + >+ "public @interface ZZZ2 {\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/p/ZZZ3.java", >+ "package p;\n" + >+ "public @interface ZZZ3 {\n" + >+ "}"); >+ >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ZZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=153130 > public void testEC001() throws JavaModelException { > this.workingCopies = new ICompilationUnit[1]; >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java,v >retrieving revision 1.177 >diff -u -r1.177 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 12 Apr 2007 09:23:29 -0000 1.177 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 26 Apr 2007 09:02:52 -0000 >@@ -112,6 +112,7 @@ > // K_BETWEEN_ANNOTATION_NAME_AND_RPAREN arguments > static final int LPAREN_NOT_CONSUMED = 1; > static final int LPAREN_CONSUMED = 2; >+ static final int ANNOTATION_NAME_COMPLETION = 4; > > // K_PARAMETERIZED_METHOD_INVOCATION arguments > static final int INSIDE_NAME = 1; >@@ -150,6 +151,8 @@ > public int[] potentialVariableNameStarts; > public int[] potentialVariableNameEnds; > >+ CompletionOnAnnotationOfType pendingAnnotation; >+ > public CompletionParser(ProblemReporter problemReporter) { > super(problemReporter); > this.reportSyntaxErrorIsRequired = false; >@@ -263,12 +266,13 @@ > } > > if(orphan instanceof Annotation) { >- TypeDeclaration fakeType = >+ CompletionOnAnnotationOfType fakeType = > new CompletionOnAnnotationOfType( > FAKE_TYPE_NAME, > this.compilationUnit.compilationResult(), > (Annotation)orphan); > currentElement.parent.add(fakeType, 0); >+ this.pendingAnnotation = fakeType; > return; > } > } >@@ -280,13 +284,20 @@ > } > > if(orphan instanceof Annotation) { >- TypeDeclaration fakeType = >- new CompletionOnAnnotationOfType( >- FAKE_TYPE_NAME, >- this.compilationUnit.compilationResult(), >- (Annotation)orphan); >- currentElement.add(fakeType, 0); >- return; >+ popUntilCompletedAnnotationIfNecessary(); >+ >+ CompletionOnAnnotationOfType fakeType = >+ new CompletionOnAnnotationOfType( >+ FAKE_TYPE_NAME, >+ this.compilationUnit.compilationResult(), >+ (Annotation)orphan); >+ currentElement.add(fakeType, 0); >+ >+ if (!isInsideAnnotation()) { >+ this.pendingAnnotation = fakeType; >+ } >+ >+ return; > } > > if ((topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_CATCH_AND_RIGHT_PAREN)) { >@@ -597,13 +608,14 @@ > annotation.memberValuePairs = memberValuePairs; > > } >- TypeDeclaration fakeType = >+ CompletionOnAnnotationOfType fakeType = > new CompletionOnAnnotationOfType( > FAKE_TYPE_NAME, > this.compilationUnit.compilationResult(), > annotation); > > currentElement.add(fakeType, 0); >+ this.pendingAnnotation = fakeType; > } > private void buildMoreCompletionContext(Expression expression) { > Statement statement = expression; >@@ -1892,6 +1904,7 @@ > protected void consumeClassBodyDeclaration() { > popElement(K_BLOCK_DELIMITER); > super.consumeClassBodyDeclaration(); >+ this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes > } > protected void consumeClassBodyopt() { > popElement(K_SELECTOR_QUALIFIER); >@@ -1919,7 +1932,10 @@ > } > protected void consumeClassHeaderName1() { > super.consumeClassHeaderName1(); >- >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } > classHeaderExtendsOrImplements(false); > } > >@@ -2002,7 +2018,16 @@ > > /* no need to take action if not inside assist identifiers */ > if (indexOfAssistIdentifier() < 0) { >- super.consumeConstructorHeaderName(); >+ /* recovering - might be an empty message send */ >+ if (this.currentElement != null && this.lastIgnoredToken == TokenNamenew){ // was an allocation expression >+ super.consumeConstructorHeaderName(); >+ } else { >+ super.consumeConstructorHeaderName(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } >+ } > return; > } > >@@ -2014,6 +2039,17 @@ > pushOnGenericsLengthStack(0); // handle type arguments > this.restartRecovery = true; > } >+protected void consumeConstructorHeaderNameWithTypeParameters() { >+ if (this.currentElement != null && this.lastIgnoredToken == TokenNamenew){ // was an allocation expression >+ super.consumeConstructorHeaderNameWithTypeParameters(); >+ } else { >+ super.consumeConstructorHeaderNameWithTypeParameters(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } >+ } >+} > protected void consumeDefaultLabel() { > super.consumeDefaultLabel(); > if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SWITCH_LABEL) { >@@ -2025,6 +2061,13 @@ > // DimWithOrWithOutExpr ::= '[' ']' > pushOnExpressionStack(null); > } >+protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) { >+ super.consumeEnhancedForStatementHeaderInit(hasModifiers); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } >+} > protected void consumeEnterAnonymousClassBody() { > popElement(K_SELECTOR_QUALIFIER); > popElement(K_SELECTOR_INVOCATION_TYPE); >@@ -2041,43 +2084,34 @@ > if(isLocalDeclaration || indexOfAssistIdentifier() < 0 || variableIndex != 0 || extendedDimension != 0) { > identifierPtr++; > identifierLengthPtr++; >- super.consumeEnterVariable(); >+ >+ if (this.pendingAnnotation != null && >+ this.assistNode != null && >+ this.currentElement != null && >+ this.currentElement instanceof RecoveredMethod && >+ !this.currentElement.foundOpeningBrace && >+ ((RecoveredMethod)this.currentElement).methodDeclaration.declarationSourceEnd == 0) { >+ // this is a method parameter >+ super.consumeEnterVariable(); >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation.isParameter = true; >+ this.pendingAnnotation = null; >+ >+ } else { >+ super.consumeEnterVariable(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } >+ } > } else { > restartRecovery = true; > >-// private boolean checkKeyword() { >-// if (currentElement instanceof RecoveredUnit) { >-// RecoveredUnit unit = (RecoveredUnit) currentElement; >-// int index = -1; >-// if ((index = this.indexOfAssistIdentifier()) > -1) { >-// if(unit.typeCount == 0 >-// && CharOperation.prefixEquals(identifierStack[index], Keywords.IMPORT)) { >-// CompletionOnKeyword2 completionOnImportKeyword = new CompletionOnKeyword2(Keywords.IMPORT, identifierPositionStack[index]); >-// this.assistNode = completionOnImportKeyword; >-// this.lastCheckPoint = completionOnImportKeyword.sourceEnd + 1; >-// this.isOrphanCompletionNode = true; >-// return true; >-// } else if(unit.typeCount == 0 >-// && unit.importCount == 0 >-// && CharOperation.prefixEquals(identifierStack[index], Keywords.PACKAGE)) { >-// CompletionOnKeyword2 completionOnImportKeyword = new CompletionOnKeyword2(Keywords.PACKAGE, identifierPositionStack[index]); >-// this.assistNode = completionOnImportKeyword; >-// this.lastCheckPoint = completionOnImportKeyword.sourceEnd + 1; >-// this.isOrphanCompletionNode = true; >-// return true; >-// } >-// } >-// } >-// return false; >-// } >- > // recovery > if (currentElement != null) { > if(!checkKeyword() && !(currentElement instanceof RecoveredUnit && ((RecoveredUnit)currentElement).typeCount == 0)) { > int nameSourceStart = (int)(identifierPositionStack[identifierPtr] >>> 32); > intPtr--; >-// pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]); >-// pushOnGenericsLengthStack(0); > TypeReference type = getTypeReference(intStack[intPtr--]); > intPtr--; > >@@ -2100,6 +2134,28 @@ > } > } > } >+protected void consumeEnumConstantHeaderName() { >+ if (this.currentElement != null) { >+ if (!(this.currentElement instanceof RecoveredType >+ || (this.currentElement instanceof RecoveredField && ((RecoveredField)currentElement).fieldDeclaration.type == null)) >+ || (this.lastIgnoredToken == TokenNameDOT)) { >+ super.consumeEnumConstantHeaderName(); >+ return; >+ } >+ } >+ super.consumeEnumConstantHeaderName(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } >+} >+protected void consumeEnumHeaderName() { >+ super.consumeEnumHeaderName(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } >+} > protected void consumeEqualityExpression(int op) { > super.consumeEqualityExpression(op); > popElement(K_BINARY_OPERATOR); >@@ -2163,6 +2219,10 @@ > protected void consumeFormalParameter(boolean isVarArgs) { > if (this.indexOfAssistIdentifier() < 0) { > super.consumeFormalParameter(isVarArgs); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } > } else { > > identifierLengthPtr--; >@@ -2298,7 +2358,10 @@ > } > protected void consumeInterfaceHeaderName1() { > super.consumeInterfaceHeaderName1(); >- >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } > classHeaderExtendsOrImplements(true); > } > protected void consumeInterfaceHeaderExtends() { >@@ -2349,6 +2412,10 @@ > identifierPtr++; > identifierLengthPtr++; > super.consumeMethodHeaderName(isAnnotationMethod); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } > } else { > restartRecovery = true; > >@@ -2463,6 +2530,13 @@ > } > } > } >+protected void consumeMethodHeaderNameWithTypeParameters( boolean isAnnotationMethod) { >+ super.consumeMethodHeaderNameWithTypeParameters(isAnnotationMethod); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } >+} > protected void consumeMethodHeaderRightParen() { > super.consumeMethodHeaderRightParen(); > >@@ -2576,9 +2650,17 @@ > > assistNode = markerAnnotation; > this.isOrphanCompletionNode = true; >- this.restartRecovery = true; > > this.lastCheckPoint = markerAnnotation.sourceEnd + 1; >+ >+ this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_NOT_CONSUMED | ANNOTATION_NAME_COMPLETION); >+} >+protected void consumeAnnotationTypeDeclarationHeaderName() { >+ super.consumeAnnotationTypeDeclarationHeaderName(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr]; >+ this.pendingAnnotation = null; >+ } > } > protected void consumeLabel() { > super.consumeLabel(); >@@ -2586,8 +2668,14 @@ > this.pushOnElementStack(K_LABEL, this.labelPtr); > } > protected void consumeMarkerAnnotation() { >- this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >- super.consumeMarkerAnnotation(); >+ if (this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN && >+ (this.topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) & ANNOTATION_NAME_COMPLETION) != 0 ) { >+ this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >+ this.restartRecovery = true; >+ } else { >+ this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >+ super.consumeMarkerAnnotation(); >+ } > } > protected void consumeMemberValuePair() { > /* check if current awaiting identifier is the completion identifier */ >@@ -2656,8 +2744,22 @@ > } > } > protected void consumeSingleMemberAnnotation() { >- this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >- super.consumeSingleMemberAnnotation(); >+ if (this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN && >+ (this.topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) & ANNOTATION_NAME_COMPLETION) != 0 ) { >+ this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >+ this.restartRecovery = true; >+ } else { >+ this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >+ super.consumeSingleMemberAnnotation(); >+ } >+} >+protected void consumeSingleStaticImportDeclarationName() { >+ super.consumeSingleStaticImportDeclarationName(); >+ this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes >+} >+protected void consumeSingleTypeImportDeclarationName() { >+ super.consumeSingleTypeImportDeclarationName(); >+ this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes > } > protected void consumeStatementBreakWithLabel() { > super.consumeStatementBreakWithLabel(); >@@ -2680,13 +2782,41 @@ > popElement(K_BLOCK_DELIMITER); > } > } >+protected void consumeStaticImportOnDemandDeclarationName() { >+ super.consumeStaticImportOnDemandDeclarationName(); >+ this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes >+} >+protected void consumeStaticInitializer() { >+ super.consumeStaticInitializer(); >+ this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes >+} > protected void consumeNestedMethod() { > super.consumeNestedMethod(); > if(!(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BLOCK_DELIMITER)) pushOnElementStack(K_BLOCK_DELIMITER); > } > protected void consumeNormalAnnotation() { >- this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >- super.consumeNormalAnnotation(); >+ if (this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN && >+ (this.topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) & ANNOTATION_NAME_COMPLETION) != 0 ) { >+ this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >+ this.restartRecovery = true; >+ } else { >+ this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >+ super.consumeNormalAnnotation(); >+ } >+} >+protected void consumePackageDeclarationName() { >+ super.consumePackageDeclarationName(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.compilationUnit.currentPackage; >+ this.pendingAnnotation = null; >+ } >+} >+protected void consumePackageDeclarationNameWithModifiers() { >+ super.consumePackageDeclarationNameWithModifiers(); >+ if (this.pendingAnnotation != null) { >+ this.pendingAnnotation.potentialAnnotatedNode = this.compilationUnit.currentPackage; >+ this.pendingAnnotation = null; >+ } > } > protected void consumePrimaryNoNewArrayName() { > // this is class literal access, so reset potential receiver >@@ -2849,11 +2979,16 @@ > switch (previous) { > case TokenNameIdentifier: // eg. fred[(]) or foo.fred[(]) > if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SELECTOR) { >+ int info = 0; > if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER,1) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN && >- topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER,1) == LPAREN_NOT_CONSUMED) { >+ (info=topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER,1) & LPAREN_NOT_CONSUMED) != 0) { > this.popElement(K_SELECTOR); > this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN); >- this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_CONSUMED); >+ if ((info & ANNOTATION_NAME_COMPLETION) != 0) { >+ this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_CONSUMED | ANNOTATION_NAME_COMPLETION); >+ } else { >+ this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_CONSUMED); >+ } > } else { > this.pushOnElementStack(K_SELECTOR_INVOCATION_TYPE, this.invocationType); > this.pushOnElementStack(K_SELECTOR_QUALIFIER, this.qualifier); >@@ -3238,6 +3373,10 @@ > TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr]; > classHeaderExtendsOrImplements((typeDecl.modifiers & ClassFileConstants.AccInterface) != 0); > } >+protected void consumeTypeImportOnDemandDeclarationName() { >+ super.consumeTypeImportOnDemandDeclarationName(); >+ this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes >+} > protected void consumeTypeParameters() { > super.consumeTypeParameters(); > popElement(K_BINARY_OPERATOR); >@@ -3780,6 +3919,7 @@ > } > return false; > } >+ > protected boolean isIndirectlyInsideBlock(){ > int i = elementPtr; > while(i > -1) { >@@ -3919,6 +4059,22 @@ > > return fakeMethod; > } >+protected void popUntilCompletedAnnotationIfNecessary() { >+ if(elementPtr < 0) return; >+ >+ int i = elementPtr; >+ while(i > -1 && >+ (elementKindStack[i] != K_BETWEEN_ANNOTATION_NAME_AND_RPAREN || >+ (elementInfoStack[i] & ANNOTATION_NAME_COMPLETION) == 0)) { >+ i--; >+ } >+ >+ if(i >= 0) { >+ previousKind = elementKindStack[i]; >+ previousInfo = elementInfoStack[i]; >+ elementPtr = i - 1; >+ } >+} > /* > * Prepares the state of the parser to go for BlockStatements. > */ >@@ -4012,6 +4168,12 @@ > public void recoveryTokenCheck() { > RecoveredElement oldElement = currentElement; > switch (currentToken) { >+ case TokenNameLBRACE : >+ if(!this.ignoreNextOpeningBrace) { >+ this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes >+ } >+ super.recoveryTokenCheck(); >+ break; > case TokenNameRBRACE : > super.recoveryTokenCheck(); > if(currentElement != oldElement && oldElement instanceof RecoveredBlock) { >@@ -4099,7 +4261,9 @@ > /* restart in diet mode for finding sibling constructs */ > if (currentElement instanceof RecoveredType > || currentElement.enclosingType() != null){ >- >+ >+ this.pendingAnnotation = null; >+ > if(lastCheckPoint <= this.assistNode.sourceEnd) { > lastCheckPoint = this.assistNode.sourceEnd+1; > } >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnAnnotationOfType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnAnnotationOfType.java,v >retrieving revision 1.3 >diff -u -r1.3 CompletionOnAnnotationOfType.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnAnnotationOfType.java 23 Feb 2005 02:47:28 -0000 1.3 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnAnnotationOfType.java 26 Apr 2007 09:02:51 -0000 >@@ -11,10 +11,16 @@ > package org.eclipse.jdt.internal.codeassist.complete; > > import org.eclipse.jdt.internal.compiler.CompilationResult; >+import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.ast.Annotation; > import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; > > public class CompletionOnAnnotationOfType extends TypeDeclaration { >+ public ASTNode potentialAnnotatedNode; >+ // During recovery a parameter can be parsed as a FieldDeclaration instead of Argument. >+ // 'isParameter' is set to true in this case. >+ public boolean isParameter; >+ > public CompletionOnAnnotationOfType(char[] typeName, CompilationResult compilationResult, Annotation annotation){ > super(compilationResult); > this.sourceEnd = annotation.sourceEnd; >Index: codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java,v >retrieving revision 1.32 >diff -u -r1.32 RelevanceConstants.java >--- codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 6 Mar 2007 02:38:51 -0000 1.32 >+++ codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 26 Apr 2007 09:02:51 -0000 >@@ -42,4 +42,5 @@ > int R_NON_INHERITED = 2; > int R_NO_PROBLEMS = 1; > int R_RESOLVED = 1; >+ int R_TARGET = 5; > } >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.326 >diff -u -r1.326 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 25 Apr 2007 16:59:24 -0000 1.326 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 26 Apr 2007 09:02:51 -0000 >@@ -255,6 +255,8 @@ > int assistNodeInJavadoc = 0; > boolean assistNodeCanBeSingleMemberAnnotation = false; > >+ long targetedElement; >+ > IJavaProject javaProject; > CompletionParser parser; > CompletionRequestor requestor; >@@ -436,7 +438,7 @@ > acceptedTypes.add(new AcceptedType(packageName, simpleTypeName, enclosingTypeNames, modifiers, accessibility)); > } > >- private void acceptTypes() { >+ private void acceptTypes(Scope scope) { > if(this.acceptedTypes == null) return; > > int length = this.acceptedTypes.size(); >@@ -512,7 +514,8 @@ > accessibility, > typeName, > fullyQualifiedName, >- !CharOperation.equals(fullyQualifiedName, importName[1])); >+ !CharOperation.equals(fullyQualifiedName, importName[1]), >+ scope); > continue next; > } > } >@@ -526,7 +529,8 @@ > accessibility, > typeName, > fullyQualifiedName, >- false); >+ false, >+ scope); > continue next; > } else { > char[] fullyQualifiedEnclosingTypeOrPackageName = null; >@@ -610,7 +614,8 @@ > accessibility, > typeName, > fullyQualifiedName, >- true); >+ true, >+ scope); > } > } > } >@@ -628,7 +633,8 @@ > value.accessibility, > value.qualifiedTypeName, > value.fullyQualifiedName, >- value.mustBeQualified); >+ value.mustBeQualified, >+ scope); > } > } > } >@@ -691,7 +697,7 @@ > return true; > } > >- private void proposeType(char[] packageName, char[] simpleTypeName, int modifiers, int accessibility, char[] typeName, char[] fullyQualifiedName, boolean isQualified) { >+ private void proposeType(char[] packageName, char[] simpleTypeName, int modifiers, int accessibility, char[] typeName, char[] fullyQualifiedName, boolean isQualified, Scope scope) { > char[] completionName = fullyQualifiedName; > if(isQualified) { > if (packageName == null || packageName.length == 0) >@@ -700,6 +706,34 @@ > } else { > completionName = simpleTypeName; > } >+ >+ TypeBinding guessedType = null; >+ if ((modifiers & ClassFileConstants.AccAnnotation) != 0 && >+ this.assistNodeIsAnnotation && >+ (this.targetedElement & TagBits.AnnotationTargetMASK) != 0) { >+ char[][] cn = CharOperation.splitOn('.', fullyQualifiedName); >+ >+ TypeReference ref; >+ if (cn.length == 1) { >+ ref = new SingleTypeReference(simpleTypeName, 0); >+ } else { >+ ref = new QualifiedTypeReference(cn,new long[cn.length]); >+ } >+ >+ switch (scope.kind) { >+ case Scope.METHOD_SCOPE : >+ case Scope.BLOCK_SCOPE : >+ guessedType = ref.resolveType((BlockScope)scope); >+ break; >+ case Scope.CLASS_SCOPE : >+ guessedType = ref.resolveType((ClassScope)scope); >+ break; >+ } >+ >+ if (!guessedType.isValidBinding()) return; >+ >+ if (!hasPossibleAnnotationTarget(guessedType, scope)) return; >+ } > > int relevance = computeBaseRelevance(); > relevance += computeRelevanceForResolution(); >@@ -714,6 +748,7 @@ > case ClassFileConstants.AccAnnotation: > case ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface: > relevance += computeRelevanceForAnnotation(); >+ if (guessedType != null) relevance += computeRelevanceForAnnotationTarget(guessedType); > relevance += computeRelevanceForInterface(); > break; > case ClassFileConstants.AccEnum: >@@ -1428,6 +1463,16 @@ > } else if (astNode instanceof CompletionOnMarkerAnnotationName) { > CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode; > >+ CompletionOnAnnotationOfType fakeType = (CompletionOnAnnotationOfType)scope.parent.referenceContext(); >+ if (fakeType.annotations[0] == annot) { >+ // When the completion is inside a method body the annotation cannot be accuratly attached to the correct node by completion recovery. >+ // So 'targetedElement' is not computed in this case. >+ if (scope.parent.parent == null || !(scope.parent.parent instanceof MethodScope)) { >+ this.targetedElement = computeTargetedElement(fakeType); >+ } >+ >+ } >+ > this.assistNodeIsAnnotation = true; > if (annot.type instanceof CompletionOnSingleTypeReference) { > CompletionOnSingleTypeReference type = (CompletionOnSingleTypeReference) annot.type; >@@ -2110,6 +2155,34 @@ > } > } > >+ private long computeTargetedElement(CompletionOnAnnotationOfType fakeNode) { >+ ASTNode annotatedElement = fakeNode.potentialAnnotatedNode; >+ >+ if (annotatedElement instanceof TypeDeclaration) { >+ TypeDeclaration annotatedTypeDeclaration = (TypeDeclaration) annotatedElement; >+ if (TypeDeclaration.kind(annotatedTypeDeclaration.modifiers) == TypeDeclaration.ANNOTATION_TYPE_DECL) { >+ return TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType; >+ } >+ return TagBits.AnnotationForType; >+ } else if (annotatedElement instanceof FieldDeclaration) { >+ if (fakeNode.isParameter) { >+ return TagBits.AnnotationForParameter; >+ } >+ return TagBits.AnnotationForField; >+ } else if (annotatedElement instanceof MethodDeclaration) { >+ return TagBits.AnnotationForMethod; >+ } else if (annotatedElement instanceof Argument) { >+ return TagBits.AnnotationForParameter; >+ } else if (annotatedElement instanceof ConstructorDeclaration) { >+ return TagBits.AnnotationForConstructor; >+ } else if (annotatedElement instanceof LocalDeclaration) { >+ return TagBits.AnnotationForLocalVariable; >+ } else if (annotatedElement instanceof ImportReference) { >+ return TagBits.AnnotationForPackage; >+ } >+ return 0; >+ } >+ > private TypeBinding[] computeTypes(Expression[] arguments) { > if (arguments == null) return null; > int argsLength = arguments.length; >@@ -3784,7 +3857,7 @@ > this.options.camelCaseMatch, > IJavaSearchConstants.TYPE, > this); >- acceptTypes(); >+ acceptTypes(null); > } > } > >@@ -4325,7 +4398,10 @@ > } > if (staticFieldsAndMethodOnly && this.insideQualifiedReference) relevance += R_NON_INHERITED; // This criterion doesn't concern types and is added to be balanced with field and method relevance. > >- if (memberType.isClass()) { >+ if (memberType.isAnnotationType()) { >+ relevance += computeRelevanceForAnnotation(); >+ relevance += computeRelevanceForAnnotationTarget(memberType); >+ } else if (memberType.isClass()) { > relevance += computeRelevanceForClass(); > relevance += computeRelevanceForException(memberType.sourceName); > } else if(memberType.isEnum()) { >@@ -5441,6 +5517,16 @@ > } > return 0; > } >+ private int computeRelevanceForAnnotationTarget(TypeBinding typeBinding){ >+ if (this.assistNodeIsAnnotation && >+ (this.targetedElement & TagBits.AnnotationTargetMASK) != 0) { >+ long target = typeBinding.getAnnotationTagBits() & TagBits.AnnotationTargetMASK; >+ if(target == 0 || (target & this.targetedElement) != 0) { >+ return R_TARGET; >+ } >+ } >+ return 0; >+ } > private int computeRelevanceForClass(){ > if(this.assistNodeIsClass) { > return R_CLASS; >@@ -6259,6 +6345,7 @@ > relevance += computeRelevanceForClass(); > relevance += computeRelevanceForQualification(false); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for nested type >+ relevance += computeRelevanceForAnnotationTarget(localType); > > this.noProposal = false; > if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { >@@ -6412,7 +6499,7 @@ > > if (!skip && proposeType && scope.enclosingSourceType() != null) { > findNestedTypes(token, scope.enclosingSourceType(), scope, proposeAllMemberTypes, typesFound); >- if(!assistNodeIsConstructor) { >+ if(!assistNodeIsConstructor && !assistNodeIsAnnotation) { > // don't propose type parameters if the completion is a constructor ('new |') > findTypeParameters(token, scope); > } >@@ -6459,6 +6546,10 @@ > if (!CharOperation.prefixEquals(token, sourceType.sourceName, false) > && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, sourceType.sourceName))) continue; > >+ if (this.assistNodeIsAnnotation && !hasPossibleAnnotationTarget(sourceType, scope)) { >+ continue next; >+ } >+ > for (int j = typesFound.size; --j >= 0;) { > ReferenceBinding otherType = (ReferenceBinding) typesFound.elementAt(j); > >@@ -6489,6 +6580,7 @@ > > if (sourceType.isAnnotationType()) { > relevance += computeRelevanceForAnnotation(); >+ relevance += computeRelevanceForAnnotationTarget(sourceType); > } else if (sourceType.isInterface()) { > relevance += computeRelevanceForInterface(); > } else if(sourceType.isClass()){ >@@ -6648,7 +6740,7 @@ > this.options.camelCaseMatch, > searchFor, > this); >- acceptTypes(); >+ acceptTypes(scope); > } > if(!isEmptyPrefix && !this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) { > this.nameEnvironment.findPackages(token, this); >@@ -6767,7 +6859,7 @@ > this.options.camelCaseMatch, > searchFor, > this); >- acceptTypes(); >+ acceptTypes(scope); > } > if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) { > this.nameEnvironment.findPackages(qualifiedName, this); >@@ -7576,6 +7668,32 @@ > > return this.parser; > } >+ >+ protected boolean hasPossibleAnnotationTarget(TypeBinding typeBinding, Scope scope) { >+ if (this.targetedElement == TagBits.AnnotationForPackage) { >+ long target = typeBinding.getAnnotationTagBits() & TagBits.AnnotationTargetMASK; >+ if(target != 0 && (target & TagBits.AnnotationForPackage) == 0) { >+ return false; >+ } >+ } else if ((this.targetedElement & TagBits.AnnotationForType) != 0) { >+ if (scope.parent != null && >+ scope.parent.parent != null && >+ scope.parent.referenceContext() instanceof CompletionOnAnnotationOfType && >+ scope.parent.parent instanceof CompilationUnitScope) { >+ long target = typeBinding.getAnnotationTagBits() & TagBits.AnnotationTargetMASK; >+ if ((this.targetedElement & TagBits.AnnotationForAnnotationType) != 0) { >+ if(target != 0 && (target &(TagBits.AnnotationForType | TagBits.AnnotationForAnnotationType)) == 0) { >+ return false; >+ } >+ } else { >+ if(target != 0 && (target &(TagBits.AnnotationForType)) == 0) { >+ return false; >+ } >+ } >+ } >+ } >+ return true; >+ } > > protected void reset() { >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 158985
:
51022
| 64989