forked from projectlombok/lombok
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixes projectlombok#2985] Resolve var/val only once in eclipse
- Loading branch information
Showing
14 changed files
with
194 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
test/transform/resource/after-delombok/ValInvalidParameter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
public class ValInvalidParameter { | ||
public void val() { | ||
final java.lang.Object a = a(new NonExistingClass()); | ||
final java.lang.Object b = a(a(new NonExistingClass())); | ||
final java.lang.Object c = nonExisitingMethod(b(1)); | ||
final java.lang.Object d = nonExistingObject.nonExistingMethod(); | ||
final java.lang.Object e = b(1).nonExistingMethod(); | ||
final java.lang.Object f = 1 > 2 ? a(new NonExistingClass()) : a(new NonExistingClass()); | ||
final java.lang.Object g = b2(1); | ||
final java.lang.Integer h = b2(a("a"), a(null)); | ||
final int i = a(a(null)); | ||
} | ||
|
||
public int a(String param) { | ||
return 0; | ||
} | ||
|
||
public int a(Integer param) { | ||
return 0; | ||
} | ||
|
||
public Integer b(int i) { | ||
return i; | ||
} | ||
|
||
public Integer b2(int i, int j) { | ||
return i; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
test/transform/resource/after-ecj/ValInvalidParameter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import lombok.val; | ||
public class ValInvalidParameter { | ||
public ValInvalidParameter() { | ||
super(); | ||
} | ||
public void val() { | ||
final @val java.lang.Object a = a(new NonExistingClass()); | ||
final @val java.lang.Object b = a(a(new NonExistingClass())); | ||
final @val java.lang.Object c = nonExisitingMethod(b(1)); | ||
final @val java.lang.Object d = nonExistingObject.nonExistingMethod(); | ||
final @val java.lang.Object e = b(1).nonExistingMethod(); | ||
final @val java.lang.Object f = ((1 > 2) ? a(new NonExistingClass()) : a(new NonExistingClass())); | ||
final @val java.lang.Object g = b2(1); | ||
final @val java.lang.Object h = b2(a("a"), a(null)); | ||
final @val java.lang.Object i = a(a(null)); | ||
} | ||
public int a(String param) { | ||
return 0; | ||
} | ||
public int a(Integer param) { | ||
return 0; | ||
} | ||
public Integer b(int i) { | ||
return i; | ||
} | ||
public Integer b2(int i, int j) { | ||
return i; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//version :9 | ||
import lombok.val; | ||
|
||
public class ValInvalidParameter { | ||
public void val() { | ||
val a = a(new NonExistingClass()); | ||
val b = a(a(new NonExistingClass())); | ||
val c = nonExisitingMethod(b(1)); | ||
val d = nonExistingObject.nonExistingMethod(); | ||
val e = b(1).nonExistingMethod(); | ||
val f = 1 > 2 ? a(new NonExistingClass()) : a(new NonExistingClass()); | ||
val g = b2(1); | ||
val h = b2(a("a"), a(null)); | ||
val i = a(a(null)); | ||
} | ||
|
||
public int a(String param) { | ||
return 0; | ||
} | ||
|
||
public int a(Integer param) { | ||
return 0; | ||
} | ||
|
||
public Integer b(int i) { | ||
return i; | ||
} | ||
|
||
public Integer b2(int i, int j) { | ||
return i; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/transform/resource/messages-delombok/ValInvalidParameter.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
12 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
6 d cannot be resolved to a variable | ||
10 'val' is not compatible with array initializer expressions. Use the full form (new int[] { ... } instead of just { ... }) | ||
7 d cannot be resolved to a variable | ||
7 d cannot be resolved or is not a field | ||
11 'val' is not compatible with array initializer expressions. Use the full form (new int[] { ... } instead of just { ... }) | ||
11 Type mismatch: cannot convert from String[] to Object |
6 changes: 4 additions & 2 deletions
6
test/transform/resource/messages-ecj/ValInBasicFor.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
7 'val' is not allowed in old-style for loops | ||
7 Type mismatch: cannot convert from int to val | ||
8 'val' is not allowed in old-style for loops | ||
8 Type mismatch: cannot convert from int to val | ||
8 Type mismatch: cannot convert from String to val | ||
8 Type mismatch: cannot convert from double to val |
9 changes: 9 additions & 0 deletions
9
test/transform/resource/messages-ecj/ValInvalidParameter.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
5 NonExistingClass cannot be resolved to a type | ||
6 NonExistingClass cannot be resolved to a type | ||
7 The method nonExisitingMethod(Integer) is undefined for the type ValInvalidParameter | ||
8 nonExistingObject cannot be resolved | ||
9 The method nonExistingMethod() is undefined for the type Integer | ||
10 NonExistingClass cannot be resolved to a type | ||
11 The method b2(int, int) in the type ValInvalidParameter is not applicable for the arguments (int) | ||
12 The method a(String) is ambiguous for the type ValInvalidParameter | ||
13 The method a(String) is ambiguous for the type ValInvalidParameter |
9 changes: 9 additions & 0 deletions
9
test/transform/resource/messages-idempotent/ValInvalidParameter.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
3 cannot find symbol | ||
4 cannot find symbol | ||
5 cannot find symbol | ||
6 cannot find symbol | ||
7 cannot find symbol | ||
8 cannot find symbol | ||
9 method b2 in class ValInvalidParameter cannot be applied to given types; | ||
10 reference to a is ambiguous | ||
11 reference to a is ambiguous |