### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v retrieving revision 1.125 diff -u -r1.125 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 20 Oct 2010 05:46:47 -0000 1.125 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 28 Oct 2010 13:55:20 -0000 @@ -489,7 +489,7 @@ } else { methodModifiers |= ExtraCompilerModifiers.AccGenericSignature; // MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)] - SignatureWrapper wrapper = new SignatureWrapper(methodSignature, use15specifics); + SignatureWrapper wrapper = new SignatureWrapper(methodSignature, true); if (wrapper.signature[wrapper.start] == '<') { // (Ljava/lang/Class;)TA; // ParameterPart = '<' ParameterSignature(s) '>' Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.374 diff -u -r1.374 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 20 Oct 2010 05:46:47 -0000 1.374 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 28 Oct 2010 13:55:25 -0000 @@ -525,6 +525,7 @@ return null; // incompatible if (typeVariables != Binding.NO_TYPE_VARIABLES) { // generic method + boolean compliant14 = compilerOptions().complianceLevel < ClassFileConstants.JDK1_5; TypeBinding[] newArgs = null; for (int i = 0; i < argLength; i++) { TypeBinding param = i < paramLength ? parameters[i] : parameters[paramLength - 1]; @@ -534,6 +535,27 @@ System.arraycopy(arguments, 0, newArgs, 0, argLength); } newArgs[i] = environment().computeBoxingType(arguments[i]); + + } else if (compliant14 && invocationSite instanceof MessageSend + && param.kind() == Binding.PARAMETERIZED_TYPE && param.erasure().id == TypeIds.T_JavaLangClass + && ((ParameterizedTypeBinding) param).arguments.length == 1 + && ((ParameterizedTypeBinding) param).arguments[0] instanceof TypeVariableBinding + && arguments[i].kind() == Binding.TYPE && arguments[i].erasure().id == TypeIds.T_JavaLangClass) { + /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=328775. Class literals are special in that + they carry (and are the only expressions that can carry) full parameterization information + even in 1.4 source code. For inference during method selection/invocation to work properly, + resolve class literal expression's type to be a parameterized type if in 1.4 we encounter + a method that expects a parameter of the type Class<> + */ + if (newArgs == null) { + newArgs = new TypeBinding[argLength]; + System.arraycopy(arguments, 0, newArgs, 0, argLength); + } + ClassLiteralAccess classLiteral = (ClassLiteralAccess) ((MessageSend) invocationSite).arguments[i]; + // Integer.class --> Class, perform boxing of base types (int.class --> Class) + // BundleWiring.class --> Class + TypeBinding boxedType = boxing(classLiteral.targetType); + newArgs[i] = classLiteral.resolvedType = environment().createParameterizedType(((ParameterizedTypeBinding)param).genericType(), new TypeBinding[]{ boxedType }, null /*not a member*/); } } if (newArgs != null)