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

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-7 / +14 lines)
Lines 408-413 Link Here
408
			originalType = type.leafComponentType();
408
			originalType = type.leafComponentType();
409
			break;
409
			break;
410
		default:
410
		default:
411
			if (type.id == TypeIds.T_JavaLangObject) 
412
				return type; // Object is not generic
411
			dimension = 0;
413
			dimension = 0;
412
			originalType = type;
414
			originalType = type;
413
	}
415
	}
Lines 440-450 Link Here
440
		} else {
442
		} else {
441
			convertedEnclosing = convertToParameterizedType(originalEnclosing);
443
			convertedEnclosing = convertToParameterizedType(originalEnclosing);
442
		}
444
		}
443
		ReferenceBinding originalGeneric = (ReferenceBinding) originalType.erasure();
444
		if (needToConvert) {
445
		if (needToConvert) {
445
			convertedType = createRawType(originalGeneric, convertedEnclosing);
446
			convertedType = createRawType((ReferenceBinding) originalType.erasure(), convertedEnclosing);
446
		} else if (originalEnclosing != convertedEnclosing) {
447
		} else if (originalEnclosing != convertedEnclosing) {
447
			convertedType = createParameterizedType(originalGeneric, null, convertedEnclosing);
448
			convertedType = createParameterizedType((ReferenceBinding) originalType.erasure(), null, convertedEnclosing);
448
		} else {
449
		} else {
449
			convertedType = originalType;
450
			convertedType = originalType;
450
		}
451
		}
Lines 470-475 Link Here
470
			originalType = type.leafComponentType();
471
			originalType = type.leafComponentType();
471
			break;
472
			break;
472
		default:
473
		default:
474
			if (type.id == TypeIds.T_JavaLangObject) 
475
				return type; // Object is not generic
473
			dimension = 0;
476
			dimension = 0;
474
			originalType = type;
477
			originalType = type;
475
	}
478
	}
Lines 494-505 Link Here
494
		convertedType = needToConvert ? createRawType((ReferenceBinding)originalType.erasure(), null) : originalType;
497
		convertedType = needToConvert ? createRawType((ReferenceBinding)originalType.erasure(), null) : originalType;
495
	} else {
498
	} else {
496
		ReferenceBinding convertedEnclosing = (ReferenceBinding) convertUnresolvedBinaryToRawType(originalEnclosing);
499
		ReferenceBinding convertedEnclosing = (ReferenceBinding) convertUnresolvedBinaryToRawType(originalEnclosing);
497
		ReferenceBinding originalGeneric = (ReferenceBinding) originalType.erasure();
500
		if (convertedEnclosing != originalEnclosing) {
498
		if (needToConvert || originalEnclosing != convertedEnclosing) {
501
			needToConvert |= !((ReferenceBinding)originalType).isStatic();
499
			convertedType = createRawType(originalGeneric, convertedEnclosing);
502
		}
503
		if (needToConvert) {
504
			convertedType = createRawType((ReferenceBinding) originalType.erasure(), convertedEnclosing);
505
		} else if (originalEnclosing != convertedEnclosing) {
506
			convertedType = createParameterizedType((ReferenceBinding) originalType.erasure(), null, convertedEnclosing);
500
		} else {
507
		} else {
501
			convertedType = originalType;
508
			convertedType = originalType;
502
		}
509
		}		
503
	}
510
	}
504
	if (originalType != convertedType) {
511
	if (originalType != convertedType) {
505
		return dimension > 0 ? (TypeBinding)createArrayType(convertedType, dimension) : convertedType;
512
		return dimension > 0 ? (TypeBinding)createArrayType(convertedType, dimension) : convertedType;
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (+47 lines)
Lines 30705-30708 Link Here
30705
			"Bean cannot be resolved to a type\n" + 
30705
			"Bean cannot be resolved to a type\n" + 
30706
			"----------\n");
30706
			"----------\n");
30707
}
30707
}
30708
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139525
30709
public void test0976() {
30710
	this.runConformTest(
30711
			new String[] {
30712
					"S.java", // =================
30713
					"import java.util.Collection;\n" + 
30714
					"public class S {\n" + 
30715
					"        public static void cow(IDA<?, ?, ?, ?, ?, ?> s) {\n" + 
30716
					"                Collection<IDA.Enum1> ids = s.getIds();  // Error here\n" + 
30717
					"        }\n" + 
30718
					"		public static void main(String[] args) {\n" +
30719
					"			System.out.println(\"SUCCESS\");\n" +
30720
					"        }\n" + 
30721
					"}\n", // =================
30722
					"ID.java", // =================
30723
					"import java.util.Collection;\n" + 
30724
					"public interface ID {\n" + 
30725
					"        Collection<? extends Comparable<?>> getIds();\n" + 
30726
					"}\n", // =================
30727
					"IDA.java", // =================
30728
					"import java.util.Collection;\n" + 
30729
					"public interface IDA<T1, C1, E1, E2, C2, T2> extends ID {\n" + 
30730
					"        enum Enum1 {\n" + 
30731
					"                ONE, TWO\n" + 
30732
					"        }\n" + 
30733
					"        Collection<IDA.Enum1> getIds();\n" + 
30734
					"}\n", // =================
30735
			},
30736
			"SUCCESS");
30737
	this.runConformTest(
30738
			new String[] {
30739
					"S.java", // =================
30740
					"import java.util.Collection;\n" + 
30741
					"public class S {\n" + 
30742
					"        public static void cow(IDA<?, ?, ?, ?, ?, ?> s) {\n" + 
30743
					"                Collection<IDA.Enum1> ids = s.getIds();  // Error here\n" + 
30744
					"        }\n" + 
30745
					"		public static void main(String[] args) {\n" +
30746
					"			System.out.println(\"SUCCESS2\");\n" +
30747
					"        }\n" + 
30748
					"}\n", // =================
30749
			},
30750
			"SUCCESS2",
30751
			null,
30752
			false,
30753
			null);
30754
}
30708
}
30755
}

Return to bug 139525