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

(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (-5 / +16 lines)
Lines 324-331 Link Here
324
	if(this.genericsPtr > -1) {
324
	if(this.genericsPtr > -1) {
325
		ASTNode node = this.genericsStack[this.genericsPtr];
325
		ASTNode node = this.genericsStack[this.genericsPtr];
326
		if(node instanceof Wildcard && ((Wildcard)node).bound == this.assistNode){
326
		if(node instanceof Wildcard && ((Wildcard)node).bound == this.assistNode){
327
			buildMoreGenericsCompletionContext(node);
327
			int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER);
328
			return;
328
			if (kind == K_BINARY_OPERATOR) {
329
				int info = topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER);
330
				if (info == LESS) {
331
					buildMoreGenericsCompletionContext(node, true);
332
					return;
333
				}
334
			}
335
			if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
336
				this.pushOnElementStack(K_BINARY_OPERATOR, LESS);
337
				buildMoreGenericsCompletionContext(node, false);
338
				return;
339
			}
329
		}
340
		}
330
	}
341
	}
331
	
342
	
Lines 406-412 Link Here
406
				}
417
				}
407
			}
418
			}
408
			if(node == this.assistNode){
419
			if(node == this.assistNode){
409
				buildMoreGenericsCompletionContext(node);
420
				buildMoreGenericsCompletionContext(node, true);
410
			}
421
			}
411
		}
422
		}
412
	}
423
	}
Lines 854-860 Link Here
854
		}
865
		}
855
	}
866
	}
856
}
867
}
857
private void buildMoreGenericsCompletionContext(ASTNode node) {
868
private void buildMoreGenericsCompletionContext(ASTNode node, boolean consumeTypeArguments) {
858
	int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER);
869
	int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER);
859
	if(kind != 0) {
870
	if(kind != 0) {
860
		int info = topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER);
871
		int info = topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER);
Lines 875-881 Link Here
875
				}
886
				}
876
				if(info == LESS && node instanceof TypeReference) {
887
				if(info == LESS && node instanceof TypeReference) {
877
					if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
888
					if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
878
						this.consumeTypeArguments();
889
						if (consumeTypeArguments) this.consumeTypeArguments();
879
						TypeReference ref = this.getTypeReference(0);
890
						TypeReference ref = this.getTypeReference(0);
880
						if(prevKind == K_PARAMETERIZED_CAST) {
891
						if(prevKind == K_PARAMETERIZED_CAST) {
881
							ref = computeQualifiedGenericsFromRightSide(ref, 0);
892
							ref = computeQualifiedGenericsFromRightSide(ref, 0);
(-)src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java (+29 lines)
Lines 9393-9396 Link Here
9393
			expectedReplacedSource,
9393
			expectedReplacedSource,
9394
	"diet ast");
9394
	"diet ast");
9395
}
9395
}
9396
public void test0212(){
9397
	String str =
9398
		"public class Test {\n" + 
9399
		"  List<? extends Obj>\n" + 
9400
		"}\n";
9401
9402
	String completeBehind = "Obj";
9403
	int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1;
9404
	String expectedCompletionNodeToString = "<CompleteOnType:Obj>";
9405
	String expectedParentNodeToString = "<NONE>";
9406
	String completionIdentifier = "Obj";
9407
	String expectedReplacedSource = "Obj";
9408
	String expectedUnitDisplayString =
9409
		"public class Test {\n" + 
9410
		"  List<? extends <CompleteOnType:Obj>>;\n" + 
9411
		"  public Test() {\n" + 
9412
		"  }\n" + 
9413
		"}\n";
9414
9415
	checkDietParse(
9416
			str.toCharArray(),
9417
			cursorLocation,
9418
			expectedCompletionNodeToString,
9419
			expectedParentNodeToString,
9420
			expectedUnitDisplayString,
9421
			completionIdentifier,
9422
			expectedReplacedSource,
9423
	"diet ast");
9424
}
9396
}
9425
}

Return to bug 160655