### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v retrieving revision 1.233 diff -u -r1.233 CompletionTests.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 24 Nov 2010 16:56:38 -0000 1.233 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 25 Nov 2010 08:34:28 -0000 @@ -21856,4 +21856,41 @@ "myString1[LOCAL_VARIABLE_REF]{myString1, null, Ljava.lang.String;, myString1, null, " + (R_NON_STATIC + R_UNQUALIFIED + R_CASE + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}", requestor.getResults()); } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=325481 +// To verify that the fix doesnt cause grief when proposing fields in another +// compilation unit. +public void test325481b() throws JavaModelException { + CompletionTestsRequestor requestor = new CompletionTestsRequestor(); + Map options = COMPLETION_PROJECT.getOptions(true); + Object savedOptionCompliance = options.get(CompilerOptions.OPTION_Compliance); + try { + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + COMPLETION_PROJECT.setOptions(options); + ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test325481", "_Main.java"); + + String str = cu.getSource(); + String completeBehind = "_IAttributeDefinitionDescriptor."; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + + cu.codeComplete(cursorLocation, requestor); + int relevance = R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED; + assumeEquals( + "should have two completions", + "element:ADD_CUSTOM_ATTRIBUTES completion:ADD_CUSTOM_ATTRIBUTES relevance:" + relevance +"\n" + + "element:ATTRIBUTE completion:ATTRIBUTE relevance:" + relevance +"\n" + + "element:BUILT_ATTRIBUTE completion:BUILT_ATTRIBUTE relevance:" + relevance +"\n" + + "element:RANKING_ATTRIBUTE completion:RANKING_ATTRIBUTE relevance:" + relevance +"\n" + + "element:RANKING_ATTRIBUTE_V2 completion:RANKING_ATTRIBUTE_V2 relevance:" + relevance +"\n" + + "element:REFERENCE_ATTRIBUTE completion:REFERENCE_ATTRIBUTE relevance:" + relevance +"\n" + + "element:WORK_ATTRIBUTE completion:WORK_ATTRIBUTE relevance:" + relevance +"\n" + + "element:class completion:class relevance:" + relevance +"\n" + + "element:this completion:this relevance:" + relevance, + requestor.getResults()); + } finally { + // Restore compliance settings. + options.put(CompilerOptions.OPTION_Compliance, savedOptionCompliance); + COMPLETION_PROJECT.setOptions(options); + } +} } 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.121 diff -u -r1.121 CompletionTests_1_5.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 21 Jun 2010 07:53:42 -0000 1.121 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 25 Nov 2010 08:34:29 -0000 @@ -2423,6 +2423,8 @@ } else { assertResults( "interface[KEYWORD]{interface, null, null, interface, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + + "_ConfigurationData[TYPE_REF]{test325481._ConfigurationData, test325481, Ltest325481._ConfigurationData;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + + "_Path[TYPE_REF]{test325481._Path, test325481, Ltest325481._Path;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + "Deprecated[TYPE_REF]{Deprecated, java.lang, Ljava.lang.Deprecated;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}\n" + "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()); @@ -9019,6 +9021,8 @@ assertResults( "interface[KEYWORD]{interface, null, null, interface, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + "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) + "}\n" + + "_ConfigurationData[TYPE_REF]{test325481._ConfigurationData, test325481, Ltest325481._ConfigurationData;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + + "_Path[TYPE_REF]{test325481._Path, test325481, Ltest325481._Path;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + "Deprecated[TYPE_REF]{Deprecated, java.lang, Ljava.lang.Deprecated;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", requestor.getResults()); } Index: workspace/Completion/src3/test325481/_ConfigurationData.java =================================================================== RCS file: workspace/Completion/src3/test325481/_ConfigurationData.java diff -N workspace/Completion/src3/test325481/_ConfigurationData.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/Completion/src3/test325481/_ConfigurationData.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,12 @@ +package test325481; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.METHOD}) +public @interface _ConfigurationData { + String value() default ""; +} \ No newline at end of file Index: workspace/Completion/src3/test325481/_IAttributeDefinitionDescriptor.java =================================================================== RCS file: workspace/Completion/src3/test325481/_IAttributeDefinitionDescriptor.java diff -N workspace/Completion/src3/test325481/_IAttributeDefinitionDescriptor.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/Completion/src3/test325481/_IAttributeDefinitionDescriptor.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,45 @@ +package test325481; + +@ConfigurationData(value= "configuration.attributes") +@_Path("attribute") +public interface _IAttributeDefinitionDescriptor { + + public static final String BUILT_ATTRIBUTE= "abc"; //$NON-NLS-1$ + public static final String WORK_ATTRIBUTE= "abc"; //$NON-NLS-1$ + public static final String RANKING_ATTRIBUTE= "abc"; //$NON-NLS-1$ + public static final String RANKING_ATTRIBUTE_V2= "abc"; //$NON-NLS-1$ + public static final String REFERENCE_ATTRIBUTE= "abc"; //$NON-NLS-1$ + + public static final String ATTRIBUTE= "attribute"; //$NON-NLS-1$ + public static final String ADD_CUSTOM_ATTRIBUTES= "addCustomAttributes"; //$NON-NLS-1$ + + @_Path("@id") + String setId(String value); + + @_Path("@name") + String setDisplayName(String value); + + @_Path("@implementation") + String setImplementationName(String value); + @_Path("@implementation") + String setImplementationD(String value); + @_Path("@implementation") + String setImplementation2(String value); + @_Path("@queryId") + String getQueryId(); + + @_Path("@queryId") + String setQueryId(String value); + + @_Path("@readOnly") + boolean isReadOnly(); + + @_Path("@readOnly") + boolean setReadOnly(boolean value); + + @_Path("@internal") + boolean isInternal(); + + @_Path("@internal") + boolean setInternal(boolean value); +} Index: workspace/Completion/src3/test325481/_Main.java =================================================================== RCS file: workspace/Completion/src3/test325481/_Main.java diff -N workspace/Completion/src3/test325481/_Main.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/Completion/src3/test325481/_Main.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,11 @@ + +package test325481; + +public class _Main { + + void m() { + + _IAttributeDefinitionDescriptor. + } + +} Index: workspace/Completion/src3/test325481/_Path.java =================================================================== RCS file: workspace/Completion/src3/test325481/_Path.java diff -N workspace/Completion/src3/test325481/_Path.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/Completion/src3/test325481/_Path.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +package test325481; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.TYPE}) +public @interface _Path { + String value() default ""; + + String from() default ""; + String to() default ""; + + String defaultDefinition() default ""; + + boolean refines() default false; +}