diff options
17 files changed, 23 insertions, 16 deletions
diff --git a/org.eclipse.jdt.apt.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.apt.core/.settings/org.eclipse.jdt.core.prefs index 410a7830bb..cbe958e3e5 100644 --- a/org.eclipse.jdt.apt.core/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jdt.apt.core/.settings/org.eclipse.jdt.core.prefs @@ -76,3 +76,4 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=enabled diff --git a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/type/ArrayTypeImpl.java b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/type/ArrayTypeImpl.java index cb4798a37e..5b861d8907 100644 --- a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/type/ArrayTypeImpl.java +++ b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/type/ArrayTypeImpl.java @@ -73,7 +73,7 @@ public class ArrayTypeImpl implements ArrayType, EclipseMirrorType public boolean equals(Object obj) { if( obj instanceof ArrayTypeImpl ) - return _arrayBinding == ((ArrayTypeImpl)obj)._arrayBinding; + return _arrayBinding == ((ArrayTypeImpl)obj)._arrayBinding; //$IDENTITY-COMPARISON$ return false; } diff --git a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/util/TypesUtil.java b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/util/TypesUtil.java index 32300984e3..65b227faad 100644 --- a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/util/TypesUtil.java +++ b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/util/TypesUtil.java @@ -186,7 +186,7 @@ public class TypesUtil implements Types binding = impl.getTypeBinding(); } final ITypeBinding erasure = binding.getErasure(); - if( erasure == binding ) return t; + if (erasure == binding) return t; //$IDENTITY-COMPARISON$ TypeMirror m_erasure = Factory.createTypeMirror(erasure, impl.getEnvironment() ); if( m_erasure == null ) return Factory.createErrorClassType(erasure); diff --git a/org.eclipse.jdt.apt.pluggable.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.apt.pluggable.core/.settings/org.eclipse.jdt.core.prefs index d290812c99..24e7190a48 100644 --- a/org.eclipse.jdt.apt.pluggable.core/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jdt.apt.pluggable.core/.settings/org.eclipse.jdt.core.prefs @@ -16,3 +16,4 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=enabled diff --git a/org.eclipse.jdt.apt.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.apt.ui/.settings/org.eclipse.jdt.core.prefs index 4c0bf01ca9..a5a3e0a341 100644 --- a/org.eclipse.jdt.apt.ui/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jdt.apt.ui/.settings/org.eclipse.jdt.core.prefs @@ -79,3 +79,4 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=enabled diff --git a/org.eclipse.jdt.compiler.apt/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.compiler.apt/.settings/org.eclipse.jdt.core.prefs index 74d2858ada..1b0bf7e0eb 100644 --- a/org.eclipse.jdt.compiler.apt/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jdt.compiler.apt/.settings/org.eclipse.jdt.core.prefs @@ -71,3 +71,4 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=enabled diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java index 6c24fcb6a6..b9703c80c5 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java @@ -174,7 +174,7 @@ public class RoundEnvImpl implements RoundEnvironment } AnnotationBinding[] annos = Factory.getPackedAnnotationBindings(searchedElement.getAnnotations()); for (AnnotationBinding annoBinding : annos) { - if (annoBinding.getAnnotationType() == anno) { + if (annoBinding.getAnnotationType() == anno) { //$IDENTITY-COMPARISON$ // element is annotated with anno return true; } diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationMirrorImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationMirrorImpl.java index cb81de6ec3..94a381d575 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationMirrorImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationMirrorImpl.java @@ -63,7 +63,7 @@ public class AnnotationMirrorImpl implements AnnotationMirror, InvocationHandler } private static boolean equals(AnnotationBinding annotationBinding, AnnotationBinding annotationBinding2) { - if (annotationBinding.getAnnotationType() != annotationBinding2.getAnnotationType()) return false; + if (annotationBinding.getAnnotationType() != annotationBinding2.getAnnotationType()) return false; //$IDENTITY-COMPARISON$ final ElementValuePair[] elementValuePairs = annotationBinding.getElementValuePairs(); final ElementValuePair[] elementValuePairs2 = annotationBinding2.getElementValuePairs(); final int length = elementValuePairs.length; diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java index aac19d8a98..47ef8efe17 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java @@ -794,7 +794,7 @@ public class Factory { if (values == null || values.length != 1) continue; // FUBAR. MethodBinding value = values[0]; - if (value.returnType == null || value.returnType.dimensions() != 1 || value.returnType.leafComponentType() != annotationType) + if (value.returnType == null || value.returnType.dimensions() != 1 || TypeBinding.notEquals(value.returnType.leafComponentType(), annotationType)) continue; // FUBAR // We have a kosher repeatable annotation with a kosher containing type. See if actually repeats. @@ -802,7 +802,7 @@ public class Factory { for (int j = i + 1; j < length; j++) { AnnotationBinding otherAnnotation = repackagedBindings[j]; if (otherAnnotation == null) continue; - if (otherAnnotation.getAnnotationType() == annotationType) { + if (otherAnnotation.getAnnotationType() == annotationType) { //$IDENTITY-COMPARISON$ if (repackagedBindings == annotations) System.arraycopy(repackagedBindings, 0, repackagedBindings = new AnnotationBinding[length], 0, length); repackagedBindings[j] = null; // so it is not double packed. @@ -861,7 +861,7 @@ public class Factory { if (containeeType == null || !containeeType.isAnnotationType() || !containeeType.isRepeatableAnnotationType()) continue; - if (containeeType.containerAnnotationType() != annotationType) + if (containeeType.containerAnnotationType() != annotationType) //$IDENTITY-COMPARISON$ continue; // We have a kosher container: unwrap the contained annotations. diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java index 5d5e9666e1..fae289490e 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java @@ -38,6 +38,7 @@ import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; public class TypeElementImpl extends ElementImpl implements TypeElement { @@ -247,7 +248,7 @@ public class TypeElementImpl extends ElementImpl implements TypeElement { return false; } ReferenceBinding hiderBinding = (ReferenceBinding)_binding; - if (hiddenBinding == hiderBinding) { + if (TypeBinding.equalsEquals(hiddenBinding, hiderBinding)) { return false; } if (!hiddenBinding.isMemberType() || !hiderBinding.isMemberType()) { diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java index 60caffddce..fbea1184db 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java @@ -76,7 +76,7 @@ public class TypeParameterElementImpl extends ElementImpl implements TypeParamet if (firstClassOrArrayBound.isTypeVariable()) { isFirstBoundATypeVariable = true; } - if (firstClassOrArrayBound == varSuperclass) { + if (TypeBinding.equalsEquals(firstClassOrArrayBound, varSuperclass)) { boundsLength++; if (firstClassOrArrayBound.isTypeVariable()) { isFirstBoundATypeVariable = true; diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeVariableImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeVariableImpl.java index 59e45ccd76..2fd4f4fd8c 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeVariableImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeVariableImpl.java @@ -59,7 +59,7 @@ public class TypeVariableImpl extends TypeMirrorImpl implements TypeVariable { // no explicit bound return _env.getFactory().newTypeMirror(typeVariableBinding.upperBound()); } - if (firstBound != null && superInterfaces.length == 1 && superInterfaces[0] == firstBound) { + if (firstBound != null && superInterfaces.length == 1 && TypeBinding.equalsEquals(superInterfaces[0], firstBound)) { // only one bound that is an interface return _env.getFactory().newTypeMirror(typeVariableBinding.upperBound()); } diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java index d974f2dc63..6ac131e162 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java @@ -85,7 +85,7 @@ public class TypesImpl implements Types { case CONSTRUCTOR : case METHOD : MethodBinding methodBinding = (MethodBinding) elementImpl._binding; - if (methodBinding.declaringClass != referenceBinding) { + if (TypeBinding.notEquals(methodBinding.declaringClass, referenceBinding)) { throw new IllegalArgumentException("element is not valid for the containing declared type"); //$NON-NLS-1$ } for (MethodBinding method : referenceBinding.methods()) { @@ -98,7 +98,7 @@ public class TypesImpl implements Types { case FIELD : case ENUM_CONSTANT: FieldBinding fieldBinding = (FieldBinding) elementImpl._binding; - if (fieldBinding.declaringClass != referenceBinding) { + if (TypeBinding.notEquals(fieldBinding.declaringClass, referenceBinding)) { throw new IllegalArgumentException("element is not valid for the containing declared type"); //$NON-NLS-1$ } for (FieldBinding field : referenceBinding.fields()) { @@ -112,7 +112,7 @@ public class TypesImpl implements Types { case INTERFACE : case CLASS : ReferenceBinding referenceBinding2 = (ReferenceBinding) elementImpl._binding; - if (referenceBinding2.enclosingType() != referenceBinding) { + if (TypeBinding.notEquals(referenceBinding2.enclosingType(), referenceBinding)) { throw new IllegalArgumentException("element is not valid for the containing declared type"); //$NON-NLS-1$ } for (ReferenceBinding referenceBinding3 : referenceBinding.memberTypes()) { diff --git a/org.eclipse.jdt.compiler.tool/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.compiler.tool/.settings/org.eclipse.jdt.core.prefs index e5c07bb485..336cd963da 100644 --- a/org.eclipse.jdt.compiler.tool/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jdt.compiler.tool/.settings/org.eclipse.jdt.core.prefs @@ -121,3 +121,4 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=enabled diff --git a/org.eclipse.jdt.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.core/.settings/org.eclipse.jdt.core.prefs index 465e861010..57ab9e338e 100644 --- a/org.eclipse.jdt.core/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jdt.core/.settings/org.eclipse.jdt.core.prefs @@ -353,3 +353,4 @@ org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=enabled diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java index 365d5e7c92..24bb855097 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java @@ -253,7 +253,7 @@ public boolean equals(Object object) { return false; AnnotationBinding that = (AnnotationBinding) object; - if (this.getAnnotationType() != that.getAnnotationType()) + if (this.getAnnotationType() != that.getAnnotationType()) //$IDENTITY-COMPARISON$ return false; final ElementValuePair[] thisElementValuePairs = this.getElementValuePairs(); diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java index 9b732f29a4..140d3e2407 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java @@ -1022,7 +1022,7 @@ class TypeBinding implements ITypeBinding { */ public boolean isAssignmentCompatible(ITypeBinding type) { try { - if (this == type) return true; + if (this == type) return true; //$IDENTITY-COMPARISON$ if (!(type instanceof TypeBinding)) return false; TypeBinding other = (TypeBinding) type; Scope scope = this.resolver.scope(); @@ -1260,7 +1260,7 @@ class TypeBinding implements ITypeBinding { */ public boolean isSubTypeCompatible(ITypeBinding type) { try { - if (this == type) return true; + if (this == type) return true; //$IDENTITY-COMPARISON$ if (this.binding.isBaseType()) return false; if (!(type instanceof TypeBinding)) return false; TypeBinding other = (TypeBinding) type; |