Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 103604 Details for
Bug 115814
[compiler] warning on comparing same to same
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
115814.txt (text/plain), 50.18 KB, created by
Philipe Mulet
on 2008-06-04 13:23:18 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2008-06-04 13:23:18 EDT
Size:
50.18 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java,v >retrieving revision 1.117 >diff -u -r1.117 Expression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 27 May 2008 22:21:13 -0000 1.117 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 4 Jun 2008 17:22:14 -0000 >@@ -749,6 +749,40 @@ > } > } > >+public static Binding getDirectBinding(Expression someExpression) { >+ if ((someExpression.bits & ASTNode.IgnoreNoEffectAssignCheck) != 0) { >+ return null; >+ } >+ if (someExpression instanceof SingleNameReference) { >+ return ((SingleNameReference)someExpression).binding; >+ } else if (someExpression instanceof FieldReference) { >+ FieldReference fieldRef = (FieldReference)someExpression; >+ if (fieldRef.receiver.isThis() && !(fieldRef.receiver instanceof QualifiedThisReference)) { >+ return fieldRef.binding; >+ } >+ } else if (someExpression instanceof Assignment) { >+ Expression lhs = ((Assignment)someExpression).lhs; >+ if ((lhs.bits & ASTNode.IsStrictlyAssigned) != 0) { >+ // i = i = ...; // eq to int i = ...; >+ return getDirectBinding (((Assignment)someExpression).lhs); >+ } else if (someExpression instanceof PrefixExpression) { >+ // i = i++; // eq to ++i; >+ return getDirectBinding (((Assignment)someExpression).lhs); >+ } >+ } else if (someExpression instanceof QualifiedNameReference) { >+ QualifiedNameReference qualifiedNameReference = (QualifiedNameReference) someExpression; >+ if (qualifiedNameReference.indexOfFirstFieldBinding != 1 >+ && qualifiedNameReference.otherBindings == null) { >+ // case where a static field is retrieved using ClassName.fieldname >+ return qualifiedNameReference.binding; >+ } >+ } >+// } else if (someExpression instanceof PostfixExpression) { // recurse for postfix: i++ --> i >+// // note: "b = b++" is equivalent to doing nothing, not to "b++" >+// return getDirectBinding(((PostfixExpression) someExpression).lhs); >+ return null; >+} >+ > public boolean isCompactableOperation() { > return false; > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java,v >retrieving revision 1.82 >diff -u -r1.82 Assignment.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java 27 May 2008 22:21:13 -0000 1.82 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java 4 Jun 2008 17:22:13 -0000 >@@ -98,40 +98,6 @@ > codeStream.recordPositionsFrom(pc, this.sourceStart); > } > >-public static Binding getDirectBinding(Expression someExpression) { >- if ((someExpression.bits & ASTNode.IgnoreNoEffectAssignCheck) != 0) { >- return null; >- } >- if (someExpression instanceof SingleNameReference) { >- return ((SingleNameReference)someExpression).binding; >- } else if (someExpression instanceof FieldReference) { >- FieldReference fieldRef = (FieldReference)someExpression; >- if (fieldRef.receiver.isThis() && !(fieldRef.receiver instanceof QualifiedThisReference)) { >- return fieldRef.binding; >- } >- } else if (someExpression instanceof Assignment) { >- Expression lhs = ((Assignment)someExpression).lhs; >- if ((lhs.bits & ASTNode.IsStrictlyAssigned) != 0) { >- // i = i = ...; // eq to int i = ...; >- return getDirectBinding (((Assignment)someExpression).lhs); >- } else if (someExpression instanceof PrefixExpression) { >- // i = i++; // eq to ++i; >- return getDirectBinding (((Assignment)someExpression).lhs); >- } >- } else if (someExpression instanceof QualifiedNameReference) { >- QualifiedNameReference qualifiedNameReference = (QualifiedNameReference) someExpression; >- if (qualifiedNameReference.indexOfFirstFieldBinding != 1 >- && qualifiedNameReference.otherBindings == null) { >- // case where a static field is retrieved using ClassName.fieldname >- return qualifiedNameReference.binding; >- } >- } >-// } else if (someExpression instanceof PostfixExpression) { // recurse for postfix: i++ --> i >-// // note: "b = b++" is equivalent to doing nothing, not to "b++" >-// return getDirectBinding(((PostfixExpression) someExpression).lhs); >- return null; >-} >- > FieldBinding getLastField(Expression someExpression) { > if (someExpression instanceof SingleNameReference) { > if ((someExpression.bits & RestrictiveFlagMASK) == Binding.FIELD) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java,v >retrieving revision 1.69 >diff -u -r1.69 EqualExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java 19 Jul 2007 14:04:59 -0000 1.69 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java 4 Jun 2008 17:22:14 -0000 >@@ -808,6 +808,12 @@ > CastExpression.checkNeedForArgumentCasts(scope, EQUAL_EQUAL, operatorSignature, left, leftType.id, leftIsCast, right, rightType.id, rightIsCast); > } > computeConstant(leftType, rightType); >+ >+ // check whether comparing identical expressions >+ Binding leftDirect = Expression.getDirectBinding(left); >+ if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) { >+ scope.problemReporter().comparingIdenticalExpressions(this); >+ } > return this.resolvedType = TypeBinding.BOOLEAN; > } > >@@ -839,6 +845,11 @@ > if (unnecessaryRightCast) scope.problemReporter().unnecessaryCast((CastExpression)right); > } > } >+ // check whether comparing identical expressions >+ Binding leftDirect = Expression.getDirectBinding(left); >+ if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) { >+ scope.problemReporter().comparingIdenticalExpressions(this); >+ } > return this.resolvedType = TypeBinding.BOOLEAN; > } > constant = Constant.NotAConstant; >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java,v >retrieving revision 1.38 >diff -u -r1.38 AND_AND_Expression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java 10 May 2007 16:05:23 -0000 1.38 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java 4 Jun 2008 17:22:13 -0000 >@@ -256,6 +256,19 @@ > return false; > } > >+ /** >+ * @see org.eclipse.jdt.internal.compiler.ast.BinaryExpression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope) >+ */ >+ public TypeBinding resolveType(BlockScope scope) { >+ TypeBinding result = super.resolveType(scope); >+ // check whether comparing identical expressions >+ Binding leftDirect = Expression.getDirectBinding(left); >+ if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) { >+ scope.problemReporter().comparingIdenticalExpressions(this); >+ } >+ return result; >+ } >+ > public void traverse(ASTVisitor visitor, BlockScope scope) { > if (visitor.visit(this, scope)) { > left.traverse(visitor, scope); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java,v >retrieving revision 1.64 >diff -u -r1.64 LocalDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 27 May 2008 22:21:13 -0000 1.64 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 4 Jun 2008 17:22:14 -0000 >@@ -217,7 +217,7 @@ > } > } > // check for assignment with no effect >- if (this.binding == Assignment.getDirectBinding(this.initialization)) { >+ if (this.binding == Expression.getDirectBinding(this.initialization)) { > scope.problemReporter().assignmentHasNoEffect(this, this.name); > } > // change the constant in the binding when it is final >Index: compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java,v >retrieving revision 1.37 >diff -u -r1.37 OR_OR_Expression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java 10 May 2007 16:05:23 -0000 1.37 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java 4 Jun 2008 17:22:14 -0000 >@@ -255,6 +255,19 @@ > return false; > } > >+ /** >+ * @see org.eclipse.jdt.internal.compiler.ast.BinaryExpression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope) >+ */ >+ public TypeBinding resolveType(BlockScope scope) { >+ TypeBinding result = super.resolveType(scope); >+ // check whether comparing identical expressions >+ Binding leftDirect = Expression.getDirectBinding(left); >+ if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) { >+ scope.problemReporter().comparingIdenticalExpressions(this); >+ } >+ return result; >+ } >+ > public void traverse(ASTVisitor visitor, BlockScope scope) { > if (visitor.visit(this, scope)) { > left.traverse(visitor, scope); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java,v >retrieving revision 1.88 >diff -u -r1.88 FieldDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 27 May 2008 22:21:13 -0000 1.88 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 4 Jun 2008 17:22:14 -0000 >@@ -253,7 +253,7 @@ > this.binding.setConstant(Constant.NotAConstant); > } > // check for assignment with no effect >- if (this.binding == Assignment.getDirectBinding(this.initialization)) { >+ if (this.binding == Expression.getDirectBinding(this.initialization)) { > initializationScope.problemReporter().assignmentHasNoEffect(this, this.name); > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.370 >diff -u -r1.370 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 27 May 2008 22:21:14 -0000 1.370 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 4 Jun 2008 17:22:16 -0000 >@@ -315,6 +315,9 @@ > > case IProblem.RedundantSuperinterface: > return CompilerOptions.RedundantSuperinterface; >+ >+ case IProblem.ComparingIdentical: >+ return CompilerOptions.ComparingIdentical; > } > return 0; > } >@@ -406,6 +409,7 @@ > case (int)(CompilerOptions.IncompleteEnumSwitch >>> 32): > case (int)(CompilerOptions.FallthroughCase >>> 32): > case (int)(CompilerOptions.OverridingMethodWithoutSuperInvocation >>> 32): >+ case (int)(CompilerOptions.ComparingIdentical >>> 32): > return CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM; > > case (int)(CompilerOptions.TypeHiding >>> 32): >@@ -743,6 +747,7 @@ > location.sourceStart, > location.sourceEnd); > } >+ > public void attemptToReturnNonVoidExpression(ReturnStatement returnStatement, TypeBinding expectedType) { > this.handle( > IProblem.VoidMethodReturnsValue, >@@ -751,6 +756,8 @@ > returnStatement.sourceStart, > returnStatement.sourceEnd); > } >+ >+ > public void attemptToReturnVoidValue(ReturnStatement returnStatement) { > this.handle( > IProblem.MethodReturnsVoid, >@@ -1043,6 +1050,17 @@ > start, > end); > } >+public void comparingIdenticalExpressions(Expression comparison){ >+ int severity = computeSeverity(IProblem.ComparingIdentical); >+ if (severity == ProblemSeverities.Ignore) return; >+ this.handle( >+ IProblem.ComparingIdentical, >+ NoArgument, >+ NoArgument, >+ severity, >+ comparison.sourceStart, >+ comparison.sourceEnd); >+} > /* > * Given the current configuration, answers which category the problem > * falls into: >Index: compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties,v >retrieving revision 1.233 >diff -u -r1.233 messages.properties >--- compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 21 Apr 2008 10:45:21 -0000 1.233 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 4 Jun 2008 17:22:16 -0000 >@@ -160,10 +160,10 @@ > 187 = Unreachable catch block for {0}. It is already handled by the catch block for {1} > 188 = Empty control-flow statement > 189 = Statement unnecessarily nested within else clause. The corresponding then clause does not complete normally >-190 = Read access to enclosing field {0}.{1} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance >-191 = Write access to enclosing field {0}.{1} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance >-192 = Access to enclosing method {1}({2}) from the type {0} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance >-193 = Access to enclosing constructor {0}({1}) is emulated by a synthetic accessor method. Increasing its visibility will improve your performance >+190 = Read access to enclosing field {0}.{1} is emulated by a synthetic accessor method >+191 = Write access to enclosing field {0}.{1} is emulated by a synthetic accessor method >+192 = Access to enclosing method {1}({2}) from the type {0} is emulated by a synthetic accessor method >+193 = Access to enclosing constructor {0}({1}) is emulated by a synthetic accessor method > 194 = Switch case may be entered by falling through previous case > 195 = The method {1} is defined in an inherited type and an enclosing scope > 196 = The field {0} is defined in an inherited type and an enclosing scope >@@ -181,6 +181,7 @@ > 208 = Array constants can only be used in initializers > 209 = Syntax error on keyword "{0}"; {1} expected > 210 = Syntax error on keyword "{0}", no accurate correction available >+211 = Comparing identical expressions > > 220 = Unmatched bracket > 221 = The primitive type {0} of {1} does not have a field {2} >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.615 >diff -u -r1.615 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 2 Jun 2008 09:17:38 -0000 1.615 >+++ model/org/eclipse/jdt/core/JavaCore.java 4 Jun 2008 17:22:17 -0000 >@@ -1456,6 +1456,20 @@ > */ > public static final String COMPILER_PB_REDUNDANT_SUPERINTERFACE = PLUGIN_ID + ".compiler.problem.redundantSuperinterface"; //$NON-NLS-1$ > /** >+ * Compiler option ID: Reporting Comparison of Identical Expressions. >+ * <p>When enabled, the compiler will issue an error or a warning if a comparison >+ * is involving identical operands (e.g <code>'x == x'</code>). >+ * <dl> >+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.comparingIdentical"</code></dd> >+ * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd> >+ * <dt>Default:</dt><dd><code>"warning"</code></dd> >+ * </dl> >+ * @since 3.5 >+ * @category CompilerOptionID >+ */ >+ public static final String COMPILER_PB_COMPARING_IDENTICAL = PLUGIN_ID + ".compiler.problem.comparingIdentical"; //$NON-NLS-1$ >+ >+ /** > * Core option ID: Computing Project Build Order. > * <p>Indicate whether JavaCore should enforce the project build order to be based on > * the classpath prerequisite chain. When requesting to compute, this takes over >Index: batch/org/eclipse/jdt/internal/compiler/batch/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties,v >retrieving revision 1.744 >diff -u -r1.744 messages.properties >--- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 2 Jun 2008 09:17:38 -0000 1.744 >+++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 4 Jun 2008 17:22:13 -0000 >@@ -237,6 +237,7 @@ > \ assertIdentifier + ''assert'' used as identifier\n\ > \ boxing autoboxing conversion\n\ > \ charConcat + char[] in String concat\n\ >+\ compareIdentical + comparing identical expressions\n\ > \ conditionAssign possible accidental boolean assignment\n\ > \ constructorName + method with constructor name\n\ > \ dep-ann missing @Deprecated annotation\n\ >Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v >retrieving revision 1.327 >diff -u -r1.327 Main.java >--- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 21 Apr 2008 15:00:59 -0000 1.327 >+++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 4 Jun 2008 17:22:13 -0000 >@@ -3164,6 +3164,10 @@ > this.options.put( > CompilerOptions.OPTION_ReportNoEffectAssignment, > isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); >+ } else if (token.equals("compareIdentical")) { //$NON-NLS-1$ >+ this.options.put( >+ CompilerOptions.OPTION_ReportComparingIdentical, >+ isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); > } else if (token.equals("intfNonInherited") || token.equals("interfaceNonInherited")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ > this.options.put( > CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod, >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.203 >diff -u -r1.203 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 14 Apr 2008 19:41:33 -0000 1.203 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 4 Jun 2008 17:22:15 -0000 >@@ -119,7 +119,8 @@ > public static final String OPTION_GenerateClassFiles = "org.eclipse.jdt.core.compiler.generateClassFiles"; //$NON-NLS-1$ > public static final String OPTION_Process_Annotations = "org.eclipse.jdt.core.compiler.processAnnotations"; //$NON-NLS-1$ > public static final String OPTION_ReportRedundantSuperinterface = "org.eclipse.jdt.core.compiler.problem.redundantSuperinterface"; //$NON-NLS-1$ >- >+ public static final String OPTION_ReportComparingIdentical = "org.eclipse.jdt.core.compiler.problem.comparingIdentical"; //$NON-NLS-1$ >+ > // Backward compatibility > public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$ > public static final String OPTION_ReportMissingAnnotation = "org.eclipse.jdt.core.compiler.problem.missingAnnotation"; //$NON-NLS-1$ >@@ -213,6 +214,7 @@ > public static final long UnusedTypeArguments = ASTNode.Bit54L; > public static final long UnusedWarningToken = ASTNode.Bit55L; > public static final long RedundantSuperinterface = ASTNode.Bit56L; >+ public static final long ComparingIdentical = ASTNode.Bit57L; > > // Map: String optionKey --> Long irritant> > private static Map OptionToIrritants; >@@ -248,7 +250,8 @@ > | UnusedLabel > | UnusedTypeArguments > | NullReference >- | UnusedWarningToken; >+ | UnusedWarningToken >+ | ComparingIdentical; > > // By default only lines and source attributes are generated. > public int produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES; >@@ -459,6 +462,7 @@ > optionsMap.put(OPTION_GenerateClassFiles, this.generateClassFiles ? ENABLED : DISABLED); > optionsMap.put(OPTION_Process_Annotations, this.processAnnotations ? ENABLED : DISABLED); > optionsMap.put(OPTION_ReportRedundantSuperinterface, getSeverityString(RedundantSuperinterface)); >+ optionsMap.put(OPTION_ReportComparingIdentical, getSeverityString(ComparingIdentical)); > return optionsMap; > } > >@@ -589,6 +593,8 @@ > return OPTION_ReportUnusedWarningToken; > case (int)(RedundantSuperinterface >>> 32) : > return OPTION_ReportRedundantSuperinterface; >+ case (int)(ComparingIdentical >>> 32) : >+ return OPTION_ReportComparingIdentical; > } > } > return null; >@@ -877,7 +883,8 @@ > if ((optionValue = optionsMap.get(OPTION_ReportOverridingMethodWithoutSuperInvocation)) != null) updateSeverity(OverridingMethodWithoutSuperInvocation, optionValue); > if ((optionValue = optionsMap.get(OPTION_ReportUnusedTypeArgumentsForMethodInvocation)) != null) updateSeverity(UnusedTypeArguments, optionValue); > if ((optionValue = optionsMap.get(OPTION_ReportRedundantSuperinterface)) != null) updateSeverity(RedundantSuperinterface, optionValue); >- >+ if ((optionValue = optionsMap.get(OPTION_ReportComparingIdentical)) != null) updateSeverity(ComparingIdentical, optionValue); >+ > // Javadoc options > if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { > if (ENABLED.equals(optionValue)) { >@@ -1073,6 +1080,7 @@ > buf.append("\n\t- process annotations: ").append(this.processAnnotations ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- unused type arguments for method/constructor invocation: ").append(getSeverityString(UnusedTypeArguments)); //$NON-NLS-1$ > buf.append("\n\t- redundant superinterface: ").append(getSeverityString(RedundantSuperinterface)); //$NON-NLS-1$ >+ buf.append("\n\t- comparing identical expr: ").append(getSeverityString(ComparingIdentical)); //$NON-NLS-1$ > return buf.toString(); > } > >Index: compiler/org/eclipse/jdt/core/compiler/IProblem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java,v >retrieving revision 1.199 >diff -u -r1.199 IProblem.java >--- compiler/org/eclipse/jdt/core/compiler/IProblem.java 27 May 2008 22:21:14 -0000 1.199 >+++ compiler/org/eclipse/jdt/core/compiler/IProblem.java 4 Jun 2008 17:22:13 -0000 >@@ -522,6 +522,9 @@ > int ParsingErrorOnKeyword = Syntax + Internal + 209; > int ParsingErrorOnKeywordNoSuggestion = Syntax + Internal + 210; > >+ /** @since 3.5 */ >+ int ComparingIdentical = Internal + 211; >+ > int UnmatchedBracket = Syntax + Internal + 220; > int NoFieldOnBaseType = FieldRelated + 221; > int InvalidExpressionAsStatement = Syntax + Internal + 222; >Index: buidnotes_35.html >=================================================================== >RCS file: buidnotes_35.html >diff -N buidnotes_35.html >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ buidnotes_35.html 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+new compiler warning for comparing identical expressions >+https://bugs.eclipse.org/bugs/show_bug.cgi?id=115814 >+ >+https://bugs.eclipse.org/bugs/show_bug.cgi?id=235004 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java,v >retrieving revision 1.13 >diff -u -r1.13 ProgrammingProblemsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 27 May 2008 23:54:00 -0000 1.13 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 4 Jun 2008 17:22:30 -0000 >@@ -1339,4 +1339,64 @@ > null /* clientRequestor */, > true /* skipJavac */); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=115814 >+public void test0037() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " boolean b1 = args == args;\n" + >+ " boolean b2 = args != args;\n" + >+ " boolean b3 = b1 == b1;\n" + >+ " boolean b4 = b1 != b1;\n" + >+ " boolean b5 = b1 && b1;\n" + >+ " boolean b6 = b1 || b1;\n" + >+ " \n" + >+ " boolean b7 = foo() == foo();\n" + >+ " boolean b8 = foo() != foo();\n" + >+ " boolean b9 = foo() && foo();\n" + >+ " boolean b10 = foo() || foo();\n" + >+ " }\n" + >+ " static boolean foo() { return true; }\n" + >+ " Zork z;\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " boolean b1 = args == args;\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 4)\n" + >+ " boolean b2 = args != args;\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 5)\n" + >+ " boolean b3 = b1 == b1;\n" + >+ " ^^^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 6)\n" + >+ " boolean b4 = b1 != b1;\n" + >+ " ^^^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 7)\n" + >+ " boolean b5 = b1 && b1;\n" + >+ " ^^^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 8)\n" + >+ " boolean b6 = b1 || b1;\n" + >+ " ^^^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "7. ERROR in X.java (at line 16)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n"); >+} > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.722 >diff -u -r1.722 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 30 May 2008 13:41:11 -0000 1.722 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 4 Jun 2008 17:22:29 -0000 >@@ -8945,7 +8945,7 @@ > "1. WARNING in X.java (at line 6)\n" + > " public int foo(T t) { return t.i + t.i() + T.M.j; }\n" + > " ^^^^^\n" + >- "Read access to enclosing field X<T>.M.j is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X<T>.M.j is emulated by a synthetic accessor method\n" + > "----------\n" + > "2. ERROR in X.java (at line 9)\n" + > " class Y extends Zork {\n" + >@@ -19216,12 +19216,12 @@ > "2. WARNING in X.java (at line 11)\n" + > " private static class AA extends A {\n" + > " ^^\n" + >- "Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + > "----------\n" + > "3. WARNING in X.java (at line 15)\n" + > " private static class C extends B<AA> {\n" + > " ^\n" + >- "Access to enclosing constructor X.B<A>() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor X.B<A>() is emulated by a synthetic accessor method\n" + > "----------\n" + > "4. ERROR in X.java (at line 21)\n" + > " System.out.println(b instanceof C);\n" + >@@ -36762,7 +36762,7 @@ > "1. WARNING in X.java (at line 5)\n" + > " private class Y<T> extends A {\n" + > " ^\n" + >- "Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + > "----------\n" + > "2. ERROR in X.java (at line 9)\n" + > " class Y extends Zork {}\n" + >@@ -37706,7 +37706,7 @@ > "4. WARNING in X.java (at line 15)\n" + > " super(null);\n" + > " ^^^^^^^^^^^^\n" + >- "Access to enclosing constructor X<T>(T) is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor X<T>(T) is emulated by a synthetic accessor method\n" + > "----------\n" + > "5. ERROR in X.java (at line 19)\n" + > " for (Map.Entry<String, String> entry : myMap().entrySet()) {\n" + >@@ -39159,7 +39159,7 @@ > "2. WARNING in X.java (at line 5)\n" + > " Object o1 = mObj;\n" + > " ^^^^\n" + >- "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n" + > "3. ERROR in X.java (at line 5)\n" + > " Object o1 = mObj;\n" + >@@ -39174,7 +39174,7 @@ > "5. WARNING in X.java (at line 7)\n" + > " Object o2 = mObj;\n" + > " ^^^^\n" + >- "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n" + > "6. ERROR in X.java (at line 7)\n" + > " Object o2 = mObj;\n" + >@@ -39189,7 +39189,7 @@ > "8. WARNING in X.java (at line 9)\n" + > " Object o3 = mObj;\n" + > " ^^^^\n" + >- "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=203061 - variation >@@ -39224,7 +39224,7 @@ > "2. WARNING in X.java (at line 5)\n" + > " Object o1 = mObj;\n" + > " ^^^^\n" + >- "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n" + > "3. ERROR in X.java (at line 5)\n" + > " Object o1 = mObj;\n" + >@@ -39234,7 +39234,7 @@ > "4. WARNING in X.java (at line 6)\n" + > " mObj = \"1\";\n" + > " ^^^^\n" + >- "Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n" + > "5. ERROR in X.java (at line 6)\n" + > " mObj = \"1\";\n" + >@@ -39249,7 +39249,7 @@ > "7. WARNING in X.java (at line 8)\n" + > " Object o2 = mObj = \"2\";\n" + > " ^^^^\n" + >- "Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n" + > "8. ERROR in X.java (at line 8)\n" + > " Object o2 = mObj = \"2\";\n" + >@@ -39264,12 +39264,12 @@ > "10. WARNING in X.java (at line 10)\n" + > " Object o3 = mObj;\n" + > " ^^^^\n" + >- "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n" + > "11. WARNING in X.java (at line 11)\n" + > " mObj = \"3\";\n" + > " ^^^^\n" + >- "Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + > "----------\n" + > "12. ERROR in X.java (at line 11)\n" + > " mObj = \"3\";\n" + >@@ -40928,7 +40928,7 @@ > "1. WARNING in p\\A.java (at line 18)\n" + > " this.box.set(new P());\n" + > " ^^^^^^^\n" + >- "Access to enclosing constructor A.P() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor A.P() is emulated by a synthetic accessor method\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=209153 - variation >@@ -44929,4 +44929,38 @@ > "Cannot cast from Other2.Member2<capture#1-of ?> to Other<String>.Member\n" + > "----------\n"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235460 >+public void test1338() { >+ this.runConformTest( >+ new String[] { >+ "Derived_A.java", // ================= >+ "import java.util.Map;\n" + >+ "class Base_A {}\n" + >+ "public class Derived_A extends Base_A {\n" + >+ " public Map<Object, Base_B> getMap() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n", // ================= >+ "Derived_B.java", // ================= >+ "class Base_B<T> {\n" + >+ "}\n" + >+ "public class Derived_B extends Base_B<Object> {\n" + >+ "}\n", // ================= >+ }, >+ ""); >+ this.runConformTest( >+ new String[] { >+ "InternalCompilerError_Main.java", // ================= >+ "public class InternalCompilerError_Main {\n" + >+ " public static void main(String args[]) {\n" + >+ " Derived_A dummy = new Derived_A();\n" + >+ " Derived_B propPrice = (Derived_B)dummy.getMap().get(null); \n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "", >+ null, >+ false, >+ null); >+} > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java,v >retrieving revision 1.35 >diff -u -r1.35 InnerEmulationTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 27 May 2008 23:54:01 -0000 1.35 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 4 Jun 2008 17:22:29 -0000 >@@ -144,7 +144,7 @@ > "1. WARNING in A.java (at line 8)\n" + > " super(getRunnable(), new B().toString()); \n" + > " ^^^^^^^\n" + >- "Access to enclosing constructor A.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor A.B() is emulated by a synthetic accessor method\n" + > "----------\n" + > "2. ERROR in A.java (at line 8)\n" + > " super(getRunnable(), new B().toString()); \n" + >@@ -1464,7 +1464,7 @@ > "2. WARNING in p1\\A2.java (at line 18)\n" + > " private class C extends B { \n" + > " ^\n" + >- "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" + > "----------\n" + > "3. ERROR in p1\\A2.java (at line 20)\n" + > " (new D.E(null, null, null, new F(get()) {}) {}).execute(); \n" + >@@ -1552,7 +1552,7 @@ > "2. WARNING in p1\\A2.java (at line 18)\n" + > " private class C extends B { \n" + > " ^\n" + >- "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" + > "----------\n" + > "3. ERROR in p1\\A2.java (at line 20)\n" + > " (new D.E(null, null, null, new F(get()) {})).execute(); \n" + >@@ -2978,11 +2978,11 @@ > "} \n" > }, > "----------\n" + >- "1. WARNING in X.java (at line 7)\n" + >- " class B extends X { \n" + >- " ^\n" + >- "The type B is never used locally\n" + >- "----------\n" + >+ "1. WARNING in X.java (at line 7)\n" + >+ " class B extends X { \n" + >+ " ^\n" + >+ "The type B is never used locally\n" + >+ "----------\n" + > "2. WARNING in X.java (at line 8)\n" + > " B() { \n" + > " ^^^\n" + >@@ -2997,7 +2997,7 @@ > "4. WARNING in X.java (at line 9)\n" + > " super(new A(){ \n" + > " ^^^\n" + >- "Access to enclosing constructor A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor A() is emulated by a synthetic accessor method\n" + > "----------\n"); > return; > } >@@ -3118,11 +3118,11 @@ > "} \n" > }, > "----------\n" + >- "1. WARNING in X.java (at line 7)\n" + >- " class B extends X { \n" + >- " ^\n" + >- "The type B is never used locally\n" + >- "----------\n" + >+ "1. WARNING in X.java (at line 7)\n" + >+ " class B extends X { \n" + >+ " ^\n" + >+ "The type B is never used locally\n" + >+ "----------\n" + > "2. WARNING in X.java (at line 8)\n" + > " B() { \n" + > " ^^^\n" + >@@ -3138,7 +3138,7 @@ > "4. WARNING in X.java (at line 9)\n" + > " super(new A(){ \n" + > " ^^^\n" + >- "Access to enclosing constructor A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor A() is emulated by a synthetic accessor method\n" + > "----------\n" + > "5. WARNING in X.java (at line 10)\n" + > " void foo() { System.out.println(X.this); } \n" + >@@ -5634,7 +5634,7 @@ > "1. WARNING in X.java (at line 5)\n" + > " private class Y extends A {\n" + > " ^\n" + >- "Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + > "----------\n" + > "2. ERROR in X.java (at line 9)\n" + > " class Y extends Zork {}\n" + >@@ -6319,12 +6319,12 @@ > "4. WARNING in X.java (at line 16)\n" + > " System.out.println(X.this.var1.trim());\n" + > " ^^^^\n" + >- "Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + > "----------\n" + > "5. WARNING in X.java (at line 17)\n" + > " System.out.println(var1.trim());\n" + > " ^^^^\n" + >- "Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + > "----------\n" + > "6. ERROR in X.java (at line 17)\n" + > " System.out.println(var1.trim());\n" + >@@ -6407,12 +6407,12 @@ > "3. WARNING in X.java (at line 16)\n" + > " System.out.println(X.this.var1.trim());\n" + > " ^^^^\n" + >- "Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + > "----------\n" + > "4. WARNING in X.java (at line 17)\n" + > " System.out.println(var1.trim());\n" + > " ^^^^\n" + >- "Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + > "----------\n" + > "5. ERROR in X.java (at line 17)\n" + > " System.out.println(var1.trim());\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java,v >retrieving revision 1.52 >diff -u -r1.52 AmbiguousMethodTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 27 May 2008 23:54:00 -0000 1.52 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 4 Jun 2008 17:22:19 -0000 >@@ -1865,7 +1865,7 @@ > "1. WARNING in X.java (at line 9)\n" + > " bar(new Z());\n" + > " ^^^^^^^\n" + >- "Access to enclosing constructor X.Z() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor X.Z() is emulated by a synthetic accessor method\n" + > "----------\n" + > "2. WARNING in X.java (at line 13)\n" + > " private static final class Z implements I {\n" + >@@ -1931,7 +1931,7 @@ > "1. WARNING in X.java (at line 9)\n" + > " bar(new Z(){});\n" + > " ^^^\n" + >- "Access to enclosing constructor X.Z() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing constructor X.Z() is emulated by a synthetic accessor method\n" + > "----------\n" + > "2. WARNING in X.java (at line 13)\n" + > " private static class Z implements I {\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java,v >retrieving revision 1.15 >diff -u -r1.15 CompilerInvocationTests.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 27 May 2008 23:54:00 -0000 1.15 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 4 Jun 2008 17:22:22 -0000 >@@ -643,6 +643,7 @@ > expectedProblemAttributes.put("NullLocalVariableInstanceofYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("NonNullLocalVariableComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); >+ expectedProblemAttributes.put("ComparingIdentical", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("UndocumentedEmptyBlock", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); > expectedProblemAttributes.put("JavadocInvalidSeeUrlReference", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocMissingTagDescription", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); >@@ -1992,6 +1993,7 @@ > expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("ExternalProblemNotFixable", SKIP); > expectedProblemAttributes.put("ExternalProblemFixable", SKIP); >+ expectedProblemAttributes.put("ComparingIdentical", new ProblemAttributes(JavaCore.COMPILER_PB_COMPARING_IDENTICAL)); > Map constantNamesIndex = new HashMap(); > Field[] fields = JavaCore.class.getFields(); > for (int i = 0, length = fields.length; i < length; i++) { >Index: src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java,v >retrieving revision 1.72 >diff -u -r1.72 LookupTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 27 May 2008 23:54:00 -0000 1.72 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 4 Jun 2008 17:22:30 -0000 >@@ -689,14 +689,13 @@ > "1. WARNING in p1\\A.java (at line 6)\n" + > " sth.rating = \"m\"; \n" + > " ^^^^^^\n" + >- "Write access to enclosing field A.rating is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Write access to enclosing field A.rating is emulated by a synthetic accessor method\n" + > "----------\n" + > "2. ERROR in p1\\A.java (at line 13)\n" + > " System.out.println(foo.rating + bar.other); \n" + > " ^^^^^^^^^\n" + > "bar.other cannot be resolved or is not a field\n" + >- "----------\n" >- ); >+ "----------\n"); > } > /** > * member class >Index: src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java,v >retrieving revision 1.99 >diff -u -r1.99 Compliance_1_3.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java 23 Apr 2008 18:13:54 -0000 1.99 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java 4 Jun 2008 17:22:22 -0000 >@@ -3189,7 +3189,7 @@ > "1. WARNING in I.java (at line 3)\n" + > " Object bar(I i) throws CloneNotSupportedException { return i.clone(); }\n" + > " ^^^^^^^^^\n" + >- "Access to enclosing method clone() from the type Object is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + >+ "Access to enclosing method clone() from the type Object is emulated by a synthetic accessor method\n" + > "----------\n" > // no compile errors but generates ClassFormatError if run > ); >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.163 >diff -u -r1.163 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 27 May 2008 09:41:15 -0000 1.163 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 4 Jun 2008 17:22:21 -0000 >@@ -1640,6 +1640,7 @@ > " assertIdentifier + ''assert'' used as identifier\n" + > " boxing autoboxing conversion\n" + > " charConcat + char[] in String concat\n" + >+ " compareIdentical + comparing identical expressions\n" + > " conditionAssign possible accidental boolean assignment\n" + > " constructorName + method with constructor name\n" + > " dep-ann missing @Deprecated annotation\n" + >@@ -1773,6 +1774,7 @@ > " <option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.comparingIdentical\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecation\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod\" value=\"disabled\"/>\n" + >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.111 >diff -u -r1.111 AutoBoxingTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java 27 May 2008 23:54:00 -0000 1.111 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java 4 Jun 2008 17:22:19 -0000 >@@ -2056,14 +2056,24 @@ > "10. WARNING in X.java (at line 15)\n" + > " case 9: return b && b;\n" + > " ^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "11. WARNING in X.java (at line 15)\n" + >+ " case 9: return b && b;\n" + >+ " ^^^^^^\n" + > "The expression of type boolean is boxed into Boolean\n" + > "----------\n" + >- "11. WARNING in X.java (at line 16)\n" + >+ "12. WARNING in X.java (at line 16)\n" + >+ " default: return b || b;\n" + >+ " ^^^^^^\n" + >+ "Comparing identical expressions\n" + >+ "----------\n" + >+ "13. WARNING in X.java (at line 16)\n" + > " default: return b || b;\n" + > " ^^^^^^\n" + > "The expression of type boolean is boxed into Boolean\n" + > "----------\n" + >- "12. ERROR in X.java (at line 22)\n" + >+ "14. ERROR in X.java (at line 22)\n" + > " Zork z;\n" + > " ^^^^\n" + > "Zork cannot be resolved to a type\n" +
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 115814
: 103604