Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 183376 Details for
Bug 330556
[typing] Indentation is messed up on paste
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
code snippet to paste in JE
typing bug.txt (text/plain), 4.50 KB, created by
Deepak Azad
on 2010-11-18 07:21:47 EST
(
hide
)
Description:
code snippet to paste in JE
Filename:
MIME Type:
Creator:
Deepak Azad
Created:
2010-11-18 07:21:47 EST
Size:
4.50 KB
patch
obsolete
>// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682 >// Referring a field in different ways, accessing non-static field. >public void test117b() { > Map compilerOptions = getCompilerOptions(); > compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBeStatic, CompilerOptions.ERROR); > compilerOptions.put(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, CompilerOptions.ERROR); > compilerOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); > this.runNegativeTest( > new String[] { > "X.java", > "public class X extends B{\n" + > " public static int field1;\n" + > " public static X xfield;\n" + > " public void bar1(int i) {\n" + > " field1 = 1;\n" + > " }\n" + > " public void bar2(int i) {\n" + > " this.field1 = 1;\n" + > " }\n" + > " public void bar3(int i) {\n" + > " System.out.println(field1);\n" + > " }\n" + > " public void bar4(int i) {\n" + > " System.out.println(this.field1);\n" + > " }\n" + > " public void bar5(int i) {\n" + > " X x = new X();\n" + > " x.field1 = 1;\n" + > " }\n" + > " public void bar6(int i) {\n" + > " A.xA.field1 = 1;\n" + > " }\n" + > " public void bar7(int i) {\n" + > " b1 = 1;\n" + > " }\n" + > " public void bar8(int i) {\n" + > " this.b1 = 1;\n" + > " }\n" + > " public void bar9(int i) {\n" + > " new X().b1 = 1;\n" + > " }\n" + > " public void bar10(int i) {\n" + > " this.xfield.field1 = 1;\n" + > " }\n" + > " public void bar11(int i) {\n" + > " System.out.println(this.xfield.field1);\n" + > " }\n" + > " public void bar12(int i) {\n" + > " System.out.println(new X().b1);\n" + > " }\n" + > " public void bar13(int i) {\n" + > " System.out.println(b1);\n" + > " }\n" + > " public void bar14(int i) {\n" + > " System.out.println(this.b1);\n" + > " }\n" + > " public void bar15(int i) {\n" + > " xfield.field1 = 1;\n" + > " }\n" + > " public void bar16(int i) {\n" + > " System.out.println(xfield.field1);\n" + > " }\n" + > " public void baz() {\n" + > " }\n" + > "}\n" + > "class A{\n" + > " public static X xA;\n" + > "}\n" + > "class B{\n" + > " public static int b1;\n" + > "}", > }, > "----------\n" + > "1. ERROR in X.java (at line 4)\n" + > " public void bar1(int i) {\n" + > " ^^^^^^^^^^^\n" + > "The method bar1(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "2. ERROR in X.java (at line 10)\n" + > " public void bar3(int i) {\n" + > " ^^^^^^^^^^^\n" + > "The method bar3(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "3. ERROR in X.java (at line 16)\n" + > " public void bar5(int i) {\n" + > " ^^^^^^^^^^^\n" + > "The method bar5(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "4. ERROR in X.java (at line 20)\n" + > " public void bar6(int i) {\n" + > " ^^^^^^^^^^^\n" + > "The method bar6(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "5. ERROR in X.java (at line 23)\n" + > " public void bar7(int i) {\n" + > " ^^^^^^^^^^^\n" + > "The method bar7(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "6. ERROR in X.java (at line 29)\n" + > " public void bar9(int i) {\n" + > " ^^^^^^^^^^^\n" + > "The method bar9(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "7. ERROR in X.java (at line 38)\n" + > " public void bar12(int i) {\n" + > " ^^^^^^^^^^^^\n" + > "The method bar12(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "8. ERROR in X.java (at line 41)\n" + > " public void bar13(int i) {\n" + > " ^^^^^^^^^^^^\n" + > "The method bar13(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "9. ERROR in X.java (at line 47)\n" + > " public void bar15(int i) {\n" + > " ^^^^^^^^^^^^\n" + > "The method bar15(int) from the type X can potentially be declared as static\n" + > "----------\n" + > "10. ERROR in X.java (at line 50)\n" + > " public void bar16(int i) {\n" + > " ^^^^^^^^^^^^\n" + > "The method bar16(int) from the type X can potentially be declared as static\n" + > "----------\n", > null /* no extra class libraries */, > true /* flush output directory */, > compilerOptions /* custom options */ > ); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 330556
: 183376 |
183642
|
183875
|
184050
|
184229
|
184390