[Bug]: Type reference building logic fails within lambda bodies
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
### Describe the bug
Something seems to go wrong with type reference parsing within method bodies when `extends` is involved. The following fails with the included stack trace:
```java
Launcher.parseClass("""
public class Test {
public static void test() {
final Supplier supplier = () -> {
final Supplier> supplier1 = () -> a -> a;
return supplier1;
};
}
}""");
```
However, each of the following succeed:
```java
Launcher.parseClass("""
public class Test {
public static void test() {
final Supplier supplier = () -> {
final Supplier> supplier1 = () -> a -> a;
return supplier1;
};
}
}""");
```
```java
Launcher.parseClass("""
public class Test {
public static void test() {
final Supplier supplier = () -> {
final Supplier> supplier1 = () -> () -> new Object();
return supplier1;
};
}
}""");
```
```java
Launcher.parseClass("""
public class Test {
public static void test() {
final Supplier> supplier = () -> a -> a;
}
}""");
```
In other words, it only seems to apply with the combination of the local definition being within a lambda, the `extends` being present, and the nested type being parameterized by more than one type (so that it is split on the comma when the outer one is being processed)
### Actual output
```Java
Caused by: spoon.JLSViolation: Not allowed javaletter or keyword in identifier found. See JLS for correct identifier. Identifier: Function
Contributor guide
Assessment
This issue has not been assessed yet.