Lines 7076-7079
Link Here
|
7076 |
compilerOptions /* custom options */ |
7076 |
compilerOptions /* custom options */ |
7077 |
); |
7077 |
); |
7078 |
} |
7078 |
} |
|
|
7079 |
|
7080 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=354502 |
7081 |
// Anonymous class instantiation of a non-static member type, method can't be static |
7082 |
public void test354502() { |
7083 |
if (this.complianceLevel < ClassFileConstants.JDK1_5) |
7084 |
return; |
7085 |
Map compilerOptions = getCompilerOptions(); |
7086 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR); |
7087 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, CompilerOptions.ERROR); |
7088 |
compilerOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE); |
7089 |
this.runNegativeTest( |
7090 |
new String[] { |
7091 |
"X.java", |
7092 |
"public class X {\n" + |
7093 |
" public abstract class Abstract{}\n" + |
7094 |
" public static abstract class Abstract2{}\n" + |
7095 |
" private void method1() {\n" + // don't warn |
7096 |
" new Abstract() {};\n" + |
7097 |
" }\n" + |
7098 |
" private void method2() {\n" + // warn |
7099 |
" new Abstract2() {};\n" + |
7100 |
" }\n" + |
7101 |
"}" |
7102 |
}, |
7103 |
"----------\n" + |
7104 |
"1. ERROR in X.java (at line 7)\n" + |
7105 |
" private void method2() {\n" + |
7106 |
" ^^^^^^^^^\n" + |
7107 |
"The method method2() from the type X can be declared as static\n" + |
7108 |
"----------\n", |
7109 |
null /* no extra class libraries */, |
7110 |
true /* flush output directory */, |
7111 |
compilerOptions /* custom options */ |
7112 |
); |
7113 |
} |
7079 |
} |
7114 |
} |