Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Issue #89] @Action/@Function/@Predicate and val should play nice...

  • Loading branch information...
commit 5e573c3efb905f04a605d0e84422eb7075bc5a01 1 parent 37f1653
@peichhorn authored
View
5 src/javac/lombok/javac/handlers/HandleActionFunctionAndPredicate.java
@@ -126,6 +126,11 @@ public void handle(final AnnotationValues<? extends java.lang.annotation.Annotat
annotationNode.addError(String.format("@%s more than one template found that matches the given method signature", annotationType));
return;
}
+
+ // call HandleVal explicitly to ensure val gets handled before yield gets handled.
+ // TODO maybe we should prioritize lombok handler
+ method.node().traverse(new HandleVal());
+
new ActionFunctionAndPredicateHandler<JavacType, JavacMethod>().rebuildMethod(method, matchingTemplates.get(0), new JavacParameterValidator(), new JavacParameterSanitizer());
}
View
13 test/transform/resource/after-delombok/FunctionAndVal.java
@@ -0,0 +1,13 @@
+public class FunctionAndVal {
+
+ @java.lang.SuppressWarnings("all")
+ private static lombok.Functions.Function0<String> needsMoreVal() {
+ return new lombok.Functions.Function0<String>(){
+
+ public String apply() {
+ final java.lang.String part = "String";
+ return part;
+ }
+ };
+ }
+}
View
18 test/transform/resource/after-ecj/FunctionAndVal.java
@@ -0,0 +1,18 @@
+import lombok.Function;
+import lombok.val;
+public class FunctionAndVal {
+ private static @Function @java.lang.SuppressWarnings("all") lombok.Functions.Function0<String> needsMoreVal() {
+ return new lombok.Functions.Function0<String>() {
+ x() {
+ super();
+ }
+ public String apply() {
+ final @val java.lang.String part = "String";
+ return part;
+ }
+};
+ }
+ public FunctionAndVal() {
+ super();
+ }
+}
View
11 test/transform/resource/before/FunctionAndVal.java
@@ -0,0 +1,11 @@
+import lombok.Function;
+import lombok.val;
+
+public class FunctionAndVal {
+
+ @Function
+ private static String needsMoreVal() {
+ val part = "String";
+ return part;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.