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

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java (-2 / +4 lines)
Lines 47-52 Link Here
47
	public Engine(Map settings){
47
	public Engine(Map settings){
48
		this.options = new AssistOptions(settings);
48
		this.options = new AssistOptions(settings);
49
		this.compilerOptions = new CompilerOptions(settings);
49
		this.compilerOptions = new CompilerOptions(settings);
50
		this.compilerOptions.storeAnnotations = true;
50
		this.forbiddenReferenceIsError =
51
		this.forbiddenReferenceIsError =
51
			(this.compilerOptions.getSeverity(CompilerOptions.ForbiddenReference) & ProblemSeverities.Error) != 0;
52
			(this.compilerOptions.getSeverity(CompilerOptions.ForbiddenReference) & ProblemSeverities.Error) != 0;
52
		this.discouragedReferenceIsError =
53
		this.discouragedReferenceIsError =
Lines 82-89 Link Here
82
		CompilationUnitDeclaration unit =
83
		CompilationUnitDeclaration unit =
83
			SourceTypeConverter.buildCompilationUnit(
84
			SourceTypeConverter.buildCompilationUnit(
84
				sourceTypes,//sourceTypes[0] is always toplevel here
85
				sourceTypes,//sourceTypes[0] is always toplevel here
85
				SourceTypeConverter.FIELD_AND_METHOD // need field and methods
86
				SourceTypeConverter.FIELD_AND_METHOD// need field and methods
86
				| SourceTypeConverter.MEMBER_TYPE, // need member types
87
				| SourceTypeConverter.MEMBER_TYPE // need member types
88
				| SourceTypeConverter.FIELD_INITIALIZATION,
87
				// no need for field initialization
89
				// no need for field initialization
88
				lookupEnvironment.problemReporter,
90
				lookupEnvironment.problemReporter,
89
				result);
91
				result);
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-25 / +27 lines)
Lines 111-116 Link Here
111
	boolean assistNodeIsAnnotation;
111
	boolean assistNodeIsAnnotation;
112
	boolean assistNodeIsConstructor;
112
	boolean assistNodeIsConstructor;
113
	int  assistNodeInJavadoc = 0;
113
	int  assistNodeInJavadoc = 0;
114
	boolean assistNodeCanBeSingleMemberAnnotation = false;
114
	
115
	
115
	IJavaProject javaProject;
116
	IJavaProject javaProject;
116
	CompletionParser parser;
117
	CompletionParser parser;
Lines 1203-1233 Link Here
1203
					findAnnotationReference(annotation.type, scope);
1204
					findAnnotationReference(annotation.type, scope);
1204
				}
1205
				}
1205
			} else {
1206
			} else {
1206
				MemberValuePair[] memberValuePairs = annotation.memberValuePairs();
1207
				if (!this.requestor.isIgnored(CompletionProposal.ANNOTATION_ATTRIBUTE_REF)) {
1207
				if (!this.requestor.isIgnored(CompletionProposal.ANNOTATION_ATTRIBUTE_REF)) {
1208
					this.findAnnotationAttributes(this.completionToken, annotation.memberValuePairs(), (ReferenceBinding)annotation.resolvedType);
1208
					this.findAnnotationAttributes(this.completionToken, annotation.memberValuePairs(), (ReferenceBinding)annotation.resolvedType);
1209
				}
1209
				}
1210
				if (memberValuePairs == null || memberValuePairs.length == 0) {
1210
				if (this.assistNodeCanBeSingleMemberAnnotation) {
1211
					if (annotation.resolvedType instanceof ReferenceBinding) {
1211
					if (this.expectedTypesPtr > -1 && this.expectedTypes[0].isAnnotationType()) {
1212
						MethodBinding[] methodBindings =
1212
						findTypesAndPackages(this.completionToken, scope);
1213
							((ReferenceBinding)annotation.resolvedType).availableMethods();
1213
					} else {
1214
						if (methodBindings != null &&
1214
						findVariablesAndMethods(
1215
								methodBindings.length == 1 &&
1215
							this.completionToken,
1216
								CharOperation.equals(methodBindings[0].selector, VALUE)) {
1216
							scope,
1217
							if (this.expectedTypesPtr > -1 && this.expectedTypes[0].isAnnotationType()) {
1217
							FakeInvocationSite,
1218
								findTypesAndPackages(this.completionToken, scope);
1218
							scope,
1219
							} else {
1219
							insideTypeAnnotation,
1220
								findVariablesAndMethods(
1220
							true);
1221
									this.completionToken,
1221
						// can be the start of a qualified type name
1222
									scope,
1222
						findTypesAndPackages(this.completionToken, scope);
1223
									FakeInvocationSite,
1224
									scope,
1225
									insideTypeAnnotation,
1226
									true);
1227
								// can be the start of a qualified type name
1228
								findTypesAndPackages(this.completionToken, scope);
1229
							}
1230
						}
1231
					}
1223
					}
1232
				}
1224
				}
1233
			}
1225
			}
Lines 6100-6109 Link Here
6100
				if(annotation.resolvedType instanceof ReferenceBinding) {
6092
				if(annotation.resolvedType instanceof ReferenceBinding) {
6101
					MethodBinding[] methodBindings =
6093
					MethodBinding[] methodBindings =
6102
						((ReferenceBinding)annotation.resolvedType).availableMethods();
6094
						((ReferenceBinding)annotation.resolvedType).availableMethods();
6103
					if(methodBindings != null &&
6095
					if (methodBindings != null &&
6104
							methodBindings.length == 1 &&
6096
							methodBindings.length > 0 &&
6105
							CharOperation.equals(methodBindings[0].selector, VALUE)) {
6097
							CharOperation.equals(methodBindings[0].selector, VALUE)) {
6106
						addExpectedType(methodBindings[0].returnType, scope);
6098
						boolean canBeSingleMemberAnnotation = true;
6099
						done : for (int i = 1; i < methodBindings.length; i++) {
6100
							if(methodBindings[i].getDefaultValue() == null) {
6101
								canBeSingleMemberAnnotation = false;
6102
								break done;
6103
							}
6104
						}
6105
						if (canBeSingleMemberAnnotation) {
6106
							this.assistNodeCanBeSingleMemberAnnotation = canBeSingleMemberAnnotation;
6107
							addExpectedType(methodBindings[0].returnType, scope);
6108
						}
6107
					}
6109
					}
6108
				}
6110
				}
6109
			}
6111
			}

Return to bug 133491