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

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (+4 lines)
Lines 1870-1875 Link Here
1870
						this.options.put(
1870
						this.options.put(
1871
							CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
1871
							CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
1872
							isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1872
							isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1873
					} else if (token.equals("parameter-assignment")) { //$NON-NLS-1$
1874
						this.options.put(
1875
							CompilerOptions.OPTION_ReportParameterAssignment,
1876
							isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1873
					} else {
1877
					} else {
1874
						throw new InvalidInputException(Main.bind("configure.invalidWarning", token)); //$NON-NLS-1$
1878
						throw new InvalidInputException(Main.bind("configure.invalidWarning", token)); //$NON-NLS-1$
1875
					}
1879
					}
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (+1 lines)
Lines 152-157 Link Here
152
\      noEffectAssign     + assignment without effect\n\
152
\      noEffectAssign     + assignment without effect\n\
153
\      null                 missing or redundant null check\n\
153
\      null                 missing or redundant null check\n\
154
\      over-ann             missing @Override annotation\n\
154
\      over-ann             missing @Override annotation\n\
155
\      parameter-assignment assignment to a parameter\n\
155
\      pkgDefaultMethod   + attempt to override package-default method\n\
156
\      pkgDefaultMethod   + attempt to override package-default method\n\
156
\      semicolon            unnecessary semicolon, empty statement\n\
157
\      semicolon            unnecessary semicolon, empty statement\n\
157
\      serial             + missing serialVersionUID\n\
158
\      serial             + missing serialVersionUID\n\
(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (-1 / +6 lines)
Lines 72-77 Link Here
72
 *     IBM Corporation - added the following constants
72
 *     IBM Corporation - added the following constants
73
 *								   IllegalUsageOfQualifiedTypeReference
73
 *								   IllegalUsageOfQualifiedTypeReference
74
 *								   InvalidDigit
74
 *								   InvalidDigit
75
 *     IBM Corporation - added the following constants
76
 *								   ParameterAssignment
75
 *******************************************************************************/
77
 *******************************************************************************/
76
package org.eclipse.jdt.core.compiler;
78
package org.eclipse.jdt.core.compiler;
77
 
79
 
Lines 287-293 Link Here
287
	int TooManyArrayDimensions = Internal + 68;
289
	int TooManyArrayDimensions = Internal + 68;
288
	/** @since 2.1 */
290
	/** @since 2.1 */
289
	int BytecodeExceeds64KLimitForConstructor = Internal + 69;
291
	int BytecodeExceeds64KLimitForConstructor = Internal + 69;
290
292
	/** @since 3.2 */
293
	int ParameterAssignment = Internal + 860;
294
	// REVIEW argument would be more homogeneous with existing code, but JLS puts a clear emphasis on parameter -- see p.211 for parameter/argument disc.
295
	
291
	// fields
296
	// fields
292
	int UndefinedField = FieldRelated + 70;
297
	int UndefinedField = FieldRelated + 70;
293
	int NotVisibleField = FieldRelated + 71;
298
	int NotVisibleField = FieldRelated + 71;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java (+3 lines)
Lines 119-124 Link Here
119
						currentScope.problemReporter().cannotAssignToFinalOuterLocal(localBinding, this);
119
						currentScope.problemReporter().cannotAssignToFinalOuterLocal(localBinding, this);
120
					}
120
					}
121
				}
121
				}
122
				else /* avoid double diagnostic */ if (localBinding.isArgument) {
123
					currentScope.problemReporter().parameterAssignment(localBinding, this);
124
				}
122
				flowInfo.markAsDefinitelyAssigned(localBinding);
125
				flowInfo.markAsDefinitelyAssigned(localBinding);
123
		}
126
		}
124
		manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo);
127
		manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo);
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (-1 / +14 lines)
Lines 101-106 Link Here
101
	public static final String OPTION_ReportDiscouragedReference =  "org.eclipse.jdt.core.compiler.problem.discouragedReference"; //$NON-NLS-1$
101
	public static final String OPTION_ReportDiscouragedReference =  "org.eclipse.jdt.core.compiler.problem.discouragedReference"; //$NON-NLS-1$
102
	public static final String OPTION_SuppressWarnings =  "org.eclipse.jdt.core.compiler.problem.suppressWarnings"; //$NON-NLS-1$
102
	public static final String OPTION_SuppressWarnings =  "org.eclipse.jdt.core.compiler.problem.suppressWarnings"; //$NON-NLS-1$
103
	public static final String OPTION_ReportUnhandledWarningToken =  "org.eclipse.jdt.core.compiler.problem.unhandledWarningToken"; //$NON-NLS-1$
103
	public static final String OPTION_ReportUnhandledWarningToken =  "org.eclipse.jdt.core.compiler.problem.unhandledWarningToken"; //$NON-NLS-1$
104
	public static final String OPTION_ReportParameterAssignment =  "org.eclipse.jdt.core.compiler.problem.parameterAssignment"; //$NON-NLS-1$
104
	
105
	
105
	// Backward compatibility
106
	// Backward compatibility
106
	public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
107
	public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
Lines 180-185 Link Here
180
	public static final long MissingDeprecatedAnnotation = ASTNode.Bit43L;
181
	public static final long MissingDeprecatedAnnotation = ASTNode.Bit43L;
181
	public static final long DiscouragedReference = ASTNode.Bit44L;
182
	public static final long DiscouragedReference = ASTNode.Bit44L;
182
	public static final long UnhandledWarningToken = ASTNode.Bit45L;
183
	public static final long UnhandledWarningToken = ASTNode.Bit45L;
184
	public static final long ParameterAssignment = ASTNode.Bit46L;
183
	
185
	
184
	// TODO (olivier) remove once http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21540 is fixed
186
	// TODO (olivier) remove once http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21540 is fixed
185
	private static final int IntMissingSerialVersion = (int) (MissingSerialVersion >>> 32);
187
	private static final int IntMissingSerialVersion = (int) (MissingSerialVersion >>> 32);
Lines 187-192 Link Here
187
	private static final int IntTypeParameterHiding = (int) (TypeParameterHiding >>> 32);
189
	private static final int IntTypeParameterHiding = (int) (TypeParameterHiding >>> 32);
188
	private static final int IntIncompleteEnumSwitch = (int) (IncompleteEnumSwitch >>> 32);
190
	private static final int IntIncompleteEnumSwitch = (int) (IncompleteEnumSwitch >>> 32);
189
	private static final int IntMissingDeprecatedAnnotation = (int) (MissingDeprecatedAnnotation >>> 32);
191
	private static final int IntMissingDeprecatedAnnotation = (int) (MissingDeprecatedAnnotation >>> 32);
192
	private static final int IntParameterAssignment = (int) (ParameterAssignment >>> 32);
190
	
193
	
191
	// Default severity level for handlers
194
	// Default severity level for handlers
192
	public long errorThreshold = 0;
195
	public long errorThreshold = 0;
Lines 310-316 Link Here
310
	}
313
	}
311
314
312
	public Map getMap() {
315
	public Map getMap() {
313
		Map optionsMap = new HashMap(30);
316
		Map optionsMap = new HashMap(96, 1.0f);
314
		optionsMap.put(OPTION_LocalVariableAttribute, (this.produceDebugAttributes & Vars) != 0 ? GENERATE : DO_NOT_GENERATE); 
317
		optionsMap.put(OPTION_LocalVariableAttribute, (this.produceDebugAttributes & Vars) != 0 ? GENERATE : DO_NOT_GENERATE); 
315
		optionsMap.put(OPTION_LineNumberAttribute, (this.produceDebugAttributes & Lines) != 0 ? GENERATE : DO_NOT_GENERATE);
318
		optionsMap.put(OPTION_LineNumberAttribute, (this.produceDebugAttributes & Lines) != 0 ? GENERATE : DO_NOT_GENERATE);
316
		optionsMap.put(OPTION_SourceFileAttribute, (this.produceDebugAttributes & Source) != 0 ? GENERATE : DO_NOT_GENERATE);
319
		optionsMap.put(OPTION_SourceFileAttribute, (this.produceDebugAttributes & Source) != 0 ? GENERATE : DO_NOT_GENERATE);
Lines 387-392 Link Here
387
		optionsMap.put(OPTION_ReportNullReference, getSeverityString(NullReference));
390
		optionsMap.put(OPTION_ReportNullReference, getSeverityString(NullReference));
388
		optionsMap.put(OPTION_SuppressWarnings, this.suppressWarnings ? ENABLED : DISABLED); 
391
		optionsMap.put(OPTION_SuppressWarnings, this.suppressWarnings ? ENABLED : DISABLED); 
389
		optionsMap.put(OPTION_ReportUnhandledWarningToken, getSeverityString(UnhandledWarningToken));
392
		optionsMap.put(OPTION_ReportUnhandledWarningToken, getSeverityString(UnhandledWarningToken));
393
		optionsMap.put(OPTION_ReportParameterAssignment, getSeverityString(ParameterAssignment));
390
		return optionsMap;		
394
		return optionsMap;		
391
	}
395
	}
392
	
396
	
Lines 618-623 Link Here
618
		if ((optionValue = optionsMap.get(OPTION_ReportMissingDeprecatedAnnotation)) != null) updateSeverity(MissingDeprecatedAnnotation, optionValue);
622
		if ((optionValue = optionsMap.get(OPTION_ReportMissingDeprecatedAnnotation)) != null) updateSeverity(MissingDeprecatedAnnotation, optionValue);
619
		if ((optionValue = optionsMap.get(OPTION_ReportIncompleteEnumSwitch)) != null) updateSeverity(IncompleteEnumSwitch, optionValue);
623
		if ((optionValue = optionsMap.get(OPTION_ReportIncompleteEnumSwitch)) != null) updateSeverity(IncompleteEnumSwitch, optionValue);
620
		if ((optionValue = optionsMap.get(OPTION_ReportUnhandledWarningToken)) != null) updateSeverity(UnhandledWarningToken, optionValue);
624
		if ((optionValue = optionsMap.get(OPTION_ReportUnhandledWarningToken)) != null) updateSeverity(UnhandledWarningToken, optionValue);
625
		if ((optionValue = optionsMap.get(OPTION_ReportParameterAssignment)) != null) updateSeverity(ParameterAssignment, optionValue);
621
		
626
		
622
		// Javadoc options
627
		// Javadoc options
623
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
628
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
Lines 780-785 Link Here
780
		buf.append("\n\t- incomplete enum switch: ").append(getSeverityString(IncompleteEnumSwitch)); //$NON-NLS-1$
785
		buf.append("\n\t- incomplete enum switch: ").append(getSeverityString(IncompleteEnumSwitch)); //$NON-NLS-1$
781
		buf.append("\n\t- suppress warnings: ").append(this.suppressWarnings ? ENABLED : DISABLED); //$NON-NLS-1$
786
		buf.append("\n\t- suppress warnings: ").append(this.suppressWarnings ? ENABLED : DISABLED); //$NON-NLS-1$
782
		buf.append("\n\t- unhandled warning token: ").append(getSeverityString(UnhandledWarningToken)); //$NON-NLS-1$
787
		buf.append("\n\t- unhandled warning token: ").append(getSeverityString(UnhandledWarningToken)); //$NON-NLS-1$
788
		buf.append("\n\t- parameter assignment: ").append(getSeverityString(ParameterAssignment)); //$NON-NLS-1$
783
		return buf.toString();
789
		return buf.toString();
784
	}
790
	}
785
791
Lines 875-880 Link Here
875
			OPTION_ReportUnusedPrivateMember,
881
			OPTION_ReportUnusedPrivateMember,
876
			OPTION_ReportVarargsArgumentNeedCast,
882
			OPTION_ReportVarargsArgumentNeedCast,
877
			OPTION_ReportUnhandledWarningToken,
883
			OPTION_ReportUnhandledWarningToken,
884
			OPTION_ReportParameterAssignment,
878
		};
885
		};
879
		return result;
886
		return result;
880
	}
887
	}
Lines 923-928 Link Here
923
					return "incomplete-switch"; //$NON-NLS-1$
930
					return "incomplete-switch"; //$NON-NLS-1$
924
				case IntMissingDeprecatedAnnotation :
931
				case IntMissingDeprecatedAnnotation :
925
					return "dep-ann"; //$NON-NLS-1$
932
					return "dep-ann"; //$NON-NLS-1$
933
				case IntParameterAssignment :
934
					return "parameter-assignment"; //$NON-NLS-1$
926
			}
935
			}
927
		}
936
		}
928
		return null;
937
		return null;
Lines 959-964 Link Here
959
				if ("nls".equals(warningToken)) //$NON-NLS-1$
968
				if ("nls".equals(warningToken)) //$NON-NLS-1$
960
					return NonExternalizedString;
969
					return NonExternalizedString;
961
				break;
970
				break;
971
			case 'p' :
972
				if ("parameter-assignment".equals(warningToken)) //$NON-NLS-1$
973
					return ParameterAssignment;
974
				break;
962
			case 's' :
975
			case 's' :
963
				if ("serial".equals(warningToken)) //$NON-NLS-1$
976
				if ("serial".equals(warningToken)) //$NON-NLS-1$
964
					return MissingSerialVersion;
977
					return MissingSerialVersion;
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (+12 lines)
Lines 1447-1452 Link Here
1447
1447
1448
		case IProblem.JavadocMissing:
1448
		case IProblem.JavadocMissing:
1449
			return CompilerOptions.MissingJavadocComments;
1449
			return CompilerOptions.MissingJavadocComments;
1450
1451
		case IProblem.ParameterAssignment:
1452
			return CompilerOptions.ParameterAssignment;
1450
	}
1453
	}
1451
	return 0;
1454
	return 0;
1452
	
1455
	
Lines 4328-4333 Link Here
4328
		compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceStart,
4331
		compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceStart,
4329
		compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceEnd);
4332
		compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceEnd);
4330
}
4333
}
4334
public void parameterAssignment(LocalVariableBinding local, ASTNode location) {
4335
	String[] arguments = new String[] { new String(local.readableName())};
4336
	this.handle(
4337
		IProblem.ParameterAssignment,
4338
		arguments,
4339
		arguments,
4340
		location.sourceStart,
4341
		location.sourceEnd);
4342
}
4331
private String parameterBoundAsString(TypeVariableBinding typeVariable, boolean makeShort) {
4343
private String parameterBoundAsString(TypeVariableBinding typeVariable, boolean makeShort) {
4332
    StringBuffer nameBuffer = new StringBuffer(10);
4344
    StringBuffer nameBuffer = new StringBuffer(10);
4333
    if (typeVariable.firstBound == typeVariable.superclass) {
4345
    if (typeVariable.firstBound == typeVariable.superclass) {
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (+3 lines)
Lines 553-555 Link Here
553
857 = Incorrect number of type arguments for generic constructor <{3}>{0}({1}) of type {2}; it cannot be parameterized with arguments <{4}>
553
857 = Incorrect number of type arguments for generic constructor <{3}>{0}({1}) of type {2}; it cannot be parameterized with arguments <{4}>
554
858 = The parameterized constructor <{3}>{0}({1}) of type {2} is not applicable for the arguments ({4})
554
858 = The parameterized constructor <{3}>{0}({1}) of type {2} is not applicable for the arguments ({4})
555
859 = The constructor {0}({1}) of raw type {2} is no longer generic; it cannot be parameterized with arguments <{3}>
555
859 = The constructor {0}({1}) of raw type {2} is no longer generic; it cannot be parameterized with arguments <{3}>
556
557
860 = The parameter {0} should not be assigned
558
### REVIEW the 'accidental' seems extraneous here (see assignment in condition)

Return to bug 53773