Lines 6633-6636
Link Here
|
6633 |
compilerOptions /* custom options */ |
6633 |
compilerOptions /* custom options */ |
6634 |
); |
6634 |
); |
6635 |
} |
6635 |
} |
|
|
6636 |
|
6637 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=335780 |
6638 |
// For this reference as an argument of a message send, method can't be static |
6639 |
public void test124a() { |
6640 |
if (this.complianceLevel < ClassFileConstants.JDK1_5) |
6641 |
return; |
6642 |
Map compilerOptions = getCompilerOptions(); |
6643 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR); |
6644 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, CompilerOptions.ERROR); |
6645 |
compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); |
6646 |
this.runNegativeTest( |
6647 |
new String[] { |
6648 |
"X.java", |
6649 |
"public class X {\n" + |
6650 |
" public void method1() {\n" + // don't warn |
6651 |
" Foo.m(this);\n" + |
6652 |
" }\n" + |
6653 |
"static class Foo{\n" + |
6654 |
" static void m(X bug) {\n" + // warn |
6655 |
" \n" + |
6656 |
" }\n" + |
6657 |
"}\n" + |
6658 |
"}" |
6659 |
}, |
6660 |
"", |
6661 |
null /* no extra class libraries */, |
6662 |
true /* flush output directory */, |
6663 |
compilerOptions /* custom options */ |
6664 |
); |
6665 |
} |
6666 |
|
6667 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=335780 |
6668 |
// For this reference as an argument of a message send, method can't be static |
6669 |
public void test124b() { |
6670 |
if (this.complianceLevel < ClassFileConstants.JDK1_5) |
6671 |
return; |
6672 |
Map compilerOptions = getCompilerOptions(); |
6673 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR); |
6674 |
compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, CompilerOptions.ERROR); |
6675 |
compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); |
6676 |
this.runNegativeTest( |
6677 |
new String[] { |
6678 |
"X.java", |
6679 |
"public class X {\n" + |
6680 |
" public static X xField;" + |
6681 |
" public void method1() {\n" + // don't warn |
6682 |
" Foo.m(this.xField);\n" + |
6683 |
" }\n" + |
6684 |
"static class Foo{\n" + |
6685 |
" static void m(X bug) {\n" + // warn |
6686 |
" \n" + |
6687 |
" }\n" + |
6688 |
"}\n" + |
6689 |
"}" |
6690 |
}, |
6691 |
"", |
6692 |
null /* no extra class libraries */, |
6693 |
true /* flush output directory */, |
6694 |
compilerOptions /* custom options */ |
6695 |
); |
6696 |
} |
6636 |
} |
6697 |
} |