Bug 39366

Summary: Changing the targetted JDK in an ant script affects the declaring class of method invocation
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Olivier Thomann CLA 2003-06-26 09:13:47 EDT
Using 0625, changing the targetted JDK from 1.1 to 1.3 in an ant script changed
the declaring class of method invocation and field references.
The guilty piece of code is in MessageSend and FieldReference.

	// and not from Object or implicit static method call.	
	if (binding.declaringClass != this.qualifyingType
		&& !this.qualifyingType.isArrayType()
		&& ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
				&& (!receiver.isImplicitThis() || !binding.isStatic())
				&& binding.declaringClass.id != T_Object) // no change for Object methods
			|| !binding.declaringClass.canBeSeenBy(currentScope))) {

		this.codegenBinding =
currentScope.enclosingSourceType().getUpdatedMethodBinding(binding,
(ReferenceBinding) this.qualifyingType);

		// Post 1.4.0 target, array clone() invocations are qualified with array type 
		// This is handled in array type #clone method binding resolution (see Scope
and UpdatedMethodBinding)
	}

We need to investigate the behavior of JDK1.3 when you set the target to be 1.3
instead of 1.1.
Comment 1 Olivier Thomann CLA 2003-06-26 09:30:53 EDT
javac 1.3 has the behavior. If the target JDK is set to 1.3 then there is a 
side-effect on the declaring class of method invocation and field reference.

So the actual behavior of the batch compiler is perfectly acceptable.

Close as WONTFIX.