mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 08:18:29 +00:00
Merge pull request #2743 from Rawi01/extension-method-chain
Handle inner method invocations first
This commit is contained in:
4 files changed
+54
-2
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user