### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java,v retrieving revision 1.104 diff -u -r1.104 ParameterizedTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 16 May 2008 15:11:14 -0000 1.104 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 23 May 2008 17:13:42 -0000 @@ -830,11 +830,11 @@ return this; this.tagBits &= ~TagBits.HasUnresolvedTypeVariables; // can be recursive so only want to call once - ReferenceBinding resolvedType = BinaryTypeBinding.resolveType(this.type, this.environment, false); // still part of parameterized type ref + ReferenceBinding resolvedType = (ReferenceBinding) BinaryTypeBinding.resolveType(this.type, this.environment, false /* no raw conversion */); // still part of parameterized type ref if (this.arguments != null) { int argLength = this.arguments.length; for (int i = 0; i < argLength; i++) - this.arguments[i] = BinaryTypeBinding.resolveType(this.arguments[i], this.environment, null, 0); + this.arguments[i] = BinaryTypeBinding.resolveType(this.arguments[i], this.environment, true /* raw conversion */); // arity check TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables(); if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic Index: compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java,v retrieving revision 1.3 diff -u -r1.3 UnresolvedAnnotationBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java 6 Sep 2006 04:58:45 -0000 1.3 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java 23 May 2008 17:13:42 -0000 @@ -21,7 +21,7 @@ public ReferenceBinding getAnnotationType() { if (this.typeUnresolved) { // the type is resolved when requested - this.type = BinaryTypeBinding.resolveType(this.type, this.env, false); + this.type = (ReferenceBinding) BinaryTypeBinding.resolveType(this.type, this.env, false /* no raw conversion for now */); // annotation type are never parameterized this.typeUnresolved = false; } Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java,v retrieving revision 1.65 diff -u -r1.65 TypeVariableBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 12 Oct 2007 13:37:16 -0000 1.65 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 23 May 2008 17:13:42 -0000 @@ -373,13 +373,13 @@ TypeBinding oldSuperclass = this.superclass, oldFirstInterface = null; if (this.superclass != null) - this.superclass = BinaryTypeBinding.resolveType(this.superclass, environment, true); + this.superclass = (ReferenceBinding) BinaryTypeBinding.resolveType(this.superclass, environment, true /* raw conversion */); ReferenceBinding[] interfaces = this.superInterfaces; int length; if ((length = interfaces.length) != 0) { oldFirstInterface = interfaces[0]; for (int i = length; --i >= 0;) { - interfaces[i] = BinaryTypeBinding.resolveType(interfaces[i], environment, true); + interfaces[i] = (ReferenceBinding) BinaryTypeBinding.resolveType(interfaces[i], environment, true /* raw conversion */); } } // refresh the firstBound in case it changed Index: compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java,v retrieving revision 1.95 diff -u -r1.95 LookupEnvironment.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 11 Apr 2008 19:42:41 -0000 1.95 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 23 May 2008 17:13:42 -0000 @@ -1092,7 +1092,7 @@ if (referenceBinding == null || referenceBinding == TheNotFoundType) return null; - referenceBinding = BinaryTypeBinding.resolveType(referenceBinding, this, false); // no raw conversion for now + referenceBinding = (ReferenceBinding) BinaryTypeBinding.resolveType(referenceBinding, this, false /* no raw conversion for now */); // compoundName refers to a nested type incorrectly (for example, package1.A$B) if (referenceBinding.isNestedType()) @@ -1261,7 +1261,7 @@ ReferenceBinding actualType = (ReferenceBinding) type; if (actualType instanceof UnresolvedReferenceBinding) if (CharOperation.indexOf('$', actualType.compoundName[actualType.compoundName.length - 1]) > 0) - actualType = BinaryTypeBinding.resolveType(actualType, this, false); // must resolve member types before asking for enclosingType + actualType = (ReferenceBinding) BinaryTypeBinding.resolveType(actualType, this, false /* no raw conversion */); // must resolve member types before asking for enclosingType ReferenceBinding actualEnclosing = actualType.enclosingType(); if (actualEnclosing != null) { // convert needed if read some static member type actualEnclosing = (ReferenceBinding) convertToRawType(actualEnclosing, false /*do not force conversion of enclosing types*/); 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.110 diff -u -r1.110 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 22 Feb 2008 09:49:37 -0000 1.110 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 23 May 2008 17:13:41 -0000 @@ -55,14 +55,14 @@ if (typeFromSignature.isBaseType()) { return typeFromSignature; } - return resolveType((ReferenceBinding) typeFromSignature, env, false); + return resolveType(typeFromSignature, env, false /* no raw conversion */); } if (binaryValue instanceof IBinaryAnnotation) return createAnnotation((IBinaryAnnotation) binaryValue, env, missingTypeNames); if (binaryValue instanceof EnumConstantSignature) { EnumConstantSignature ref = (EnumConstantSignature) binaryValue; ReferenceBinding enumType = (ReferenceBinding) env.getTypeFromSignature(ref.getTypeName(), 0, -1, false, null, missingTypeNames); - enumType = resolveType(enumType, env, false); + enumType = (ReferenceBinding) resolveType(enumType, env, false /* no raw conversion */); return enumType.getField(ref.getEnumConstantName(), false); } if (binaryValue instanceof Object[]) { @@ -78,6 +78,7 @@ // should never reach here. throw new IllegalStateException(); } + static AnnotationBinding createAnnotation(IBinaryAnnotation annotationInfo, LookupEnvironment env, char[][][] missingTypeNames) { IBinaryElementValuePair[] binaryPairs = annotationInfo.getElementValuePairs(); int length = binaryPairs == null ? 0 : binaryPairs.length; @@ -89,6 +90,7 @@ ReferenceBinding annotationType = env.getTypeFromConstantPoolName(typeName, 1, typeName.length - 1, false, missingTypeNames); return new UnresolvedAnnotationBinding(annotationType, pairs, env); } + public static AnnotationBinding[] createAnnotations(IBinaryAnnotation[] annotationInfos, LookupEnvironment env, char[][][] missingTypeNames) { int length = annotationInfos == null ? 0 : annotationInfos.length; AnnotationBinding[] result = length == 0 ? Binding.NO_ANNOTATIONS : new AnnotationBinding[length]; @@ -96,32 +98,19 @@ result[i] = createAnnotation(annotationInfos[i], env, missingTypeNames); return result; } -public static ReferenceBinding resolveType(ReferenceBinding type, LookupEnvironment environment, boolean convertGenericToRawType) { - if (type instanceof UnresolvedReferenceBinding) - return ((UnresolvedReferenceBinding) type).resolve(environment, convertGenericToRawType); - switch (type.kind()) { - case Binding.PARAMETERIZED_TYPE : - return ((ParameterizedTypeBinding) type).resolve(); - case Binding.WILDCARD_TYPE : - case Binding.INTERSECTION_TYPE : - return ((WildcardBinding) type).resolve(); - } - if (convertGenericToRawType) // raw reference to generic ? - return (ReferenceBinding) environment.convertUnresolvedBinaryToRawType(type); - return type; -} -public static TypeBinding resolveType(TypeBinding type, LookupEnvironment environment, ParameterizedTypeBinding parameterizedType, int rank) { + +public static TypeBinding resolveType(TypeBinding type, LookupEnvironment environment, boolean convertGenericToRawType) { switch (type.kind()) { - case Binding.PARAMETERIZED_TYPE : - return ((ParameterizedTypeBinding) type).resolve(); - + ((ParameterizedTypeBinding) type).resolve(); + break; + case Binding.WILDCARD_TYPE : case Binding.INTERSECTION_TYPE : return ((WildcardBinding) type).resolve(); case Binding.ARRAY_TYPE : - resolveType(((ArrayBinding) type).leafComponentType, environment, parameterizedType, rank); + resolveType(((ArrayBinding) type).leafComponentType, environment, convertGenericToRawType); break; case Binding.TYPE_PARAMETER : @@ -129,13 +118,16 @@ break; case Binding.GENERIC_TYPE : - if (parameterizedType == null) // raw reference to generic ? + if (convertGenericToRawType) // raw reference to generic ? return environment.convertUnresolvedBinaryToRawType(type); break; - - default: + + default: if (type instanceof UnresolvedReferenceBinding) - return ((UnresolvedReferenceBinding) type).resolve(environment, parameterizedType == null); + return ((UnresolvedReferenceBinding) type).resolve(environment, convertGenericToRawType); + if (convertGenericToRawType) // raw reference to generic ? + return environment.convertUnresolvedBinaryToRawType(type); + break; } return type; } @@ -251,6 +243,7 @@ System.arraycopy(availableMethods, 0, availableMethods = new MethodBinding[count], 0, count); return availableMethods; } + void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) { // default initialization for super-interfaces early, in case some aborting compilation error occurs, // and still want to use binaries passed that point (e.g. type hierarchy resolver, see bug 63748). @@ -338,6 +331,7 @@ if (this.environment.globalOptions.storeAnnotations) setAnnotations(createAnnotations(binaryType.getAnnotations(), this.environment, missingTypeNames)); } + private void createFields(IBinaryField[] iFields, long sourceLevel, char[][][] missingTypeNames) { this.fields = Binding.NO_FIELDS; if (iFields != null) { @@ -387,6 +381,7 @@ } } } + private MethodBinding createMethod(IBinaryMethod method, long sourceLevel, char[][][] missingTypeNames) { int methodModifiers = method.getModifiers() | ExtraCompilerModifiers.AccUnresolved; if (sourceLevel < ClassFileConstants.JDK1_5) @@ -523,6 +518,7 @@ typeVars[i].declaringElement = result; return result; } + /** * Create method bindings for binary type, filtering out and synthetics */ @@ -582,6 +578,7 @@ } } } + private TypeVariableBinding[] createTypeVariables(SignatureWrapper wrapper, boolean assignVariables, char[][][] missingTypeNames) { // detect all type variables first char[] typeSignature = wrapper.signature; @@ -626,6 +623,7 @@ } return result; } + /* Answer the receiver's enclosing type... null if the receiver is a top level type. * * NOTE: enclosingType of a binary type is resolved when needed @@ -635,7 +633,7 @@ return this.enclosingType; // finish resolving the type - this.enclosingType = resolveType(this.enclosingType, this.environment, false); + this.enclosingType = (ReferenceBinding) resolveType(this.enclosingType, this.environment, false /* no raw conversion */); this.tagBits &= ~TagBits.HasUnresolvedEnclosingType; return this.enclosingType; } @@ -656,12 +654,14 @@ this.tagBits |= TagBits.AreFieldsComplete; return fields; } + /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature() */ public char[] genericTypeSignature() { return computeGenericTypeSignature(this.typeVariables); } + //NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) { @@ -759,7 +759,7 @@ int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; // enclosing$ if (name.length == (prefixLength + typeName.length)) // enclosing $ typeName if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) // only check trailing portion - return this.memberTypes[i] = resolveType(memberType, this.environment, false); // no raw conversion for now + return this.memberTypes[i] = (ReferenceBinding) resolveType(memberType, this.environment, false /* no raw conversion for now */); } else if (CharOperation.equals(typeName, memberType.sourceName)) { return memberType; } @@ -875,7 +875,7 @@ return this.memberTypes; for (int i = this.memberTypes.length; --i >= 0;) - this.memberTypes[i] = resolveType(this.memberTypes[i], this.environment, false); // no raw conversion for now + this.memberTypes[i] = (ReferenceBinding) resolveType(this.memberTypes[i], this.environment, false /* no raw conversion for now */); this.tagBits &= ~TagBits.HasUnresolvedMemberTypes; return this.memberTypes; } @@ -900,7 +900,7 @@ if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0) return field; - TypeBinding resolvedType = resolveType(field.type, this.environment, null, 0); + TypeBinding resolvedType = resolveType(field.type, this.environment, true /* raw conversion */); field.type = resolvedType; if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) { field.tagBits |= TagBits.HasMissingType; @@ -913,21 +913,21 @@ return method; if (!method.isConstructor()) { - TypeBinding resolvedType = resolveType(method.returnType, this.environment, null, 0); + TypeBinding resolvedType = resolveType(method.returnType, this.environment, true /* raw conversion */); method.returnType = resolvedType; if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) { method.tagBits |= TagBits.HasMissingType; } } for (int i = method.parameters.length; --i >= 0;) { - TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, null, 0); + TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, true /* raw conversion */); method.parameters[i] = resolvedType; if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) { method.tagBits |= TagBits.HasMissingType; } } for (int i = method.thrownExceptions.length; --i >= 0;) { - ReferenceBinding resolvedType = resolveType(method.thrownExceptions[i], this.environment, true); + ReferenceBinding resolvedType = (ReferenceBinding) resolveType(method.thrownExceptions[i], this.environment, true /* raw conversion */); method.thrownExceptions[i] = resolvedType; if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) { method.tagBits |= TagBits.HasMissingType; @@ -959,7 +959,7 @@ return this.superclass; // finish resolving the type - this.superclass = resolveType(this.superclass, this.environment, true); + this.superclass = (ReferenceBinding) resolveType(this.superclass, this.environment, true /* raw conversion */); this.tagBits &= ~TagBits.HasUnresolvedSuperclass; if (this.superclass.problemId() == ProblemReasons.NotFound) this.tagBits |= TagBits.HierarchyHasProblems; // propagate type inconsistency @@ -971,7 +971,7 @@ return this.superInterfaces; for (int i = this.superInterfaces.length; --i >= 0;) { - this.superInterfaces[i] = resolveType(this.superInterfaces[i], this.environment, true); + this.superInterfaces[i] = (ReferenceBinding) resolveType(this.superInterfaces[i], this.environment, true /* raw conversion */); if (this.superInterfaces[i].problemId() == ProblemReasons.NotFound) this.tagBits |= TagBits.HierarchyHasProblems; // propagate type inconsistency } Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java,v retrieving revision 1.94 diff -u -r1.94 MethodVerifier.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 29 Feb 2008 21:17:55 -0000 1.94 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 23 May 2008 17:13:42 -0000 @@ -848,7 +848,7 @@ return Binding.NO_EXCEPTIONS; // safety check for (int i = exceptions.length; --i >= 0;) - exceptions[i] = BinaryTypeBinding.resolveType(exceptions[i], this.environment, true); + exceptions[i] = (ReferenceBinding) BinaryTypeBinding.resolveType(exceptions[i], this.environment, true /* raw conversion */); return exceptions; } Index: compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java,v retrieving revision 1.43 diff -u -r1.43 PackageBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 22 Feb 2008 09:49:37 -0000 1.43 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 23 May 2008 17:13:42 -0000 @@ -122,22 +122,22 @@ */ ReferenceBinding getType(char[] name) { - ReferenceBinding typeBinding = getType0(name); - if (typeBinding == null) { - if ((typeBinding = environment.askForType(this, name)) == null) { + ReferenceBinding referenceBinding = getType0(name); + if (referenceBinding == null) { + if ((referenceBinding = environment.askForType(this, name)) == null) { // not found so remember a problem type binding in the cache for future lookups addNotFoundType(name); return null; } } - if (typeBinding == LookupEnvironment.TheNotFoundType) + if (referenceBinding == LookupEnvironment.TheNotFoundType) return null; - typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now - if (typeBinding.isNestedType()) - return new ProblemReferenceBinding(new char[][]{ name }, typeBinding, ProblemReasons.InternalNameProvided); - return typeBinding; + referenceBinding = (ReferenceBinding) BinaryTypeBinding.resolveType(referenceBinding, environment, false /* no raw conversion for now */); + if (referenceBinding.isNestedType()) + return new ProblemReferenceBinding(new char[][]{ name }, referenceBinding, ProblemReasons.InternalNameProvided); + return referenceBinding; } /* Answer the type named name if it exists in the cache. * Answer theNotFoundType if it could not be resolved the first time @@ -163,23 +163,23 @@ */ public Binding getTypeOrPackage(char[] name) { - ReferenceBinding typeBinding = getType0(name); - if (typeBinding != null && typeBinding != LookupEnvironment.TheNotFoundType) { - typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now - if (typeBinding.isNestedType()) - return new ProblemReferenceBinding(new char[][]{name}, typeBinding, ProblemReasons.InternalNameProvided); - return typeBinding; + ReferenceBinding referenceBinding = getType0(name); + if (referenceBinding != null && referenceBinding != LookupEnvironment.TheNotFoundType) { + referenceBinding = (ReferenceBinding) BinaryTypeBinding.resolveType(referenceBinding, environment, false /* no raw conversion for now */); + if (referenceBinding.isNestedType()) + return new ProblemReferenceBinding(new char[][]{name}, referenceBinding, ProblemReasons.InternalNameProvided); + return referenceBinding; } PackageBinding packageBinding = getPackage0(name); if (packageBinding != null && packageBinding != LookupEnvironment.TheNotFoundPackage) return packageBinding; - if (typeBinding == null) { // have not looked for it before - if ((typeBinding = environment.askForType(this, name)) != null) { - if (typeBinding.isNestedType()) - return new ProblemReferenceBinding(new char[][]{name}, typeBinding, ProblemReasons.InternalNameProvided); - return typeBinding; + if (referenceBinding == null) { // have not looked for it before + if ((referenceBinding = environment.askForType(this, name)) != null) { + if (referenceBinding.isNestedType()) + return new ProblemReferenceBinding(new char[][]{name}, referenceBinding, ProblemReasons.InternalNameProvided); + return referenceBinding; } // Since name could not be found, add a problem binding Index: compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java,v retrieving revision 1.67 diff -u -r1.67 WildcardBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java 27 Feb 2008 11:26:13 -0000 1.67 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java 23 May 2008 17:13:42 -0000 @@ -489,16 +489,16 @@ return this; this.tagBits &= ~TagBits.HasUnresolvedTypeVariables; - BinaryTypeBinding.resolveType(this.genericType, this.environment, null, 0); // do not assign to genericType field, since will return a raw type + BinaryTypeBinding.resolveType(this.genericType, this.environment, false /* no raw conversion */); switch(this.boundKind) { case Wildcard.EXTENDS : - this.bound = BinaryTypeBinding.resolveType(this.bound, this.environment, null, 0); + this.bound = BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */); for (int i = 0, length = this.otherBounds == null ? 0 : this.otherBounds.length; i < length; i++) { - this.otherBounds[i]= BinaryTypeBinding.resolveType(this.bound, this.environment, null, 0); + this.otherBounds[i]= BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */); } break; case Wildcard.SUPER : - this.bound = BinaryTypeBinding.resolveType(this.bound, this.environment, null, 0); + this.bound = BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */); break; case Wildcard.UNBOUND : } Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java,v retrieving revision 1.115 diff -u -r1.115 FieldReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 5 May 2008 18:58:31 -0000 1.115 +++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 23 May 2008 17:13:41 -0000 @@ -341,10 +341,7 @@ public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) { boolean isStatic; - this.receiver.generateCode( - currentScope, - codeStream, - !(isStatic = this.codegenBinding.isStatic())); + this.receiver.generateCode(currentScope, codeStream, !(isStatic = this.codegenBinding.isStatic())); if (isStatic) { if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) { codeStream.getstatic(this.codegenBinding); @@ -359,32 +356,28 @@ codeStream.invokestatic(this.syntheticAccessors[FieldReference.READ]); } } + if (this.genericCast != null) codeStream.checkcast(this.genericCast); + codeStream.generateImplicitConversion(this.implicitConversion); + int operandType = this.implicitConversion & TypeIds.COMPILE_TYPE_MASK; + if (valueRequired) { if (isStatic) { - if ((this.codegenBinding.type == TypeBinding.LONG) - || (this.codegenBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2(); } else { codeStream.dup(); } } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value] - if ((this.codegenBinding.type == TypeBinding.LONG) - || (this.codegenBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2_x1(); } else { codeStream.dup_x1(); } } } - if (this.genericCast != null) - codeStream.checkcast(this.genericCast); - codeStream.generateImplicitConversion(this.implicitConversion); - codeStream.generateConstant( - postIncrement.expression.constant, - this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, this.implicitConversion & TypeIds.COMPILE_TYPE_MASK); - codeStream.generateImplicitConversion( - postIncrement.preAssignImplicitConversion); + codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); + codeStream.sendOperator(postIncrement.operator, operandType); + codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); fieldStore(codeStream, this.codegenBinding, this.syntheticAccessors == null ? null : this.syntheticAccessors[FieldReference.WRITE], false); } Index: compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java,v retrieving revision 1.26 diff -u -r1.26 PostfixExpression.java --- compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java 28 Mar 2006 20:29:57 -0000 1.26 +++ compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java 23 May 2008 17:13:41 -0000 @@ -36,9 +36,6 @@ int pc = codeStream.position; ((Reference) this.lhs).generatePostIncrement(currentScope, codeStream, this, valueRequired); - if (valueRequired) { - codeStream.generateImplicitConversion(this.implicitConversion); - } codeStream.recordPositionsFrom(pc, this.sourceStart); } Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java,v retrieving revision 1.102 diff -u -r1.102 SingleNameReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 5 May 2008 18:58:31 -0000 1.102 +++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 23 May 2008 17:13:41 -0000 @@ -497,8 +497,6 @@ break; case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding; - Constant assignConstant; - int increment; // using incr bytecode if possible switch (localBinding.type.id) { case T_JavaLangString : @@ -509,25 +507,30 @@ codeStream.store(localBinding, false); return; case T_int : + Constant assignConstant; if (((assignConstant = expression.constant) != Constant.NotAConstant) - && (assignConstant.typeID() != TypeIds.T_float) // only for integral types - && (assignConstant.typeID() != TypeIds.T_double) - && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value + && (assignConstant.typeID() != TypeIds.T_float) // only for integral types + && (assignConstant.typeID() != TypeIds.T_double)) {// TODO (philippe) is this test needed ? switch (operator) { case PLUS : + int increment = assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); } return; case MINUS : - codeStream.iinc(localBinding.resolvedPosition, -increment); + increment = -assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value + codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); } return; } } + // fallthrough default : codeStream.load(localBinding); } @@ -604,26 +607,26 @@ codeStream.invokestatic(this.syntheticAccessors[SingleNameReference.READ]); } } + if (this.genericCast != null) codeStream.checkcast(this.genericCast); + codeStream.generateImplicitConversion(this.implicitConversion); + int operandType = this.implicitConversion & TypeIds.COMPILE_TYPE_MASK; if (valueRequired) { if (fieldBinding.isStatic()) { - if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2(); } else { codeStream.dup(); } } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value] - if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2_x1(); } else { codeStream.dup_x1(); } } } - if (this.genericCast != null) - codeStream.checkcast(this.genericCast); - codeStream.generateImplicitConversion(this.implicitConversion); codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, this.implicitConversion & TypeIds.COMPILE_TYPE_MASK); + codeStream.sendOperator(postIncrement.operator, operandType); codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); fieldStore(codeStream, fieldBinding, this.syntheticAccessors == null ? null : this.syntheticAccessors[SingleNameReference.WRITE], false); // no need for generic cast @@ -642,18 +645,18 @@ } } else { codeStream.load(localBinding); + codeStream.generateImplicitConversion(this.implicitConversion); + operandType = this.implicitConversion & TypeIds.COMPILE_TYPE_MASK; if (valueRequired){ - if ((localBinding.type == TypeBinding.LONG) || (localBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2(); } else { codeStream.dup(); } } - codeStream.generateImplicitConversion(this.implicitConversion); codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, this.implicitConversion & TypeIds.COMPILE_TYPE_MASK); + codeStream.sendOperator(postIncrement.operator, operandType); codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); - codeStream.store(localBinding, false); } } Index: compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java,v retrieving revision 1.48 diff -u -r1.48 ArrayReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java 22 Feb 2008 09:49:36 -0000 1.48 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java 23 May 2008 17:13:41 -0000 @@ -139,21 +139,18 @@ this.position.generateCode(currentScope, codeStream, true); codeStream.dup2(); codeStream.arrayAt(this.resolvedType.id); + int operandType = this.implicitConversion & TypeIds.COMPILE_TYPE_MASK; + codeStream.generateImplicitConversion(this.implicitConversion); if (valueRequired) { - if ((this.resolvedType == TypeBinding.LONG) - || (this.resolvedType == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2_x2(); } else { codeStream.dup_x2(); } } - codeStream.generateImplicitConversion(this.implicitConversion); - codeStream.generateConstant( - postIncrement.expression.constant, - this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, this.implicitConversion & TypeIds.COMPILE_TYPE_MASK); - codeStream.generateImplicitConversion( - postIncrement.preAssignImplicitConversion); + codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); + codeStream.sendOperator(postIncrement.operator, operandType); + codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); codeStream.arrayAtPut(this.resolvedType.id, false); } Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java,v retrieving revision 1.124 diff -u -r1.124 QualifiedNameReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java 5 May 2008 18:58:31 -0000 1.124 +++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java 23 May 2008 17:13:41 -0000 @@ -495,12 +495,7 @@ // equivalent to valuesRequired[maxOtherBindings] } -public void generatePostIncrement( - BlockScope currentScope, - CodeStream codeStream, - CompoundAssignment postIncrement, - boolean valueRequired) { - +public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) { FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream); SyntheticMethodBinding accessor = this.syntheticReadAccessors == null @@ -520,34 +515,31 @@ codeStream.invokestatic(accessor); } } + + TypeBinding requiredGenericCast = getGenericCast(this.otherCodegenBindings == null ? 0 : this.otherCodegenBindings.length); + if (requiredGenericCast != null) codeStream.checkcast(requiredGenericCast); + codeStream.generateImplicitConversion(this.implicitConversion); + // duplicate the old field value + int operandType = this.implicitConversion & TypeIds.COMPILE_TYPE_MASK; if (valueRequired) { if (lastFieldBinding.isStatic()) { - if ((lastFieldBinding.type == TypeBinding.LONG) - || (lastFieldBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2(); } else { codeStream.dup(); } } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value] - if ((lastFieldBinding.type == TypeBinding.LONG) - || (lastFieldBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2_x1(); } else { codeStream.dup_x1(); } } } - TypeBinding requiredGenericCast = getGenericCast(this.otherCodegenBindings == null ? 0 : this.otherCodegenBindings.length); - if (requiredGenericCast != null) codeStream.checkcast(requiredGenericCast); - - codeStream.generateImplicitConversion(this.implicitConversion); - codeStream.generateConstant( - postIncrement.expression.constant, - this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, this.implicitConversion & TypeIds.COMPILE_TYPE_MASK); - codeStream.generateImplicitConversion( - postIncrement.preAssignImplicitConversion); + codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); + codeStream.sendOperator(postIncrement.operator, operandType); + codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); fieldStore(codeStream, lastFieldBinding, this.syntheticWriteAccessor, false); } Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java,v retrieving revision 1.41 diff -u -r1.41 CodeSnippetFieldReference.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java 23 Oct 2006 17:04:36 -0000 1.41 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java 23 May 2008 17:13:42 -0000 @@ -209,32 +209,7 @@ public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) { boolean isStatic; if (this.codegenBinding.canBeSeenBy(this.receiverType, this, currentScope)) { - this.receiver.generateCode(currentScope, codeStream, !(isStatic = this.codegenBinding.isStatic())); - if (isStatic) { - codeStream.getstatic(this.codegenBinding); - } else { - codeStream.dup(); - codeStream.getfield(this.codegenBinding); - } - if (valueRequired) { - if (isStatic) { - if ((this.codegenBinding.type == TypeBinding.LONG) || (this.codegenBinding.type == TypeBinding.DOUBLE)) { - codeStream.dup2(); - } else { - codeStream.dup(); - } - } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value] - if ((this.codegenBinding.type == TypeBinding.LONG) || (this.codegenBinding.type == TypeBinding.DOUBLE)) { - codeStream.dup2_x1(); - } else { - codeStream.dup_x1(); - } - } - } - codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, this.codegenBinding.type.id); - codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); - fieldStore(codeStream, this.codegenBinding, null, false); + super.generatePostIncrement(currentScope, codeStream, postIncrement, valueRequired); } else { this.receiver.generateCode(currentScope, codeStream, !(isStatic = this.codegenBinding.isStatic())); if (isStatic) { Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java,v retrieving revision 1.50 diff -u -r1.50 CodeSnippetSingleNameReference.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 16 Apr 2008 11:55:01 -0000 1.50 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 23 May 2008 17:13:43 -0000 @@ -23,17 +23,6 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.lookup.BlockScope; -import org.eclipse.jdt.internal.compiler.lookup.ClassScope; -import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; -import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; -import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; -import org.eclipse.jdt.internal.compiler.lookup.ProblemBinding; -import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; -import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; -import org.eclipse.jdt.internal.compiler.lookup.Scope; -import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; -import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; /** * A single name reference inside a code snippet can denote a field of a remote @@ -335,8 +324,6 @@ break; case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding; - Constant assignConstant; - int increment; // using incr bytecode if possible switch (localBinding.type.id) { case T_JavaLangString : @@ -347,25 +334,30 @@ codeStream.store(localBinding, false); return; case T_int : + Constant assignConstant; if (((assignConstant = expression.constant) != Constant.NotAConstant) - && (assignConstant.typeID() != T_float) // only for integral types - && (assignConstant.typeID() != T_double) - && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value + && (assignConstant.typeID() != TypeIds.T_float) // only for integral types + && (assignConstant.typeID() != TypeIds.T_double)) { // TODO (philippe) is this test needed ? switch (operator) { case PLUS : + int increment = assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); } return; case MINUS : - codeStream.iinc(localBinding.resolvedPosition, -increment); + increment = -assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value + codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); } return; } } + // fallthrough default : codeStream.load(localBinding); } @@ -430,38 +422,7 @@ case Binding.FIELD : // assigning to a field FieldBinding fieldBinding = (FieldBinding) this.codegenBinding; if (fieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) { - if (fieldBinding.isStatic()) { - codeStream.getstatic(fieldBinding); - } else { - if ((this.bits & DepthMASK) != 0) { - ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT); - Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/); - codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope); - } else { - generateReceiver(codeStream); - } - codeStream.dup(); - codeStream.getfield(fieldBinding); - } - if (valueRequired) { - if (fieldBinding.isStatic()) { - if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) { - codeStream.dup2(); - } else { - codeStream.dup(); - } - } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value] - if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) { - codeStream.dup2_x1(); - } else { - codeStream.dup_x1(); - } - } - } - codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, fieldBinding.type.id); - codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); - fieldStore(codeStream, fieldBinding, null, false); + super.generatePostIncrement(currentScope, codeStream, postIncrement, valueRequired); } else { if (fieldBinding.isStatic()) { codeStream.aconst_null(); @@ -511,32 +472,7 @@ } return; case Binding.LOCAL : // assigning to a local variable - LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding; - // using incr bytecode if possible - if (localBinding.type == TypeBinding.INT) { - if (valueRequired) { - codeStream.load(localBinding); - } - if (postIncrement.operator == PLUS) { - codeStream.iinc(localBinding.resolvedPosition, 1); - } else { - codeStream.iinc(localBinding.resolvedPosition, -1); - } - } else { - codeStream.load(localBinding); - if (valueRequired){ - if ((localBinding.type == TypeBinding.LONG) || (localBinding.type == TypeBinding.DOUBLE)) { - codeStream.dup2(); - } else { - codeStream.dup(); - } - } - codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, localBinding.type.id); - codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); - - codeStream.store(localBinding, false); - } + super.generatePostIncrement(currentScope, codeStream, postIncrement, valueRequired); } } public void generateReceiver(CodeStream codeStream) { Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java,v retrieving revision 1.53 diff -u -r1.53 CodeSnippetQualifiedNameReference.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java 16 Apr 2008 11:54:39 -0000 1.53 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java 23 May 2008 17:13:42 -0000 @@ -30,7 +30,9 @@ import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticMethodBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; public class CodeSnippetQualifiedNameReference extends QualifiedNameReference implements EvaluationConstants, ProblemReasons { @@ -212,22 +214,40 @@ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream); if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) { - if (lastFieldBinding.isStatic()){ - codeStream.getstatic(lastFieldBinding); + SyntheticMethodBinding accessor = + this.syntheticReadAccessors == null + ? null + : this.syntheticReadAccessors[this.syntheticReadAccessors.length - 1]; + if (lastFieldBinding.isStatic()) { + if (accessor == null) { + codeStream.getstatic(lastFieldBinding); + } else { + codeStream.invokestatic(accessor); + } } else { codeStream.dup(); - codeStream.getfield(lastFieldBinding); - } + if (accessor == null) { + codeStream.getfield(lastFieldBinding); + } else { + codeStream.invokestatic(accessor); + } + } + + TypeBinding requiredGenericCast = getGenericCast(this.otherCodegenBindings == null ? 0 : this.otherCodegenBindings.length); + if (requiredGenericCast != null) codeStream.checkcast(requiredGenericCast); + codeStream.generateImplicitConversion(this.implicitConversion); + // duplicate the old field value + int operandType = this.implicitConversion & TypeIds.COMPILE_TYPE_MASK; if (valueRequired) { if (lastFieldBinding.isStatic()) { - if ((lastFieldBinding.type == TypeBinding.LONG) || (lastFieldBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2(); } else { codeStream.dup(); } } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value] - if ((lastFieldBinding.type == TypeBinding.LONG) || (lastFieldBinding.type == TypeBinding.DOUBLE)) { + if (operandType == T_long || operandType == T_double) { codeStream.dup2_x1(); } else { codeStream.dup_x1(); @@ -235,10 +255,9 @@ } } codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion); - codeStream.sendOperator(postIncrement.operator, lastFieldBinding.type.id); + codeStream.sendOperator(postIncrement.operator, operandType); codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion); - - fieldStore(codeStream, lastFieldBinding, null, false); + fieldStore(codeStream, lastFieldBinding, this.syntheticWriteAccessor, false); } else { codeStream.generateEmulatedReadAccessForField(lastFieldBinding); if (valueRequired) { Index: codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java,v retrieving revision 1.4 diff -u -r1.4 InternalExtendedCompletionContext.java --- codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java 12 May 2008 15:25:57 -0000 1.4 +++ codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java 23 May 2008 17:13:41 -0000 @@ -316,7 +316,7 @@ SignatureWrapper wrapper = new SignatureWrapper(replacePackagesDot(typeSignature.toCharArray())); assignableTypeBinding = lookupEnvironment.getTypeFromTypeSignature(wrapper, typeVariables, this.assistScope.enclosingClassScope().referenceContext.binding, null); if (assignableTypeBinding instanceof ReferenceBinding) { - assignableTypeBinding = BinaryTypeBinding.resolveType((ReferenceBinding)assignableTypeBinding, lookupEnvironment, true); + assignableTypeBinding = BinaryTypeBinding.resolveType(assignableTypeBinding, lookupEnvironment, true); } } catch (AbortCompilation e) { assignableTypeBinding = null; #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/NumericTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NumericTest.java,v retrieving revision 1.7 diff -u -r1.7 NumericTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/NumericTest.java 29 Mar 2006 19:12:47 -0000 1.7 +++ src/org/eclipse/jdt/core/tests/compiler/regression/NumericTest.java 23 May 2008 17:13:45 -0000 @@ -89,6 +89,55 @@ "The literal 9223372036854775808L of type long is out of range \n" + "----------\n"); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232814 +public void test005() { + this.runConformTest(new String[] { + "X.java", + "public class X {\n" + + " public static void main(String[] args) {\n" + + " int result;\n" + + " if (130 != (result = testShort1())) System.out.println(\"failed-testShort1():\" + result);\n" + + " if (130 != (result = testShort2())) System.out.println(\"failed-testShort2():\" + result);\n" + + " if (130 != (result = testInt1())) System.out.println(\"failed-testInt1():\" + result);\n" + + " if (130 != (result = testInt2())) System.out.println(\"failed-testInt2():\" + result);\n" + + " if (30 != (result = testByte1())) System.out.println(\"failed-testByte1():\" + result);\n" + + " if (30 != (result = testByte2())) System.out.println(\"failed-testByte2():\" + result);\n" + + " System.out.println(\"done\");\n" + + " }\n" + + " static int testShort1() {\n" + + " short min = Short.MIN_VALUE;\n" + + " int num = -32638;\n" + + " return num = num - min;\n" + + " }\n" + + " static int testShort2() {\n" + + " final short min = Short.MIN_VALUE;\n" + + " int num = -32638;\n" + + " return num = num - min;\n" + + " }\n" + + " static int testInt1() {\n" + + " int min = Short.MIN_VALUE;\n" + + " int num = -32638;\n" + + " return num = num - min;\n" + + " }\n" + + " static int testInt2() {\n" + + " final int min = Short.MIN_VALUE;\n" + + " int num = -32638;\n" + + " return num = num - min;\n" + + " } \n" + + " static int testByte1() {\n" + + " byte min = Byte.MIN_VALUE;\n" + + " int num = -98;\n" + + " return num = num - min;\n" + + " }\n" + + " static int testByte2() {\n" + + " final byte min = Byte.MIN_VALUE;\n" + + " int num = -98;\n" + + " return num = num - min;\n" + + " } \n" + + "}\n", + }, + "done"); +} public static Class testClass() { return NumericTest.class; } Index: src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java,v retrieving revision 1.110 diff -u -r1.110 AutoBoxingTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java 10 Apr 2008 11:03:52 -0000 1.110 +++ src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java 23 May 2008 17:13:45 -0000 @@ -4495,5 +4495,69 @@ "Unnecessary cast from null to X\n" + "----------\n"); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 +public void test154() { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " T counter;\n" + + " public static void main(String[] args) {\n" + + " bar(new X());\n" + + " new Y().foo();\n" + + " new Y().baz();\n" + + " }\n" + + " static void bar(X x) {\n" + + " x.counter = 0;\n" + + " System.out.print(Integer.toString(x.counter++));\n" + + " }\n" + + "}\n" + + "\n" + + "class Y extends X {\n" + + " Y() {\n" + + " this.counter = 0;\n" + + " }\n" + + " void foo() {\n" + + " System.out.print(Integer.toString(counter++));\n" + + " }\n" + + " void baz() {\n" + + " System.out.println(Integer.toString(this.counter++));\n" + + " }\n" + + "}\n", + }, + "000"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation +public void test155() { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " T[] counter;\n" + + " public static void main(String[] args) {\n" + + " bar(new X());\n" + + " new Y().foo();\n" + + " new Y().baz();\n" + + " }\n" + + " static void bar(X x) {\n" + + " x.counter = new Integer[]{ 0 };\n" + + " System.out.print(Integer.toString(x.counter[0]++));\n" + + " }\n" + + "}\n" + + "\n" + + "class Y extends X {\n" + + " Y() {\n" + + " this.counter = new Integer[]{ 0 };\n" + + " }\n" + + " void foo() {\n" + + " System.out.print(Integer.toString(counter[0]++));\n" + + " }\n" + + " void baz() {\n" + + " System.out.println(Integer.toString(this.counter[0]++));\n" + + " }\n" + + "}\n", + }, + "000"); +} }