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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-1 / +1 lines)
Lines 489-495 Link Here
489
	} else {
489
	} else {
490
		methodModifiers |= ExtraCompilerModifiers.AccGenericSignature;
490
		methodModifiers |= ExtraCompilerModifiers.AccGenericSignature;
491
		// MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)]
491
		// MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)]
492
		SignatureWrapper wrapper = new SignatureWrapper(methodSignature, use15specifics);
492
		SignatureWrapper wrapper = new SignatureWrapper(methodSignature, true);
493
		if (wrapper.signature[wrapper.start] == '<') {
493
		if (wrapper.signature[wrapper.start] == '<') {
494
			// <A::Ljava/lang/annotation/Annotation;>(Ljava/lang/Class<TA;>;)TA;
494
			// <A::Ljava/lang/annotation/Annotation;>(Ljava/lang/Class<TA;>;)TA;
495
			// ParameterPart = '<' ParameterSignature(s) '>'
495
			// ParameterPart = '<' ParameterSignature(s) '>'
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (+22 lines)
Lines 525-530 Link Here
525
				return null; // incompatible
525
				return null; // incompatible
526
526
527
		if (typeVariables != Binding.NO_TYPE_VARIABLES) { // generic method
527
		if (typeVariables != Binding.NO_TYPE_VARIABLES) { // generic method
528
			boolean compliant14 = compilerOptions().complianceLevel < ClassFileConstants.JDK1_5;
528
			TypeBinding[] newArgs = null;
529
			TypeBinding[] newArgs = null;
529
			for (int i = 0; i < argLength; i++) {
530
			for (int i = 0; i < argLength; i++) {
530
				TypeBinding param = i < paramLength ? parameters[i] : parameters[paramLength - 1];
531
				TypeBinding param = i < paramLength ? parameters[i] : parameters[paramLength - 1];
Lines 534-539 Link Here
534
						System.arraycopy(arguments, 0, newArgs, 0, argLength);
535
						System.arraycopy(arguments, 0, newArgs, 0, argLength);
535
					}
536
					}
536
					newArgs[i] = environment().computeBoxingType(arguments[i]);
537
					newArgs[i] = environment().computeBoxingType(arguments[i]);
538
					
539
				} else if (compliant14 && invocationSite instanceof MessageSend
540
						   && param.kind() == Binding.PARAMETERIZED_TYPE && param.erasure().id == TypeIds.T_JavaLangClass
541
						   && ((ParameterizedTypeBinding) param).arguments.length == 1 
542
						   && ((ParameterizedTypeBinding) param).arguments[0] instanceof TypeVariableBinding 
543
						   && arguments[i].kind() == Binding.TYPE && arguments[i].erasure().id == TypeIds.T_JavaLangClass) {
544
					/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=328775. Class literals are special in that
545
					   they carry (and are the only expressions that can carry) full parameterization information
546
					   even in 1.4 source code. For inference during method selection/invocation to work properly,
547
					   resolve class literal expression's type to be a parameterized type if in 1.4 we encounter
548
					   a method that expects a parameter of the type Class<>   
549
					 */
550
					if (newArgs == null) {
551
						newArgs = new TypeBinding[argLength];
552
						System.arraycopy(arguments, 0, newArgs, 0, argLength);
553
					}
554
					ClassLiteralAccess classLiteral = (ClassLiteralAccess) ((MessageSend) invocationSite).arguments[i];
555
					// Integer.class --> Class<Integer>, perform boxing of base types (int.class --> Class<Integer>)
556
					// BundleWiring.class --> Class<BundleWiring>
557
					TypeBinding boxedType = boxing(classLiteral.targetType);
558
					newArgs[i] = classLiteral.resolvedType = environment().createParameterizedType(((ParameterizedTypeBinding)param).genericType(), new TypeBinding[]{ boxedType }, null /*not a member*/);
537
				}
559
				}
538
			}
560
			}
539
			if (newArgs != null)
561
			if (newArgs != null)

Return to bug 328775