Skip to content

Commit

Permalink
Merge pull request #3288 from Rawi01/val-default-method
Browse files Browse the repository at this point in the history
Use real type for enclosing class
  • Loading branch information
rzwitserloot authored Jan 12, 2023
2 parents 3c9e477 + ea14879 commit fd64adb
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/lombok/javac/JavacResolution.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,15 @@ public void resolveClassMember(JavacNode node) {
}

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.
}
Expand Down
12 changes: 12 additions & 0 deletions test/transform/resource/after-delombok/ValSuperDefaultMethod.java
Original file line number Diff line number Diff line change
@@ -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() {
}
}
14 changes: 14 additions & 0 deletions test/transform/resource/after-ecj/ValSuperDefaultMethod.java
Original file line number Diff line number Diff line change
@@ -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() {
}
}
16 changes: 16 additions & 0 deletions test/transform/resource/before/ValSuperDefaultMethod.java
Original file line number Diff line number Diff line change
@@ -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() {

}
}

0 comments on commit fd64adb

Please sign in to comment.