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

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (+3 lines)
Lines 3461-3466 Link Here
3461
			} else if (token.equals("super")) { //$NON-NLS-1$
3461
			} else if (token.equals("super")) { //$NON-NLS-1$
3462
				setSeverity(CompilerOptions.OPTION_ReportOverridingMethodWithoutSuperInvocation, severity, isEnabling);
3462
				setSeverity(CompilerOptions.OPTION_ReportOverridingMethodWithoutSuperInvocation, severity, isEnabling);
3463
				return;
3463
				return;
3464
			} else if (token.equals("static-method")) { //$NON-NLS-1$
3465
				setSeverity(CompilerOptions.OPTION_ReportMethodCanBeStatic, severity, isEnabling);
3466
				return;
3464
			}
3467
			}
3465
			break;
3468
			break;
3466
		case 't' :
3469
		case 't' :
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (+1 lines)
Lines 309-314 Link Here
309
\      semicolon            unnecessary semicolon, empty statement\n\
309
\      semicolon            unnecessary semicolon, empty statement\n\
310
\      serial             + missing serialVersionUID\n\
310
\      serial             + missing serialVersionUID\n\
311
\      specialParamHiding   constructor or setter parameter hiding a field\n\
311
\      specialParamHiding   constructor or setter parameter hiding a field\n\
312
\      static-method        method can be declared as static\n\
312
\      static-access        macro for indirectStatic and staticReceiver\n\
313
\      static-access        macro for indirectStatic and staticReceiver\n\
313
\      staticReceiver     + non-static reference to static member\n\
314
\      staticReceiver     + non-static reference to static member\n\
314
\      super                overriding a method without making a super invocation\n\
315
\      super                overriding a method without making a super invocation\n\
(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (+2 lines)
Lines 401-406 Link Here
401
	int IndirectAccessToStaticMethod = Internal + MethodRelated + 119;
401
	int IndirectAccessToStaticMethod = Internal + MethodRelated + 119;
402
	/** @since 3.4 */
402
	/** @since 3.4 */
403
	int MissingTypeInMethod = MethodRelated + 120;
403
	int MissingTypeInMethod = MethodRelated + 120;
404
	/** @since 3.7 */
405
	int MethodCanBeStatic = Internal + MethodRelated + 121;
404
406
405
	// constructors
407
	// constructors
406
	/** @since 3.4 */
408
	/** @since 3.4 */
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (+1 lines)
Lines 146-151 Link Here
146
	// for type, method and field declarations
146
	// for type, method and field declarations
147
	public static final int HasLocalType = Bit2; // cannot conflict with AddAssertionMASK
147
	public static final int HasLocalType = Bit2; // cannot conflict with AddAssertionMASK
148
	public static final int HasBeenResolved = Bit5; // field decl only (to handle forward references)
148
	public static final int HasBeenResolved = Bit5; // field decl only (to handle forward references)
149
	public static final int CanBeStatic = Bit9;
149
150
150
	// for expression
151
	// for expression
151
	public static final int ParenthesizedSHIFT = 21; // Bit22 -> Bit29
152
	public static final int ParenthesizedSHIFT = 21; // Bit22 -> Bit29
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java (+21 lines)
Lines 107-112 Link Here
107
			currentScope.problemReporter().cannotAssignToFinalField(this.binding, this);
107
			currentScope.problemReporter().cannotAssignToFinalField(this.binding, this);
108
		}
108
		}
109
	}
109
	}
110
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
111
	if (!this.binding.isStatic()) {
112
		if (this.receiver.isThis()) {
113
			currentScope.resetEnclosingMethodStaticFlag();
114
		}
115
	} else if (this.receiver.isThis()) {
116
		if ((this.receiver.bits & ASTNode.IsImplicitThis) == 0) {
117
			// explicit this, not allowed in static context
118
			currentScope.resetEnclosingMethodStaticFlag();
119
		}
120
	}
110
	return flowInfo;
121
	return flowInfo;
111
}
122
}
112
123
Lines 119-124 Link Here
119
	this.receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic);
130
	this.receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic);
120
	if (nonStatic) {
131
	if (nonStatic) {
121
		this.receiver.checkNPE(currentScope, flowContext, flowInfo);
132
		this.receiver.checkNPE(currentScope, flowContext, flowInfo);
133
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
134
		if (this.receiver.isThis()) {
135
			currentScope.resetEnclosingMethodStaticFlag();
136
		}
137
	} else if (this.receiver.isThis()) {
138
		if ((this.receiver.bits & ASTNode.IsImplicitThis) == 0) {
139
			// explicit this receiver, not allowed in static context
140
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
141
			currentScope.resetEnclosingMethodStaticFlag();
142
		}
122
	}
143
	}
123
144
124
	if (valueRequired || currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
145
	if (valueRequired || currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (+10 lines)
Lines 61-66 Link Here
61
	flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic).unconditionalInits();
61
	flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic).unconditionalInits();
62
	if (nonStatic) {
62
	if (nonStatic) {
63
		this.receiver.checkNPE(currentScope, flowContext, flowInfo);
63
		this.receiver.checkNPE(currentScope, flowContext, flowInfo);
64
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
65
		if (this.receiver.isThis()) {
66
			// accessing non-static method without an object
67
			currentScope.resetEnclosingMethodStaticFlag();
68
		}
69
	} else if (this.receiver.isThis()) {
70
		if ((this.receiver.bits & ASTNode.IsImplicitThis) == 0) {
71
			// explicit this receiver, not allowed in static context
72
			currentScope.resetEnclosingMethodStaticFlag();
73
		}
64
	}
74
	}
65
75
66
	if (this.arguments != null) {
76
	if (this.arguments != null) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java (-1 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 105-110 Link Here
105
			methodContext.complainIfUnusedExceptionHandlers(this);
105
			methodContext.complainIfUnusedExceptionHandlers(this);
106
			// check unused parameters
106
			// check unused parameters
107
			this.scope.checkUnusedParameters(this.binding);
107
			this.scope.checkUnusedParameters(this.binding);
108
			// check if the method could have been static
109
			if (!this.binding.isStatic() && (this.bits & ASTNode.CanBeStatic) != 0) {
110
				this.scope.problemReporter().methodCanBeDeclaredStatic(this);
111
			}
108
		} catch (AbortMethod e) {
112
		} catch (AbortMethod e) {
109
			this.ignoreFurtherInvestigation = true;
113
			this.ignoreFurtherInvestigation = true;
110
		}
114
		}
Lines 204-209 Link Here
204
						if ((this.modifiers & ClassFileConstants.AccAbstract) == 0)
208
						if ((this.modifiers & ClassFileConstants.AccAbstract) == 0)
205
							this.scope.problemReporter().methodNeedBody(this);
209
							this.scope.problemReporter().methodNeedBody(this);
206
				} else {
210
				} else {
211
					this.bits |= ASTNode.CanBeStatic;
207
					// the method HAS a body --> abstract native modifiers are forbiden
212
					// the method HAS a body --> abstract native modifiers are forbiden
208
					if (((this.modifiers & ClassFileConstants.AccNative) != 0) || ((this.modifiers & ClassFileConstants.AccAbstract) != 0))
213
					if (((this.modifiers & ClassFileConstants.AccNative) != 0) || ((this.modifiers & ClassFileConstants.AccAbstract) != 0))
209
						this.scope.problemReporter().methodNeedingNoBody(this);
214
						this.scope.problemReporter().methodNeedingNoBody(this);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java (-1 / +7 lines)
Lines 80-85 Link Here
80
					currentScope.problemReporter().uninitializedBlankFinalField(lastFieldBinding, this);
80
					currentScope.problemReporter().uninitializedBlankFinalField(lastFieldBinding, this);
81
				}
81
				}
82
			}
82
			}
83
			if (!lastFieldBinding.isStatic()) {
84
				currentScope.resetEnclosingMethodStaticFlag();
85
			}
83
			break;
86
			break;
84
		case Binding.LOCAL :
87
		case Binding.LOCAL :
85
			// first binding is a local variable
88
			// first binding is a local variable
Lines 175-182 Link Here
175
			if (needValue || complyTo14) {
178
			if (needValue || complyTo14) {
176
				manageSyntheticAccessIfNecessary(currentScope, (FieldBinding) this.binding, 0, flowInfo);
179
				manageSyntheticAccessIfNecessary(currentScope, (FieldBinding) this.binding, 0, flowInfo);
177
			}
180
			}
181
			FieldBinding fieldBinding = (FieldBinding) this.binding;
178
			if (this.indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
182
			if (this.indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
179
				FieldBinding fieldBinding = (FieldBinding) this.binding;
180
				// check if reading a final blank field
183
				// check if reading a final blank field
181
				if (fieldBinding.isBlankFinal()
184
				if (fieldBinding.isBlankFinal()
182
						&& currentScope.needBlankFinalFieldInitializationCheck(fieldBinding)) {
185
						&& currentScope.needBlankFinalFieldInitializationCheck(fieldBinding)) {
Lines 186-191 Link Here
186
					}
189
					}
187
				}
190
				}
188
			}
191
			}
192
			if (!fieldBinding.isStatic()) {
193
				currentScope.resetEnclosingMethodStaticFlag();
194
			}
189
			break;
195
			break;
190
		case Binding.LOCAL : // reading a local variable
196
		case Binding.LOCAL : // reading a local variable
191
			LocalVariableBinding localBinding;
197
			LocalVariableBinding localBinding;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java (-2 / +14 lines)
Lines 61-74 Link Here
61
	if (isCompound) { // check the variable part is initialized if blank final
61
	if (isCompound) { // check the variable part is initialized if blank final
62
		switch (this.bits & ASTNode.RestrictiveFlagMASK) {
62
		switch (this.bits & ASTNode.RestrictiveFlagMASK) {
63
			case Binding.FIELD : // reading a field
63
			case Binding.FIELD : // reading a field
64
				FieldBinding fieldBinding;
64
				FieldBinding fieldBinding = (FieldBinding) this.binding;
65
				if ((fieldBinding = (FieldBinding) this.binding).isBlankFinal()
65
				if (fieldBinding.isBlankFinal()
66
						&& currentScope.needBlankFinalFieldInitializationCheck(fieldBinding)) {
66
						&& currentScope.needBlankFinalFieldInitializationCheck(fieldBinding)) {
67
					FlowInfo fieldInits = flowContext.getInitsForFinalBlankInitializationCheck(fieldBinding.declaringClass.original(), flowInfo);
67
					FlowInfo fieldInits = flowContext.getInitsForFinalBlankInitializationCheck(fieldBinding.declaringClass.original(), flowInfo);
68
					if (!fieldInits.isDefinitelyAssigned(fieldBinding)) {
68
					if (!fieldInits.isDefinitelyAssigned(fieldBinding)) {
69
						currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
69
						currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
70
					}
70
					}
71
				}
71
				}
72
				if (!fieldBinding.isStatic()) {
73
					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
74
					currentScope.resetEnclosingMethodStaticFlag();
75
				}
72
				manageSyntheticAccessIfNecessary(currentScope, flowInfo, true /*read-access*/);
76
				manageSyntheticAccessIfNecessary(currentScope, flowInfo, true /*read-access*/);
73
				break;
77
				break;
74
			case Binding.LOCAL : // reading a local variable
78
			case Binding.LOCAL : // reading a local variable
Lines 107-112 Link Here
107
					currentScope.problemReporter().cannotAssignToFinalField(fieldBinding, this);
111
					currentScope.problemReporter().cannotAssignToFinalField(fieldBinding, this);
108
				}
112
				}
109
			}
113
			}
114
			if (!fieldBinding.isStatic()) {
115
				// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
116
				currentScope.resetEnclosingMethodStaticFlag();
117
			}
110
			break;
118
			break;
111
		case Binding.LOCAL : // assigning to a local variable
119
		case Binding.LOCAL : // assigning to a local variable
112
			LocalVariableBinding localBinding = (LocalVariableBinding) this.binding;
120
			LocalVariableBinding localBinding = (LocalVariableBinding) this.binding;
Lines 156-161 Link Here
156
					currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
164
					currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
157
				}
165
				}
158
			}
166
			}
167
			if (!fieldBinding.isStatic()) {
168
				// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
169
				currentScope.resetEnclosingMethodStaticFlag();
170
			}
159
			break;
171
			break;
160
		case Binding.LOCAL : // reading a local variable
172
		case Binding.LOCAL : // reading a local variable
161
			LocalVariableBinding localBinding;
173
			LocalVariableBinding localBinding;
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (+13 lines)
Lines 133-138 Link Here
133
	public static final String OPTION_ReportTasks = "org.eclipse.jdt.core.compiler.problem.tasks"; //$NON-NLS-1$
133
	public static final String OPTION_ReportTasks = "org.eclipse.jdt.core.compiler.problem.tasks"; //$NON-NLS-1$
134
	public static final String OPTION_ReportUnusedObjectAllocation = "org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation";  //$NON-NLS-1$
134
	public static final String OPTION_ReportUnusedObjectAllocation = "org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation";  //$NON-NLS-1$
135
	public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts";  //$NON-NLS-1$
135
	public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts";  //$NON-NLS-1$
136
	public static final String OPTION_ReportMethodCanBeStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic";  //$NON-NLS-1$
136
	// Backward compatibility
137
	// Backward compatibility
137
	public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
138
	public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
138
	public static final String OPTION_ReportMissingAnnotation = "org.eclipse.jdt.core.compiler.problem.missingAnnotation"; //$NON-NLS-1$
139
	public static final String OPTION_ReportMissingAnnotation = "org.eclipse.jdt.core.compiler.problem.missingAnnotation"; //$NON-NLS-1$
Lines 238-243 Link Here
238
	public static final int DeadCode = IrritantSet.GROUP2 | ASTNode.Bit2;
239
	public static final int DeadCode = IrritantSet.GROUP2 | ASTNode.Bit2;
239
	public static final int Tasks = IrritantSet.GROUP2 | ASTNode.Bit3;
240
	public static final int Tasks = IrritantSet.GROUP2 | ASTNode.Bit3;
240
	public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4;
241
	public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4;
242
	public static final int MethodCanBeStatic = IrritantSet.GROUP2 | ASTNode.Bit5;
241
243
242
	// Severity level for handlers
244
	// Severity level for handlers
243
	/** 
245
	/** 
Lines 375-380 Link Here
375
		"rawtypes", //$NON-NLS-1$
377
		"rawtypes", //$NON-NLS-1$
376
		"serial", //$NON-NLS-1$
378
		"serial", //$NON-NLS-1$
377
		"static-access", //$NON-NLS-1$
379
		"static-access", //$NON-NLS-1$
380
		"static-method", //$NON-NLS-1$
378
		"super", //$NON-NLS-1$
381
		"super", //$NON-NLS-1$
379
		"synthetic-access", //$NON-NLS-1$
382
		"synthetic-access", //$NON-NLS-1$
380
		"unchecked", //$NON-NLS-1$
383
		"unchecked", //$NON-NLS-1$
Lines 539-544 Link Here
539
				return OPTION_ReportDeadCode;
542
				return OPTION_ReportDeadCode;
540
			case UnusedObjectAllocation:
543
			case UnusedObjectAllocation:
541
				return OPTION_ReportUnusedObjectAllocation;
544
				return OPTION_ReportUnusedObjectAllocation;
545
			case MethodCanBeStatic :
546
				return OPTION_ReportMethodCanBeStatic;
542
		}
547
		}
543
		return null;
548
		return null;
544
	}
549
	}
Lines 638-643 Link Here
638
			OPTION_ReportInvalidJavadoc,
643
			OPTION_ReportInvalidJavadoc,
639
			OPTION_ReportLocalVariableHiding,
644
			OPTION_ReportLocalVariableHiding,
640
			OPTION_ReportMethodWithConstructorName,
645
			OPTION_ReportMethodWithConstructorName,
646
			OPTION_ReportMethodCanBeStatic,
641
			OPTION_ReportMissingDeprecatedAnnotation,
647
			OPTION_ReportMissingDeprecatedAnnotation,
642
			OPTION_ReportMissingJavadocComments,
648
			OPTION_ReportMissingJavadocComments,
643
			OPTION_ReportMissingJavadocTagDescription,
649
			OPTION_ReportMissingJavadocTagDescription,
Lines 739-744 Link Here
739
				return "fallthrough"; //$NON-NLS-1$
745
				return "fallthrough"; //$NON-NLS-1$
740
			case OverridingMethodWithoutSuperInvocation :
746
			case OverridingMethodWithoutSuperInvocation :
741
				return "super"; //$NON-NLS-1$
747
				return "super"; //$NON-NLS-1$
748
			case MethodCanBeStatic :
749
				return "static-method"; //$NON-NLS-1$
742
		}
750
		}
743
		return null;
751
		return null;
744
	}
752
	}
Lines 796-801 Link Here
796
					return IrritantSet.SERIAL;
804
					return IrritantSet.SERIAL;
797
				if ("static-access".equals(warningToken)) //$NON-NLS-1$
805
				if ("static-access".equals(warningToken)) //$NON-NLS-1$
798
					return IrritantSet.STATIC_ACCESS;
806
					return IrritantSet.STATIC_ACCESS;
807
				if ("static-method".equals(warningToken)) //$NON-NLS-1$
808
					return IrritantSet.STATIC_METHOD;
799
				if ("synthetic-access".equals(warningToken)) //$NON-NLS-1$
809
				if ("synthetic-access".equals(warningToken)) //$NON-NLS-1$
800
					return IrritantSet.SYNTHETIC_ACCESS;
810
					return IrritantSet.SYNTHETIC_ACCESS;
801
				if ("super".equals(warningToken)) { //$NON-NLS-1$
811
				if ("super".equals(warningToken)) { //$NON-NLS-1$
Lines 921-926 Link Here
921
		optionsMap.put(OPTION_ReportTasks, getSeverityString(Tasks));
931
		optionsMap.put(OPTION_ReportTasks, getSeverityString(Tasks));
922
		optionsMap.put(OPTION_ReportUnusedObjectAllocation, getSeverityString(UnusedObjectAllocation));
932
		optionsMap.put(OPTION_ReportUnusedObjectAllocation, getSeverityString(UnusedObjectAllocation));
923
		optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED);
933
		optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED);
934
		optionsMap.put(OPTION_ReportMethodCanBeStatic, getSeverityString(MethodCanBeStatic));
924
		return optionsMap;
935
		return optionsMap;
925
	}
936
	}
926
937
Lines 1339-1344 Link Here
1339
		if ((optionValue = optionsMap.get(OPTION_ReportDeadCode)) != null) updateSeverity(DeadCode, optionValue);
1350
		if ((optionValue = optionsMap.get(OPTION_ReportDeadCode)) != null) updateSeverity(DeadCode, optionValue);
1340
		if ((optionValue = optionsMap.get(OPTION_ReportTasks)) != null) updateSeverity(Tasks, optionValue);
1351
		if ((optionValue = optionsMap.get(OPTION_ReportTasks)) != null) updateSeverity(Tasks, optionValue);
1341
		if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue);
1352
		if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue);
1353
		if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBeStatic)) != null) updateSeverity(MethodCanBeStatic, optionValue);
1342
1354
1343
		// Javadoc options
1355
		// Javadoc options
1344
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
1356
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
Lines 1551-1556 Link Here
1551
		buf.append("\n\t- dead code in trivial if statement: ").append(this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED); //$NON-NLS-1$
1563
		buf.append("\n\t- dead code in trivial if statement: ").append(this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED); //$NON-NLS-1$
1552
		buf.append("\n\t- tasks severity: ").append(getSeverityString(Tasks)); //$NON-NLS-1$
1564
		buf.append("\n\t- tasks severity: ").append(getSeverityString(Tasks)); //$NON-NLS-1$
1553
		buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$
1565
		buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$
1566
		buf.append("\n\t- method can be static: ").append(getSeverityString(MethodCanBeStatic)); //$NON-NLS-1$
1554
		return buf.toString();
1567
		return buf.toString();
1555
	}
1568
	}
1556
	
1569
	
(-)compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java (-1 / +5 lines)
Lines 51-56 Link Here
51
	public static final IrritantSet RESTRICTION = new IrritantSet(CompilerOptions.ForbiddenReference);
51
	public static final IrritantSet RESTRICTION = new IrritantSet(CompilerOptions.ForbiddenReference);
52
	public static final IrritantSet SERIAL = new IrritantSet(CompilerOptions.MissingSerialVersion);
52
	public static final IrritantSet SERIAL = new IrritantSet(CompilerOptions.MissingSerialVersion);
53
	public static final IrritantSet STATIC_ACCESS = new IrritantSet(CompilerOptions.IndirectStaticAccess);
53
	public static final IrritantSet STATIC_ACCESS = new IrritantSet(CompilerOptions.IndirectStaticAccess);
54
	public static final IrritantSet STATIC_METHOD = new IrritantSet(CompilerOptions.MethodCanBeStatic);
54
	public static final IrritantSet SYNTHETIC_ACCESS = new IrritantSet(CompilerOptions.AccessEmulation);
55
	public static final IrritantSet SYNTHETIC_ACCESS = new IrritantSet(CompilerOptions.AccessEmulation);
55
	public static final IrritantSet SUPER = new IrritantSet(CompilerOptions.OverridingMethodWithoutSuperInvocation);
56
	public static final IrritantSet SUPER = new IrritantSet(CompilerOptions.OverridingMethodWithoutSuperInvocation);
56
	public static final IrritantSet UNUSED = new IrritantSet(CompilerOptions.UnusedLocalVariable);
57
	public static final IrritantSet UNUSED = new IrritantSet(CompilerOptions.UnusedLocalVariable);
Lines 118-124 Link Here
118
			.set(CompilerOptions.UnusedTypeArguments)
119
			.set(CompilerOptions.UnusedTypeArguments)
119
			.set(CompilerOptions.RedundantSuperinterface)
120
			.set(CompilerOptions.RedundantSuperinterface)
120
			.set(CompilerOptions.DeadCode)
121
			.set(CompilerOptions.DeadCode)
121
			.set(CompilerOptions.UnusedObjectAllocation);
122
			.set(CompilerOptions.UnusedObjectAllocation)
123
			.set(CompilerOptions.MethodCanBeStatic);
124
		STATIC_METHOD
125
			.set(CompilerOptions.MethodCanBeStatic);
122
		String suppressRawWhenUnchecked = System.getProperty("suppressRawWhenUnchecked"); //$NON-NLS-1$
126
		String suppressRawWhenUnchecked = System.getProperty("suppressRawWhenUnchecked"); //$NON-NLS-1$
123
		if (suppressRawWhenUnchecked != null && "true".equalsIgnoreCase(suppressRawWhenUnchecked)) { //$NON-NLS-1$
127
		if (suppressRawWhenUnchecked != null && "true".equalsIgnoreCase(suppressRawWhenUnchecked)) { //$NON-NLS-1$
124
			UNCHECKED.set(CompilerOptions.RawTypeReference);
128
			UNCHECKED.set(CompilerOptions.RawTypeReference);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java (+8 lines)
Lines 940-943 Link Here
940
			s += ((BlockScope) this.subscopes[i]).toString(tab + 1) + "\n"; //$NON-NLS-1$
940
			s += ((BlockScope) this.subscopes[i]).toString(tab + 1) + "\n"; //$NON-NLS-1$
941
	return s;
941
	return s;
942
}
942
}
943
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
944
public void resetEnclosingMethodStaticFlag() {
945
	MethodScope methodScope = methodScope();
946
	if (methodScope != null && methodScope.referenceContext instanceof MethodDeclaration) {
947
		MethodDeclaration methodDeclaration= (MethodDeclaration) methodScope.referenceContext;
948
		methodDeclaration.bits &= ~ASTNode.CanBeStatic;
949
	}
950
}
943
}
951
}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (+25 lines)
Lines 418-423 Link Here
418
418
419
		case IProblem.UnusedObjectAllocation:
419
		case IProblem.UnusedObjectAllocation:
420
			return CompilerOptions.UnusedObjectAllocation;
420
			return CompilerOptions.UnusedObjectAllocation;
421
			
422
		case IProblem.MethodCanBeStatic:
423
			return CompilerOptions.MethodCanBeStatic;
421
	}
424
	}
422
	return 0;
425
	return 0;
423
}
426
}
Lines 448-453 Link Here
448
			case CompilerOptions.MissingOverrideAnnotation :
451
			case CompilerOptions.MissingOverrideAnnotation :
449
			case CompilerOptions.MissingDeprecatedAnnotation :
452
			case CompilerOptions.MissingDeprecatedAnnotation :
450
			case CompilerOptions.ParameterAssignment :
453
			case CompilerOptions.ParameterAssignment :
454
			case CompilerOptions.MethodCanBeStatic:
451
				return CategorizedProblem.CAT_CODE_STYLE;
455
				return CategorizedProblem.CAT_CODE_STYLE;
452
456
453
			case CompilerOptions.MaskedCatchBlock :
457
			case CompilerOptions.MaskedCatchBlock :
Lines 5019-5024 Link Here
5019
		methodDecl.sourceEnd);
5023
		methodDecl.sourceEnd);
5020
}
5024
}
5021
5025
5026
public void methodCanBeDeclaredStatic(MethodDeclaration methodDecl) {
5027
	int severity = computeSeverity(IProblem.MethodCanBeStatic);
5028
	if (severity == ProblemSeverities.Ignore) return;
5029
	MethodBinding method = methodDecl.binding;
5030
	this.handle(
5031
			IProblem.MethodCanBeStatic,
5032
		new String[] {
5033
			new String(method.declaringClass.readableName()),
5034
			new String(method.selector),
5035
			typesAsString(method.isVarargs(), method.parameters, false)
5036
		 },
5037
		new String[] {
5038
			new String(method.declaringClass.shortReadableName()),
5039
			new String(method.selector),
5040
			typesAsString(method.isVarargs(), method.parameters, true)
5041
		 },
5042
		severity,
5043
		methodDecl.sourceStart,
5044
		methodDecl.sourceEnd);
5045
}
5046
5022
public void missingDeprecatedAnnotationForField(FieldDeclaration field) {
5047
public void missingDeprecatedAnnotationForField(FieldDeclaration field) {
5023
	int severity = computeSeverity(IProblem.FieldMissingDeprecatedAnnotation);
5048
	int severity = computeSeverity(IProblem.FieldMissingDeprecatedAnnotation);
5024
	if (severity == ProblemSeverities.Ignore) return;
5049
	if (severity == ProblemSeverities.Ignore) return;
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (+1 lines)
Lines 102-107 Link Here
102
118 = The method {1}({2}) from the type {0} is never used locally
102
118 = The method {1}({2}) from the type {0} is never used locally
103
119 = The static method {1}({2}) from the type {0} should be accessed directly 
103
119 = The static method {1}({2}) from the type {0} should be accessed directly 
104
120 = The method {1}({2}) from the type {0} refers to the missing type {3}
104
120 = The method {1}({2}) from the type {0} refers to the missing type {3}
105
121 = The method {1}({2}) from the type {0} can be declared as static
105
106
106
129 = The constructor {0}({1}) refers to the missing type {2}
107
129 = The constructor {0}({1}) refers to the missing type {2}
107
130 = The constructor {0}({1}) is undefined
108
130 = The constructor {0}({1}) is undefined
(-)formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java (+1 lines)
Lines 338-343 Link Here
338
			optionsMap.put(CompilerOptions.OPTION_ReportSpecialParameterHidingField, CompilerOptions.DISABLED);
338
			optionsMap.put(CompilerOptions.OPTION_ReportSpecialParameterHidingField, CompilerOptions.DISABLED);
339
			optionsMap.put(CompilerOptions.OPTION_MaxProblemPerUnit, String.valueOf(100));
339
			optionsMap.put(CompilerOptions.OPTION_MaxProblemPerUnit, String.valueOf(100));
340
			optionsMap.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.DISABLED);
340
			optionsMap.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.DISABLED);
341
			optionsMap.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.IGNORE);
341
			this.defaultCompilerOptions = optionsMap;
342
			this.defaultCompilerOptions = optionsMap;
342
		}
343
		}
343
		Object sourceOption = this.options.get(CompilerOptions.OPTION_Source);
344
		Object sourceOption = this.options.get(CompilerOptions.OPTION_Source);
(-)model/org/eclipse/jdt/core/JavaCore.java (+13 lines)
Lines 1314-1319 Link Here
1314
	 */
1314
	 */
1315
	public static final String COMPILER_PB_PARAMETER_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.parameterAssignment"; //$NON-NLS-1$
1315
	public static final String COMPILER_PB_PARAMETER_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.parameterAssignment"; //$NON-NLS-1$
1316
	/**
1316
	/**
1317
	 * Compiler option ID: Reporting potentially static method not declared static.
1318
	 * <p>When enabled, the compiler will issue an error or a warning if a method has
1319
	 *    not be declared as <code>static</code>, even though it qualifies as one.
1320
	 * <dl>
1321
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic"</code></dd>
1322
	 * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
1323
	 * <dt>Default:</dt><dd><code>"ignore"</code></dd>
1324
	 * </dl>
1325
	 * @since 3.7
1326
	 * @category CompilerOptionID
1327
	 */
1328
	public static final String COMPILER_PB_METHOD_CAN_BE_STATIC = PLUGIN_ID + ".compiler.problem.reportMethodCanBeStatic"; //$NON-NLS-1$
1329
	/**
1317
	 * Compiler option ID: Setting Source Compatibility Mode.
1330
	 * Compiler option ID: Setting Source Compatibility Mode.
1318
	 * <p>Specify whether which source level compatibility is used. From 1.4 on, <code>'assert'</code> is a keyword
1331
	 * <p>Specify whether which source level compatibility is used. From 1.4 on, <code>'assert'</code> is a keyword
1319
	 *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
1332
	 *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-10 / +50 lines)
Lines 47-53 Link Here
47
	private static final Main MAIN = new Main(null/*outWriter*/, null/*errWriter*/, false/*systemExit*/, null/*options*/, null/*progress*/);
47
	private static final Main MAIN = new Main(null/*outWriter*/, null/*errWriter*/, false/*systemExit*/, null/*options*/, null/*progress*/);
48
48
49
	static {
49
	static {
50
//		TESTS_NAMES = new String[] { "test292_warn_options" };
50
//		TESTS_NAMES = new String[] { "test294_warn_options" };
51
//		TESTS_NUMBERS = new int[] { 306 };
51
//		TESTS_NUMBERS = new int[] { 306 };
52
//		TESTS_RANGE = new int[] { 298, -1 };
52
//		TESTS_RANGE = new int[] { 298, -1 };
53
	}
53
	}
Lines 830-837 Link Here
830
	abstract String expected(); // for use in JUnit comparison framework
830
	abstract String expected(); // for use in JUnit comparison framework
831
}
831
}
832
static class StringMatcher extends Matcher {
832
static class StringMatcher extends Matcher {
833
	private String expected;
833
	private final String expected;
834
	private Normalizer normalizer;
834
	private final Normalizer normalizer;
835
	StringMatcher(String expected, Normalizer normalizer) {
835
	StringMatcher(String expected, Normalizer normalizer) {
836
		this.expected = expected;
836
		this.expected = expected;
837
		this.normalizer = normalizer;
837
		this.normalizer = normalizer;
Lines 850-856 Link Here
850
	}
850
	}
851
}
851
}
852
static class SubstringMatcher extends Matcher {
852
static class SubstringMatcher extends Matcher {
853
	private String substring;
853
	private final String substring;
854
	SubstringMatcher(String substring) {
854
	SubstringMatcher(String substring) {
855
		this.substring = substring;
855
		this.substring = substring;
856
	}
856
	}
Lines 878-884 Link Here
878
	 * here, that is {@link #normalized(String) normalized}.
878
	 * here, that is {@link #normalized(String) normalized}.
879
	 */
879
	 */
880
	private static abstract class Normalizer {
880
	private static abstract class Normalizer {
881
		private Normalizer nextInChain;
881
		private final Normalizer nextInChain;
882
		Normalizer(Normalizer nextInChain) {
882
		Normalizer(Normalizer nextInChain) {
883
			this.nextInChain = nextInChain;
883
			this.nextInChain = nextInChain;
884
		}
884
		}
Lines 897-905 Link Here
897
	 * placeholder.
897
	 * placeholder.
898
	 */
898
	 */
899
	private static class StringNormalizer extends Normalizer {
899
	private static class StringNormalizer extends Normalizer {
900
		private String match;
900
		private final String match;
901
		private int matchLength;
901
		private final int matchLength;
902
		private String placeholder;
902
		private final String placeholder;
903
		StringNormalizer(Normalizer nextInChain, String match, String placeholder) {
903
		StringNormalizer(Normalizer nextInChain, String match, String placeholder) {
904
			super(nextInChain);
904
			super(nextInChain);
905
			this.match = match;
905
			this.match = match;
Lines 973-979 Link Here
973
	 * This normalizer removes a selected range of lines from a log file.
973
	 * This normalizer removes a selected range of lines from a log file.
974
	 */
974
	 */
975
	private static class LinesRangeNormalizer extends Normalizer {
975
	private static class LinesRangeNormalizer extends Normalizer {
976
		private int first, number;
976
		private final int first;
977
		private int number;
977
978
978
		LinesRangeNormalizer() {
979
		LinesRangeNormalizer() {
979
			super(null);
980
			super(null);
Lines 1704-1709 Link Here
1704
        "      semicolon            unnecessary semicolon, empty statement\n" + 
1705
        "      semicolon            unnecessary semicolon, empty statement\n" + 
1705
        "      serial             + missing serialVersionUID\n" + 
1706
        "      serial             + missing serialVersionUID\n" + 
1706
        "      specialParamHiding   constructor or setter parameter hiding a field\n" + 
1707
        "      specialParamHiding   constructor or setter parameter hiding a field\n" + 
1708
        "      static-method        method can be declared as static\n" + 
1707
        "      static-access        macro for indirectStatic and staticReceiver\n" + 
1709
        "      static-access        macro for indirectStatic and staticReceiver\n" + 
1708
        "      staticReceiver     + non-static reference to static member\n" + 
1710
        "      staticReceiver     + non-static reference to static member\n" + 
1709
        "      super                overriding a method without making a super invocation\n" + 
1711
        "      super                overriding a method without making a super invocation\n" + 
Lines 1730-1736 Link Here
1730
        "      unusedTypeArgs     + unused type arguments for method\n" + 
1732
        "      unusedTypeArgs     + unused type arguments for method\n" + 
1731
        "      uselessTypeCheck     unnecessary cast/instanceof operation\n" + 
1733
        "      uselessTypeCheck     unnecessary cast/instanceof operation\n" + 
1732
        "      varargsCast        + varargs argument need explicit cast\n" + 
1734
        "      varargsCast        + varargs argument need explicit cast\n" + 
1733
        "      warningToken       + unsupported or unnecessary @SuppressWarnings\n" + 
1735
        "      warningToken       + unsupported or unnecessary @SuppressWarnings\n" +
1734
        "\n";
1736
        "\n";
1735
	String expandedExpectedOutput =
1737
	String expandedExpectedOutput =
1736
		MessageFormat.format(expectedOutput, new String[] {
1738
		MessageFormat.format(expectedOutput, new String[] {
Lines 1856-1861 Link Here
1856
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + 
1858
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + 
1857
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + 
1859
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + 
1858
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + 
1860
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + 
1861
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic\" value=\"ignore\"/>\n" + 
1859
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + 
1862
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + 
1860
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + 
1863
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + 
1861
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors\" value=\"disabled\"/>\n" + 
1864
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors\" value=\"disabled\"/>\n" + 
Lines 11194-11199 Link Here
11194
		"4 problems (4 warnings)", 
11197
		"4 problems (4 warnings)", 
11195
		true);
11198
		true);
11196
}
11199
}
11200
11201
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
11202
// -warn option - regression test to check option static-method
11203
// Method can be static warning should be given
11204
public void test294_warn_options() {
11205
	this.runConformTest(
11206
		new String[] {
11207
			"X.java",
11208
			"public class X {\n" +
11209
			"	public static int field1;\n" +
11210
			"	public static int field2;\n" + 
11211
			"	public void bar(int i) {\n" + 
11212
			"		System.out.println(foo());\n" +
11213
			"		foo();" +
11214
			"		System.out.println(X.field1);\n" +
11215
			"		System.out.println(field2);\n" +
11216
			"		field2 = 1;\n" +
11217
			"	}\n" + 
11218
			"	private static String foo() {\n" + 
11219
			"		return null;\n" + 
11220
			"	}\n" + 
11221
			"}",
11222
		},
11223
		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
11224
		+ " -sourcepath \"" + OUTPUT_DIR + "\""
11225
		+ " -warn:static-method -proc:none -d \"" + OUTPUT_DIR + "\"",
11226
		"",
11227
		"----------\n" + 
11228
		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" + 
11229
		"	public void bar(int i) {\n" + 
11230
		"	            ^^^^^^^^^^\n" + 
11231
		"The method bar(int) from the type X can be declared as static\n" + 
11232
		"----------\n" + 
11233
		"1 problem (1 warning)", 
11234
		true);
11235
}
11236
11197
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784
11237
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784
11198
public void test293(){
11238
public void test293(){
11199
	createCascadedJars();
11239
	createCascadedJars();
(-)src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (+2 lines)
Lines 655-660 Link Here
655
		expectedProblemAttributes.put("LocalVariableMayBeNull", DEPRECATED);
655
		expectedProblemAttributes.put("LocalVariableMayBeNull", DEPRECATED);
656
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
656
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
657
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
657
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
658
		expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
658
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
659
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
659
		expectedProblemAttributes.put("MethodMustOverride", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
660
		expectedProblemAttributes.put("MethodMustOverride", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
660
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
661
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
Lines 1290-1295 Link Here
1290
		expectedProblemAttributes.put("LocalVariableMayBeNull", SKIP);
1291
		expectedProblemAttributes.put("LocalVariableMayBeNull", SKIP);
1291
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
1292
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
1292
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME));
1293
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME));
1294
		expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(JavaCore.COMPILER_PB_METHOD_CAN_BE_STATIC));
1293
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION));
1295
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION));
1294
		expectedProblemAttributes.put("MethodMustOverride", SKIP);
1296
		expectedProblemAttributes.put("MethodMustOverride", SKIP);
1295
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", SKIP);
1297
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", SKIP);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java (-1 / +498 lines)
Lines 30-36 Link Here
30
// Static initializer to specify tests subset using TESTS_* static variables
30
// Static initializer to specify tests subset using TESTS_* static variables
31
// All specified tests which does not belong to the class are skipped...
31
// All specified tests which does not belong to the class are skipped...
32
static {
32
static {
33
//		TESTS_NAMES = new String[] { "test127" };
33
//		TESTS_NAMES = new String[] { "test114" };
34
//		TESTS_NUMBERS = new int[] { 113 };
34
//		TESTS_NUMBERS = new int[] { 113 };
35
//		TESTS_RANGE = new int[] { 108, -1 };
35
//		TESTS_RANGE = new int[] { 108, -1 };
36
}
36
}
Lines 5887-5890 Link Here
5887
		false,
5887
		false,
5888
		null);
5888
		null);
5889
}
5889
}
5890
5891
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
5892
// QualifiedNameReference, SingleNameReference and MessageSend
5893
// Can be static warning shown
5894
public void test114() {
5895
	Map compilerOptions = getCompilerOptions();
5896
	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR);
5897
	this.runNegativeTest(
5898
		new String[] {
5899
			"X.java", 
5900
			"public class X {\n" +
5901
			"	public static int field1;\n" +
5902
			"	public static int field2;\n" + 
5903
			"	public void bar(int i) {\n" + 
5904
			"		System.out.println(foo());\n" +
5905
			"		foo();" +
5906
			"		System.out.println(X.field1);\n" +
5907
			"		System.out.println(field2);\n" +
5908
			"		field2 = 1;\n" +
5909
			"	}\n" + 
5910
			"	private static String foo() {\n" + 
5911
			"		return null;\n" + 
5912
			"	}\n" + 
5913
			"}"
5914
		},
5915
		"----------\n" + 
5916
		"1. ERROR in X.java (at line 4)\n" + 
5917
		"	public void bar(int i) {\n" + 
5918
		"	            ^^^^^^^^^^\n" + 
5919
		"The method bar(int) from the type X can be declared as static\n" + 
5920
		"----------\n",
5921
		null /* no extra class libraries */,
5922
		true /* flush output directory */,
5923
		compilerOptions /* custom options */
5924
	);
5925
}
5926
5927
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
5928
// FieldReference and MessageSend
5929
// Can be static warning shown
5930
public void test115() {
5931
	Map compilerOptions = getCompilerOptions();
5932
	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR);
5933
	this.runNegativeTest(
5934
		new String[] {
5935
			"X.java",
5936
			"public class X extends B{\n" +
5937
			"	public static int field1;\n" +
5938
			"	public static int field2;\n" +
5939
			"	public void bar(int i) {\n" + 
5940
			"		System.out.println(foo());\n" +
5941
			"		X.field2 = 2;\n" +
5942
			"		System.out.println(field1);\n" +
5943
			"		A a = new A();\n" +
5944
			"		a.a1();\n" +
5945
			"	}\n" + 
5946
			"	private static String foo() {\n" + 
5947
			"		return null;\n" + 
5948
			"	}\n" + 
5949
			"}\n" +
5950
			"class A{\n" +
5951
			"	public void a1() {\n" +
5952
			"	}\n" +
5953
			"}\n" +
5954
			"class B{\n" +
5955
			"	public void b1(){\n" +
5956
			"	}\n" +
5957
			"}"
5958
		},
5959
		"----------\n" + 
5960
		"1. ERROR in X.java (at line 4)\n" + 
5961
		"	public void bar(int i) {\n" + 
5962
		"	            ^^^^^^^^^^\n" + 
5963
		"The method bar(int) from the type X can be declared as static\n" + 
5964
		"----------\n" + 
5965
		"2. ERROR in X.java (at line 16)\n" + 
5966
		"	public void a1() {\n" + 
5967
		"	            ^^^^\n" + 
5968
		"The method a1() from the type A can be declared as static\n" + 
5969
		"----------\n" + 
5970
		"3. ERROR in X.java (at line 20)\n" + 
5971
		"	public void b1(){\n" + 
5972
		"	            ^^^^\n" + 
5973
		"The method b1() from the type B can be declared as static\n" + 
5974
		"----------\n",
5975
		null /* no extra class libraries */,
5976
		true /* flush output directory */,
5977
		compilerOptions /* custom options */
5978
	);
5979
}
5980
5981
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
5982
// MessageSend in different ways
5983
public void test116a() {
5984
	Map compilerOptions = getCompilerOptions();
5985
	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR);
5986
	compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE);
5987
	this.runNegativeTest(
5988
		new String[] {
5989
			"X.java",
5990
			"public class X extends B{\n" +
5991
			"	public static int field1;\n" +
5992
			"	public X xfield;\n" +
5993
			"	public void bar1(int i) {\n" + 
5994
			"		baz();\n" +
5995
			"	}\n" +
5996
			"	public void bar2(int i) {\n" + 
5997
			"		this.baz();\n" +
5998
			"	}\n" +
5999
			"	public void bar3(int i) {\n" + 
6000
			"		this.xfield.baz();\n" +
6001
			"	}\n" +
6002
			"	public void bar4(int i) {\n" + 
6003
			"		xfield.baz();\n" +
6004
			"	}\n" +
6005
			"	public void bar5(int i) {\n" + 
6006
			"		X x = new X();\n" +
6007
			"		x.baz();\n" +
6008
			"	}\n" +
6009
			"	public void bar6(int i) {\n" + 
6010
			"		A.xA.baz();\n" +
6011
			"	}\n" +
6012
			"	public void bar7(int i) {\n" + 
6013
			"		b1();\n" +
6014
			"	}\n" +
6015
			"	public void bar8(int i) {\n" + 
6016
			"		this.b1();\n" +
6017
			"	}\n" +
6018
			"	public void bar9(int i) {\n" + 
6019
			"		new X().b1();\n" +
6020
			"	}\n" +
6021
			"	public void baz() {\n" +
6022
			"	}\n" + 
6023
			"}\n" +
6024
			"class A{\n" +
6025
			"	public static X xA;\n" +
6026
			"}\n" +
6027
			"class B{\n" +
6028
			"	public void b1(){\n" +
6029
			"	}\n" +
6030
			"}",
6031
		},
6032
		"----------\n" + 
6033
		"1. ERROR in X.java (at line 16)\n" + 
6034
		"	public void bar5(int i) {\n" + 
6035
		"	            ^^^^^^^^^^^\n" + 
6036
		"The method bar5(int) from the type X can be declared as static\n" + 
6037
		"----------\n" + 
6038
		"2. ERROR in X.java (at line 20)\n" + 
6039
		"	public void bar6(int i) {\n" + 
6040
		"	            ^^^^^^^^^^^\n" + 
6041
		"The method bar6(int) from the type X can be declared as static\n" + 
6042
		"----------\n" + 
6043
		"3. ERROR in X.java (at line 29)\n" + 
6044
		"	public void bar9(int i) {\n" + 
6045
		"	            ^^^^^^^^^^^\n" + 
6046
		"The method bar9(int) from the type X can be declared as static\n" + 
6047
		"----------\n" + 
6048
		"4. ERROR in X.java (at line 32)\n" + 
6049
		"	public void baz() {\n" + 
6050
		"	            ^^^^^\n" + 
6051
		"The method baz() from the type X can be declared as static\n" + 
6052
		"----------\n" + 
6053
		"5. ERROR in X.java (at line 39)\n" + 
6054
		"	public void b1(){\n" + 
6055
		"	            ^^^^\n" + 
6056
		"The method b1() from the type B can be declared as static\n" + 
6057
		"----------\n",
6058
		null /* no extra class libraries */,
6059
		true /* flush output directory */,
6060
		compilerOptions /* custom options */
6061
	);
6062
}
6063
6064
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
6065
// MessageSend in different ways, referencing a static method.
6066
public void test116b() {
6067
	Map compilerOptions = getCompilerOptions();
6068
	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR);
6069
	compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE);
6070
	this.runNegativeTest(
6071
		new String[] {
6072
			"X.java",
6073
			"public class X extends B{\n" +
6074
			"	public static int field1;\n" +
6075
			"	public static X xfield;\n" +
6076
			"	public void bar1(int i) {\n" + 
6077
			"		baz();\n" +
6078
			"	}\n" +
6079
			"	public void bar2(int i) {\n" + 
6080
			"		this.baz();\n" +
6081
			"	}\n" +
6082
			"	public void bar3(int i) {\n" + 
6083
			"		this.xfield.baz();\n" +
6084
			"	}\n" +
6085
			"	public void bar4(int i) {\n" + 
6086
			"		xfield.baz();\n" +
6087
			"	}\n" +
6088
			"	public void bar5(int i) {\n" + 
6089
			"		X x = new X();\n" +
6090
			"		x.baz();\n" +
6091
			"	}\n" +
6092
			"	public void bar6(int i) {\n" + 
6093
			"		A.xA.baz();\n" +
6094
			"	}\n" +
6095
			"	public void bar7(int i) {\n" + 
6096
			"		b1();\n" +
6097
			"	}\n" +
6098
			"	public void bar8(int i) {\n" + 
6099
			"		this.b1();\n" +
6100
			"	}\n" +
6101
			"	public void bar9(int i) {\n" + 
6102
			"		new X().b1();\n" +
6103
			"	}\n" +
6104
			"	public static void baz() {\n" +
6105
			"	}\n" + 
6106
			"}\n" +
6107
			"class A{\n" +
6108
			"	public static X xA;\n" +
6109
			"}\n" +
6110
			"class B{\n" +
6111
			"	public static void b1(){\n" +
6112
			"	}\n" +
6113
			"}",
6114
		},
6115
		"----------\n" + 
6116
		"1. ERROR in X.java (at line 4)\n" + 
6117
		"	public void bar1(int i) {\n" + 
6118
		"	            ^^^^^^^^^^^\n" + 
6119
		"The method bar1(int) from the type X can be declared as static\n" + 
6120
		"----------\n" + 
6121
		"2. ERROR in X.java (at line 13)\n" + 
6122
		"	public void bar4(int i) {\n" + 
6123
		"	            ^^^^^^^^^^^\n" + 
6124
		"The method bar4(int) from the type X can be declared as static\n" + 
6125
		"----------\n" + 
6126
		"3. ERROR in X.java (at line 16)\n" + 
6127
		"	public void bar5(int i) {\n" + 
6128
		"	            ^^^^^^^^^^^\n" + 
6129
		"The method bar5(int) from the type X can be declared as static\n" + 
6130
		"----------\n" + 
6131
		"4. ERROR in X.java (at line 20)\n" + 
6132
		"	public void bar6(int i) {\n" + 
6133
		"	            ^^^^^^^^^^^\n" + 
6134
		"The method bar6(int) from the type X can be declared as static\n" + 
6135
		"----------\n" + 
6136
		"5. ERROR in X.java (at line 23)\n" + 
6137
		"	public void bar7(int i) {\n" + 
6138
		"	            ^^^^^^^^^^^\n" + 
6139
		"The method bar7(int) from the type X can be declared as static\n" + 
6140
		"----------\n" + 
6141
		"6. ERROR in X.java (at line 29)\n" + 
6142
		"	public void bar9(int i) {\n" + 
6143
		"	            ^^^^^^^^^^^\n" + 
6144
		"The method bar9(int) from the type X can be declared as static\n" + 
6145
		"----------\n",
6146
		null /* no extra class libraries */,
6147
		true /* flush output directory */,
6148
		compilerOptions /* custom options */
6149
	);
6150
}
6151
6152
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
6153
// Referring a field in different ways, accessing non-static field.
6154
public void test117a() {
6155
	Map compilerOptions = getCompilerOptions();
6156
	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR);
6157
	compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE);
6158
	this.runNegativeTest(
6159
		new String[] {
6160
			"X.java",
6161
			"public class X extends B{\n" +
6162
			"	public int field1;\n" +
6163
			"	public X xfield;\n" +
6164
			"	public void bar1(int i) {\n" + 
6165
			"		field1 = 1;\n" +
6166
			"	}\n" +
6167
			"	public void bar2(int i) {\n" + 
6168
			"		this.field1 = 1;\n" +
6169
			"	}\n" +
6170
			"	public void bar3(int i) {\n" + 
6171
			"		System.out.println(field1);\n" +
6172
			"	}\n" +
6173
			"	public void bar4(int i) {\n" + 
6174
			"		System.out.println(this.field1);\n" +
6175
			"	}\n" +
6176
			"	public void bar5(int i) {\n" + 
6177
			"		X x = new X();\n" +
6178
			"		x.field1 = 1;\n" +
6179
			"	}\n" +
6180
			"	public void bar6(int i) {\n" + 
6181
			"		A.xA.field1 = 1;\n" +
6182
			"	}\n" +
6183
			"	public void bar7(int i) {\n" + 
6184
			"		b1 = 1;\n" +
6185
			"	}\n" +
6186
			"	public void bar8(int i) {\n" + 
6187
			"		this.b1 = 1;\n" +
6188
			"	}\n" +
6189
			"	public void bar9(int i) {\n" + 
6190
			"		new X().b1 = 1;\n" +
6191
			"	}\n" +
6192
			"	public void bar10(int i) {\n" + 
6193
			"		this.xfield.field1 = 1;\n" +
6194
			"	}\n" +
6195
			"	public void bar11(int i) {\n" + 
6196
			"		System.out.println(this.xfield.field1);\n" +
6197
			"	}\n" +
6198
			"	public void bar12(int i) {\n" + 
6199
			"		System.out.println(new X().b1);\n" +
6200
			"	}\n" +
6201
			"	public void bar13(int i) {\n" + 
6202
			"		System.out.println(b1);\n" +
6203
			"	}\n" +
6204
			"	public void bar14(int i) {\n" + 
6205
			"		System.out.println(this.b1);\n" +
6206
			"	}\n" +
6207
			"	public void bar15(int i) {\n" + 
6208
			"		xfield.field1 = 1;\n" +
6209
			"	}\n" +
6210
			"	public void bar16(int i) {\n" + 
6211
			"		System.out.println(xfield.field1);\n" +
6212
			"	}\n" +
6213
			"	public void baz() {\n" +
6214
			"	}\n" + 
6215
			"}\n" +
6216
			"class A{\n" +
6217
			"	public static X xA;\n" +
6218
			"}\n" +
6219
			"class B{\n" +
6220
			"	public int b1;\n" +
6221
			"}",
6222
		},
6223
		"----------\n" + 
6224
		"1. ERROR in X.java (at line 16)\n" + 
6225
		"	public void bar5(int i) {\n" + 
6226
		"	            ^^^^^^^^^^^\n" + 
6227
		"The method bar5(int) from the type X can be declared as static\n" + 
6228
		"----------\n" + 
6229
		"2. ERROR in X.java (at line 20)\n" + 
6230
		"	public void bar6(int i) {\n" + 
6231
		"	            ^^^^^^^^^^^\n" + 
6232
		"The method bar6(int) from the type X can be declared as static\n" + 
6233
		"----------\n" + 
6234
		"3. ERROR in X.java (at line 29)\n" + 
6235
		"	public void bar9(int i) {\n" + 
6236
		"	            ^^^^^^^^^^^\n" + 
6237
		"The method bar9(int) from the type X can be declared as static\n" + 
6238
		"----------\n" + 
6239
		"4. ERROR in X.java (at line 38)\n" + 
6240
		"	public void bar12(int i) {\n" + 
6241
		"	            ^^^^^^^^^^^^\n" + 
6242
		"The method bar12(int) from the type X can be declared as static\n" + 
6243
		"----------\n" + 
6244
		"5. ERROR in X.java (at line 53)\n" + 
6245
		"	public void baz() {\n" + 
6246
		"	            ^^^^^\n" + 
6247
		"The method baz() from the type X can be declared as static\n" + 
6248
		"----------\n",
6249
		null /* no extra class libraries */,
6250
		true /* flush output directory */,
6251
		compilerOptions /* custom options */
6252
	);
6253
}
6254
6255
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
6256
// Referring a field in different ways, accessing non-static field.
6257
public void test117b() {
6258
	Map compilerOptions = getCompilerOptions();
6259
	compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR);
6260
	compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE);
6261
	this.runNegativeTest(
6262
		new String[] {
6263
			"X.java",
6264
			"public class X extends B{\n" +
6265
			"	public static int field1;\n" +
6266
			"	public static X xfield;\n" +
6267
			"	public void bar1(int i) {\n" + 
6268
			"		field1 = 1;\n" +
6269
			"	}\n" +
6270
			"	public void bar2(int i) {\n" + 
6271
			"		this.field1 = 1;\n" +
6272
			"	}\n" +
6273
			"	public void bar3(int i) {\n" + 
6274
			"		System.out.println(field1);\n" +
6275
			"	}\n" +
6276
			"	public void bar4(int i) {\n" + 
6277
			"		System.out.println(this.field1);\n" +
6278
			"	}\n" +
6279
			"	public void bar5(int i) {\n" + 
6280
			"		X x = new X();\n" +
6281
			"		x.field1 = 1;\n" +
6282
			"	}\n" +
6283
			"	public void bar6(int i) {\n" + 
6284
			"		A.xA.field1 = 1;\n" +
6285
			"	}\n" +
6286
			"	public void bar7(int i) {\n" + 
6287
			"		b1 = 1;\n" +
6288
			"	}\n" +
6289
			"	public void bar8(int i) {\n" + 
6290
			"		this.b1 = 1;\n" +
6291
			"	}\n" +
6292
			"	public void bar9(int i) {\n" + 
6293
			"		new X().b1 = 1;\n" +
6294
			"	}\n" +
6295
			"	public void bar10(int i) {\n" + 
6296
			"		this.xfield.field1 = 1;\n" +
6297
			"	}\n" +
6298
			"	public void bar11(int i) {\n" + 
6299
			"		System.out.println(this.xfield.field1);\n" +
6300
			"	}\n" +
6301
			"	public void bar12(int i) {\n" + 
6302
			"		System.out.println(new X().b1);\n" +
6303
			"	}\n" +
6304
			"	public void bar13(int i) {\n" + 
6305
			"		System.out.println(b1);\n" +
6306
			"	}\n" +
6307
			"	public void bar14(int i) {\n" + 
6308
			"		System.out.println(this.b1);\n" +
6309
			"	}\n" +
6310
			"	public void bar15(int i) {\n" + 
6311
			"		xfield.field1 = 1;\n" +
6312
			"	}\n" +
6313
			"	public void bar16(int i) {\n" + 
6314
			"		System.out.println(xfield.field1);\n" +
6315
			"	}\n" +
6316
			"	public void baz() {\n" +
6317
			"	}\n" + 
6318
			"}\n" +
6319
			"class A{\n" +
6320
			"	public static X xA;\n" +
6321
			"}\n" +
6322
			"class B{\n" +
6323
			"	public static int b1;\n" +
6324
			"}",
6325
		},
6326
		"----------\n" + 
6327
		"1. ERROR in X.java (at line 4)\n" + 
6328
		"	public void bar1(int i) {\n" + 
6329
		"	            ^^^^^^^^^^^\n" + 
6330
		"The method bar1(int) from the type X can be declared as static\n" + 
6331
		"----------\n" + 
6332
		"2. ERROR in X.java (at line 10)\n" + 
6333
		"	public void bar3(int i) {\n" + 
6334
		"	            ^^^^^^^^^^^\n" + 
6335
		"The method bar3(int) from the type X can be declared as static\n" + 
6336
		"----------\n" + 
6337
		"3. ERROR in X.java (at line 16)\n" + 
6338
		"	public void bar5(int i) {\n" + 
6339
		"	            ^^^^^^^^^^^\n" + 
6340
		"The method bar5(int) from the type X can be declared as static\n" + 
6341
		"----------\n" + 
6342
		"4. ERROR in X.java (at line 20)\n" + 
6343
		"	public void bar6(int i) {\n" + 
6344
		"	            ^^^^^^^^^^^\n" + 
6345
		"The method bar6(int) from the type X can be declared as static\n" + 
6346
		"----------\n" + 
6347
		"5. ERROR in X.java (at line 23)\n" + 
6348
		"	public void bar7(int i) {\n" + 
6349
		"	            ^^^^^^^^^^^\n" + 
6350
		"The method bar7(int) from the type X can be declared as static\n" + 
6351
		"----------\n" + 
6352
		"6. ERROR in X.java (at line 29)\n" + 
6353
		"	public void bar9(int i) {\n" + 
6354
		"	            ^^^^^^^^^^^\n" + 
6355
		"The method bar9(int) from the type X can be declared as static\n" + 
6356
		"----------\n" + 
6357
		"7. ERROR in X.java (at line 38)\n" + 
6358
		"	public void bar12(int i) {\n" + 
6359
		"	            ^^^^^^^^^^^^\n" + 
6360
		"The method bar12(int) from the type X can be declared as static\n" + 
6361
		"----------\n" + 
6362
		"8. ERROR in X.java (at line 41)\n" + 
6363
		"	public void bar13(int i) {\n" + 
6364
		"	            ^^^^^^^^^^^^\n" + 
6365
		"The method bar13(int) from the type X can be declared as static\n" + 
6366
		"----------\n" + 
6367
		"9. ERROR in X.java (at line 47)\n" + 
6368
		"	public void bar15(int i) {\n" + 
6369
		"	            ^^^^^^^^^^^^\n" + 
6370
		"The method bar15(int) from the type X can be declared as static\n" + 
6371
		"----------\n" + 
6372
		"10. ERROR in X.java (at line 50)\n" + 
6373
		"	public void bar16(int i) {\n" + 
6374
		"	            ^^^^^^^^^^^^\n" + 
6375
		"The method bar16(int) from the type X can be declared as static\n" + 
6376
		"----------\n" + 
6377
		"11. ERROR in X.java (at line 53)\n" + 
6378
		"	public void baz() {\n" + 
6379
		"	            ^^^^^\n" + 
6380
		"The method baz() from the type X can be declared as static\n" + 
6381
		"----------\n",
6382
		null /* no extra class libraries */,
6383
		true /* flush output directory */,
6384
		compilerOptions /* custom options */
6385
	);
6386
}
5890
}
6387
}
(-)guide/jdt_api_options.htm (+15 lines)
Lines 666-671 Link Here
666
</tr>
666
</tr>
667
667
668
<tr>
668
<tr>
669
<td colspan=2><b>Reporting that a method can be declared static</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_METHOD_CAN_BE_STATIC">COMPILER_PB_METHOD_CAN_BE_STATIC</a></b>)</td>
670
</tr>
671
<tr valign="top">
672
<td rowspan=3>When enabled, the compiler will issue an error or a warning if a method has
673
not be declared as <code>static</code>, even though it qualifies as one.</td>
674
<td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#ERROR">ERROR</a></b></td>
675
</tr>
676
<tr valign="top">
677
<td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#WARNING">WARNING</a></b></td>
678
</tr>
679
<tr valign="top">
680
<td><b><i><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#IGNORE">IGNORE</a></i></b></td>
681
</tr>
682
683
<tr>
669
<td colspan=2><b>Reporting Method With Constructor Name</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME">COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME</a></b>)</td>
684
<td colspan=2><b>Reporting Method With Constructor Name</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME">COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME</a></b>)</td>
670
</tr>
685
</tr>
671
<tr valign="top">
686
<tr valign="top">

Return to bug 318682