Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use real type for enclosing class #3288

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {

}
}