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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (+3 lines)
Lines 44-49 Link Here
44
	private final static int METHOD_EMUL = 0;
44
	private final static int METHOD_EMUL = 0;
45
	private final static int FIELD_EMUL = 1;
45
	private final static int FIELD_EMUL = 1;
46
	private final static int CLASS_LITERAL_EMUL = 2;
46
	private final static int CLASS_LITERAL_EMUL = 2;
47
	/** @deprecated */
47
	private final static int RECEIVER_TYPE_EMUL = 3;
48
	private final static int RECEIVER_TYPE_EMUL = 3;
48
49
49
	private final static int MAX_SYNTHETICS = 4;
50
	private final static int MAX_SYNTHETICS = 4;
Lines 1064-1069 Link Here
1064
public ReferenceBinding[] memberTypes() {
1065
public ReferenceBinding[] memberTypes() {
1065
	return this.memberTypes;
1066
	return this.memberTypes;
1066
}
1067
}
1068
/** @deprecated */
1067
public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBinding newDeclaringClass) {
1069
public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBinding newDeclaringClass) {
1068
	if (this.synthetics == null)
1070
	if (this.synthetics == null)
1069
		this.synthetics = new HashMap[MAX_SYNTHETICS];
1071
		this.synthetics = new HashMap[MAX_SYNTHETICS];
Lines 1082-1087 Link Here
1082
	}
1084
	}
1083
	return updatedField;
1085
	return updatedField;
1084
}
1086
}
1087
/** @deprecated */
1085
public MethodBinding getUpdatedMethodBinding(MethodBinding targetMethod, ReferenceBinding newDeclaringClass) {
1088
public MethodBinding getUpdatedMethodBinding(MethodBinding targetMethod, ReferenceBinding newDeclaringClass) {
1086
	if (this.synthetics == null)
1089
	if (this.synthetics == null)
1087
		this.synthetics = new HashMap[MAX_SYNTHETICS];
1090
		this.synthetics = new HashMap[MAX_SYNTHETICS];
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-47 / +46 lines)
Lines 23-29 Link Here
23
import org.eclipse.jdt.internal.compiler.util.ObjectVector;
23
import org.eclipse.jdt.internal.compiler.util.ObjectVector;
24
import org.eclipse.jdt.internal.compiler.util.SimpleSet;
24
import org.eclipse.jdt.internal.compiler.util.SimpleSet;
25
25
26
public abstract class Scope implements TypeConstants, TypeIds {
26
public abstract class Scope {
27
27
28
	/* Scope kinds */
28
	/* Scope kinds */
29
	public final static int BLOCK_SCOPE = 1;
29
	public final static int BLOCK_SCOPE = 1;
Lines 781-787 Link Here
781
			// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type)
781
			// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type)
782
			if (receiverType.isInterface() || exactMethod.canBeSeenBy(receiverType, invocationSite, this)) {
782
			if (receiverType.isInterface() || exactMethod.canBeSeenBy(receiverType, invocationSite, this)) {
783
				if (argumentTypes == Binding.NO_PARAMETERS
783
				if (argumentTypes == Binding.NO_PARAMETERS
784
				    && CharOperation.equals(selector, GETCLASS)
784
				    && CharOperation.equals(selector, TypeConstants.GETCLASS)
785
				    && exactMethod.returnType.isParameterizedType()/*1.5*/) {
785
				    && exactMethod.returnType.isParameterizedType()/*1.5*/) {
786
						return ParameterizedMethodBinding.instantiateGetClass(receiverType, exactMethod, this);
786
						return ParameterizedMethodBinding.instantiateGetClass(receiverType, exactMethod, this);
787
			    }
787
			    }
Lines 832-838 Link Here
832
			if (leafType instanceof ReferenceBinding)
832
			if (leafType instanceof ReferenceBinding)
833
				if (!((ReferenceBinding) leafType).canBeSeenBy(this))
833
				if (!((ReferenceBinding) leafType).canBeSeenBy(this))
834
					return new ProblemFieldBinding((ReferenceBinding)leafType, fieldName, ProblemReasons.ReceiverTypeNotVisible);
834
					return new ProblemFieldBinding((ReferenceBinding)leafType, fieldName, ProblemReasons.ReceiverTypeNotVisible);
835
			if (CharOperation.equals(fieldName, LENGTH)) {
835
			if (CharOperation.equals(fieldName, TypeConstants.LENGTH)) {
836
				if ((leafType.tagBits & TagBits.HasMissingType) != 0) {
836
				if ((leafType.tagBits & TagBits.HasMissingType) != 0) {
837
					return new ProblemFieldBinding(ArrayBinding.ArrayLength, null, fieldName, ProblemReasons.NotFound);
837
					return new ProblemFieldBinding(ArrayBinding.ArrayLength, null, fieldName, ProblemReasons.NotFound);
838
				}
838
				}
Lines 1314-1332 Link Here
1314
			if (argumentTypes == Binding.NO_PARAMETERS) {
1314
			if (argumentTypes == Binding.NO_PARAMETERS) {
1315
			    switch (selector[0]) {
1315
			    switch (selector[0]) {
1316
			        case 'c':
1316
			        case 'c':
1317
			            if (CharOperation.equals(selector, CLONE)) {
1317
			            if (CharOperation.equals(selector, TypeConstants.CLONE)) {
1318
							return new UpdatedMethodBinding(
1318
							return new MethodBinding(
1319
								compilerOptions().targetJDK >= ClassFileConstants.JDK1_4 ? (TypeBinding)receiverType : (TypeBinding)object, // remember its array type for codegen purpose on target>=1.4.0
1320
								(methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic,
1319
								(methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic,
1321
								CLONE,
1320
								TypeConstants.CLONE,
1322
								methodBinding.returnType,
1321
								methodBinding.returnType,
1323
								argumentTypes,
1322
								argumentTypes,
1324
								null,
1323
								Binding.NO_EXCEPTIONS,
1325
								object);
1324
								object);
1326
			            }
1325
			            }
1327
			            break;
1326
			            break;
1328
			        case 'g':
1327
			        case 'g':
1329
			            if (CharOperation.equals(selector, GETCLASS) && methodBinding.returnType.isParameterizedType()/*1.5*/) {
1328
			            if (CharOperation.equals(selector, TypeConstants.GETCLASS) && methodBinding.returnType.isParameterizedType()/*1.5*/) {
1330
							return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
1329
							return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
1331
			            }
1330
			            }
1332
			            break;
1331
			            break;
Lines 1854-1860 Link Here
1854
										}
1853
										}
1855
										// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type)
1854
										// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type)
1856
										if (argumentTypes == Binding.NO_PARAMETERS
1855
										if (argumentTypes == Binding.NO_PARAMETERS
1857
										    && CharOperation.equals(selector, GETCLASS)
1856
										    && CharOperation.equals(selector, TypeConstants.GETCLASS)
1858
										    && methodBinding.returnType.isParameterizedType()/*1.5*/) {
1857
										    && methodBinding.returnType.isParameterizedType()/*1.5*/) {
1859
												return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
1858
												return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
1860
										}
1859
										}
Lines 2014-2078 Link Here
2014
2013
2015
	public final ReferenceBinding getJavaIoSerializable() {
2014
	public final ReferenceBinding getJavaIoSerializable() {
2016
		CompilationUnitScope unitScope = compilationUnitScope();
2015
		CompilationUnitScope unitScope = compilationUnitScope();
2017
		unitScope.recordQualifiedReference(JAVA_IO_SERIALIZABLE);
2016
		unitScope.recordQualifiedReference(TypeConstants.JAVA_IO_SERIALIZABLE);
2018
		return unitScope.environment.getResolvedType(JAVA_IO_SERIALIZABLE, this);
2017
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_IO_SERIALIZABLE, this);
2019
	}
2018
	}
2020
2019
2021
	public final ReferenceBinding getJavaLangAnnotationAnnotation() {
2020
	public final ReferenceBinding getJavaLangAnnotationAnnotation() {
2022
		CompilationUnitScope unitScope = compilationUnitScope();
2021
		CompilationUnitScope unitScope = compilationUnitScope();
2023
		unitScope.recordQualifiedReference(JAVA_LANG_ANNOTATION_ANNOTATION);
2022
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_ANNOTATION_ANNOTATION);
2024
		return unitScope.environment.getResolvedType(JAVA_LANG_ANNOTATION_ANNOTATION, this);
2023
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_ANNOTATION_ANNOTATION, this);
2025
	}
2024
	}
2026
2025
2027
	public final ReferenceBinding getJavaLangAssertionError() {
2026
	public final ReferenceBinding getJavaLangAssertionError() {
2028
		CompilationUnitScope unitScope = compilationUnitScope();
2027
		CompilationUnitScope unitScope = compilationUnitScope();
2029
		unitScope.recordQualifiedReference(JAVA_LANG_ASSERTIONERROR);
2028
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_ASSERTIONERROR);
2030
		return unitScope.environment.getResolvedType(JAVA_LANG_ASSERTIONERROR, this);
2029
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_ASSERTIONERROR, this);
2031
	}
2030
	}
2032
2031
2033
	public final ReferenceBinding getJavaLangClass() {
2032
	public final ReferenceBinding getJavaLangClass() {
2034
		CompilationUnitScope unitScope = compilationUnitScope();
2033
		CompilationUnitScope unitScope = compilationUnitScope();
2035
		unitScope.recordQualifiedReference(JAVA_LANG_CLASS);
2034
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_CLASS);
2036
		return unitScope.environment.getResolvedType(JAVA_LANG_CLASS, this);
2035
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_CLASS, this);
2037
	}
2036
	}
2038
2037
2039
	public final ReferenceBinding getJavaLangCloneable() {
2038
	public final ReferenceBinding getJavaLangCloneable() {
2040
		CompilationUnitScope unitScope = compilationUnitScope();
2039
		CompilationUnitScope unitScope = compilationUnitScope();
2041
		unitScope.recordQualifiedReference(JAVA_LANG_CLONEABLE);
2040
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_CLONEABLE);
2042
		return unitScope.environment.getResolvedType(JAVA_LANG_CLONEABLE, this);
2041
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_CLONEABLE, this);
2043
	}
2042
	}
2044
	public final ReferenceBinding getJavaLangEnum() {
2043
	public final ReferenceBinding getJavaLangEnum() {
2045
		CompilationUnitScope unitScope = compilationUnitScope();
2044
		CompilationUnitScope unitScope = compilationUnitScope();
2046
		unitScope.recordQualifiedReference(JAVA_LANG_ENUM);
2045
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_ENUM);
2047
		return unitScope.environment.getResolvedType(JAVA_LANG_ENUM, this);
2046
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_ENUM, this);
2048
	}
2047
	}
2049
2048
2050
	public final ReferenceBinding getJavaLangIterable() {
2049
	public final ReferenceBinding getJavaLangIterable() {
2051
		CompilationUnitScope unitScope = compilationUnitScope();
2050
		CompilationUnitScope unitScope = compilationUnitScope();
2052
		unitScope.recordQualifiedReference(JAVA_LANG_ITERABLE);
2051
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_ITERABLE);
2053
		return unitScope.environment.getResolvedType(JAVA_LANG_ITERABLE, this);
2052
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_ITERABLE, this);
2054
	}
2053
	}
2055
	public final ReferenceBinding getJavaLangObject() {
2054
	public final ReferenceBinding getJavaLangObject() {
2056
		CompilationUnitScope unitScope = compilationUnitScope();
2055
		CompilationUnitScope unitScope = compilationUnitScope();
2057
		unitScope.recordQualifiedReference(JAVA_LANG_OBJECT);
2056
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_OBJECT);
2058
		return unitScope.environment.getResolvedType(JAVA_LANG_OBJECT, this);
2057
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, this);
2059
	}
2058
	}
2060
2059
2061
	public final ReferenceBinding getJavaLangString() {
2060
	public final ReferenceBinding getJavaLangString() {
2062
		CompilationUnitScope unitScope = compilationUnitScope();
2061
		CompilationUnitScope unitScope = compilationUnitScope();
2063
		unitScope.recordQualifiedReference(JAVA_LANG_STRING);
2062
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_STRING);
2064
		return unitScope.environment.getResolvedType(JAVA_LANG_STRING, this);
2063
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_STRING, this);
2065
	}
2064
	}
2066
2065
2067
	public final ReferenceBinding getJavaLangThrowable() {
2066
	public final ReferenceBinding getJavaLangThrowable() {
2068
		CompilationUnitScope unitScope = compilationUnitScope();
2067
		CompilationUnitScope unitScope = compilationUnitScope();
2069
		unitScope.recordQualifiedReference(JAVA_LANG_THROWABLE);
2068
		unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_THROWABLE);
2070
		return unitScope.environment.getResolvedType(JAVA_LANG_THROWABLE, this);
2069
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_LANG_THROWABLE, this);
2071
	}
2070
	}
2072
	public final ReferenceBinding getJavaUtilIterator() {
2071
	public final ReferenceBinding getJavaUtilIterator() {
2073
		CompilationUnitScope unitScope = compilationUnitScope();
2072
		CompilationUnitScope unitScope = compilationUnitScope();
2074
		unitScope.recordQualifiedReference(JAVA_UTIL_ITERATOR);
2073
		unitScope.recordQualifiedReference(TypeConstants.JAVA_UTIL_ITERATOR);
2075
		return unitScope.environment.getResolvedType(JAVA_UTIL_ITERATOR, this);
2074
		return unitScope.environment.getResolvedType(TypeConstants.JAVA_UTIL_ITERATOR, this);
2076
	}
2075
	}
2077
2076
2078
	/* Answer the type binding corresponding to the typeName argument, relative to the enclosingType.
2077
	/* Answer the type binding corresponding to the typeName argument, relative to the enclosingType.
Lines 2114-2120 Link Here
2114
2113
2115
			// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type)
2114
			// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type)
2116
			if (argumentTypes == Binding.NO_PARAMETERS
2115
			if (argumentTypes == Binding.NO_PARAMETERS
2117
			    && CharOperation.equals(selector, GETCLASS)
2116
			    && CharOperation.equals(selector, TypeConstants.GETCLASS)
2118
			    && methodBinding.returnType.isParameterizedType()/*1.5*/) {
2117
			    && methodBinding.returnType.isParameterizedType()/*1.5*/) {
2119
					return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
2118
					return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
2120
		    }
2119
		    }
Lines 3038-3045 Link Here
3038
			case 0 : return TypeBinding.VOID;
3037
			case 0 : return TypeBinding.VOID;
3039
			case 1 : return mecs[0];
3038
			case 1 : return mecs[0];
3040
			case 2 :
3039
			case 2 :
3041
				if ((commonDim == 0 ? mecs[1].id : mecs[1].leafComponentType().id) == T_JavaLangObject) return mecs[0];
3040
				if ((commonDim == 0 ? mecs[1].id : mecs[1].leafComponentType().id) == TypeIds.T_JavaLangObject) return mecs[0];
3042
				if ((commonDim == 0 ? mecs[0].id : mecs[0].leafComponentType().id) == T_JavaLangObject) return mecs[1];
3041
				if ((commonDim == 0 ? mecs[0].id : mecs[0].leafComponentType().id) == TypeIds.T_JavaLangObject) return mecs[1];
3043
		}
3042
		}
3044
		TypeBinding[] otherBounds = new TypeBinding[count - 1];
3043
		TypeBinding[] otherBounds = new TypeBinding[count - 1];
3045
		int rank = 0;
3044
		int rank = 0;
Lines 3118-3124 Link Here
3118
			if (dim > 0) {
3117
			if (dim > 0) {
3119
				leafType = typeToVisit.leafComponentType();
3118
				leafType = typeToVisit.leafComponentType();
3120
				switch(leafType.id) {
3119
				switch(leafType.id) {
3121
					case T_JavaLangObject:
3120
					case TypeIds.T_JavaLangObject:
3122
						if (dim > 1) { // Object[][] supertype is Object[]
3121
						if (dim > 1) { // Object[][] supertype is Object[]
3123
							TypeBinding elementType = ((ArrayBinding)typeToVisit).elementsType();
3122
							TypeBinding elementType = ((ArrayBinding)typeToVisit).elementsType();
3124
							if (!typesToVisit.contains(elementType)) {
3123
							if (!typesToVisit.contains(elementType)) {
Lines 3128-3141 Link Here
3128
							continue;
3127
							continue;
3129
						}
3128
						}
3130
						//$FALL-THROUGH$
3129
						//$FALL-THROUGH$
3131
					case T_byte:
3130
					case TypeIds.T_byte:
3132
					case T_short:
3131
					case TypeIds.T_short:
3133
					case T_char:
3132
					case TypeIds.T_char:
3134
					case T_boolean:
3133
					case TypeIds.T_boolean:
3135
					case T_int:
3134
					case TypeIds.T_int:
3136
					case T_long:
3135
					case TypeIds.T_long:
3137
					case T_float:
3136
					case TypeIds.T_float:
3138
					case T_double:
3137
					case TypeIds.T_double:
3139
						TypeBinding superType = getJavaIoSerializable();
3138
						TypeBinding superType = getJavaIoSerializable();
3140
						if (!typesToVisit.contains(superType)) {
3139
						if (!typesToVisit.contains(superType)) {
3141
							typesToVisit.add(superType);
3140
							typesToVisit.add(superType);
Lines 3254-3260 Link Here
3254
				TypeBinding erasedSuperType = erasedSuperTypes[j];
3253
				TypeBinding erasedSuperType = erasedSuperTypes[j];
3255
				if (erasedSuperType == null) continue nextSuperType;
3254
				if (erasedSuperType == null) continue nextSuperType;
3256
				TypeBinding match;
3255
				TypeBinding match;
3257
				if (erasedSuperType == otherType || erasedSuperType.id == T_JavaLangObject && otherType.isInterface()) {
3256
				if (erasedSuperType == otherType || erasedSuperType.id == TypeIds.T_JavaLangObject && otherType.isInterface()) {
3258
					match = erasedSuperType;
3257
					match = erasedSuperType;
3259
				} else {
3258
				} else {
3260
					if (erasedSuperType.isArrayType()) {
3259
					if (erasedSuperType.isArrayType()) {
Lines 3302-3315 Link Here
3302
					TypeBinding otherType = erasedSuperTypes[j];
3301
					TypeBinding otherType = erasedSuperTypes[j];
3303
					if (otherType == null) continue nextOtherType;
3302
					if (otherType == null) continue nextOtherType;
3304
					if (erasedSuperType instanceof ReferenceBinding) {
3303
					if (erasedSuperType instanceof ReferenceBinding) {
3305
						if (otherType.id == T_JavaLangObject && erasedSuperType.isInterface()) continue nextOtherType; // keep Object for an interface
3304
						if (otherType.id == TypeIds.T_JavaLangObject && erasedSuperType.isInterface()) continue nextOtherType; // keep Object for an interface
3306
						if (erasedSuperType.findSuperTypeOriginatingFrom(otherType) != null) {
3305
						if (erasedSuperType.findSuperTypeOriginatingFrom(otherType) != null) {
3307
							erasedSuperTypes[j] = null; // discard non minimal supertype
3306
							erasedSuperTypes[j] = null; // discard non minimal supertype
3308
							remaining--;
3307
							remaining--;
3309
						}
3308
						}
3310
					} else if (erasedSuperType.isArrayType()) {
3309
					} else if (erasedSuperType.isArrayType()) {
3311
					if (otherType.isArrayType() // keep Object[...] for an interface array (same dimensions)
3310
					if (otherType.isArrayType() // keep Object[...] for an interface array (same dimensions)
3312
							&& otherType.leafComponentType().id == T_JavaLangObject
3311
							&& otherType.leafComponentType().id == TypeIds.T_JavaLangObject
3313
							&& otherType.dimensions() == erasedSuperType.dimensions()
3312
							&& otherType.dimensions() == erasedSuperType.dimensions()
3314
							&& erasedSuperType.leafComponentType().isInterface()) continue nextOtherType;
3313
							&& erasedSuperType.leafComponentType().isInterface()) continue nextOtherType;
3315
						if (erasedSuperType.findSuperTypeOriginatingFrom(otherType) != null) {
3314
						if (erasedSuperType.findSuperTypeOriginatingFrom(otherType) != null) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java (+1 lines)
Lines 73-78 Link Here
73
    char[] UPPER_LOCAL_VARIABLE = "LOCAL_VARIABLE".toCharArray(); //$NON-NLS-1$
73
    char[] UPPER_LOCAL_VARIABLE = "LOCAL_VARIABLE".toCharArray(); //$NON-NLS-1$
74
    char[] UPPER_ANNOTATION_TYPE = "ANNOTATION_TYPE".toCharArray(); //$NON-NLS-1$
74
    char[] UPPER_ANNOTATION_TYPE = "ANNOTATION_TYPE".toCharArray(); //$NON-NLS-1$
75
    char[] UPPER_PACKAGE = "PACKAGE".toCharArray(); //$NON-NLS-1$
75
    char[] UPPER_PACKAGE = "PACKAGE".toCharArray(); //$NON-NLS-1$
76
    char[] ITERATOR = "iterator".toCharArray(); //$NON-NLS-1$
76
77
77
	// Constant compound names
78
	// Constant compound names
78
	char[][] JAVA_LANG = {JAVA, LANG};
79
	char[][] JAVA_LANG = {JAVA, LANG};
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-7 / +7 lines)
Lines 154-160 Link Here
154
	int numberOfImports = numberOfStatements + 1;
154
	int numberOfImports = numberOfStatements + 1;
155
	for (int i = 0; i < numberOfStatements; i++) {
155
	for (int i = 0; i < numberOfStatements; i++) {
156
		ImportReference importReference = this.referenceContext.imports[i];
156
		ImportReference importReference = this.referenceContext.imports[i];
157
		if (((importReference.bits & ASTNode.OnDemand) != 0) && CharOperation.equals(JAVA_LANG, importReference.tokens) && !importReference.isStatic()) {
157
		if (((importReference.bits & ASTNode.OnDemand) != 0) && CharOperation.equals(TypeConstants.JAVA_LANG, importReference.tokens) && !importReference.isStatic()) {
158
			numberOfImports--;
158
			numberOfImports--;
159
			break;
159
			break;
160
		}
160
		}
Lines 313-319 Link Here
313
	int numberOfImports = numberOfStatements + 1;
313
	int numberOfImports = numberOfStatements + 1;
314
	for (int i = 0; i < numberOfStatements; i++) {
314
	for (int i = 0; i < numberOfStatements; i++) {
315
		ImportReference importReference = this.referenceContext.imports[i];
315
		ImportReference importReference = this.referenceContext.imports[i];
316
		if (((importReference.bits & ASTNode.OnDemand) != 0) && CharOperation.equals(JAVA_LANG, importReference.tokens) && !importReference.isStatic()) {
316
		if (((importReference.bits & ASTNode.OnDemand) != 0) && CharOperation.equals(TypeConstants.JAVA_LANG, importReference.tokens) && !importReference.isStatic()) {
317
			numberOfImports--;
317
			numberOfImports--;
318
			break;
318
			break;
319
		}
319
		}
Lines 569-589 Link Here
569
	// initialize the default imports if necessary... share the default java.lang.* import
569
	// initialize the default imports if necessary... share the default java.lang.* import
570
	if (this.environment.defaultImports != null) return this.environment.defaultImports;
570
	if (this.environment.defaultImports != null) return this.environment.defaultImports;
571
571
572
	Binding importBinding = this.environment.getTopLevelPackage(JAVA);
572
	Binding importBinding = this.environment.getTopLevelPackage(TypeConstants.JAVA);
573
	if (importBinding != null)
573
	if (importBinding != null)
574
		importBinding = ((PackageBinding) importBinding).getTypeOrPackage(JAVA_LANG[1]);
574
		importBinding = ((PackageBinding) importBinding).getTypeOrPackage(TypeConstants.JAVA_LANG[1]);
575
575
576
	if (importBinding == null || !importBinding.isValidBinding()) {
576
	if (importBinding == null || !importBinding.isValidBinding()) {
577
		// create a proxy for the missing BinaryType
577
		// create a proxy for the missing BinaryType
578
		problemReporter().isClassPathCorrect(
578
		problemReporter().isClassPathCorrect(
579
			JAVA_LANG_OBJECT,
579
				TypeConstants.JAVA_LANG_OBJECT,
580
			this.referenceContext,
580
			this.referenceContext,
581
			this.environment.missingClassFileLocation);
581
			this.environment.missingClassFileLocation);
582
		BinaryTypeBinding missingObject = this.environment.createMissingType(null, JAVA_LANG_OBJECT);
582
		BinaryTypeBinding missingObject = this.environment.createMissingType(null, TypeConstants.JAVA_LANG_OBJECT);
583
		importBinding = missingObject.fPackage;
583
		importBinding = missingObject.fPackage;
584
	}
584
	}
585
585
586
	return this.environment.defaultImports = new ImportBinding[] {new ImportBinding(JAVA_LANG, true, importBinding, null)};
586
	return this.environment.defaultImports = new ImportBinding[] {new ImportBinding(TypeConstants.JAVA_LANG, true, importBinding, null)};
587
}
587
}
588
// NOT Public API
588
// NOT Public API
589
public final Binding getImport(char[][] compoundName, boolean onDemand, boolean isStaticImport) {
589
public final Binding getImport(char[][] compoundName, boolean onDemand, boolean isStaticImport) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java (-8 lines)
Lines 391-404 Link Here
391
	return uniqueKey;
391
	return uniqueKey;
392
}
392
}
393
393
394
/*
395
 * Answer the declaring class to use in the constant pool
396
 * may not be a reference binding (see subtypes)
397
 */
398
public TypeBinding constantPoolDeclaringClass() {
399
	return this.declaringClass;
400
}
401
402
/* Answer the receiver's constant pool name.
394
/* Answer the receiver's constant pool name.
403
*
395
*
404
* <init> for constructors
396
* <init> for constructors
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/UpdatedMethodBinding.java (-25 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.lookup;
12
13
public class UpdatedMethodBinding extends MethodBinding {
14
15
	public TypeBinding updatedDeclaringClass;
16
17
	public UpdatedMethodBinding(TypeBinding updatedDeclaringClass, int modifiers, char[] selector, TypeBinding returnType, TypeBinding[] args, ReferenceBinding[] exceptions, ReferenceBinding declaringClass) {
18
		super(modifiers, selector, returnType, args, exceptions, declaringClass);
19
		this.updatedDeclaringClass = updatedDeclaringClass;
20
	}
21
22
	public TypeBinding constantPoolDeclaringClass() {
23
		return this.updatedDeclaringClass;
24
	}
25
}
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-20 / +21 lines)
Lines 2245-2251 Link Here
2245
			FieldBinding fieldBinding = (FieldBinding) mappingSequence[i];
2245
			FieldBinding fieldBinding = (FieldBinding) mappingSequence[i];
2246
			getfield(fieldBinding);
2246
			getfield(fieldBinding);
2247
		} else {
2247
		} else {
2248
			invokestatic((MethodBinding) mappingSequence[i]);
2248
			invokestatic((MethodBinding) mappingSequence[i], null /* default declaringClass */);
2249
		}
2249
		}
2250
	}
2250
	}
2251
}
2251
}
Lines 2312-2320 Link Here
2312
 * @param accessBinding the access method binding to generate
2312
 * @param accessBinding the access method binding to generate
2313
 */
2313
 */
2314
public void generateSyntheticBodyForConstructorAccess(SyntheticMethodBinding accessBinding) {
2314
public void generateSyntheticBodyForConstructorAccess(SyntheticMethodBinding accessBinding) {
2315
2316
	initializeMaxLocals(accessBinding);
2315
	initializeMaxLocals(accessBinding);
2317
2318
	MethodBinding constructorBinding = accessBinding.targetMethod;
2316
	MethodBinding constructorBinding = accessBinding.targetMethod;
2319
	TypeBinding[] parameters = constructorBinding.parameters;
2317
	TypeBinding[] parameters = constructorBinding.parameters;
2320
	int length = parameters.length;
2318
	int length = parameters.length;
Lines 2359-2365 Link Here
2359
				resolvedPosition++;
2357
				resolvedPosition++;
2360
		}
2358
		}
2361
	}
2359
	}
2362
	invokespecial(constructorBinding);
2360
	invokespecial(constructorBinding, null /* default declaringClass */);
2363
	return_();
2361
	return_();
2364
}
2362
}
2365
//static X valueOf(String name) {
2363
//static X valueOf(String name) {
Lines 2451-2457 Link Here
2451
	return_();
2449
	return_();
2452
}
2450
}
2453
public void generateSyntheticBodyForMethodAccess(SyntheticMethodBinding accessMethod) {
2451
public void generateSyntheticBodyForMethodAccess(SyntheticMethodBinding accessMethod) {
2454
2455
	initializeMaxLocals(accessMethod);
2452
	initializeMaxLocals(accessMethod);
2456
	MethodBinding targetMethod = accessMethod.targetMethod;
2453
	MethodBinding targetMethod = accessMethod.targetMethod;
2457
	TypeBinding[] parameters = targetMethod.parameters;
2454
	TypeBinding[] parameters = targetMethod.parameters;
Lines 2482-2499 Link Here
2482
			resolvedPosition++;
2479
			resolvedPosition++;
2483
	}
2480
	}
2484
	if (targetMethod.isStatic())
2481
	if (targetMethod.isStatic())
2485
		invokestatic(targetMethod);
2482
		invokestatic(targetMethod, null /* default declaringClass */);
2486
	else {
2483
	else {
2487
		if (targetMethod.isConstructor()
2484
		if (targetMethod.isConstructor()
2488
			|| targetMethod.isPrivate()
2485
			|| targetMethod.isPrivate()
2489
			// qualified super "X.super.foo()" targets methods from superclass
2486
			// qualified super "X.super.foo()" targets methods from superclass
2490
			|| accessMethod.purpose == SyntheticMethodBinding.SuperMethodAccess){
2487
			|| accessMethod.purpose == SyntheticMethodBinding.SuperMethodAccess){
2491
			invokespecial(targetMethod);
2488
			invokespecial(targetMethod, null /* default declaringClass */);
2492
		} else {
2489
		} else {
2493
			if (targetMethod.declaringClass.isInterface()) { // interface or annotation type
2490
			if (targetMethod.declaringClass.isInterface()) { // interface or annotation type
2494
				invokeinterface(targetMethod);
2491
				invokeinterface(targetMethod, null /* default declaringClass */);
2495
			} else {
2492
			} else {
2496
				invokevirtual(targetMethod);
2493
				invokevirtual(targetMethod, accessMethod.declaringClass);
2497
			}
2494
			}
2498
		}
2495
		}
2499
	}
2496
	}
Lines 3845-3852 Link Here
3845
			ConstantPool.Ordinal,
3842
			ConstantPool.Ordinal,
3846
			ConstantPool.OrdinalSignature);
3843
			ConstantPool.OrdinalSignature);
3847
}
3844
}
3848
public void invokeinterface(MethodBinding methodBinding) {
3845
public void invokeinterface(MethodBinding methodBinding, TypeBinding declaringClass) {
3849
	if (DEBUG) System.out.println(this.position + "\t\tinvokeinterface: " + methodBinding); //$NON-NLS-1$
3846
	if (DEBUG) System.out.println(this.position + "\t\tinvokeinterface: " + methodBinding); //$NON-NLS-1$
3847
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
3850
	this.countLabels = 0;
3848
	this.countLabels = 0;
3851
	// initialized to 1 to take into account this  immediately
3849
	// initialized to 1 to take into account this  immediately
3852
	int argCount = 1;
3850
	int argCount = 1;
Lines 3858-3864 Link Here
3858
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokeinterface;
3856
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokeinterface;
3859
	writeUnsignedShort(
3857
	writeUnsignedShort(
3860
		this.constantPool.literalIndexForMethod(
3858
		this.constantPool.literalIndexForMethod(
3861
			methodBinding.constantPoolDeclaringClass(),
3859
			declaringClass,
3862
			methodBinding.selector,
3860
			methodBinding.selector,
3863
			methodBinding.signature(this.classFile),
3861
			methodBinding.signature(this.classFile),
3864
			true));
3862
			true));
Lines 4143-4150 Link Here
4143
			ConstantPool.GetClass,
4141
			ConstantPool.GetClass,
4144
			ConstantPool.GetClassSignature);
4142
			ConstantPool.GetClassSignature);
4145
}
4143
}
4146
public void invokespecial(MethodBinding methodBinding) {
4144
public void invokespecial(MethodBinding methodBinding, TypeBinding declaringClass) {
4147
	if (DEBUG) System.out.println(this.position + "\t\tinvokespecial:"+methodBinding); //$NON-NLS-1$
4145
	if (DEBUG) System.out.println(this.position + "\t\tinvokespecial:"+methodBinding); //$NON-NLS-1$
4146
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
4148
	this.countLabels = 0;
4147
	this.countLabels = 0;
4149
	// initialized to 1 to take into account this immediately
4148
	// initialized to 1 to take into account this immediately
4150
	int argCount = 1;
4149
	int argCount = 1;
Lines 4156-4170 Link Here
4156
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokespecial;
4155
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokespecial;
4157
	writeUnsignedShort(
4156
	writeUnsignedShort(
4158
		this.constantPool.literalIndexForMethod(
4157
		this.constantPool.literalIndexForMethod(
4159
			methodBinding.constantPoolDeclaringClass(),
4158
				declaringClass,
4160
			methodBinding.selector,
4159
			methodBinding.selector,
4161
			methodBinding.signature(this.classFile),
4160
			methodBinding.signature(this.classFile),
4162
			false));
4161
			false));
4163
	if (methodBinding.isConstructor()) {
4162
	if (methodBinding.isConstructor()) {
4164
		final ReferenceBinding declaringClass = methodBinding.declaringClass;
4165
		if (declaringClass.isNestedType()) {
4163
		if (declaringClass.isNestedType()) {
4164
			final ReferenceBinding nestedType = (ReferenceBinding) declaringClass;
4166
			// enclosing instances
4165
			// enclosing instances
4167
			TypeBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
4166
			TypeBinding[] syntheticArgumentTypes = nestedType.syntheticEnclosingInstanceTypes();
4168
			if (syntheticArgumentTypes != null) {
4167
			if (syntheticArgumentTypes != null) {
4169
				for (int i = 0, max = syntheticArgumentTypes.length; i < max; i++) {
4168
				for (int i = 0, max = syntheticArgumentTypes.length; i < max; i++) {
4170
					if (((id = syntheticArgumentTypes[i].id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
4169
					if (((id = syntheticArgumentTypes[i].id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
Lines 4175-4181 Link Here
4175
				}
4174
				}
4176
			}
4175
			}
4177
			// outer local variables
4176
			// outer local variables
4178
			SyntheticArgumentBinding[] syntheticArguments = declaringClass.syntheticOuterLocalVariables();
4177
			SyntheticArgumentBinding[] syntheticArguments = nestedType.syntheticOuterLocalVariables();
4179
			if (syntheticArguments != null) {
4178
			if (syntheticArguments != null) {
4180
				for (int i = 0, max = syntheticArguments.length; i < max; i++) {
4179
				for (int i = 0, max = syntheticArguments.length; i < max; i++) {
4181
					if (((id = syntheticArguments[i].type.id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
4180
					if (((id = syntheticArguments[i].type.id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
Lines 4206-4213 Link Here
4206
	if (this.stackDepth > this.stackMax)
4205
	if (this.stackDepth > this.stackMax)
4207
		this.stackMax = this.stackDepth;
4206
		this.stackMax = this.stackDepth;
4208
}
4207
}
4209
public void invokestatic(MethodBinding methodBinding) {
4208
public void invokestatic(MethodBinding methodBinding, TypeBinding declaringClass) {
4210
	if (DEBUG) System.out.println(this.position + "\t\tinvokestatic:"+methodBinding); //$NON-NLS-1$
4209
	if (DEBUG) System.out.println(this.position + "\t\tinvokestatic:"+methodBinding); //$NON-NLS-1$
4210
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
4211
	// initialized to 0 to take into account that there is no this for
4211
	// initialized to 0 to take into account that there is no this for
4212
	// a static method
4212
	// a static method
4213
	this.countLabels = 0;
4213
	this.countLabels = 0;
Lines 4220-4226 Link Here
4220
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokestatic;
4220
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokestatic;
4221
	writeUnsignedShort(
4221
	writeUnsignedShort(
4222
		this.constantPool.literalIndexForMethod(
4222
		this.constantPool.literalIndexForMethod(
4223
			methodBinding.constantPoolDeclaringClass(),
4223
			declaringClass,
4224
			methodBinding.selector,
4224
			methodBinding.selector,
4225
			methodBinding.signature(this.classFile),
4225
			methodBinding.signature(this.classFile),
4226
			false));
4226
			false));
Lines 4481-4488 Link Here
4481
			ConstantPool.GetMessage,
4481
			ConstantPool.GetMessage,
4482
			ConstantPool.GetMessageSignature);
4482
			ConstantPool.GetMessageSignature);
4483
}
4483
}
4484
public void invokevirtual(MethodBinding methodBinding) {
4484
public void invokevirtual(MethodBinding methodBinding,TypeBinding declaringClass) {
4485
	if (DEBUG) System.out.println(this.position + "\t\tinvokevirtual:"+methodBinding); //$NON-NLS-1$
4485
	if (DEBUG) System.out.println(this.position + "\t\tinvokevirtual:"+methodBinding); //$NON-NLS-1$
4486
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
4486
	this.countLabels = 0;
4487
	this.countLabels = 0;
4487
	// initialized to 1 to take into account this  immediately
4488
	// initialized to 1 to take into account this  immediately
4488
	int argCount = 1;
4489
	int argCount = 1;
Lines 4494-4500 Link Here
4494
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokevirtual;
4495
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_invokevirtual;
4495
	writeUnsignedShort(
4496
	writeUnsignedShort(
4496
		this.constantPool.literalIndexForMethod(
4497
		this.constantPool.literalIndexForMethod(
4497
			methodBinding.constantPoolDeclaringClass(),
4498
				declaringClass,
4498
			methodBinding.selector,
4499
			methodBinding.selector,
4499
			methodBinding.signature(this.classFile),
4500
			methodBinding.signature(this.classFile),
4500
			false));
4501
			false));
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java (-6 / +6 lines)
Lines 377-383 Link Here
377
					if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
377
					if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
378
						codeStream.getstatic(fieldBinding);
378
						codeStream.getstatic(fieldBinding);
379
					} else {
379
					} else {
380
						codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ]);
380
						codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
381
					}
381
					}
382
				} else {
382
				} else {
383
					if (!valueRequired
383
					if (!valueRequired
Lines 399-405 Link Here
399
					if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
399
					if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
400
						codeStream.getfield(fieldBinding);
400
						codeStream.getfield(fieldBinding);
401
					} else {
401
					} else {
402
						codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ]);
402
						codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
403
					}
403
					}
404
				}
404
				}
405
				break;
405
				break;
Lines 474-480 Link Here
474
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
474
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
475
					codeStream.getstatic(fieldBinding);
475
					codeStream.getstatic(fieldBinding);
476
				} else {
476
				} else {
477
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ]);
477
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
478
				}
478
				}
479
			} else {
479
			} else {
480
				if ((this.bits & ASTNode.DepthMASK) != 0) {
480
				if ((this.bits & ASTNode.DepthMASK) != 0) {
Lines 488-494 Link Here
488
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
488
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
489
					codeStream.getfield(fieldBinding);
489
					codeStream.getfield(fieldBinding);
490
				} else {
490
				} else {
491
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ]);
491
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
492
				}
492
				}
493
			}
493
			}
494
			break;
494
			break;
Lines 587-593 Link Here
587
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
587
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
588
					codeStream.getstatic(fieldBinding);
588
					codeStream.getstatic(fieldBinding);
589
				} else {
589
				} else {
590
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ]);
590
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
591
				}
591
				}
592
			} else {
592
			} else {
593
				if ((this.bits & ASTNode.DepthMASK) != 0) {
593
				if ((this.bits & ASTNode.DepthMASK) != 0) {
Lines 601-607 Link Here
601
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
601
				if ((this.syntheticAccessors == null) || (this.syntheticAccessors[SingleNameReference.READ] == null)) {
602
					codeStream.getfield(fieldBinding);
602
					codeStream.getfield(fieldBinding);
603
				} else {
603
				} else {
604
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ]);
604
					codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
605
				}
605
				}
606
			}
606
			}
607
			TypeBinding operandType;
607
			TypeBinding operandType;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java (-6 / +6 lines)
Lines 233-239 Link Here
233
					codeStream.getfield(this.codegenBinding);
233
					codeStream.getfield(this.codegenBinding);
234
				}
234
				}
235
			} else {
235
			} else {
236
				codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ]);
236
				codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ], null /* default declaringClass */);
237
			}
237
			}
238
			// required cast must occur even if no value is required
238
			// required cast must occur even if no value is required
239
			if (this.genericCast != null) codeStream.checkcast(this.genericCast);
239
			if (this.genericCast != null) codeStream.checkcast(this.genericCast);
Lines 262-268 Link Here
262
					if (accessor == null) {
262
					if (accessor == null) {
263
						codeStream.getstatic(this.codegenBinding);
263
						codeStream.getstatic(this.codegenBinding);
264
					} else {
264
					} else {
265
						codeStream.invokestatic(accessor);
265
						codeStream.invokestatic(accessor, null /* default declaringClass */);
266
					}
266
					}
267
					switch (this.codegenBinding.type.id) {
267
					switch (this.codegenBinding.type.id) {
268
						case T_long :
268
						case T_long :
Lines 295-308 Link Here
295
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
295
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
296
			codeStream.getstatic(this.codegenBinding);
296
			codeStream.getstatic(this.codegenBinding);
297
		} else {
297
		} else {
298
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ]);
298
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ], null /* default declaringClass */);
299
		}
299
		}
300
	} else {
300
	} else {
301
		codeStream.dup();
301
		codeStream.dup();
302
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
302
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
303
			codeStream.getfield(this.codegenBinding);
303
			codeStream.getfield(this.codegenBinding);
304
		} else {
304
		} else {
305
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ]);
305
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ], null /* default declaringClass */);
306
		}
306
		}
307
	}
307
	}
308
	int operationTypeID;
308
	int operationTypeID;
Lines 346-359 Link Here
346
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
346
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
347
			codeStream.getstatic(this.codegenBinding);
347
			codeStream.getstatic(this.codegenBinding);
348
		} else {
348
		} else {
349
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ]);
349
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ], null /* default declaringClass */);
350
		}
350
		}
351
	} else {
351
	} else {
352
		codeStream.dup();
352
		codeStream.dup();
353
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
353
		if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
354
			codeStream.getfield(this.codegenBinding);
354
			codeStream.getfield(this.codegenBinding);
355
		} else {
355
		} else {
356
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ]);
356
			codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ], null /* default declaringClass */);
357
		}
357
		}
358
	}
358
	}
359
	TypeBinding operandType;
359
	TypeBinding operandType;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java (-2 / +2 lines)
Lines 44-50 Link Here
44
		if (syntheticWriteAccessor == null) {
44
		if (syntheticWriteAccessor == null) {
45
			codeStream.putstatic(fieldBinding);
45
			codeStream.putstatic(fieldBinding);
46
		} else {
46
		} else {
47
			codeStream.invokestatic(syntheticWriteAccessor);
47
			codeStream.invokestatic(syntheticWriteAccessor, null /* default declaringClass */);
48
		}
48
		}
49
	} else { // Stack:  [owner][new field value]  ---> [new field value][owner][new field value]
49
	} else { // Stack:  [owner][new field value]  ---> [new field value][owner][new field value]
50
		if (valueRequired) {
50
		if (valueRequired) {
Lines 57-63 Link Here
57
		if (syntheticWriteAccessor == null) {
57
		if (syntheticWriteAccessor == null) {
58
			codeStream.putfield(fieldBinding);
58
			codeStream.putfield(fieldBinding);
59
		} else {
59
		} else {
60
			codeStream.invokestatic(syntheticWriteAccessor);
60
			codeStream.invokestatic(syntheticWriteAccessor, null /* default declaringClass */);
61
		}
61
		}
62
	}
62
	}
63
	codeStream.recordPositionsFrom(pc, this.sourceStart);
63
	codeStream.recordPositionsFrom(pc, this.sourceStart);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (-2 / +2 lines)
Lines 138-144 Link Here
138
138
139
		// invoke constructor
139
		// invoke constructor
140
		if (this.syntheticAccessor == null) {
140
		if (this.syntheticAccessor == null) {
141
			codeStream.invokespecial(this.codegenBinding);
141
			codeStream.invokespecial(this.codegenBinding, null /* default declaringClass */);
142
		} else {
142
		} else {
143
			// synthetic accessor got some extra arguments appended to its signature, which need values
143
			// synthetic accessor got some extra arguments appended to its signature, which need values
144
			for (int i = 0,
144
			for (int i = 0,
Lines 147-153 Link Here
147
				i++) {
147
				i++) {
148
				codeStream.aconst_null();
148
				codeStream.aconst_null();
149
			}
149
			}
150
			codeStream.invokespecial(this.syntheticAccessor);
150
			codeStream.invokespecial(this.syntheticAccessor, null /* default declaringClass */);
151
		}
151
		}
152
		if (valueRequired) {
152
		if (valueRequired) {
153
			codeStream.generateImplicitConversion(this.implicitConversion);
153
			codeStream.generateImplicitConversion(this.implicitConversion);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java (-1 / +1 lines)
Lines 156-162 Link Here
156
			if (resolvedType.isEnum()) {
156
			if (resolvedType.isEnum()) {
157
				if (needSwitch) {
157
				if (needSwitch) {
158
					// go through the translation table
158
					// go through the translation table
159
					codeStream.invokestatic(this.synthetic);
159
					codeStream.invokestatic(this.synthetic, null /* default declaringClass */);
160
					this.expression.generateCode(currentScope, codeStream, true);
160
					this.expression.generateCode(currentScope, codeStream, true);
161
					// get enum constant ordinal()
161
					// get enum constant ordinal()
162
					codeStream.invokeEnumOrdinal(resolvedType.constantPoolName());
162
					codeStream.invokeEnumOrdinal(resolvedType.constantPoolName());
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-2 / +2 lines)
Lines 115-121 Link Here
115
	}
115
	}
116
	// invoke constructor
116
	// invoke constructor
117
	if (this.syntheticAccessor == null) {
117
	if (this.syntheticAccessor == null) {
118
		codeStream.invokespecial(this.codegenBinding);
118
		codeStream.invokespecial(this.codegenBinding, null /* default declaringClass */);
119
	} else {
119
	} else {
120
		// synthetic accessor got some extra arguments appended to its signature, which need values
120
		// synthetic accessor got some extra arguments appended to its signature, which need values
121
		for (int i = 0,
121
		for (int i = 0,
Lines 124-130 Link Here
124
			i++) {
124
			i++) {
125
			codeStream.aconst_null();
125
			codeStream.aconst_null();
126
		}
126
		}
127
		codeStream.invokespecial(this.syntheticAccessor);
127
		codeStream.invokespecial(this.syntheticAccessor, null /* default declaringClass */);
128
	}
128
	}
129
	if (valueRequired) {
129
	if (valueRequired) {
130
		codeStream.generateImplicitConversion(this.implicitConversion);
130
		codeStream.generateImplicitConversion(this.implicitConversion);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java (-11 / +19 lines)
Lines 12-19 Link Here
12
12
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
16
import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
15
import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
16
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
17
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
17
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
18
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
18
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
19
import org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext;
19
import org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext;
Lines 27-32 Link Here
27
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
29
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
29
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
30
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
30
31
31
public class ForeachStatement extends Statement {
32
public class ForeachStatement extends Statement {
32
33
Lines 63-68 Link Here
63
	int postCollectionInitStateIndex = -1;
64
	int postCollectionInitStateIndex = -1;
64
	int mergedInitStateIndex = -1;
65
	int mergedInitStateIndex = -1;
65
66
67
	private static MethodBinding ITERATOR_METHOD;
68
	
66
	public ForeachStatement(
69
	public ForeachStatement(
67
		LocalDeclaration elementVariable,
70
		LocalDeclaration elementVariable,
68
		int start) {
71
		int start) {
Lines 212-229 Link Here
212
			case GENERIC_ITERABLE :
215
			case GENERIC_ITERABLE :
213
				this.collection.generateCode(this.scope, codeStream, true);
216
				this.collection.generateCode(this.scope, codeStream, true);
214
				// declaringClass.iterator();
217
				// declaringClass.iterator();
215
				MethodBinding iteratorMethodBinding =
216
					new MethodBinding(
217
							ClassFileConstants.AccPublic,
218
							"iterator".toCharArray(),//$NON-NLS-1$
219
							this.scope.getJavaUtilIterator(),
220
							Binding.NO_PARAMETERS,
221
							Binding.NO_EXCEPTIONS,
222
							(ReferenceBinding) this.iteratorReceiverType.erasure());
223
				if (this.iteratorReceiverType.isInterface()) {
218
				if (this.iteratorReceiverType.isInterface()) {
224
					codeStream.invokeinterface(iteratorMethodBinding);
219
					codeStream.invokeinterface(getIteratorMethod(), this.iteratorReceiverType);
225
				} else {
220
				} else {
226
					codeStream.invokevirtual(iteratorMethodBinding);
221
					codeStream.invokevirtual(getIteratorMethod(), this.iteratorReceiverType);
227
				}
222
				}
228
				codeStream.store(this.indexVariable, false);
223
				codeStream.store(this.indexVariable, false);
229
				codeStream.addVariable(this.indexVariable);
224
				codeStream.addVariable(this.indexVariable);
Lines 367-372 Link Here
367
		this.breakLabel.place();
362
		this.breakLabel.place();
368
		codeStream.recordPositionsFrom(pc, this.sourceStart);
363
		codeStream.recordPositionsFrom(pc, this.sourceStart);
369
	}
364
	}
365
	private MethodBinding getIteratorMethod() {
366
		if (ITERATOR_METHOD == null) {
367
			ITERATOR_METHOD = new MethodBinding(
368
					ClassFileConstants.AccPublic,
369
					TypeConstants.ITERATOR,
370
					this.scope.getJavaUtilIterator(),
371
					Binding.NO_PARAMETERS,
372
					Binding.NO_EXCEPTIONS,
373
					null);
374
			
375
		}
376
		return ITERATOR_METHOD;
377
	}
370
378
371
	public StringBuffer printStatement(int indent, StringBuffer output) {
379
	public StringBuffer printStatement(int indent, StringBuffer output) {
372
380
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-26 / +25 lines)
Lines 148-170 Link Here
148
	}
148
	}
149
	// generate arguments
149
	// generate arguments
150
	generateArguments(this.binding, this.arguments, currentScope, codeStream);
150
	generateArguments(this.binding, this.arguments, currentScope, codeStream);
151
151
	// actual message invocation
152
	// actual message invocation
152
	if (this.syntheticAccessor == null){
153
	if (this.syntheticAccessor == null){
153
		if (isStatic){
154
		if (isStatic){
154
			codeStream.invokestatic(this.codegenBinding);
155
			codeStream.invokestatic(this.codegenBinding, null /* default declaringClass */);
155
		} else {
156
		} else {
157
			// constantpool declaringClass
158
			TypeBinding constantPoolDeclaringClass = this.codegenBinding.declaringClass;
159
			// if the binding declaring class is not visible, need special action
160
			// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
161
			// NOTE: from target 1.2 on, method's declaring class is touched if any different from receiver type
162
			// and not from Object or implicit static method call.
163
			if (constantPoolDeclaringClass != this.actualReceiverType && this.receiverGenericCast == null && !this.actualReceiverType.isArrayType()) {
164
				CompilerOptions options = currentScope.compilerOptions();
165
				if ((options.targetJDK >= ClassFileConstants.JDK1_2
166
						&& (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(this.receiver.isImplicitThis() && this.codegenBinding.isStatic()))
167
						&& this.binding.declaringClass.id != TypeIds.T_JavaLangObject) // no change for Object methods
168
					|| !this.binding.declaringClass.canBeSeenBy(currentScope)) {
169
170
					constantPoolDeclaringClass = this.actualReceiverType.erasure();
171
				}
172
				// Post 1.4.0 target, array clone() invocations are qualified with array type
173
				// This is handled in array type #clone method binding resolution (see Scope and UpdatedMethodBinding)
174
			}				
156
			if( (this.receiver.isSuper()) || this.codegenBinding.isPrivate()){
175
			if( (this.receiver.isSuper()) || this.codegenBinding.isPrivate()){
157
				codeStream.invokespecial(this.codegenBinding);
176
				codeStream.invokespecial(this.codegenBinding, constantPoolDeclaringClass);
158
			} else {
177
			} else {
159
				if (this.codegenBinding.declaringClass.isInterface()) { // interface or annotation type
178
				if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
160
					codeStream.invokeinterface(this.codegenBinding);
179
					codeStream.invokeinterface(this.codegenBinding, constantPoolDeclaringClass);
161
				} else {
180
				} else {
162
					codeStream.invokevirtual(this.codegenBinding);
181
					codeStream.invokevirtual(this.codegenBinding, constantPoolDeclaringClass);
163
				}
182
				}
164
			}
183
			}
165
		}
184
		}
166
	} else {
185
	} else {
167
		codeStream.invokestatic(this.syntheticAccessor);
186
		codeStream.invokestatic(this.syntheticAccessor, null /* default declaringClass */);
168
	}
187
	}
169
	// required cast must occur even if no value is required
188
	// required cast must occur even if no value is required
170
	if (this.valueCast != null) codeStream.checkcast(this.valueCast);
189
	if (this.valueCast != null) codeStream.checkcast(this.valueCast);
Lines 239-264 Link Here
239
			return;
258
			return;
240
		}
259
		}
241
	}
260
	}
242
243
	// if the binding declaring class is not visible, need special action
244
	// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
245
	// NOTE: from target 1.2 on, method's declaring class is touched if any different from receiver type
246
	// and not from Object or implicit static method call.
247
	if (this.binding.declaringClass != this.actualReceiverType
248
			&& this.receiverGenericCast == null
249
			&& !this.actualReceiverType.isArrayType()) {
250
		CompilerOptions options = currentScope.compilerOptions();
251
		if ((options.targetJDK >= ClassFileConstants.JDK1_2
252
				&& (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(this.receiver.isImplicitThis() && this.codegenBinding.isStatic()))
253
				&& this.binding.declaringClass.id != TypeIds.T_JavaLangObject) // no change for Object methods
254
			|| !this.binding.declaringClass.canBeSeenBy(currentScope)) {
255
256
			this.codegenBinding = currentScope.enclosingSourceType().getUpdatedMethodBinding(
257
			        										this.codegenBinding, (ReferenceBinding) this.actualReceiverType.erasure());
258
		}
259
		// Post 1.4.0 target, array clone() invocations are qualified with array type
260
		// This is handled in array type #clone method binding resolution (see Scope and UpdatedMethodBinding)
261
	}
262
}
261
}
263
public int nullStatus(FlowInfo flowInfo) {
262
public int nullStatus(FlowInfo flowInfo) {
264
	return FlowInfo.UNKNOWN;
263
	return FlowInfo.UNKNOWN;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java (-7 / +7 lines)
Lines 401-407 Link Here
401
								codeStream.getfield(lastFieldBinding);
401
								codeStream.getfield(lastFieldBinding);
402
							}
402
							}
403
						} else {
403
						} else {
404
							codeStream.invokestatic(accessor);
404
							codeStream.invokestatic(accessor, null /* default declaringClass */);
405
						}
405
						}
406
						if (requiredGenericCast != null) codeStream.checkcast(requiredGenericCast);
406
						if (requiredGenericCast != null) codeStream.checkcast(requiredGenericCast);
407
						if (valueRequired) {
407
						if (valueRequired) {
Lines 452-465 Link Here
452
		if (accessor == null) {
452
		if (accessor == null) {
453
			codeStream.getstatic(lastFieldBinding);
453
			codeStream.getstatic(lastFieldBinding);
454
		} else {
454
		} else {
455
			codeStream.invokestatic(accessor);
455
			codeStream.invokestatic(accessor, null /* default declaringClass */);
456
		}
456
		}
457
	} else {
457
	} else {
458
		codeStream.dup();
458
		codeStream.dup();
459
		if (accessor == null) {
459
		if (accessor == null) {
460
			codeStream.getfield(lastFieldBinding);
460
			codeStream.getfield(lastFieldBinding);
461
		} else {
461
		} else {
462
			codeStream.invokestatic(accessor);
462
			codeStream.invokestatic(accessor, null /* default declaringClass */);
463
		}
463
		}
464
	}
464
	}
465
	// the last field access is a write access
465
	// the last field access is a write access
Lines 501-514 Link Here
501
		if (accessor == null) {
501
		if (accessor == null) {
502
			codeStream.getstatic(lastFieldBinding);
502
			codeStream.getstatic(lastFieldBinding);
503
		} else {
503
		} else {
504
			codeStream.invokestatic(accessor);
504
			codeStream.invokestatic(accessor, null /* default declaringClass */);
505
		}
505
		}
506
	} else {
506
	} else {
507
		codeStream.dup();
507
		codeStream.dup();
508
		if (accessor == null) {
508
		if (accessor == null) {
509
			codeStream.getfield(lastFieldBinding);
509
			codeStream.getfield(lastFieldBinding);
510
		} else {
510
		} else {
511
			codeStream.invokestatic(accessor);
511
			codeStream.invokestatic(accessor, null /* default declaringClass */);
512
		}
512
		}
513
	}
513
	}
514
	TypeBinding requiredGenericCast = getGenericCast(this.otherCodegenBindings == null ? 0 : this.otherCodegenBindings.length);
514
	TypeBinding requiredGenericCast = getGenericCast(this.otherCodegenBindings == null ? 0 : this.otherCodegenBindings.length);
Lines 628-634 Link Here
628
								codeStream.getfield(lastFieldBinding);
628
								codeStream.getfield(lastFieldBinding);
629
							}
629
							}
630
						} else {
630
						} else {
631
							codeStream.invokestatic(accessor);
631
							codeStream.invokestatic(accessor, null /* default declaringClass */);
632
						}
632
						}
633
						if (lastGenericCast != null) codeStream.checkcast(lastGenericCast);
633
						if (lastGenericCast != null) codeStream.checkcast(lastGenericCast);
634
						if (!needValue) codeStream.pop();
634
						if (!needValue) codeStream.pop();
Lines 641-647 Link Here
641
									if (accessor == null) {
641
									if (accessor == null) {
642
										codeStream.getstatic(lastFieldBinding);
642
										codeStream.getstatic(lastFieldBinding);
643
									} else {
643
									} else {
644
										codeStream.invokestatic(accessor);
644
										codeStream.invokestatic(accessor, null /* default declaringClass */);
645
									}
645
									}
646
									codeStream.pop();
646
									codeStream.pop();
647
								}
647
								}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java (-2 / +2 lines)
Lines 148-156 Link Here
148
					i++) {
148
					i++) {
149
					codeStream.aconst_null();
149
					codeStream.aconst_null();
150
				}
150
				}
151
				codeStream.invokespecial(this.syntheticAccessor);
151
				codeStream.invokespecial(this.syntheticAccessor, null /* default declaringClass */);
152
			} else {
152
			} else {
153
				codeStream.invokespecial(this.codegenBinding);
153
				codeStream.invokespecial(this.codegenBinding, null /* default declaringClass */);
154
			}
154
			}
155
			codeStream.recordPositionsFrom(pc, this.sourceStart);
155
			codeStream.recordPositionsFrom(pc, this.sourceStart);
156
		} finally {
156
		} finally {
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java (-1 / +1 lines)
Lines 83-89 Link Here
83
	}
83
	}
84
84
85
	// generate the invoke virtual to "setResult(Object,Class)"
85
	// generate the invoke virtual to "setResult(Object,Class)"
86
	codeStream.invokevirtual(this.setResultMethod);
86
	codeStream.invokevirtual(this.setResultMethod, null /* default declaringClass */);
87
}
87
}
88
/**
88
/**
89
 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
89
 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java (-9 / +27 lines)
Lines 32-38 Link Here
32
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
32
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
33
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
33
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
34
34
35
public class CodeSnippetMessageSend extends MessageSend implements ProblemReasons, EvaluationConstants {
35
public class CodeSnippetMessageSend extends MessageSend {
36
	EvaluationContext evaluationContext;
36
	EvaluationContext evaluationContext;
37
	FieldBinding delegateThis;
37
	FieldBinding delegateThis;
38
/**
38
/**
Lines 79-93 Link Here
79
		generateArguments(this.binding, this.arguments, currentScope, codeStream);
79
		generateArguments(this.binding, this.arguments, currentScope, codeStream);
80
		// actual message invocation
80
		// actual message invocation
81
		if (isStatic) {
81
		if (isStatic) {
82
			codeStream.invokestatic(this.codegenBinding);
82
			codeStream.invokestatic(this.codegenBinding, null /* default declaringClass */);
83
		} else {
83
		} else {
84
			if (this.receiver.isSuper()) {
84
			// constantpool declaringClass
85
				codeStream.invokespecial(this.codegenBinding);
85
			TypeBinding constantPoolDeclaringClass = this.codegenBinding.declaringClass;
86
			// if the binding declaring class is not visible, need special action
87
			// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
88
			// NOTE: from target 1.2 on, method's declaring class is touched if any different from receiver type
89
			// and not from Object or implicit static method call.
90
			if (constantPoolDeclaringClass != this.actualReceiverType && this.receiverGenericCast == null && !this.actualReceiverType.isArrayType()) {
91
				CompilerOptions options = currentScope.compilerOptions();
92
				if ((options.targetJDK >= ClassFileConstants.JDK1_2
93
						&& (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(this.receiver.isImplicitThis() && this.codegenBinding.isStatic()))
94
						&& this.binding.declaringClass.id != TypeIds.T_JavaLangObject) // no change for Object methods
95
					|| !this.binding.declaringClass.canBeSeenBy(currentScope)) {
96
97
					constantPoolDeclaringClass = this.actualReceiverType.erasure();
98
				}
99
				// Post 1.4.0 target, array clone() invocations are qualified with array type
100
				// This is handled in array type #clone method binding resolution (see Scope and UpdatedMethodBinding)
101
			}				
102
			if( (this.receiver.isSuper()) || this.codegenBinding.isPrivate()){
103
				codeStream.invokespecial(this.codegenBinding, constantPoolDeclaringClass);
86
			} else {
104
			} else {
87
				if (this.codegenBinding.declaringClass.isInterface()) {
105
				if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
88
					codeStream.invokeinterface(this.codegenBinding);
106
					codeStream.invokeinterface(this.codegenBinding, constantPoolDeclaringClass);
89
				} else {
107
				} else {
90
					codeStream.invokevirtual(this.codegenBinding);
108
					codeStream.invokevirtual(this.codegenBinding, constantPoolDeclaringClass);
91
				}
109
				}
92
			}
110
			}
93
		}
111
		}
Lines 273-281 Link Here
273
			: scope.getMethod(this.actualReceiverType, this.selector, argumentTypes, this);
291
			: scope.getMethod(this.actualReceiverType, this.selector, argumentTypes, this);
274
	if (!this.binding.isValidBinding()) {
292
	if (!this.binding.isValidBinding()) {
275
		if (this.binding instanceof ProblemMethodBinding
293
		if (this.binding instanceof ProblemMethodBinding
276
			&& ((ProblemMethodBinding) this.binding).problemId() == NotVisible) {
294
			&& ((ProblemMethodBinding) this.binding).problemId() == ProblemReasons.NotVisible) {
277
			if (this.evaluationContext.declaringTypeName != null) {
295
			if (this.evaluationContext.declaringTypeName != null) {
278
				this.delegateThis = scope.getField(scope.enclosingSourceType(), DELEGATE_THIS, this);
296
				this.delegateThis = scope.getField(scope.enclosingSourceType(), EvaluationConstants.DELEGATE_THIS, this);
279
				if (this.delegateThis == null){ // if not found then internal error, field should have been found
297
				if (this.delegateThis == null){ // if not found then internal error, field should have been found
280
					this.constant = Constant.NotAConstant;
298
					this.constant = Constant.NotAConstant;
281
					scope.problemReporter().invalidMethod(this, this.binding);
299
					scope.problemReporter().invalidMethod(this, this.binding);
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java (-1 / +1 lines)
Lines 73-79 Link Here
73
				this);
73
				this);
74
		}
74
		}
75
		// invoke constructor
75
		// invoke constructor
76
		codeStream.invokespecial(this.codegenBinding);
76
		codeStream.invokespecial(this.codegenBinding, null /* default declaringClass */);
77
	} else {
77
	} else {
78
		// private emulation using reflect
78
		// private emulation using reflect
79
		codeStream.generateEmulationForConstructor(currentScope, this.codegenBinding);
79
		codeStream.generateEmulationForConstructor(currentScope, this.codegenBinding);
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java (-2 / +2 lines)
Lines 222-235 Link Here
222
			if (accessor == null) {
222
			if (accessor == null) {
223
				codeStream.getstatic(lastFieldBinding);
223
				codeStream.getstatic(lastFieldBinding);
224
			} else {
224
			} else {
225
				codeStream.invokestatic(accessor);
225
				codeStream.invokestatic(accessor, null /* default declaringClass */);
226
			}
226
			}
227
		} else {
227
		} else {
228
			codeStream.dup();
228
			codeStream.dup();
229
			if (accessor == null) {
229
			if (accessor == null) {
230
				codeStream.getfield(lastFieldBinding);
230
				codeStream.getfield(lastFieldBinding);
231
			} else {
231
			} else {
232
				codeStream.invokestatic(accessor);
232
				codeStream.invokestatic(accessor, null /* default declaringClass */);
233
			}
233
			}
234
		}
234
		}
235
235
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java (-3 / +3 lines)
Lines 271-277 Link Here
271
		if (!((ReferenceBinding)leafType).canBeSeenBy(this)) {
271
		if (!((ReferenceBinding)leafType).canBeSeenBy(this)) {
272
			return new ProblemFieldBinding((ReferenceBinding)leafType, fieldName, ProblemReasons.ReceiverTypeNotVisible);
272
			return new ProblemFieldBinding((ReferenceBinding)leafType, fieldName, ProblemReasons.ReceiverTypeNotVisible);
273
		}
273
		}
274
		if (CharOperation.equals(fieldName, LENGTH))
274
		if (CharOperation.equals(fieldName, TypeConstants.LENGTH))
275
			return ArrayBinding.ArrayLength;
275
			return ArrayBinding.ArrayLength;
276
		return null;
276
		return null;
277
	}
277
	}
Lines 371-378 Link Here
371
	MethodBinding methodBinding = object.getExactMethod(selector, argumentTypes, null);
371
	MethodBinding methodBinding = object.getExactMethod(selector, argumentTypes, null);
372
	if (methodBinding != null) {
372
	if (methodBinding != null) {
373
		// handle the method clone() specially... cannot be protected or throw exceptions
373
		// handle the method clone() specially... cannot be protected or throw exceptions
374
		if (argumentTypes == Binding.NO_PARAMETERS && CharOperation.equals(selector, CLONE))
374
		if (argumentTypes == Binding.NO_PARAMETERS && CharOperation.equals(selector, TypeConstants.CLONE))
375
			return new MethodBinding((methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic, CLONE, methodBinding.returnType, argumentTypes, null, object);
375
			return new MethodBinding((methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic, TypeConstants.CLONE, methodBinding.returnType, argumentTypes, null, object);
376
		if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
376
		if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
377
			return methodBinding;
377
			return methodBinding;
378
	}
378
	}

Return to bug 247292