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 inner method invocations first #2743

Merged
merged 1 commit into from
Mar 4, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/lombok/javac/handlers/HandleExtensionMethod.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -152,8 +152,9 @@ public void replace() {

@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) {
Expand Down
15 changes: 15 additions & 0 deletions test/transform/resource/after-delombok/ExtensionMethodChain.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
19 changes: 19 additions & 0 deletions test/transform/resource/after-ecj/ExtensionMethodChain.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
17 changes: 17 additions & 0 deletions test/transform/resource/before/ExtensionMethodChain.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}