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#2648] Reset inference context, remove generic in…
…formation copy In Java >= 8 ecj uses the inference context to resolve the generic information. This one is already set before lombok tries rewrite the method call. Simply copying the information does not cover all the different cases but reseting the inference contexts and running type inference again does.
- Loading branch information
Showing
7 changed files
with
154 additions
and
13 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
33 changes: 33 additions & 0 deletions
33
test/transform/resource/after-delombok/ExtensionMethodGeneric.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,33 @@ | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
class ExtensionMethodGeneric { | ||
public void test() { | ||
List<String> stringList = null; | ||
List<Number> numberList = null; | ||
ExtensionMethodGeneric.Extensions.test(stringList); | ||
ExtensionMethodGeneric.Extensions.test(stringList, numberList); | ||
ExtensionMethodGeneric.Extensions.test(ExtensionMethodGeneric.Extensions.test(stringList, stringList), numberList); | ||
Integer i = ExtensionMethodGeneric.Extensions.test2(stringList); | ||
Map<String, Integer> map = null; | ||
List<String> l = ExtensionMethodGeneric.Extensions.test(map, stringList, numberList); | ||
} | ||
|
||
static class Extensions { | ||
public static <T> List<T> test(List<String> obj, List<T> list) { | ||
return null; | ||
} | ||
|
||
public static <K, V> K test(Map<String, Integer> obj, K k, V v) { | ||
return k; | ||
} | ||
|
||
public static <T> T test(List<T> list) { | ||
return null; | ||
} | ||
|
||
public static <T, U> U test2(List<T> list) { | ||
return null; | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
test/transform/resource/after-ecj/ExtensionMethodGeneric.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,35 @@ | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.experimental.ExtensionMethod; | ||
@ExtensionMethod(ExtensionMethodGeneric.Extensions.class) class ExtensionMethodGeneric { | ||
static class Extensions { | ||
Extensions() { | ||
super(); | ||
} | ||
public static <T>List<T> test(List<String> obj, List<T> list) { | ||
return null; | ||
} | ||
public static <K, V>K test(Map<String, Integer> obj, K k, V v) { | ||
return k; | ||
} | ||
public static <T>T test(List<T> list) { | ||
return null; | ||
} | ||
public static <T, U>U test2(List<T> list) { | ||
return null; | ||
} | ||
} | ||
ExtensionMethodGeneric() { | ||
super(); | ||
} | ||
public void test() { | ||
List<String> stringList = null; | ||
List<Number> numberList = null; | ||
ExtensionMethodGeneric.Extensions.test(stringList); | ||
ExtensionMethodGeneric.Extensions.test(stringList, numberList); | ||
ExtensionMethodGeneric.Extensions.test(ExtensionMethodGeneric.Extensions.test(stringList, stringList), numberList); | ||
Integer i = ExtensionMethodGeneric.Extensions.test2(stringList); | ||
Map<String, Integer> map = null; | ||
List<String> l = ExtensionMethodGeneric.Extensions.test(map, stringList, numberList); | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
test/transform/resource/before/ExtensionMethodGeneric.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,34 @@ | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import lombok.experimental.ExtensionMethod; | ||
|
||
@ExtensionMethod(ExtensionMethodGeneric.Extensions.class) | ||
class ExtensionMethodGeneric { | ||
public void test() { | ||
List<String> stringList = null; | ||
List<Number> numberList = null; | ||
stringList.test(); | ||
stringList.test(numberList); | ||
stringList.test(stringList).test(numberList); | ||
Integer i = stringList.test2(); | ||
|
||
Map<String, Integer> map = null; | ||
List<String> l = map.test(stringList, numberList); | ||
} | ||
|
||
static class Extensions { | ||
public static <T> List<T> test(List<String> obj, List<T> list) { | ||
return null; | ||
} | ||
public static <K,V> K test(Map<String, Integer> obj, K k, V v) { | ||
return k; | ||
} | ||
public static <T> T test(List<T> list) { | ||
return null; | ||
} | ||
public static <T,U> U test2(List<T> list) { | ||
return null; | ||
} | ||
} | ||
} |