View | Details | Raw Unified | Return to bug 115814
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java (+34 lines)
Lines 749-754 Link Here
749
	}
749
	}
750
}
750
}
751
751
752
public static Binding getDirectBinding(Expression someExpression) {
753
	if ((someExpression.bits & ASTNode.IgnoreNoEffectAssignCheck) != 0) {
754
		return null;
755
	}
756
	if (someExpression instanceof SingleNameReference) {
757
		return ((SingleNameReference)someExpression).binding;
758
	} else if (someExpression instanceof FieldReference) {
759
		FieldReference fieldRef = (FieldReference)someExpression;
760
		if (fieldRef.receiver.isThis() && !(fieldRef.receiver instanceof QualifiedThisReference)) {
761
			return fieldRef.binding;
762
		}			
763
	} else if (someExpression instanceof Assignment) {
764
		Expression lhs = ((Assignment)someExpression).lhs;
765
		if ((lhs.bits & ASTNode.IsStrictlyAssigned) != 0) {
766
			// i = i = ...; // eq to int i = ...;
767
			return getDirectBinding (((Assignment)someExpression).lhs);
768
		} else if (someExpression instanceof PrefixExpression) {
769
			// i = i++; // eq to ++i;
770
			return getDirectBinding (((Assignment)someExpression).lhs);
771
		}
772
	} else if (someExpression instanceof QualifiedNameReference) {
773
		QualifiedNameReference qualifiedNameReference = (QualifiedNameReference) someExpression;
774
		if (qualifiedNameReference.indexOfFirstFieldBinding != 1
775
				&& qualifiedNameReference.otherBindings == null) {
776
			// case where a static field is retrieved using ClassName.fieldname
777
			return qualifiedNameReference.binding;
778
		}
779
	}
780
//		} else if (someExpression instanceof PostfixExpression) { // recurse for postfix: i++ --> i
781
//			// note: "b = b++" is equivalent to doing nothing, not to "b++"
782
//			return getDirectBinding(((PostfixExpression) someExpression).lhs);
783
	return null;
784
}
785
752
public boolean isCompactableOperation() {
786
public boolean isCompactableOperation() {
753
	return false;
787
	return false;
754
}	
788
}	
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java (-34 lines)
Lines 98-137 Link Here
98
	codeStream.recordPositionsFrom(pc, this.sourceStart);
98
	codeStream.recordPositionsFrom(pc, this.sourceStart);
99
}
99
}
100
100
101
public static Binding getDirectBinding(Expression someExpression) {
102
	if ((someExpression.bits & ASTNode.IgnoreNoEffectAssignCheck) != 0) {
103
		return null;
104
	}
105
	if (someExpression instanceof SingleNameReference) {
106
		return ((SingleNameReference)someExpression).binding;
107
	} else if (someExpression instanceof FieldReference) {
108
		FieldReference fieldRef = (FieldReference)someExpression;
109
		if (fieldRef.receiver.isThis() && !(fieldRef.receiver instanceof QualifiedThisReference)) {
110
			return fieldRef.binding;
111
		}			
112
	} else if (someExpression instanceof Assignment) {
113
		Expression lhs = ((Assignment)someExpression).lhs;
114
		if ((lhs.bits & ASTNode.IsStrictlyAssigned) != 0) {
115
			// i = i = ...; // eq to int i = ...;
116
			return getDirectBinding (((Assignment)someExpression).lhs);
117
		} else if (someExpression instanceof PrefixExpression) {
118
			// i = i++; // eq to ++i;
119
			return getDirectBinding (((Assignment)someExpression).lhs);
120
		}
121
	} else if (someExpression instanceof QualifiedNameReference) {
122
		QualifiedNameReference qualifiedNameReference = (QualifiedNameReference) someExpression;
123
		if (qualifiedNameReference.indexOfFirstFieldBinding != 1
124
				&& qualifiedNameReference.otherBindings == null) {
125
			// case where a static field is retrieved using ClassName.fieldname
126
			return qualifiedNameReference.binding;
127
		}
128
	}
129
//		} else if (someExpression instanceof PostfixExpression) { // recurse for postfix: i++ --> i
130
//			// note: "b = b++" is equivalent to doing nothing, not to "b++"
131
//			return getDirectBinding(((PostfixExpression) someExpression).lhs);
132
	return null;
133
}
134
135
FieldBinding getLastField(Expression someExpression) {
101
FieldBinding getLastField(Expression someExpression) {
136
    if (someExpression instanceof SingleNameReference) {
102
    if (someExpression instanceof SingleNameReference) {
137
        if ((someExpression.bits & RestrictiveFlagMASK) == Binding.FIELD) {
103
        if ((someExpression.bits & RestrictiveFlagMASK) == Binding.FIELD) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java (+11 lines)
Lines 808-813 Link Here
808
				CastExpression.checkNeedForArgumentCasts(scope, EQUAL_EQUAL, operatorSignature, left, leftType.id, leftIsCast, right, rightType.id, rightIsCast);
808
				CastExpression.checkNeedForArgumentCasts(scope, EQUAL_EQUAL, operatorSignature, left, leftType.id, leftIsCast, right, rightType.id, rightIsCast);
809
			}
809
			}
810
			computeConstant(leftType, rightType);
810
			computeConstant(leftType, rightType);
811
			
812
			// check whether comparing identical expressions
813
			Binding leftDirect = Expression.getDirectBinding(left);
814
			if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) {
815
				scope.problemReporter().comparingIdenticalExpressions(this);
816
			}
811
			return this.resolvedType = TypeBinding.BOOLEAN;
817
			return this.resolvedType = TypeBinding.BOOLEAN;
812
		}
818
		}
813
	
819
	
Lines 839-844 Link Here
839
					if (unnecessaryRightCast) scope.problemReporter().unnecessaryCast((CastExpression)right);
845
					if (unnecessaryRightCast) scope.problemReporter().unnecessaryCast((CastExpression)right);
840
				}
846
				}
841
			}
847
			}
848
			// check whether comparing identical expressions
849
			Binding leftDirect = Expression.getDirectBinding(left);
850
			if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) {
851
				scope.problemReporter().comparingIdenticalExpressions(this);
852
			}			
842
			return this.resolvedType = TypeBinding.BOOLEAN;
853
			return this.resolvedType = TypeBinding.BOOLEAN;
843
		}
854
		}
844
		constant = Constant.NotAConstant;
855
		constant = Constant.NotAConstant;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java (+13 lines)
Lines 256-261 Link Here
256
		return false;
256
		return false;
257
	}
257
	}
258
258
259
	/**
260
	 * @see org.eclipse.jdt.internal.compiler.ast.BinaryExpression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
261
	 */
262
	public TypeBinding resolveType(BlockScope scope) {
263
		TypeBinding result = super.resolveType(scope);
264
		// check whether comparing identical expressions
265
		Binding leftDirect = Expression.getDirectBinding(left);
266
		if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) {
267
			scope.problemReporter().comparingIdenticalExpressions(this);
268
		}	
269
		return result;
270
	}
271
259
	public void traverse(ASTVisitor visitor, BlockScope scope) {
272
	public void traverse(ASTVisitor visitor, BlockScope scope) {
260
		if (visitor.visit(this, scope)) {
273
		if (visitor.visit(this, scope)) {
261
			left.traverse(visitor, scope);
274
			left.traverse(visitor, scope);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java (-1 / +1 lines)
Lines 217-223 Link Here
217
				}
217
				}
218
			}
218
			}
219
			// check for assignment with no effect
219
			// check for assignment with no effect
220
			if (this.binding == Assignment.getDirectBinding(this.initialization)) {
220
			if (this.binding == Expression.getDirectBinding(this.initialization)) {
221
				scope.problemReporter().assignmentHasNoEffect(this, this.name);
221
				scope.problemReporter().assignmentHasNoEffect(this, this.name);
222
			}
222
			}
223
			// change the constant in the binding when it is final
223
			// change the constant in the binding when it is final
(-)compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java (+13 lines)
Lines 255-260 Link Here
255
		return false;
255
		return false;
256
	}
256
	}
257
257
258
	/**
259
	 * @see org.eclipse.jdt.internal.compiler.ast.BinaryExpression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
260
	 */
261
	public TypeBinding resolveType(BlockScope scope) {
262
		TypeBinding result = super.resolveType(scope);
263
		// check whether comparing identical expressions
264
		Binding leftDirect = Expression.getDirectBinding(left);
265
		if (leftDirect != null && leftDirect == Expression.getDirectBinding(right)) {
266
			scope.problemReporter().comparingIdenticalExpressions(this);
267
		}	
268
		return result;
269
	}
270
	
258
	public void traverse(ASTVisitor visitor, BlockScope scope) {
271
	public void traverse(ASTVisitor visitor, BlockScope scope) {
259
		if (visitor.visit(this, scope)) {
272
		if (visitor.visit(this, scope)) {
260
			left.traverse(visitor, scope);
273
			left.traverse(visitor, scope);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java (-1 / +1 lines)
Lines 253-259 Link Here
253
				this.binding.setConstant(Constant.NotAConstant);
253
				this.binding.setConstant(Constant.NotAConstant);
254
			}
254
			}
255
			// check for assignment with no effect
255
			// check for assignment with no effect
256
			if (this.binding == Assignment.getDirectBinding(this.initialization)) {
256
			if (this.binding == Expression.getDirectBinding(this.initialization)) {
257
				initializationScope.problemReporter().assignmentHasNoEffect(this, this.name);
257
				initializationScope.problemReporter().assignmentHasNoEffect(this, this.name);
258
			}					
258
			}					
259
		}
259
		}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (+18 lines)
Lines 315-320 Link Here
315
315
316
		case IProblem.RedundantSuperinterface:
316
		case IProblem.RedundantSuperinterface:
317
			return CompilerOptions.RedundantSuperinterface;
317
			return CompilerOptions.RedundantSuperinterface;
318
			
319
		case IProblem.ComparingIdentical:
320
			return CompilerOptions.ComparingIdentical;
318
	}
321
	}
319
	return 0;
322
	return 0;
320
}
323
}
Lines 406-411 Link Here
406
				case (int)(CompilerOptions.IncompleteEnumSwitch >>> 32):
409
				case (int)(CompilerOptions.IncompleteEnumSwitch >>> 32):
407
				case (int)(CompilerOptions.FallthroughCase >>> 32):
410
				case (int)(CompilerOptions.FallthroughCase >>> 32):
408
				case (int)(CompilerOptions.OverridingMethodWithoutSuperInvocation >>> 32):
411
				case (int)(CompilerOptions.OverridingMethodWithoutSuperInvocation >>> 32):
412
				case (int)(CompilerOptions.ComparingIdentical >>> 32):
409
					return CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM;
413
					return CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM;
410
	
414
	
411
				case (int)(CompilerOptions.TypeHiding >>> 32):
415
				case (int)(CompilerOptions.TypeHiding >>> 32):
Lines 743-748 Link Here
743
			location.sourceStart,
747
			location.sourceStart,
744
			location.sourceEnd);
748
			location.sourceEnd);
745
}
749
}
750
746
public void attemptToReturnNonVoidExpression(ReturnStatement returnStatement, TypeBinding expectedType) {
751
public void attemptToReturnNonVoidExpression(ReturnStatement returnStatement, TypeBinding expectedType) {
747
	this.handle(
752
	this.handle(
748
		IProblem.VoidMethodReturnsValue,
753
		IProblem.VoidMethodReturnsValue,
Lines 751-756 Link Here
751
		returnStatement.sourceStart,
756
		returnStatement.sourceStart,
752
		returnStatement.sourceEnd);
757
		returnStatement.sourceEnd);
753
}
758
}
759
760
754
public void attemptToReturnVoidValue(ReturnStatement returnStatement) {
761
public void attemptToReturnVoidValue(ReturnStatement returnStatement) {
755
	this.handle(
762
	this.handle(
756
		IProblem.MethodReturnsVoid,
763
		IProblem.MethodReturnsVoid,
Lines 1043-1048 Link Here
1043
		start,
1050
		start,
1044
		end);
1051
		end);
1045
}
1052
}
1053
public void comparingIdenticalExpressions(Expression comparison){
1054
	int severity = computeSeverity(IProblem.ComparingIdentical);
1055
	if (severity == ProblemSeverities.Ignore) return;
1056
	this.handle(
1057
			IProblem.ComparingIdentical,
1058
			NoArgument,
1059
			NoArgument,
1060
			severity,
1061
			comparison.sourceStart,
1062
			comparison.sourceEnd);
1063
}
1046
/*
1064
/*
1047
 * Given the current configuration, answers which category the problem
1065
 * Given the current configuration, answers which category the problem
1048
 * falls into:
1066
 * falls into:
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-4 / +5 lines)
Lines 160-169 Link Here
160
187 = Unreachable catch block for {0}. It is already handled by the catch block for {1}
160
187 = Unreachable catch block for {0}. It is already handled by the catch block for {1}
161
188 = Empty control-flow statement
161
188 = Empty control-flow statement
162
189 = Statement unnecessarily nested within else clause. The corresponding then clause does not complete normally
162
189 = Statement unnecessarily nested within else clause. The corresponding then clause does not complete normally
163
190 = Read access to enclosing field {0}.{1} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance
163
190 = Read access to enclosing field {0}.{1} is emulated by a synthetic accessor method
164
191 = Write access to enclosing field {0}.{1} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance
164
191 = Write access to enclosing field {0}.{1} is emulated by a synthetic accessor method
165
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
165
192 = Access to enclosing method {1}({2}) from the type {0} is emulated by a synthetic accessor method
166
193 = Access to enclosing constructor {0}({1}) is emulated by a synthetic accessor method. Increasing its visibility will improve your performance
166
193 = Access to enclosing constructor {0}({1}) is emulated by a synthetic accessor method
167
194 = Switch case may be entered by falling through previous case
167
194 = Switch case may be entered by falling through previous case
168
195 = The method {1} is defined in an inherited type and an enclosing scope
168
195 = The method {1} is defined in an inherited type and an enclosing scope
169
196 = The field {0} is defined in an inherited type and an enclosing scope 
169
196 = The field {0} is defined in an inherited type and an enclosing scope 
Lines 181-186 Link Here
181
208 = Array constants can only be used in initializers
181
208 = Array constants can only be used in initializers
182
209 = Syntax error on keyword "{0}"; {1} expected
182
209 = Syntax error on keyword "{0}"; {1} expected
183
210 = Syntax error on keyword "{0}", no accurate correction available
183
210 = Syntax error on keyword "{0}", no accurate correction available
184
211 = Comparing identical expressions
184
185
185
220 = Unmatched bracket
186
220 = Unmatched bracket
186
221 = The primitive type {0} of {1} does not have a field {2}
187
221 = The primitive type {0} of {1} does not have a field {2}
(-)model/org/eclipse/jdt/core/JavaCore.java (+14 lines)
Lines 1456-1461 Link Here
1456
	 */
1456
	 */
1457
	public static final String COMPILER_PB_REDUNDANT_SUPERINTERFACE = PLUGIN_ID + ".compiler.problem.redundantSuperinterface"; //$NON-NLS-1$
1457
	public static final String COMPILER_PB_REDUNDANT_SUPERINTERFACE = PLUGIN_ID + ".compiler.problem.redundantSuperinterface"; //$NON-NLS-1$
1458
	/**
1458
	/**
1459
	 * Compiler option ID: Reporting Comparison of Identical Expressions.
1460
	 * <p>When enabled, the compiler will issue an error or a warning if a comparison
1461
	 * is involving identical operands (e.g <code>'x == x'</code>).
1462
	 * <dl>
1463
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.comparingIdentical"</code></dd>
1464
	 * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
1465
	 * <dt>Default:</dt><dd><code>"warning"</code></dd>
1466
	 * </dl>
1467
	 * @since 3.5
1468
	 * @category CompilerOptionID
1469
	 */
1470
	public static final String COMPILER_PB_COMPARING_IDENTICAL = PLUGIN_ID + ".compiler.problem.comparingIdentical"; //$NON-NLS-1$
1471
1472
	/**
1459
	 * Core option ID: Computing Project Build Order.
1473
	 * Core option ID: Computing Project Build Order.
1460
	 * <p>Indicate whether JavaCore should enforce the project build order to be based on
1474
	 * <p>Indicate whether JavaCore should enforce the project build order to be based on
1461
	 *    the classpath prerequisite chain. When requesting to compute, this takes over
1475
	 *    the classpath prerequisite chain. When requesting to compute, this takes over
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (+1 lines)
Lines 237-242 Link Here
237
\      assertIdentifier   + ''assert'' used as identifier\n\
237
\      assertIdentifier   + ''assert'' used as identifier\n\
238
\      boxing               autoboxing conversion\n\
238
\      boxing               autoboxing conversion\n\
239
\      charConcat         + char[] in String concat\n\
239
\      charConcat         + char[] in String concat\n\
240
\      compareIdentical   + comparing identical expressions\n\
240
\      conditionAssign      possible accidental boolean assignment\n\
241
\      conditionAssign      possible accidental boolean assignment\n\
241
\      constructorName    + method with constructor name\n\
242
\      constructorName    + method with constructor name\n\
242
\      dep-ann              missing @Deprecated annotation\n\
243
\      dep-ann              missing @Deprecated annotation\n\
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (+4 lines)
Lines 3164-3169 Link Here
3164
		this.options.put(
3164
		this.options.put(
3165
			CompilerOptions.OPTION_ReportNoEffectAssignment,
3165
			CompilerOptions.OPTION_ReportNoEffectAssignment,
3166
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
3166
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
3167
	} else if (token.equals("compareIdentical")) { //$NON-NLS-1$
3168
		this.options.put(
3169
				CompilerOptions.OPTION_ReportComparingIdentical,
3170
				isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
3167
	} else if (token.equals("intfNonInherited") || token.equals("interfaceNonInherited")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
3171
	} else if (token.equals("intfNonInherited") || token.equals("interfaceNonInherited")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
3168
		this.options.put(
3172
		this.options.put(
3169
			CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod,
3173
			CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod,
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (-3 / +11 lines)
Lines 119-125 Link Here
119
	public static final String OPTION_GenerateClassFiles = "org.eclipse.jdt.core.compiler.generateClassFiles"; //$NON-NLS-1$
119
	public static final String OPTION_GenerateClassFiles = "org.eclipse.jdt.core.compiler.generateClassFiles"; //$NON-NLS-1$
120
	public static final String OPTION_Process_Annotations = "org.eclipse.jdt.core.compiler.processAnnotations"; //$NON-NLS-1$
120
	public static final String OPTION_Process_Annotations = "org.eclipse.jdt.core.compiler.processAnnotations"; //$NON-NLS-1$
121
	public static final String OPTION_ReportRedundantSuperinterface =  "org.eclipse.jdt.core.compiler.problem.redundantSuperinterface"; //$NON-NLS-1$
121
	public static final String OPTION_ReportRedundantSuperinterface =  "org.eclipse.jdt.core.compiler.problem.redundantSuperinterface"; //$NON-NLS-1$
122
122
	public static final String OPTION_ReportComparingIdentical =  "org.eclipse.jdt.core.compiler.problem.comparingIdentical"; //$NON-NLS-1$
123
	
123
	// Backward compatibility
124
	// Backward compatibility
124
	public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
125
	public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
125
	public static final String OPTION_ReportMissingAnnotation = "org.eclipse.jdt.core.compiler.problem.missingAnnotation"; //$NON-NLS-1$
126
	public static final String OPTION_ReportMissingAnnotation = "org.eclipse.jdt.core.compiler.problem.missingAnnotation"; //$NON-NLS-1$
Lines 213-218 Link Here
213
	public static final long UnusedTypeArguments = ASTNode.Bit54L;
214
	public static final long UnusedTypeArguments = ASTNode.Bit54L;
214
	public static final long UnusedWarningToken = ASTNode.Bit55L;
215
	public static final long UnusedWarningToken = ASTNode.Bit55L;
215
	public static final long RedundantSuperinterface = ASTNode.Bit56L;
216
	public static final long RedundantSuperinterface = ASTNode.Bit56L;
217
	public static final long ComparingIdentical = ASTNode.Bit57L;
216
218
217
	// Map: String optionKey --> Long irritant>
219
	// Map: String optionKey --> Long irritant>
218
	private static Map OptionToIrritants;
220
	private static Map OptionToIrritants;
Lines 248-254 Link Here
248
		| UnusedLabel
250
		| UnusedLabel
249
		| UnusedTypeArguments
251
		| UnusedTypeArguments
250
		| NullReference
252
		| NullReference
251
		| UnusedWarningToken;
253
		| UnusedWarningToken
254
		| ComparingIdentical;
252
255
253
	// By default only lines and source attributes are generated.
256
	// By default only lines and source attributes are generated.
254
	public int produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES;
257
	public int produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES;
Lines 459-464 Link Here
459
		optionsMap.put(OPTION_GenerateClassFiles, this.generateClassFiles ? ENABLED : DISABLED);
462
		optionsMap.put(OPTION_GenerateClassFiles, this.generateClassFiles ? ENABLED : DISABLED);
460
		optionsMap.put(OPTION_Process_Annotations, this.processAnnotations ? ENABLED : DISABLED);
463
		optionsMap.put(OPTION_Process_Annotations, this.processAnnotations ? ENABLED : DISABLED);
461
		optionsMap.put(OPTION_ReportRedundantSuperinterface, getSeverityString(RedundantSuperinterface));
464
		optionsMap.put(OPTION_ReportRedundantSuperinterface, getSeverityString(RedundantSuperinterface));
465
		optionsMap.put(OPTION_ReportComparingIdentical, getSeverityString(ComparingIdentical));
462
		return optionsMap;
466
		return optionsMap;
463
	}
467
	}
464
468
Lines 589-594 Link Here
589
					return OPTION_ReportUnusedWarningToken;
593
					return OPTION_ReportUnusedWarningToken;
590
				case (int)(RedundantSuperinterface >>> 32) :
594
				case (int)(RedundantSuperinterface >>> 32) :
591
					return OPTION_ReportRedundantSuperinterface;
595
					return OPTION_ReportRedundantSuperinterface;
596
				case (int)(ComparingIdentical >>> 32) :
597
					return OPTION_ReportComparingIdentical;
592
			}
598
			}
593
		}
599
		}
594
		return null;
600
		return null;
Lines 877-883 Link Here
877
		if ((optionValue = optionsMap.get(OPTION_ReportOverridingMethodWithoutSuperInvocation)) != null) updateSeverity(OverridingMethodWithoutSuperInvocation, optionValue);
883
		if ((optionValue = optionsMap.get(OPTION_ReportOverridingMethodWithoutSuperInvocation)) != null) updateSeverity(OverridingMethodWithoutSuperInvocation, optionValue);
878
		if ((optionValue = optionsMap.get(OPTION_ReportUnusedTypeArgumentsForMethodInvocation)) != null) updateSeverity(UnusedTypeArguments, optionValue);
884
		if ((optionValue = optionsMap.get(OPTION_ReportUnusedTypeArgumentsForMethodInvocation)) != null) updateSeverity(UnusedTypeArguments, optionValue);
879
		if ((optionValue = optionsMap.get(OPTION_ReportRedundantSuperinterface)) != null) updateSeverity(RedundantSuperinterface, optionValue);
885
		if ((optionValue = optionsMap.get(OPTION_ReportRedundantSuperinterface)) != null) updateSeverity(RedundantSuperinterface, optionValue);
880
886
		if ((optionValue = optionsMap.get(OPTION_ReportComparingIdentical)) != null) updateSeverity(ComparingIdentical, optionValue);
887
		
881
		// Javadoc options
888
		// Javadoc options
882
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
889
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
883
			if (ENABLED.equals(optionValue)) {
890
			if (ENABLED.equals(optionValue)) {
Lines 1073-1078 Link Here
1073
		buf.append("\n\t- process annotations: ").append(this.processAnnotations ? ENABLED : DISABLED); //$NON-NLS-1$
1080
		buf.append("\n\t- process annotations: ").append(this.processAnnotations ? ENABLED : DISABLED); //$NON-NLS-1$
1074
		buf.append("\n\t- unused type arguments for method/constructor invocation: ").append(getSeverityString(UnusedTypeArguments)); //$NON-NLS-1$
1081
		buf.append("\n\t- unused type arguments for method/constructor invocation: ").append(getSeverityString(UnusedTypeArguments)); //$NON-NLS-1$
1075
		buf.append("\n\t- redundant superinterface: ").append(getSeverityString(RedundantSuperinterface)); //$NON-NLS-1$
1082
		buf.append("\n\t- redundant superinterface: ").append(getSeverityString(RedundantSuperinterface)); //$NON-NLS-1$
1083
		buf.append("\n\t- comparing identical expr: ").append(getSeverityString(ComparingIdentical)); //$NON-NLS-1$
1076
		return buf.toString();
1084
		return buf.toString();
1077
	}
1085
	}
1078
1086
(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (+3 lines)
Lines 522-527 Link Here
522
	int ParsingErrorOnKeyword = Syntax + Internal + 209;	
522
	int ParsingErrorOnKeyword = Syntax + Internal + 209;	
523
	int ParsingErrorOnKeywordNoSuggestion = Syntax + Internal + 210;
523
	int ParsingErrorOnKeywordNoSuggestion = Syntax + Internal + 210;
524
524
525
	/** @since 3.5 */
526
	int ComparingIdentical = Internal + 211;
527
525
	int UnmatchedBracket = Syntax + Internal + 220;
528
	int UnmatchedBracket = Syntax + Internal + 220;
526
	int NoFieldOnBaseType = FieldRelated + 221;
529
	int NoFieldOnBaseType = FieldRelated + 221;
527
	int InvalidExpressionAsStatement = Syntax + Internal + 222;
530
	int InvalidExpressionAsStatement = Syntax + Internal + 222;
(-)buidnotes_35.html (+4 lines)
Added Link Here
1
new compiler warning for comparing identical expressions
2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=115814
3
4
https://bugs.eclipse.org/bugs/show_bug.cgi?id=235004
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java (+60 lines)
Lines 1339-1342 Link Here
1339
		null /* clientRequestor */,
1339
		null /* clientRequestor */,
1340
		true /* skipJavac */);
1340
		true /* skipJavac */);
1341
}
1341
}
1342
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=115814
1343
public void test0037() {
1344
	this.runNegativeTest(
1345
		new String[] {
1346
			"X.java",
1347
			"public class X {\n" + 
1348
			"	public static void main(String[] args) {\n" + 
1349
			"		boolean b1 = args == args;\n" + 
1350
			"		boolean b2 = args != args;\n" + 
1351
			"		boolean b3 = b1 == b1;\n" + 
1352
			"		boolean b4 = b1 != b1;\n" + 
1353
			"		boolean b5 = b1 && b1;\n" + 
1354
			"		boolean b6 = b1 || b1;\n" + 
1355
			"		\n" + 
1356
			"		boolean b7 = foo() == foo();\n" + 
1357
			"		boolean b8 = foo() != foo();\n" + 
1358
			"		boolean b9 = foo() && foo();\n" + 
1359
			"		boolean b10 = foo() || foo();\n" + 
1360
			"	}\n" + 
1361
			"	static boolean foo() { return true; }\n" + 
1362
			"	Zork z;\n" + 
1363
			"}\n"
1364
			},
1365
			"----------\n" + 
1366
			"1. WARNING in X.java (at line 3)\n" + 
1367
			"	boolean b1 = args == args;\n" + 
1368
			"	             ^^^^^^^^^^^^\n" + 
1369
			"Comparing identical expressions\n" + 
1370
			"----------\n" + 
1371
			"2. WARNING in X.java (at line 4)\n" + 
1372
			"	boolean b2 = args != args;\n" + 
1373
			"	             ^^^^^^^^^^^^\n" + 
1374
			"Comparing identical expressions\n" + 
1375
			"----------\n" + 
1376
			"3. WARNING in X.java (at line 5)\n" + 
1377
			"	boolean b3 = b1 == b1;\n" + 
1378
			"	             ^^^^^^^^\n" + 
1379
			"Comparing identical expressions\n" + 
1380
			"----------\n" + 
1381
			"4. WARNING in X.java (at line 6)\n" + 
1382
			"	boolean b4 = b1 != b1;\n" + 
1383
			"	             ^^^^^^^^\n" + 
1384
			"Comparing identical expressions\n" + 
1385
			"----------\n" + 
1386
			"5. WARNING in X.java (at line 7)\n" + 
1387
			"	boolean b5 = b1 && b1;\n" + 
1388
			"	             ^^^^^^^^\n" + 
1389
			"Comparing identical expressions\n" + 
1390
			"----------\n" + 
1391
			"6. WARNING in X.java (at line 8)\n" + 
1392
			"	boolean b6 = b1 || b1;\n" + 
1393
			"	             ^^^^^^^^\n" + 
1394
			"Comparing identical expressions\n" + 
1395
			"----------\n" + 
1396
			"7. ERROR in X.java (at line 16)\n" + 
1397
			"	Zork z;\n" + 
1398
			"	^^^^\n" + 
1399
			"Zork cannot be resolved to a type\n" + 
1400
			"----------\n");
1401
}
1342
}
1402
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-14 / +48 lines)
Lines 8945-8951 Link Here
8945
			"1. WARNING in X.java (at line 6)\n" + 
8945
			"1. WARNING in X.java (at line 6)\n" + 
8946
			"	public int foo(T t) { return t.i + t.i() + T.M.j; }\n" + 
8946
			"	public int foo(T t) { return t.i + t.i() + T.M.j; }\n" + 
8947
			"	                                           ^^^^^\n" + 
8947
			"	                                           ^^^^^\n" + 
8948
			"Read access to enclosing field X<T>.M.j is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
8948
			"Read access to enclosing field X<T>.M.j is emulated by a synthetic accessor method\n" + 
8949
			"----------\n" + 
8949
			"----------\n" + 
8950
			"2. ERROR in X.java (at line 9)\n" + 
8950
			"2. ERROR in X.java (at line 9)\n" + 
8951
			"	class Y extends Zork {\n" + 
8951
			"	class Y extends Zork {\n" + 
Lines 19216-19227 Link Here
19216
    		"2. WARNING in X.java (at line 11)\n" + 
19216
    		"2. WARNING in X.java (at line 11)\n" + 
19217
    		"	private static class AA extends A {\n" + 
19217
    		"	private static class AA extends A {\n" + 
19218
    		"	                     ^^\n" + 
19218
    		"	                     ^^\n" + 
19219
    		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
19219
    		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + 
19220
    		"----------\n" + 
19220
    		"----------\n" + 
19221
    		"3. WARNING in X.java (at line 15)\n" + 
19221
    		"3. WARNING in X.java (at line 15)\n" + 
19222
    		"	private static class C extends B<AA> {\n" + 
19222
    		"	private static class C extends B<AA> {\n" + 
19223
    		"	                     ^\n" + 
19223
    		"	                     ^\n" + 
19224
    		"Access to enclosing constructor X.B<A>() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
19224
    		"Access to enclosing constructor X.B<A>() is emulated by a synthetic accessor method\n" + 
19225
    		"----------\n" + 
19225
    		"----------\n" + 
19226
    		"4. ERROR in X.java (at line 21)\n" + 
19226
    		"4. ERROR in X.java (at line 21)\n" + 
19227
    		"	System.out.println(b instanceof C);\n" + 
19227
    		"	System.out.println(b instanceof C);\n" + 
Lines 36762-36768 Link Here
36762
		"1. WARNING in X.java (at line 5)\n" + 
36762
		"1. WARNING in X.java (at line 5)\n" + 
36763
		"	private class Y<T> extends A {\n" + 
36763
		"	private class Y<T> extends A {\n" + 
36764
		"	              ^\n" + 
36764
		"	              ^\n" + 
36765
		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
36765
		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + 
36766
		"----------\n" + 
36766
		"----------\n" + 
36767
		"2. ERROR in X.java (at line 9)\n" + 
36767
		"2. ERROR in X.java (at line 9)\n" + 
36768
		"	class Y extends Zork {}\n" + 
36768
		"	class Y extends Zork {}\n" + 
Lines 37706-37712 Link Here
37706
		"4. WARNING in X.java (at line 15)\n" + 
37706
		"4. WARNING in X.java (at line 15)\n" + 
37707
		"	super(null);\n" + 
37707
		"	super(null);\n" + 
37708
		"	^^^^^^^^^^^^\n" + 
37708
		"	^^^^^^^^^^^^\n" + 
37709
		"Access to enclosing constructor X<T>(T) is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
37709
		"Access to enclosing constructor X<T>(T) is emulated by a synthetic accessor method\n" + 
37710
		"----------\n" + 
37710
		"----------\n" + 
37711
		"5. ERROR in X.java (at line 19)\n" + 
37711
		"5. ERROR in X.java (at line 19)\n" + 
37712
		"	for (Map.Entry<String, String> entry : myMap().entrySet()) {\n" + 
37712
		"	for (Map.Entry<String, String> entry : myMap().entrySet()) {\n" + 
Lines 39159-39165 Link Here
39159
		"2. WARNING in X.java (at line 5)\n" + 
39159
		"2. WARNING in X.java (at line 5)\n" + 
39160
		"	Object o1 = mObj;\n" + 
39160
		"	Object o1 = mObj;\n" + 
39161
		"	            ^^^^\n" + 
39161
		"	            ^^^^\n" + 
39162
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39162
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39163
		"----------\n" + 
39163
		"----------\n" + 
39164
		"3. ERROR in X.java (at line 5)\n" + 
39164
		"3. ERROR in X.java (at line 5)\n" + 
39165
		"	Object o1 = mObj;\n" + 
39165
		"	Object o1 = mObj;\n" + 
Lines 39174-39180 Link Here
39174
		"5. WARNING in X.java (at line 7)\n" + 
39174
		"5. WARNING in X.java (at line 7)\n" + 
39175
		"	Object o2 = mObj;\n" + 
39175
		"	Object o2 = mObj;\n" + 
39176
		"	            ^^^^\n" + 
39176
		"	            ^^^^\n" + 
39177
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39177
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39178
		"----------\n" + 
39178
		"----------\n" + 
39179
		"6. ERROR in X.java (at line 7)\n" + 
39179
		"6. ERROR in X.java (at line 7)\n" + 
39180
		"	Object o2 = mObj;\n" + 
39180
		"	Object o2 = mObj;\n" + 
Lines 39189-39195 Link Here
39189
		"8. WARNING in X.java (at line 9)\n" + 
39189
		"8. WARNING in X.java (at line 9)\n" + 
39190
		"	Object o3 = mObj;\n" + 
39190
		"	Object o3 = mObj;\n" + 
39191
		"	            ^^^^\n" + 
39191
		"	            ^^^^\n" + 
39192
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39192
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39193
		"----------\n");
39193
		"----------\n");
39194
}
39194
}
39195
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=203061 - variation
39195
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=203061 - variation
Lines 39224-39230 Link Here
39224
		"2. WARNING in X.java (at line 5)\n" + 
39224
		"2. WARNING in X.java (at line 5)\n" + 
39225
		"	Object o1 = mObj;\n" + 
39225
		"	Object o1 = mObj;\n" + 
39226
		"	            ^^^^\n" + 
39226
		"	            ^^^^\n" + 
39227
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39227
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39228
		"----------\n" + 
39228
		"----------\n" + 
39229
		"3. ERROR in X.java (at line 5)\n" + 
39229
		"3. ERROR in X.java (at line 5)\n" + 
39230
		"	Object o1 = mObj;\n" + 
39230
		"	Object o1 = mObj;\n" + 
Lines 39234-39240 Link Here
39234
		"4. WARNING in X.java (at line 6)\n" + 
39234
		"4. WARNING in X.java (at line 6)\n" + 
39235
		"	mObj = \"1\";\n" + 
39235
		"	mObj = \"1\";\n" + 
39236
		"	^^^^\n" + 
39236
		"	^^^^\n" + 
39237
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39237
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39238
		"----------\n" + 
39238
		"----------\n" + 
39239
		"5. ERROR in X.java (at line 6)\n" + 
39239
		"5. ERROR in X.java (at line 6)\n" + 
39240
		"	mObj = \"1\";\n" + 
39240
		"	mObj = \"1\";\n" + 
Lines 39249-39255 Link Here
39249
		"7. WARNING in X.java (at line 8)\n" + 
39249
		"7. WARNING in X.java (at line 8)\n" + 
39250
		"	Object o2 = mObj = \"2\";\n" + 
39250
		"	Object o2 = mObj = \"2\";\n" + 
39251
		"	            ^^^^\n" + 
39251
		"	            ^^^^\n" + 
39252
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39252
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39253
		"----------\n" + 
39253
		"----------\n" + 
39254
		"8. ERROR in X.java (at line 8)\n" + 
39254
		"8. ERROR in X.java (at line 8)\n" + 
39255
		"	Object o2 = mObj = \"2\";\n" + 
39255
		"	Object o2 = mObj = \"2\";\n" + 
Lines 39264-39275 Link Here
39264
		"10. WARNING in X.java (at line 10)\n" + 
39264
		"10. WARNING in X.java (at line 10)\n" + 
39265
		"	Object o3 = mObj;\n" + 
39265
		"	Object o3 = mObj;\n" + 
39266
		"	            ^^^^\n" + 
39266
		"	            ^^^^\n" + 
39267
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39267
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39268
		"----------\n" + 
39268
		"----------\n" + 
39269
		"11. WARNING in X.java (at line 11)\n" + 
39269
		"11. WARNING in X.java (at line 11)\n" + 
39270
		"	mObj = \"3\";\n" + 
39270
		"	mObj = \"3\";\n" + 
39271
		"	^^^^\n" + 
39271
		"	^^^^\n" + 
39272
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
39272
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" + 
39273
		"----------\n" + 
39273
		"----------\n" + 
39274
		"12. ERROR in X.java (at line 11)\n" + 
39274
		"12. ERROR in X.java (at line 11)\n" + 
39275
		"	mObj = \"3\";\n" + 
39275
		"	mObj = \"3\";\n" + 
Lines 40928-40934 Link Here
40928
		"1. WARNING in p\\A.java (at line 18)\n" + 
40928
		"1. WARNING in p\\A.java (at line 18)\n" + 
40929
		"	this.box.set(new P());\n" + 
40929
		"	this.box.set(new P());\n" + 
40930
		"	             ^^^^^^^\n" + 
40930
		"	             ^^^^^^^\n" + 
40931
		"Access to enclosing constructor A.P() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
40931
		"Access to enclosing constructor A.P() is emulated by a synthetic accessor method\n" + 
40932
		"----------\n");
40932
		"----------\n");
40933
}	
40933
}	
40934
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=209153 - variation
40934
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=209153 - variation
Lines 44929-44932 Link Here
44929
			"Cannot cast from Other2.Member2<capture#1-of ?> to Other<String>.Member\n" + 
44929
			"Cannot cast from Other2.Member2<capture#1-of ?> to Other<String>.Member\n" + 
44930
			"----------\n");
44930
			"----------\n");
44931
}
44931
}
44932
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235460
44933
public void test1338() {
44934
	this.runConformTest(
44935
			new String[] {
44936
				"Derived_A.java", // =================
44937
				"import java.util.Map;\n" + 
44938
				"class Base_A {}\n" + 
44939
				"public class Derived_A extends Base_A {\n" + 
44940
				"	public Map<Object, Base_B> getMap() {\n" + 
44941
				"		return null;\n" + 
44942
				"	}\n" + 
44943
				"}\n", // =================
44944
				"Derived_B.java", // =================
44945
				"class Base_B<T> {\n" + 
44946
				"}\n" + 
44947
				"public class Derived_B extends Base_B<Object> {\n" + 
44948
				"}\n", // =================				
44949
			},
44950
			"");
44951
	this.runConformTest(
44952
			new String[] {
44953
				"InternalCompilerError_Main.java", // =================
44954
				"public class InternalCompilerError_Main {\n" + 
44955
				"	public static void main(String args[]) {\n" + 
44956
				"		Derived_A dummy = new Derived_A();\n" + 
44957
				"		Derived_B propPrice = (Derived_B)dummy.getMap().get(null);		\n" + 
44958
				"	}\n" + 
44959
				"}\n", // =================
44960
			},
44961
			"",
44962
			null,
44963
			false,
44964
			null);	
44965
}
44932
}
44966
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (-20 / +20 lines)
Lines 144-150 Link Here
144
		"1. WARNING in A.java (at line 8)\n" + 
144
		"1. WARNING in A.java (at line 8)\n" + 
145
		"	super(getRunnable(), new B().toString()); \n" + 
145
		"	super(getRunnable(), new B().toString()); \n" + 
146
		"	                     ^^^^^^^\n" + 
146
		"	                     ^^^^^^^\n" + 
147
		"Access to enclosing constructor A.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
147
		"Access to enclosing constructor A.B() is emulated by a synthetic accessor method\n" + 
148
		"----------\n" + 
148
		"----------\n" + 
149
		"2. ERROR in A.java (at line 8)\n" + 
149
		"2. ERROR in A.java (at line 8)\n" + 
150
		"	super(getRunnable(), new B().toString()); \n" + 
150
		"	super(getRunnable(), new B().toString()); \n" + 
Lines 1464-1470 Link Here
1464
		"2. WARNING in p1\\A2.java (at line 18)\n" + 
1464
		"2. WARNING in p1\\A2.java (at line 18)\n" + 
1465
		"	private class C extends B {	\n" + 
1465
		"	private class C extends B {	\n" + 
1466
		"	              ^\n" + 
1466
		"	              ^\n" + 
1467
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
1467
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" + 
1468
		"----------\n" + 
1468
		"----------\n" + 
1469
		"3. ERROR in p1\\A2.java (at line 20)\n" + 
1469
		"3. ERROR in p1\\A2.java (at line 20)\n" + 
1470
		"	(new D.E(null, null, null, new F(get()) {}) {}).execute();	\n" + 
1470
		"	(new D.E(null, null, null, new F(get()) {}) {}).execute();	\n" + 
Lines 1552-1558 Link Here
1552
		"2. WARNING in p1\\A2.java (at line 18)\n" + 
1552
		"2. WARNING in p1\\A2.java (at line 18)\n" + 
1553
		"	private class C extends B {	\n" + 
1553
		"	private class C extends B {	\n" + 
1554
		"	              ^\n" + 
1554
		"	              ^\n" + 
1555
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
1555
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" + 
1556
		"----------\n" + 
1556
		"----------\n" + 
1557
		"3. ERROR in p1\\A2.java (at line 20)\n" + 
1557
		"3. ERROR in p1\\A2.java (at line 20)\n" + 
1558
		"	(new D.E(null, null, null, new F(get()) {})).execute();	\n" + 
1558
		"	(new D.E(null, null, null, new F(get()) {})).execute();	\n" + 
Lines 2978-2988 Link Here
2978
				"} 	\n"
2978
				"} 	\n"
2979
			},
2979
			},
2980
			"----------\n" + 
2980
			"----------\n" + 
2981
			"1. WARNING in X.java (at line 7)\n" +
2981
			"1. WARNING in X.java (at line 7)\n" + 
2982
			"	class B extends X {	\n" +
2982
			"	class B extends X {	\n" + 
2983
			"	      ^\n" +
2983
			"	      ^\n" + 
2984
			"The type B is never used locally\n" +
2984
			"The type B is never used locally\n" + 
2985
			"----------\n" +
2985
			"----------\n" + 
2986
			"2. WARNING in X.java (at line 8)\n" + 
2986
			"2. WARNING in X.java (at line 8)\n" + 
2987
			"	B() {	\n" + 
2987
			"	B() {	\n" + 
2988
			"	^^^\n" + 
2988
			"	^^^\n" + 
Lines 2997-3003 Link Here
2997
			"4. WARNING in X.java (at line 9)\n" + 
2997
			"4. WARNING in X.java (at line 9)\n" + 
2998
			"	super(new A(){	\n" + 
2998
			"	super(new A(){	\n" + 
2999
			"	          ^^^\n" + 
2999
			"	          ^^^\n" + 
3000
			"Access to enclosing constructor A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
3000
			"Access to enclosing constructor A() is emulated by a synthetic accessor method\n" + 
3001
			"----------\n");
3001
			"----------\n");
3002
		return;
3002
		return;
3003
	}
3003
	}
Lines 3118-3128 Link Here
3118
				"} 	\n"
3118
				"} 	\n"
3119
			},
3119
			},
3120
			"----------\n" + 
3120
			"----------\n" + 
3121
			"1. WARNING in X.java (at line 7)\n" +
3121
			"1. WARNING in X.java (at line 7)\n" + 
3122
			"	class B extends X {	\n" +
3122
			"	class B extends X {	\n" + 
3123
			"	      ^\n" +
3123
			"	      ^\n" + 
3124
			"The type B is never used locally\n" +
3124
			"The type B is never used locally\n" + 
3125
			"----------\n" +
3125
			"----------\n" + 
3126
			"2. WARNING in X.java (at line 8)\n" + 
3126
			"2. WARNING in X.java (at line 8)\n" + 
3127
			"	B() {	\n" + 
3127
			"	B() {	\n" + 
3128
			"	^^^\n" + 
3128
			"	^^^\n" + 
Lines 3138-3144 Link Here
3138
			"4. WARNING in X.java (at line 9)\n" + 
3138
			"4. WARNING in X.java (at line 9)\n" + 
3139
			"	super(new A(){	\n" + 
3139
			"	super(new A(){	\n" + 
3140
			"	          ^^^\n" + 
3140
			"	          ^^^\n" + 
3141
			"Access to enclosing constructor A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
3141
			"Access to enclosing constructor A() is emulated by a synthetic accessor method\n" + 
3142
			"----------\n" + 
3142
			"----------\n" + 
3143
			"5. WARNING in X.java (at line 10)\n" + 
3143
			"5. WARNING in X.java (at line 10)\n" + 
3144
			"	void foo() { System.out.println(X.this);	} \n" + 
3144
			"	void foo() { System.out.println(X.this);	} \n" + 
Lines 5634-5640 Link Here
5634
		"1. WARNING in X.java (at line 5)\n" + 
5634
		"1. WARNING in X.java (at line 5)\n" + 
5635
		"	private class Y extends A {\n" + 
5635
		"	private class Y extends A {\n" + 
5636
		"	              ^\n" + 
5636
		"	              ^\n" + 
5637
		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
5637
		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + 
5638
		"----------\n" + 
5638
		"----------\n" + 
5639
		"2. ERROR in X.java (at line 9)\n" + 
5639
		"2. ERROR in X.java (at line 9)\n" + 
5640
		"	class Y extends Zork {}\n" + 
5640
		"	class Y extends Zork {}\n" + 
Lines 6319-6330 Link Here
6319
				"4. WARNING in X.java (at line 16)\n" + 
6319
				"4. WARNING in X.java (at line 16)\n" + 
6320
				"	System.out.println(X.this.var1.trim());\n" + 
6320
				"	System.out.println(X.this.var1.trim());\n" + 
6321
				"	                          ^^^^\n" + 
6321
				"	                          ^^^^\n" + 
6322
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
6322
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + 
6323
				"----------\n" + 
6323
				"----------\n" + 
6324
				"5. WARNING in X.java (at line 17)\n" + 
6324
				"5. WARNING in X.java (at line 17)\n" + 
6325
				"	System.out.println(var1.trim());\n" + 
6325
				"	System.out.println(var1.trim());\n" + 
6326
				"	                   ^^^^\n" + 
6326
				"	                   ^^^^\n" + 
6327
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
6327
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + 
6328
				"----------\n" + 
6328
				"----------\n" + 
6329
				"6. ERROR in X.java (at line 17)\n" + 
6329
				"6. ERROR in X.java (at line 17)\n" + 
6330
				"	System.out.println(var1.trim());\n" + 
6330
				"	System.out.println(var1.trim());\n" + 
Lines 6407-6418 Link Here
6407
				"3. WARNING in X.java (at line 16)\n" + 
6407
				"3. WARNING in X.java (at line 16)\n" + 
6408
				"	System.out.println(X.this.var1.trim());\n" + 
6408
				"	System.out.println(X.this.var1.trim());\n" + 
6409
				"	                          ^^^^\n" + 
6409
				"	                          ^^^^\n" + 
6410
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
6410
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + 
6411
				"----------\n" + 
6411
				"----------\n" + 
6412
				"4. WARNING in X.java (at line 17)\n" + 
6412
				"4. WARNING in X.java (at line 17)\n" + 
6413
				"	System.out.println(var1.trim());\n" + 
6413
				"	System.out.println(var1.trim());\n" + 
6414
				"	                   ^^^^\n" + 
6414
				"	                   ^^^^\n" + 
6415
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
6415
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + 
6416
				"----------\n" + 
6416
				"----------\n" + 
6417
				"5. ERROR in X.java (at line 17)\n" + 
6417
				"5. ERROR in X.java (at line 17)\n" + 
6418
				"	System.out.println(var1.trim());\n" + 
6418
				"	System.out.println(var1.trim());\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-2 / +2 lines)
Lines 1865-1871 Link Here
1865
		"1. WARNING in X.java (at line 9)\n" + 
1865
		"1. WARNING in X.java (at line 9)\n" + 
1866
		"	bar(new Z());\n" + 
1866
		"	bar(new Z());\n" + 
1867
		"	    ^^^^^^^\n" + 
1867
		"	    ^^^^^^^\n" + 
1868
		"Access to enclosing constructor X.Z() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
1868
		"Access to enclosing constructor X.Z() is emulated by a synthetic accessor method\n" + 
1869
		"----------\n" + 
1869
		"----------\n" + 
1870
		"2. WARNING in X.java (at line 13)\n" + 
1870
		"2. WARNING in X.java (at line 13)\n" + 
1871
		"	private static final class Z implements I {\n" + 
1871
		"	private static final class Z implements I {\n" + 
Lines 1931-1937 Link Here
1931
		"1. WARNING in X.java (at line 9)\n" + 
1931
		"1. WARNING in X.java (at line 9)\n" + 
1932
		"	bar(new Z(){});\n" + 
1932
		"	bar(new Z(){});\n" + 
1933
		"	        ^^^\n" + 
1933
		"	        ^^^\n" + 
1934
		"Access to enclosing constructor X.Z() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
1934
		"Access to enclosing constructor X.Z() is emulated by a synthetic accessor method\n" + 
1935
		"----------\n" + 
1935
		"----------\n" + 
1936
		"2. WARNING in X.java (at line 13)\n" + 
1936
		"2. WARNING in X.java (at line 13)\n" + 
1937
		"	private static class Z implements I {\n" + 
1937
		"	private static class Z implements I {\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (+2 lines)
Lines 643-648 Link Here
643
		expectedProblemAttributes.put("NullLocalVariableInstanceofYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
643
		expectedProblemAttributes.put("NullLocalVariableInstanceofYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
644
		expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
644
		expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
645
		expectedProblemAttributes.put("NonNullLocalVariableComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
645
		expectedProblemAttributes.put("NonNullLocalVariableComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
646
		expectedProblemAttributes.put("ComparingIdentical", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));		
646
		expectedProblemAttributes.put("UndocumentedEmptyBlock", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
647
		expectedProblemAttributes.put("UndocumentedEmptyBlock", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
647
		expectedProblemAttributes.put("JavadocInvalidSeeUrlReference", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
648
		expectedProblemAttributes.put("JavadocInvalidSeeUrlReference", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
648
		expectedProblemAttributes.put("JavadocMissingTagDescription", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
649
		expectedProblemAttributes.put("JavadocMissingTagDescription", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
Lines 1992-1997 Link Here
1992
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1993
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1993
		expectedProblemAttributes.put("ExternalProblemNotFixable", SKIP);
1994
		expectedProblemAttributes.put("ExternalProblemNotFixable", SKIP);
1994
		expectedProblemAttributes.put("ExternalProblemFixable", SKIP);
1995
		expectedProblemAttributes.put("ExternalProblemFixable", SKIP);
1996
		expectedProblemAttributes.put("ComparingIdentical", new ProblemAttributes(JavaCore.COMPILER_PB_COMPARING_IDENTICAL));
1995
		Map constantNamesIndex = new HashMap();
1997
		Map constantNamesIndex = new HashMap();
1996
		Field[] fields = JavaCore.class.getFields();
1998
		Field[] fields = JavaCore.class.getFields();
1997
		for (int i = 0, length = fields.length; i < length; i++) {
1999
		for (int i = 0, length = fields.length; i < length; i++) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java (-3 / +2 lines)
Lines 689-702 Link Here
689
		"1. WARNING in p1\\A.java (at line 6)\n" + 
689
		"1. WARNING in p1\\A.java (at line 6)\n" + 
690
		"	sth.rating = \"m\";						\n" + 
690
		"	sth.rating = \"m\";						\n" + 
691
		"	    ^^^^^^\n" + 
691
		"	    ^^^^^^\n" + 
692
		"Write access to enclosing field A.rating is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
692
		"Write access to enclosing field A.rating is emulated by a synthetic accessor method\n" + 
693
		"----------\n" + 
693
		"----------\n" + 
694
		"2. ERROR in p1\\A.java (at line 13)\n" + 
694
		"2. ERROR in p1\\A.java (at line 13)\n" + 
695
		"	System.out.println(foo.rating + bar.other);	\n" + 
695
		"	System.out.println(foo.rating + bar.other);	\n" + 
696
		"	                                ^^^^^^^^^\n" + 
696
		"	                                ^^^^^^^^^\n" + 
697
		"bar.other cannot be resolved or is not a field\n" + 
697
		"bar.other cannot be resolved or is not a field\n" + 
698
		"----------\n"
698
		"----------\n");
699
	);
700
}
699
}
701
/**
700
/**
702
 * member class
701
 * member class
(-)src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java (-1 / +1 lines)
Lines 3189-3195 Link Here
3189
		"1. WARNING in I.java (at line 3)\n" + 
3189
		"1. WARNING in I.java (at line 3)\n" + 
3190
		"	Object bar(I i) throws CloneNotSupportedException { return i.clone(); }\n" + 
3190
		"	Object bar(I i) throws CloneNotSupportedException { return i.clone(); }\n" + 
3191
		"	                                                           ^^^^^^^^^\n" + 
3191
		"	                                                           ^^^^^^^^^\n" + 
3192
		"Access to enclosing method clone() from the type Object is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
3192
		"Access to enclosing method clone() from the type Object is emulated by a synthetic accessor method\n" + 
3193
		"----------\n"
3193
		"----------\n"
3194
		// no compile errors but generates ClassFormatError if run
3194
		// no compile errors but generates ClassFormatError if run
3195
	);
3195
	);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (+2 lines)
Lines 1640-1645 Link Here
1640
        "      assertIdentifier   + ''assert'' used as identifier\n" +
1640
        "      assertIdentifier   + ''assert'' used as identifier\n" +
1641
        "      boxing               autoboxing conversion\n" +
1641
        "      boxing               autoboxing conversion\n" +
1642
        "      charConcat         + char[] in String concat\n" +
1642
        "      charConcat         + char[] in String concat\n" +
1643
        "      compareIdentical   + comparing identical expressions\n" + 
1643
        "      conditionAssign      possible accidental boolean assignment\n" +
1644
        "      conditionAssign      possible accidental boolean assignment\n" +
1644
        "      constructorName    + method with constructor name\n" +
1645
        "      constructorName    + method with constructor name\n" +
1645
        "      dep-ann              missing @Deprecated annotation\n" +
1646
        "      dep-ann              missing @Deprecated annotation\n" +
Lines 1773-1778 Link Here
1773
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + 
1774
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + 
1774
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + 
1775
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + 
1775
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" + 
1776
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" + 
1777
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.comparingIdentical\" value=\"warning\"/>\n" + 
1776
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecation\" value=\"warning\"/>\n" + 
1778
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecation\" value=\"warning\"/>\n" + 
1777
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode\" value=\"disabled\"/>\n" + 
1779
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode\" value=\"disabled\"/>\n" + 
1778
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod\" value=\"disabled\"/>\n" + 
1780
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod\" value=\"disabled\"/>\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java (-2 / +12 lines)
Lines 2056-2069 Link Here
2056
			"10. WARNING in X.java (at line 15)\n" + 
2056
			"10. WARNING in X.java (at line 15)\n" + 
2057
			"	case 9: return b && b;\n" + 
2057
			"	case 9: return b && b;\n" + 
2058
			"	               ^^^^^^\n" + 
2058
			"	               ^^^^^^\n" + 
2059
			"Comparing identical expressions\n" + 
2060
			"----------\n" + 
2061
			"11. WARNING in X.java (at line 15)\n" + 
2062
			"	case 9: return b && b;\n" + 
2063
			"	               ^^^^^^\n" + 
2059
			"The expression of type boolean is boxed into Boolean\n" + 
2064
			"The expression of type boolean is boxed into Boolean\n" + 
2060
			"----------\n" + 
2065
			"----------\n" + 
2061
			"11. WARNING in X.java (at line 16)\n" + 
2066
			"12. WARNING in X.java (at line 16)\n" + 
2067
			"	default: return b || b;\n" + 
2068
			"	                ^^^^^^\n" + 
2069
			"Comparing identical expressions\n" + 
2070
			"----------\n" + 
2071
			"13. WARNING in X.java (at line 16)\n" + 
2062
			"	default: return b || b;\n" + 
2072
			"	default: return b || b;\n" + 
2063
			"	                ^^^^^^\n" + 
2073
			"	                ^^^^^^\n" + 
2064
			"The expression of type boolean is boxed into Boolean\n" + 
2074
			"The expression of type boolean is boxed into Boolean\n" + 
2065
			"----------\n" + 
2075
			"----------\n" + 
2066
			"12. ERROR in X.java (at line 22)\n" + 
2076
			"14. ERROR in X.java (at line 22)\n" + 
2067
			"	Zork z;\n" + 
2077
			"	Zork z;\n" + 
2068
			"	^^^^\n" + 
2078
			"	^^^^\n" + 
2069
			"Zork cannot be resolved to a type\n" + 
2079
			"Zork cannot be resolved to a type\n" + 

Return to bug 115814