aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2021-03-04 21:50:13 +0100
committerGitHub <noreply@github.com>2021-03-04 21:50:13 +0100
commit99d108f8dc9505e324f126bbf99aa9b44a24f7d1 (patch)
treeaf7b43adec646dbc7e3ab019b7295683fc839890
parented4ced1a3bc694f9a9903b5a15b2641236ff2f92 (diff)
parentd42a6fe40eacd8aca9697adda0eed61f66ab7d6c (diff)
downloadlombok-99d108f8dc9505e324f126bbf99aa9b44a24f7d1.tar.gz
lombok-99d108f8dc9505e324f126bbf99aa9b44a24f7d1.tar.bz2
lombok-99d108f8dc9505e324f126bbf99aa9b44a24f7d1.zip
Merge pull request #2743 from Rawi01/extension-method-chain
Handle inner method invocations first
-rw-r--r--src/core/lombok/javac/handlers/HandleExtensionMethod.java5
-rw-r--r--test/transform/resource/after-delombok/ExtensionMethodChain.java15
-rw-r--r--test/transform/resource/after-ecj/ExtensionMethodChain.java19
-rw-r--r--test/transform/resource/before/ExtensionMethodChain.java17
4 files changed, 54 insertions, 2 deletions
diff --git a/src/core/lombok/javac/handlers/HandleExtensionMethod.java b/src/core/lombok/javac/handlers/HandleExtensionMethod.java
index bda8c93a..8d42a82d 100644
--- a/src/core/lombok/javac/handlers/HandleExtensionMethod.java
+++ b/src/core/lombok/javac/handlers/HandleExtensionMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2014 The Project Lombok Authors.
+ * Copyright (C) 2012-2021 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -152,8 +152,9 @@ public class HandleExtensionMethod extends JavacAnnotationHandler<ExtensionMetho
@Override
public Void visitMethodInvocation(final MethodInvocationTree tree, final Void p) {
+ super.visitMethodInvocation(tree, p);
handleMethodCall((JCMethodInvocation) tree);
- return super.visitMethodInvocation(tree, p);
+ return null;
}
private void handleMethodCall(final JCMethodInvocation methodCall) {
diff --git a/test/transform/resource/after-delombok/ExtensionMethodChain.java b/test/transform/resource/after-delombok/ExtensionMethodChain.java
new file mode 100644
index 00000000..77f79dea
--- /dev/null
+++ b/test/transform/resource/after-delombok/ExtensionMethodChain.java
@@ -0,0 +1,15 @@
+import java.util.Arrays;
+import java.util.List;
+
+class ExtensionMethodChain {
+ public void test() {
+ ExtensionMethodChain.Extensions.intValue("1").intValue();
+ }
+
+
+ static class Extensions {
+ public static Integer intValue(String s) {
+ return Integer.valueOf(s);
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ExtensionMethodChain.java b/test/transform/resource/after-ecj/ExtensionMethodChain.java
new file mode 100644
index 00000000..8eda4bf8
--- /dev/null
+++ b/test/transform/resource/after-ecj/ExtensionMethodChain.java
@@ -0,0 +1,19 @@
+import java.util.Arrays;
+import java.util.List;
+import lombok.experimental.ExtensionMethod;
+@ExtensionMethod(ExtensionMethodChain.Extensions.class) class ExtensionMethodChain {
+ static class Extensions {
+ Extensions() {
+ super();
+ }
+ public static Integer intValue(String s) {
+ return Integer.valueOf(s);
+ }
+ }
+ ExtensionMethodChain() {
+ super();
+ }
+ public void test() {
+ ExtensionMethodChain.Extensions.intValue("1").intValue();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/ExtensionMethodChain.java b/test/transform/resource/before/ExtensionMethodChain.java
new file mode 100644
index 00000000..f7960ed4
--- /dev/null
+++ b/test/transform/resource/before/ExtensionMethodChain.java
@@ -0,0 +1,17 @@
+import java.util.Arrays;
+import java.util.List;
+import lombok.experimental.ExtensionMethod;
+
+@ExtensionMethod(ExtensionMethodChain.Extensions.class)
+class ExtensionMethodChain {
+
+ public void test() {
+ "1".intValue().intValue();
+ }
+
+ static class Extensions {
+ public static Integer intValue(String s) {
+ return Integer.valueOf(s);
+ }
+ }
+}