Merge pull request #3288 from Rawi01/val-default-method

Use real type for enclosing class
This commit is contained in:
Reinier Zwitserloot authored and GitHub committed 2023-01-12 01:50:17 +01:00
commit fd64adb9f0
4 files changed
+51 -2

No files matched your search

+9 -2
View File
@@ -244,8 +244,15 @@ public class JavacResolution {
}
private void attrib(JCTree tree, Env<AttrContext> env) {
if (env.enclClass.type == null) try {
env.enclClass.type = Type.noType;
try {
if (env.enclClass.type == null) {
if (env.enclClass.sym != null) {
env.enclClass.type = env.enclClass.sym.type;
}
}
if (env.enclClass.type == null) {
env.enclClass.type = Type.noType;
}
} catch (Throwable ignore) {
// This addresses issue #1553 which involves JDK9; if it doesn't exist, we probably don't need to set it.
}
@@ -0,0 +1,12 @@
// version :9
class ValSuperDefaultMethod implements Default {
public void test() {
final java.lang.String a = "";
Default.super.method();
}
}
interface Default {
default void method() {
}
}
@@ -0,0 +1,14 @@
import lombok.val;
class ValSuperDefaultMethod implements Default {
ValSuperDefaultMethod() {
super();
}
public void test() {
final @val java.lang.String a = "";
Default.super.method();
}
}
interface Default {
default void method() {
}
}
@@ -0,0 +1,16 @@
// version :9
import lombok.val;
class ValSuperDefaultMethod implements Default {
public void test() {
val a = "";
Default.super.method();
}
}
interface Default {
default void method() {
}
}