Community
Participate
Working Groups
I20080702-0939 public class Try { //Illegal modifier for the method Try.Try(): public synchronized Try(int a) { } //Illegal modifier for the method Try.Try(): public final static Try() { } //Illegal modifier for the method m.Try(): public volatile void m() { } //Illegal modifier for the field fField; only public, protected, // private, static, final, transient & volatile are permitted public synchronized int fField; } The errors for illegal modifiers on methods and constructors are a bit odd: - Range is the method & parameter list => Expected: The actually illegal modifier - Talk about method even for constructors - Would be nice if they listed the allowed modifiers (as in the error for fields)
One more: - "... for the method m.Try()" => should be Try.m()
Created attachment 109995 [details] Proposed patch with testcase
Released for 3.5M2
When you set 3.4 as API Baseline (and everyone should do this), you get an error for the missing @since 3.5 tag on org.eclipse.jdt.core.compiler.IProblem.IllegalModifierForConstructor.
Adapted quick fix "Remove invalid modifiers" to new API in HEAD.
Added since 3.5 tag thanks Markus
3 problems were reported in comment 0: - range problem (not fixed) - odd message (fixed) - request to list allowed modifiers (fixed) Marking verified for 3.5M2 using I20080914-2000. Markus, please open a separate bug for the range problem if this is important to you.