View | Details | Raw Unified | Return to bug 134976
Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-46 / +58 lines)
Lines 98-103 Link Here
98
	int expectedTypesPtr = -1;
98
	int expectedTypesPtr = -1;
99
	TypeBinding[] expectedTypes = new TypeBinding[1];
99
	TypeBinding[] expectedTypes = new TypeBinding[1];
100
	int expectedTypesFilter;
100
	int expectedTypesFilter;
101
	boolean hasJavaLangObjectAsExpectedType = false;
101
	int uninterestingBindingsPtr = -1;
102
	int uninterestingBindingsPtr = -1;
102
	Binding[] uninterestingBindings = new Binding[1];
103
	Binding[] uninterestingBindings = new Binding[1];
103
	int forbbidenBindingsPtr = -1;
104
	int forbbidenBindingsPtr = -1;
Lines 4228-4233 Link Here
4228
					return R_EXACT_EXPECTED_TYPE;
4229
					return R_EXACT_EXPECTED_TYPE;
4229
				}
4230
				}
4230
			}
4231
			}
4232
			if(this.hasJavaLangObjectAsExpectedType) {
4233
				return R_EXPECTED_TYPE;
4234
			}
4231
		} 
4235
		} 
4232
		return 0;
4236
		return 0;
4233
	}
4237
	}
Lines 5829-5834 Link Here
5829
		
5833
		
5830
		// default filter
5834
		// default filter
5831
		this.expectedTypesFilter = SUBTYPE;
5835
		this.expectedTypesFilter = SUBTYPE;
5836
		this.hasJavaLangObjectAsExpectedType = false;
5832
		
5837
		
5833
		// find types from parent
5838
		// find types from parent
5834
		if(parent instanceof AbstractVariableDeclaration) {
5839
		if(parent instanceof AbstractVariableDeclaration) {
Lines 5836-5862 Link Here
5836
			TypeBinding binding = variable.type.resolvedType;
5841
			TypeBinding binding = variable.type.resolvedType;
5837
			if(binding != null) {
5842
			if(binding != null) {
5838
				if(!(variable.initialization instanceof ArrayInitializer)) {
5843
				if(!(variable.initialization instanceof ArrayInitializer)) {
5839
					addExpectedType(binding);
5844
					addExpectedType(binding, scope);
5840
				}
5845
				}
5841
			}
5846
			}
5842
		} else if(parent instanceof Assignment) {
5847
		} else if(parent instanceof Assignment) {
5843
			TypeBinding binding = ((Assignment)parent).lhs.resolvedType;
5848
			TypeBinding binding = ((Assignment)parent).lhs.resolvedType;
5844
			if(binding != null) {
5849
			if(binding != null) {
5845
				addExpectedType(binding);
5850
				addExpectedType(binding, scope);
5846
			}
5851
			}
5847
		} else if(parent instanceof ReturnStatement) {
5852
		} else if(parent instanceof ReturnStatement) {
5848
			if(scope.methodScope().referenceContext instanceof AbstractMethodDeclaration) {
5853
			if(scope.methodScope().referenceContext instanceof AbstractMethodDeclaration) {
5849
				MethodBinding methodBinding = ((AbstractMethodDeclaration) scope.methodScope().referenceContext).binding;
5854
				MethodBinding methodBinding = ((AbstractMethodDeclaration) scope.methodScope().referenceContext).binding;
5850
				TypeBinding binding = methodBinding  == null ? null : methodBinding.returnType;
5855
				TypeBinding binding = methodBinding  == null ? null : methodBinding.returnType;
5851
				if(binding != null) {
5856
				if(binding != null) {
5852
					addExpectedType(binding);
5857
					addExpectedType(binding, scope);
5853
				}
5858
				}
5854
			}
5859
			}
5855
		} else if(parent instanceof CastExpression) {
5860
		} else if(parent instanceof CastExpression) {
5856
			Expression e = ((CastExpression)parent).type;
5861
			Expression e = ((CastExpression)parent).type;
5857
			TypeBinding binding = e.resolvedType;
5862
			TypeBinding binding = e.resolvedType;
5858
			if(binding != null){
5863
			if(binding != null){
5859
				addExpectedType(binding);
5864
				addExpectedType(binding, scope);
5860
				this.expectedTypesFilter = SUBTYPE | SUPERTYPE;
5865
				this.expectedTypesFilter = SUBTYPE | SUPERTYPE;
5861
			}
5866
			}
5862
		} else if(parent instanceof MessageSend) {
5867
		} else if(parent instanceof MessageSend) {
Lines 5906-5939 Link Here
5906
				InstanceOfExpression e = (InstanceOfExpression) parent;
5911
				InstanceOfExpression e = (InstanceOfExpression) parent;
5907
				TypeBinding binding = e.expression.resolvedType;
5912
				TypeBinding binding = e.expression.resolvedType;
5908
				if(binding != null){
5913
				if(binding != null){
5909
					addExpectedType(binding);
5914
					addExpectedType(binding, scope);
5910
					this.expectedTypesFilter = SUBTYPE | SUPERTYPE;
5915
					this.expectedTypesFilter = SUBTYPE | SUPERTYPE;
5911
				}
5916
				}
5912
			} else if(parent instanceof BinaryExpression) {
5917
			} else if(parent instanceof BinaryExpression) {
5913
				switch(operator) {
5918
				switch(operator) {
5914
					case OperatorIds.PLUS :
5919
					case OperatorIds.PLUS :
5915
						addExpectedType(TypeBinding.SHORT);
5920
						addExpectedType(TypeBinding.SHORT, scope);
5916
						addExpectedType(TypeBinding.INT);
5921
						addExpectedType(TypeBinding.INT, scope);
5917
						addExpectedType(TypeBinding.LONG);
5922
						addExpectedType(TypeBinding.LONG, scope);
5918
						addExpectedType(TypeBinding.FLOAT);
5923
						addExpectedType(TypeBinding.FLOAT, scope);
5919
						addExpectedType(TypeBinding.DOUBLE);
5924
						addExpectedType(TypeBinding.DOUBLE, scope);
5920
						addExpectedType(TypeBinding.CHAR);
5925
						addExpectedType(TypeBinding.CHAR, scope);
5921
						addExpectedType(TypeBinding.BYTE);
5926
						addExpectedType(TypeBinding.BYTE, scope);
5922
						addExpectedType(scope.getJavaLangString());
5927
						addExpectedType(scope.getJavaLangString(), scope);
5923
						break;
5928
						break;
5924
					case OperatorIds.AND_AND :
5929
					case OperatorIds.AND_AND :
5925
					case OperatorIds.OR_OR :
5930
					case OperatorIds.OR_OR :
5926
					case OperatorIds.XOR :
5931
					case OperatorIds.XOR :
5927
						addExpectedType(TypeBinding.BOOLEAN);
5932
						addExpectedType(TypeBinding.BOOLEAN, scope);
5928
						break;
5933
						break;
5929
					default :
5934
					default :
5930
						addExpectedType(TypeBinding.SHORT);
5935
						addExpectedType(TypeBinding.SHORT, scope);
5931
						addExpectedType(TypeBinding.INT);
5936
						addExpectedType(TypeBinding.INT, scope);
5932
						addExpectedType(TypeBinding.LONG);
5937
						addExpectedType(TypeBinding.LONG, scope);
5933
						addExpectedType(TypeBinding.FLOAT);
5938
						addExpectedType(TypeBinding.FLOAT, scope);
5934
						addExpectedType(TypeBinding.DOUBLE);
5939
						addExpectedType(TypeBinding.DOUBLE, scope);
5935
						addExpectedType(TypeBinding.CHAR);
5940
						addExpectedType(TypeBinding.CHAR, scope);
5936
						addExpectedType(TypeBinding.BYTE);
5941
						addExpectedType(TypeBinding.BYTE, scope);
5937
						break;
5942
						break;
5938
				}
5943
				}
5939
				BinaryExpression binaryExpression = (BinaryExpression) parent;
5944
				BinaryExpression binaryExpression = (BinaryExpression) parent;
Lines 5944-5950 Link Here
5944
						if(b instanceof ReferenceBinding) {
5949
						if(b instanceof ReferenceBinding) {
5945
							TypeVariableBinding[] typeVariableBindings =((ReferenceBinding)b).typeVariables();
5950
							TypeVariableBinding[] typeVariableBindings =((ReferenceBinding)b).typeVariables();
5946
							if(typeVariableBindings != null && typeVariableBindings.length > 0) {
5951
							if(typeVariableBindings != null && typeVariableBindings.length > 0) {
5947
								addExpectedType(typeVariableBindings[0].firstBound);
5952
								addExpectedType(typeVariableBindings[0].firstBound, scope);
5948
							}
5953
							}
5949
							
5954
							
5950
						}
5955
						}
Lines 5953-5985 Link Here
5953
			} else if(parent instanceof UnaryExpression) {
5958
			} else if(parent instanceof UnaryExpression) {
5954
				switch(operator) {
5959
				switch(operator) {
5955
					case OperatorIds.NOT :
5960
					case OperatorIds.NOT :
5956
						addExpectedType(TypeBinding.BOOLEAN);
5961
						addExpectedType(TypeBinding.BOOLEAN, scope);
5957
						break;
5962
						break;
5958
					case OperatorIds.TWIDDLE :
5963
					case OperatorIds.TWIDDLE :
5959
						addExpectedType(TypeBinding.SHORT);
5964
						addExpectedType(TypeBinding.SHORT, scope);
5960
						addExpectedType(TypeBinding.INT);
5965
						addExpectedType(TypeBinding.INT, scope);
5961
						addExpectedType(TypeBinding.LONG);
5966
						addExpectedType(TypeBinding.LONG, scope);
5962
						addExpectedType(TypeBinding.CHAR);
5967
						addExpectedType(TypeBinding.CHAR, scope);
5963
						addExpectedType(TypeBinding.BYTE);
5968
						addExpectedType(TypeBinding.BYTE, scope);
5964
						break;
5969
						break;
5965
					case OperatorIds.PLUS :
5970
					case OperatorIds.PLUS :
5966
					case OperatorIds.MINUS :
5971
					case OperatorIds.MINUS :
5967
					case OperatorIds.PLUS_PLUS :
5972
					case OperatorIds.PLUS_PLUS :
5968
					case OperatorIds.MINUS_MINUS :
5973
					case OperatorIds.MINUS_MINUS :
5969
						addExpectedType(TypeBinding.SHORT);
5974
						addExpectedType(TypeBinding.SHORT, scope);
5970
						addExpectedType(TypeBinding.INT);
5975
						addExpectedType(TypeBinding.INT, scope);
5971
						addExpectedType(TypeBinding.LONG);
5976
						addExpectedType(TypeBinding.LONG, scope);
5972
						addExpectedType(TypeBinding.FLOAT);
5977
						addExpectedType(TypeBinding.FLOAT, scope);
5973
						addExpectedType(TypeBinding.DOUBLE);
5978
						addExpectedType(TypeBinding.DOUBLE, scope);
5974
						addExpectedType(TypeBinding.CHAR);
5979
						addExpectedType(TypeBinding.CHAR, scope);
5975
						addExpectedType(TypeBinding.BYTE);
5980
						addExpectedType(TypeBinding.BYTE, scope);
5976
						break;
5981
						break;
5977
				}
5982
				}
5978
			}
5983
			}
5979
		} else if(parent instanceof ArrayReference) {
5984
		} else if(parent instanceof ArrayReference) {
5980
			addExpectedType(TypeBinding.SHORT);
5985
			addExpectedType(TypeBinding.SHORT, scope);
5981
			addExpectedType(TypeBinding.INT);
5986
			addExpectedType(TypeBinding.INT, scope);
5982
			addExpectedType(TypeBinding.LONG);
5987
			addExpectedType(TypeBinding.LONG, scope);
5983
		} else if(parent instanceof ParameterizedSingleTypeReference) {
5988
		} else if(parent instanceof ParameterizedSingleTypeReference) {
5984
			ParameterizedSingleTypeReference ref = (ParameterizedSingleTypeReference) parent;
5989
			ParameterizedSingleTypeReference ref = (ParameterizedSingleTypeReference) parent;
5985
			TypeVariableBinding[] typeVariables = ((ReferenceBinding)ref.resolvedType).typeVariables();
5990
			TypeVariableBinding[] typeVariables = ((ReferenceBinding)ref.resolvedType).typeVariables();
Lines 5987-5993 Link Here
5987
			if(typeVariables != null && typeVariables.length >= length) {
5992
			if(typeVariables != null && typeVariables.length >= length) {
5988
				int index = length - 1;
5993
				int index = length - 1;
5989
				while(index > -1 && ref.typeArguments[index] != node) index--;
5994
				while(index > -1 && ref.typeArguments[index] != node) index--;
5990
				addExpectedType(typeVariables[index].firstBound);
5995
				
5996
				TypeBinding bound = typeVariables[index].firstBound;
5997
				addExpectedType(bound == null ? scope.getJavaLangObject() : bound, scope);
5991
			}
5998
			}
5992
		} else if(parent instanceof ParameterizedQualifiedTypeReference) {
5999
		} else if(parent instanceof ParameterizedQualifiedTypeReference) {
5993
			ParameterizedQualifiedTypeReference ref = (ParameterizedQualifiedTypeReference) parent;
6000
			ParameterizedQualifiedTypeReference ref = (ParameterizedQualifiedTypeReference) parent;
Lines 5999-6005 Link Here
5999
					int jLength = arguments[i] == null ? 0 : arguments[i].length;
6006
					int jLength = arguments[i] == null ? 0 : arguments[i].length;
6000
					for (int j = 0; j < jLength; j++) {
6007
					for (int j = 0; j < jLength; j++) {
6001
						if(arguments[i][j] == node && typeVariables.length > j) {
6008
						if(arguments[i][j] == node && typeVariables.length > j) {
6002
							addExpectedType(typeVariables[j].firstBound);
6009
							TypeBinding bound = typeVariables[j].firstBound;
6010
							addExpectedType(bound == null ? scope.getJavaLangObject() : bound, scope);
6003
							break done;
6011
							break done;
6004
						}
6012
						}
6005
					}
6013
					}
Lines 6008-6014 Link Here
6008
		} else if(parent instanceof MemberValuePair) {
6016
		} else if(parent instanceof MemberValuePair) {
6009
			MemberValuePair memberValuePair = (MemberValuePair) parent;
6017
			MemberValuePair memberValuePair = (MemberValuePair) parent;
6010
			if(memberValuePair.binding != null) {
6018
			if(memberValuePair.binding != null) {
6011
				addExpectedType(memberValuePair.binding.returnType);
6019
				addExpectedType(memberValuePair.binding.returnType, scope);
6012
			}
6020
			}
6013
		} else if (parent instanceof NormalAnnotation) {
6021
		} else if (parent instanceof NormalAnnotation) {
6014
			NormalAnnotation annotation = (NormalAnnotation) parent;
6022
			NormalAnnotation annotation = (NormalAnnotation) parent;
Lines 6020-6026 Link Here
6020
					if(methodBindings != null &&
6028
					if(methodBindings != null &&
6021
							methodBindings.length == 1 &&
6029
							methodBindings.length == 1 &&
6022
							CharOperation.equals(methodBindings[0].selector, VALUE)) {
6030
							CharOperation.equals(methodBindings[0].selector, VALUE)) {
6023
						addExpectedType(methodBindings[0].returnType);
6031
						addExpectedType(methodBindings[0].returnType, scope);
6024
					}
6032
					}
6025
				}
6033
				}
6026
			}
6034
			}
Lines 6033-6039 Link Here
6033
					ReferenceBinding[] exceptions = methodDecl.binding.thrownExceptions;
6041
					ReferenceBinding[] exceptions = methodDecl.binding.thrownExceptions;
6034
					if (exceptions != null) {
6042
					if (exceptions != null) {
6035
						for (int i = 0; i < exceptions.length; i++) {
6043
						for (int i = 0; i < exceptions.length; i++) {
6036
							addExpectedType(exceptions[i]);
6044
							addExpectedType(exceptions[i], scope);
6037
						}
6045
						}
6038
					}
6046
					}
6039
				}
6047
				}
Lines 6076-6082 Link Here
6076
			
6084
			
6077
			TypeBinding expectedType = method.parameters[arguments.length - 1];
6085
			TypeBinding expectedType = method.parameters[arguments.length - 1];
6078
			if(expectedType != null) {
6086
			if(expectedType != null) {
6079
				addExpectedType(expectedType);
6087
				addExpectedType(expectedType, scope);
6080
			}
6088
			}
6081
		}
6089
		}
6082
	}
6090
	}
Lines 6182-6198 Link Here
6182
				
6190
				
6183
			TypeBinding expectedType = method.parameters[arguments.length - 1];
6191
			TypeBinding expectedType = method.parameters[arguments.length - 1];
6184
			if(expectedType != null) {
6192
			if(expectedType != null) {
6185
				addExpectedType(expectedType);
6193
				addExpectedType(expectedType, scope);
6186
			}
6194
			}
6187
		}
6195
		}
6188
	}
6196
	}
6189
	private void addExpectedType(TypeBinding type){
6197
	private void addExpectedType(TypeBinding type, Scope scope){
6190
		if (type == null || !type.isValidBinding()) return;
6198
		if (type == null || !type.isValidBinding()) return;
6191
6199
6192
		int length = this.expectedTypes.length;
6200
		int length = this.expectedTypes.length;
6193
		if (++this.expectedTypesPtr >= length)
6201
		if (++this.expectedTypesPtr >= length)
6194
			System.arraycopy(this.expectedTypes, 0, this.expectedTypes = new TypeBinding[length * 2], 0, length);
6202
			System.arraycopy(this.expectedTypes, 0, this.expectedTypes = new TypeBinding[length * 2], 0, length);
6195
		this.expectedTypes[this.expectedTypesPtr] = type;
6203
		this.expectedTypes[this.expectedTypesPtr] = type;
6204
		
6205
		if(type == scope.getJavaLangObject()) {
6206
			this.hasJavaLangObjectAsExpectedType = true;
6207
		}
6196
	}
6208
	}
6197
	private void addForbiddenBindings(Binding binding){
6209
	private void addForbiddenBindings(Binding binding){
6198
		if (binding == null) return;
6210
		if (binding == null) return;
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java (-32 / +66 lines)
Lines 19-25 Link Here
19
import junit.framework.*;
19
import junit.framework.*;
20
20
21
public class CompletionTests_1_5 extends AbstractJavaModelCompletionTests implements RelevanceConstants {
21
public class CompletionTests_1_5 extends AbstractJavaModelCompletionTests implements RelevanceConstants {
22
22
	static {
23
//		TESTS_NAMES = new String[]{"test0040"};
24
	}
23
public CompletionTests_1_5(String name) {
25
public CompletionTests_1_5(String name) {
24
	super(name);
26
	super(name);
25
}
27
}
Lines 122-128 Link Here
122
	cu.codeComplete(cursorLocation, requestor);
124
	cu.codeComplete(cursorLocation, requestor);
123
	
125
	
124
	assertEquals("should have one class",
126
	assertEquals("should have one class",
125
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
127
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
126
		requestor.getResults());
128
		requestor.getResults());
127
}
129
}
128
public void test0002() throws JavaModelException {
130
public void test0002() throws JavaModelException {
Lines 135-141 Link Here
135
	cu.codeComplete(cursorLocation, requestor);
137
	cu.codeComplete(cursorLocation, requestor);
136
	
138
	
137
	assertEquals("should have one class",
139
	assertEquals("should have one class",
138
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
140
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
139
		requestor.getResults());
141
		requestor.getResults());
140
}
142
}
141
public void test0003() throws JavaModelException {
143
public void test0003() throws JavaModelException {
Lines 183-194 Link Here
183
            "Y<St");
185
            "Y<St");
184
    
186
    
185
    assertResults(
187
    assertResults(
186
            "expectedTypesSignatures=null\n" +
188
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
187
            "expectedTypesKeys=null",
189
            "expectedTypesKeys={Ljava/lang/Object;}",
188
            result.context);
190
            result.context);
189
    
191
    
190
    assertResults(
192
    assertResults(
191
            "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
193
            "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
192
            result.proposals);
194
            result.proposals);
193
}
195
}
194
public void test0006() throws JavaModelException {
196
public void test0006() throws JavaModelException {
Lines 209-220 Link Here
209
            "Y<Ob");
211
            "Y<Ob");
210
    
212
    
211
    assertResults(
213
    assertResults(
212
            "expectedTypesSignatures=null\n" +
214
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
213
            "expectedTypesKeys=null",
215
            "expectedTypesKeys={Ljava/lang/Object;}",
214
            result.context);
216
            result.context);
215
    
217
    
216
    assertResults(
218
    assertResults(
217
            "Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) +"}",
219
            "Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) +"}",
218
            result.proposals);
220
            result.proposals);
219
}
221
}
220
public void test0007() throws JavaModelException {
222
public void test0007() throws JavaModelException {
Lines 642-648 Link Here
642
	cu.codeComplete(cursorLocation, requestor);
644
	cu.codeComplete(cursorLocation, requestor);
643
	
645
	
644
	assertEquals("should have one class",
646
	assertEquals("should have one class",
645
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
647
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
646
		requestor.getResults());
648
		requestor.getResults());
647
}
649
}
648
public void test0026() throws JavaModelException {
650
public void test0026() throws JavaModelException {
Lines 669-675 Link Here
669
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
671
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
670
	
672
	
671
	assertResults(
673
	assertResults(
672
			"String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
674
			"String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
673
			requestor.getResults());
675
			requestor.getResults());
674
}
676
}
675
public void test0027() throws JavaModelException {
677
public void test0027() throws JavaModelException {
Lines 696-702 Link Here
696
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
698
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
697
	
699
	
698
	assertResults(
700
	assertResults(
699
			"String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
701
			"String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
700
			requestor.getResults());
702
			requestor.getResults());
701
	
703
	
702
	
704
	
Lines 786-792 Link Here
786
	cu.codeComplete(cursorLocation, requestor);
788
	cu.codeComplete(cursorLocation, requestor);
787
	
789
	
788
	assertEquals("unexpected result",
790
	assertEquals("unexpected result",
789
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
791
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
790
		requestor.getResults());
792
		requestor.getResults());
791
}
793
}
792
/*
794
/*
Lines 802-808 Link Here
802
	cu.codeComplete(cursorLocation, requestor);
804
	cu.codeComplete(cursorLocation, requestor);
803
	
805
	
804
	assertEquals("unexpected result",
806
	assertEquals("unexpected result",
805
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
807
		"element:String    completion:String    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
806
		requestor.getResults());
808
		requestor.getResults());
807
}
809
}
808
/*
810
/*
Lines 920-931 Link Here
920
            "Stri");
922
            "Stri");
921
    
923
    
922
    assertResults(
924
    assertResults(
923
            "expectedTypesSignatures=null\n" +
925
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
924
            "expectedTypesKeys=null",
926
            "expectedTypesKeys={Ljava/lang/Object;}",
925
            result.context);
927
            result.context);
926
    
928
    
927
    assertResults(
929
    assertResults(
928
            "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) +"}",
930
            "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE  + R_UNQUALIFIED + R_NON_RESTRICTED) +"}",
929
            result.proposals);
931
            result.proposals);
930
}
932
}
931
/*
933
/*
Lines 949-960 Link Here
949
            "Stri");
951
            "Stri");
950
    
952
    
951
    assertResults(
953
    assertResults(
952
            "expectedTypesSignatures=null\n" +
954
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
953
            "expectedTypesKeys=null",
955
            "expectedTypesKeys={Ljava/lang/Object;}",
954
            result.context);
956
            result.context);
955
    
957
    
956
    assertResults(
958
    assertResults(
957
            "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED  + R_NON_RESTRICTED) +"}",
959
            "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED  + R_NON_RESTRICTED) +"}",
958
            result.proposals);
960
            result.proposals);
959
}
961
}
960
/*
962
/*
Lines 6001-6012 Link Here
6001
            "ZZClass1<");
6003
            "ZZClass1<");
6002
    
6004
    
6003
    assertResults(
6005
    assertResults(
6004
            "expectedTypesSignatures=null\n" +
6006
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
6005
            "expectedTypesKeys=null",
6007
            "expectedTypesKeys={Ljava/lang/Object;}",
6006
            result.context);
6008
            result.context);
6007
    
6009
    
6008
    assertResults(
6010
    assertResults(
6009
            "ZZClass1<X,Y>[TYPE_REF]{, test0192, Ltest0192.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6011
            "ZZClass1<X,Y>[TYPE_REF]{, test0192, Ltest0192.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6010
            result.proposals);
6012
            result.proposals);
6011
}
6013
}
6012
public void test0193() throws JavaModelException {
6014
public void test0193() throws JavaModelException {
Lines 6023-6034 Link Here
6023
            "ZZClass1<");
6025
            "ZZClass1<");
6024
    
6026
    
6025
    assertResults(
6027
    assertResults(
6026
            "expectedTypesSignatures=null\n" +
6028
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
6027
            "expectedTypesKeys=null",
6029
            "expectedTypesKeys={Ljava/lang/Object;}",
6028
            result.context);
6030
            result.context);
6029
    
6031
    
6030
    assertResults(
6032
    assertResults(
6031
            "ZZClass1<X,Y>[TYPE_REF]{, test0193, Ltest0193.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6033
            "ZZClass1<X,Y>[TYPE_REF]{, test0193, Ltest0193.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_EXACT_NAME + R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6032
            result.proposals);
6034
            result.proposals);
6033
}
6035
}
6034
public void test0194() throws JavaModelException {
6036
public void test0194() throws JavaModelException {
Lines 6043-6054 Link Here
6043
            "ZZClass1<Object,");
6045
            "ZZClass1<Object,");
6044
    
6046
    
6045
    assertResults(
6047
    assertResults(
6046
            "expectedTypesSignatures=null\n" +
6048
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
6047
            "expectedTypesKeys=null",
6049
            "expectedTypesKeys={Ljava/lang/Object;}",
6048
            result.context);
6050
            result.context);
6049
    
6051
    
6050
    assertResults(
6052
    assertResults(
6051
            "ZZClass1<X,Y>[TYPE_REF]{, test0194, Ltest0194.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6053
            "ZZClass1<X,Y>[TYPE_REF]{, test0194, Ltest0194.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6052
            result.proposals);
6054
            result.proposals);
6053
}
6055
}
6054
public void test0195() throws JavaModelException {
6056
public void test0195() throws JavaModelException {
Lines 6065-6076 Link Here
6065
            "ZZClass1<Object,");
6067
            "ZZClass1<Object,");
6066
    
6068
    
6067
    assertResults(
6069
    assertResults(
6068
            "expectedTypesSignatures=null\n" +
6070
            "expectedTypesSignatures={Ljava.lang.Object;}\n" +
6069
            "expectedTypesKeys=null",
6071
            "expectedTypesKeys={Ljava/lang/Object;}",
6070
            result.context);
6072
            result.context);
6071
    
6073
    
6072
    assertResults(
6074
    assertResults(
6073
            "ZZClass1<X,Y>[TYPE_REF]{, test0195, Ltest0195.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6075
            "ZZClass1<X,Y>[TYPE_REF]{, test0195, Ltest0195.ZZClass1<TX;TY;>;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_EXACT_NAME + R_UNQUALIFIED + + R_NON_RESTRICTED) + "}",
6074
            result.proposals);
6076
            result.proposals);
6075
}
6077
}
6076
public void test0196() throws JavaModelException {
6078
public void test0196() throws JavaModelException {
Lines 8162-8165 Link Here
8162
			"foo[METHOD_DECLARATION]{public <T> void foo(), Ltest.SuperTest;, <T:Ljava.lang.Object;>()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
8164
			"foo[METHOD_DECLARATION]{public <T> void foo(), Ltest.SuperTest;, <T:Ljava.lang.Object;>()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
8163
			requestor.getResults());
8165
			requestor.getResults());
8164
}
8166
}
8167
public void test0270() throws JavaModelException {
8168
	this.workingCopies = new ICompilationUnit[3];
8169
	this.workingCopies[0] = getWorkingCopy(
8170
		"/Completion/src/test/Test270_2.java",
8171
		"package test;\n"+
8172
		"public class Test270_2 extends SuperTest<Test270> {\n"+
8173
		"}");
8174
	
8175
	this.workingCopies[1] = getWorkingCopy(
8176
		"/Completion/src/test/SuperTest.java",
8177
		"package test;\n"+
8178
		"public class SuperTest<T> {\n"+
8179
		"}");
8180
	
8181
	this.workingCopies[2] = getWorkingCopy(
8182
		"/Completion/src/test/Test270.java",
8183
		"package test;\n"+
8184
		"public class Test270 {\n"+
8185
		"}");
8186
8187
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8188
	
8189
	String str = this.workingCopies[0].getSource();
8190
	String completeBehind = "Test270";
8191
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8192
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
8193
8194
	assertResults(
8195
			"Test270_2[TYPE_REF]{Test270_2, test, Ltest.Test270_2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
8196
			"Test270[TYPE_REF]{Test270, test, Ltest.Test270;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_EXACT_NAME + R_NON_RESTRICTED) + "}",
8197
			requestor.getResults());
8198
}
8165
}
8199
}

Return to bug 134976