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

Handle right hand side of assignment first #2792

Merged
merged 1 commit into from
Apr 1, 2021
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
2 changes: 1 addition & 1 deletion src/core/lombok/javac/handlers/HandleVal.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private static boolean eq(String typeTreeToString, String key) {
}

@SuppressWarnings("deprecation") @Override
public void visitLocal(JavacNode localNode, JCVariableDecl local) {
public void endVisitLocal(JavacNode localNode, JCVariableDecl local) {
JCTree typeTree = local.vartype;
if (typeTree == null) return;
String typeTreeToString = typeTree.toString();
Expand Down
11 changes: 11 additions & 0 deletions test/transform/resource/after-delombok/ValInLambda.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// version 8:
import java.util.function.Function;
import java.util.function.Supplier;

class ValInLambda {
Runnable foo = (Runnable) () -> {
final int i = 1;
Expand All @@ -24,4 +27,12 @@ public void easyLubLambda() {
} : System.out::println;
};
}

public void inParameter() {
final java.util.function.Function<java.util.function.Supplier<java.lang.String>, java.lang.String> foo = (Function<Supplier<String>, String>) s -> s.get();
final java.lang.String foo2 = foo.apply(() -> {
final java.lang.String bar = "";
return bar;
});
}
}
9 changes: 9 additions & 0 deletions test/transform/resource/after-ecj/ValInLambda.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.function.Function;
import java.util.function.Supplier;
import lombok.val;
class ValInLambda {
Runnable foo = (Runnable) () -> {
Expand All @@ -24,4 +26,11 @@ public void easyLubLambda() {
} : System.out::println);
};
}
public void inParameter() {
final @val java.util.function.Function<java.util.function.Supplier<java.lang.String>, java.lang.String> foo = (Function<Supplier<String>, String>) (<no type> s) -> s.get();
final @val java.lang.String foo2 = foo.apply(() -> {
final @val java.lang.String bar = "";
return bar;
});
}
}
11 changes: 11 additions & 0 deletions test/transform/resource/before/ValInLambda.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// version 8:

import java.util.function.Function;
import java.util.function.Supplier;

import lombok.val;

class ValInLambda {
Expand All @@ -25,4 +28,12 @@ public void easyLubLambda() {
lombok.val fooInner = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println;
};
}

public void inParameter() {
val foo = (Function<Supplier<String>, String>) s -> s.get();
val foo2 = foo.apply(() -> {
val bar = "";
return bar;
});
}
}