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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java (-1 / +2 lines)
Lines 101-107 Link Here
101
			scope.problemReporter().illegalClassLiteralForTypeVariable((TypeVariableBinding)this.targetType, this);
101
			scope.problemReporter().illegalClassLiteralForTypeVariable((TypeVariableBinding)this.targetType, this);
102
		}
102
		}
103
		ReferenceBinding classType = scope.getJavaLangClass();
103
		ReferenceBinding classType = scope.getJavaLangClass();
104
		if (classType.isGenericType()) {
104
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328689
105
		if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
105
			// Integer.class --> Class<Integer>, perform boxing of base types (int.class --> Class<Integer>)
106
			// Integer.class --> Class<Integer>, perform boxing of base types (int.class --> Class<Integer>)
106
			TypeBinding boxedType = null;
107
			TypeBinding boxedType = null;
107
			if (this.targetType.id == T_void) {
108
			if (this.targetType.id == T_void) {
(-)src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java (+39 lines)
Lines 5145-5148 Link Here
5145
			deleteProject(project15);
5145
			deleteProject(project15);
5146
	}
5146
	}
5147
}
5147
}
5148
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328775
5149
public void test14ProjectWith15JRE() throws CoreException, IOException {
5150
	IJavaProject project14 = null;
5151
	try {
5152
		project14 = createJavaProject("Reconciler1415", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin");
5153
		project14.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4);
5154
		project14.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
5155
		project14.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_4);
5156
5157
		createFolder("/Reconciler1415/src/p1");
5158
		String source = 
5159
			"package p1;\n" +
5160
			"public class X {\n" +
5161
			"	int a;\n" +
5162
			"   private Class c = a == 1 ? int.class : long.class;\n" + 
5163
			"}\n";
5164
		createFile(
5165
			"/Reconciler1415/src/p1/X.java",
5166
			source
5167
		);
5168
		
5169
		this.workingCopies = new ICompilationUnit[1];
5170
		char[] sourceChars = source.toCharArray();
5171
		this.problemRequestor.initialize(sourceChars);
5172
		this.workingCopies[0] = getCompilationUnit("/Reconciler1415/src/p1/X.java").getWorkingCopy(this.wcOwner, null);
5173
		assertProblems(
5174
			"Unexpected problems",
5175
			"----------\n" + 
5176
			"1. WARNING in /Reconciler1415/src/p1/X.java (at line 4)\n" + 
5177
			"	private Class c = a == 1 ? int.class : long.class;\n" + 
5178
			"	              ^\n" + 
5179
			"The value of the field X.c is not used\n" + 
5180
			"----------\n"
5181
		);
5182
	} finally {
5183
		if (project14 != null)
5184
			deleteProject(project14);
5185
	}
5186
}
5148
}
5187
}

Return to bug 328689