Last change
on this file was 922, checked in by wouter, 5 months ago |
#316 isInMethod also includes constructor "method". This fixes issue with incoorrect 'self' inside constructor local variables
|
File size:
701 bytes
|
Line | |
---|
1 | package testcode;
|
---|
2 |
|
---|
3 | import org.eclipse.jdt.annotation.NonNull;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Test modifiers: private, public, Tests the self. prefixes that should be
|
---|
7 | * added automatically sometimes. The __ that should be added automatically.
|
---|
8 | *
|
---|
9 | */
|
---|
10 | public class Modifiers {
|
---|
11 | private final double fval;
|
---|
12 | public String string;
|
---|
13 |
|
---|
14 | public Modifiers(@NonNull Double f) {
|
---|
15 | final @NonNull String s = "test";
|
---|
16 | string = s;
|
---|
17 | this.fval = f;
|
---|
18 | }
|
---|
19 |
|
---|
20 | private Double f(int x) {
|
---|
21 | @NonNull
|
---|
22 | Double g = this.fval * 3;
|
---|
23 | return g * 5 + 1;
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public String toString() {
|
---|
28 | return string + f(1).toString();
|
---|
29 | }
|
---|
30 |
|
---|
31 | static public void main(String[] args) {
|
---|
32 | Modifiers m = new Modifiers(1d);
|
---|
33 | System.out.println(m.toString());
|
---|
34 | }
|
---|
35 |
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.