View | Details | Raw Unified | Return to bug 325481 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+37 lines)
Lines 21856-21859 Link Here
21856
			"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) + "}",
21856
			"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) + "}",
21857
			requestor.getResults());
21857
			requestor.getResults());
21858
}
21858
}
21859
21860
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=325481
21861
// To verify that the fix doesnt cause grief when proposing fields in another
21862
// compilation unit.
21863
public void test325481b() throws JavaModelException {
21864
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
21865
	Map options = COMPLETION_PROJECT.getOptions(true);
21866
	Object savedOptionCompliance = options.get(CompilerOptions.OPTION_Compliance);
21867
	try {
21868
		options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
21869
		COMPLETION_PROJECT.setOptions(options);
21870
		ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test325481", "Main.java");
21871
21872
		String str = cu.getSource();
21873
		String completeBehind = "IAttributeDefinitionDescriptor.";
21874
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
21875
		
21876
		cu.codeComplete(cursorLocation, requestor);
21877
		int relevance = R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED;
21878
		assumeEquals(
21879
				"should have two completions",
21880
				"element:ADD_CUSTOM_ATTRIBUTES    completion:ADD_CUSTOM_ATTRIBUTES    relevance:" + relevance +"\n" + 
21881
				"element:ATTRIBUTE    completion:ATTRIBUTE    relevance:" + relevance +"\n" + 
21882
				"element:BUILT_ATTRIBUTE    completion:BUILT_ATTRIBUTE    relevance:" + relevance +"\n" + 
21883
				"element:RANKING_ATTRIBUTE    completion:RANKING_ATTRIBUTE    relevance:" + relevance +"\n" + 
21884
				"element:RANKING_ATTRIBUTE_V2    completion:RANKING_ATTRIBUTE_V2    relevance:" + relevance +"\n" + 
21885
				"element:REFERENCE_ATTRIBUTE    completion:REFERENCE_ATTRIBUTE    relevance:" + relevance +"\n" + 
21886
				"element:WORK_ATTRIBUTE    completion:WORK_ATTRIBUTE    relevance:" + relevance +"\n" + 
21887
				"element:class    completion:class    relevance:" + relevance +"\n" + 
21888
				"element:this    completion:this    relevance:" + relevance,
21889
				requestor.getResults());
21890
	} finally {
21891
		// Restore compliance settings.
21892
		options.put(CompilerOptions.OPTION_Compliance, savedOptionCompliance);
21893
		COMPLETION_PROJECT.setOptions(options);	
21894
	}
21895
}
21859
}
21896
}
(-)workspace/Completion/src3/test325481/ConfigurationData.java (+12 lines)
Added Link Here
1
package test325481;
2
3
import java.lang.annotation.ElementType;
4
import java.lang.annotation.Retention;
5
import java.lang.annotation.RetentionPolicy;
6
import java.lang.annotation.Target;
7
8
@Retention(RetentionPolicy.RUNTIME)
9
@Target({ElementType.TYPE, ElementType.METHOD})
10
public @interface ConfigurationData {
11
	String value() default "";
12
}
(-)workspace/Completion/src3/test325481/IAttributeDefinitionDescriptor.java (+45 lines)
Added Link Here
1
package test325481;
2
3
@ConfigurationData(value= "configuration.attributes")
4
@Path("attribute")
5
public interface IAttributeDefinitionDescriptor {
6
7
	public static final String BUILT_ATTRIBUTE= "abc"; //$NON-NLS-1$
8
	public static final String WORK_ATTRIBUTE= "abc"; //$NON-NLS-1$
9
	public static final String RANKING_ATTRIBUTE= "abc"; //$NON-NLS-1$
10
	public static final String RANKING_ATTRIBUTE_V2= "abc"; //$NON-NLS-1$
11
	public static final String REFERENCE_ATTRIBUTE= "abc"; //$NON-NLS-1$
12
	
13
	public static final String ATTRIBUTE= "attribute"; //$NON-NLS-1$
14
	public static final String ADD_CUSTOM_ATTRIBUTES= "addCustomAttributes"; //$NON-NLS-1$
15
	
16
	@Path("@id")
17
	String setId(String value);
18
	
19
	@Path("@name")
20
	String setDisplayName(String value);
21
22
	@Path("@implementation")
23
	String setImplementationName(String value);
24
	@Path("@implementation")
25
	String setImplementationD(String value);
26
	@Path("@implementation")
27
	String setImplementation2(String value);
28
	@Path("@queryId")
29
	String getQueryId();
30
31
	@Path("@queryId")
32
	String setQueryId(String value);
33
34
	@Path("@readOnly")
35
	boolean isReadOnly();
36
37
	@Path("@readOnly")
38
	boolean setReadOnly(boolean value);
39
40
	@Path("@internal")
41
	boolean isInternal();
42
	
43
	@Path("@internal")
44
	boolean setInternal(boolean value);
45
}
(-)workspace/Completion/src3/test325481/Main.java (+11 lines)
Added Link Here
1
2
package test325481;
3
4
public class Main {
5
6
	void m() {
7
		
8
		IAttributeDefinitionDescriptor.
9
	}
10
	
11
}
(-)workspace/Completion/src3/test325481/Path.java (+19 lines)
Added Link Here
1
package test325481;
2
3
import java.lang.annotation.ElementType;
4
import java.lang.annotation.Retention;
5
import java.lang.annotation.RetentionPolicy;
6
import java.lang.annotation.Target;
7
8
@Retention(RetentionPolicy.RUNTIME)
9
@Target({ElementType.METHOD, ElementType.TYPE})
10
public @interface Path {
11
	String value() default "";
12
	
13
	String from() default "";
14
	String to() default "";
15
	
16
	String defaultDefinition() default "";
17
	
18
	boolean refines() default false;
19
}

Return to bug 325481