Lines 6868-6871
Link Here
|
6868 |
compilerOptions /* custom options */ |
6868 |
compilerOptions /* custom options */ |
6869 |
); |
6869 |
); |
6870 |
} |
6870 |
} |
|
|
6871 |
|
6872 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=335780 |
6873 |
// For this reference as an argument of a message send, method can't be static |
6874 |
public void test124a() { |
6875 |
if (this.complianceLevel < ClassFileConstants.JDK1_5) |
6876 |
return; |
6877 |
Map compilerOptions = getCompilerOptions(); |
6878 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR); |
6879 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, CompilerOptions.ERROR); |
6880 |
compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); |
6881 |
this.runNegativeTest( |
6882 |
new String[] { |
6883 |
"X.java", |
6884 |
"public class X {\n" + |
6885 |
" public void method1() {\n" + // don't warn |
6886 |
" Foo.m(this);\n" + |
6887 |
" }\n" + |
6888 |
"static class Foo{\n" + |
6889 |
" static void m(X bug) {\n" + |
6890 |
" \n" + |
6891 |
" }\n" + |
6892 |
"}\n" + |
6893 |
"}" |
6894 |
}, |
6895 |
"", |
6896 |
null /* no extra class libraries */, |
6897 |
true /* flush output directory */, |
6898 |
compilerOptions /* custom options */ |
6899 |
); |
6900 |
} |
6901 |
|
6902 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=335780 |
6903 |
// For this reference as an argument of a message send, method can't be static |
6904 |
public void test124b() { |
6905 |
if (this.complianceLevel < ClassFileConstants.JDK1_5) |
6906 |
return; |
6907 |
Map compilerOptions = getCompilerOptions(); |
6908 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR); |
6909 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, CompilerOptions.ERROR); |
6910 |
compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); |
6911 |
this.runNegativeTest( |
6912 |
new String[] { |
6913 |
"X.java", |
6914 |
"public class X {\n" + |
6915 |
" public static X xField;" + |
6916 |
" public void method1() {\n" + // don't warn |
6917 |
" Foo.m(this.xField);\n" + |
6918 |
" }\n" + |
6919 |
"static class Foo{\n" + |
6920 |
" static void m(X bug) {\n" + |
6921 |
" \n" + |
6922 |
" }\n" + |
6923 |
"}\n" + |
6924 |
"}" |
6925 |
}, |
6926 |
"", |
6927 |
null /* no extra class libraries */, |
6928 |
true /* flush output directory */, |
6929 |
compilerOptions /* custom options */ |
6930 |
); |
6931 |
} |
6871 |
} |
6932 |
} |