### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java,v retrieving revision 1.52 diff -u -r1.52 ClassLiteralAccess.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java 1 Oct 2010 21:09:58 -0000 1.52 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java 29 Oct 2010 08:13:39 -0000 @@ -101,7 +101,8 @@ scope.problemReporter().illegalClassLiteralForTypeVariable((TypeVariableBinding)this.targetType, this); } ReferenceBinding classType = scope.getJavaLangClass(); - if (classType.isGenericType()) { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328689 + if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { // Integer.class --> Class, perform boxing of base types (int.class --> Class) TypeBinding boxedType = null; if (this.targetType.id == T_void) { #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java,v retrieving revision 1.158 diff -u -r1.158 ReconcilerTests.java --- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 23 Oct 2010 00:18:36 -0000 1.158 +++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 29 Oct 2010 08:13:45 -0000 @@ -5145,4 +5145,43 @@ deleteProject(project15); } } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328775 +public void test14ProjectWith15JRE() throws CoreException, IOException { + IJavaProject project14 = null; + try { + project14 = createJavaProject("Reconciler1415", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin"); + project14.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4); + project14.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); + project14.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_4); + + createFolder("/Reconciler1415/src/p1"); + String source = + "package p1;\n" + + "public class X {\n" + + " int a;\n" + + " private Class c = a == 1 ? int.class : long.class;\n" + + "}\n"; + createFile( + "/Reconciler1415/src/p1/X.java", + source + ); + + this.workingCopies = new ICompilationUnit[1]; + char[] sourceChars = source.toCharArray(); + this.problemRequestor.initialize(sourceChars); + this.workingCopies[0] = getCompilationUnit("/Reconciler1415/src/p1/X.java").getWorkingCopy(this.wcOwner, null); + assertProblems( + "Unexpected problems", + "----------\n" + + "1. WARNING in /Reconciler1415/src/p1/X.java (at line 4)\n" + + " private Class c = a == 1 ? int.class : long.class;\n" + + " ^\n" + + "The value of the field X.c is not used\n" + + "----------\n" + ); + } finally { + if (project14 != null) + deleteProject(project14); + } +} }