-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[Eclipse 4.27] Lombok ignores lombok.config #3335
Conversation
This could use some early returns https://softwareengineering.stackexchange.com/questions/18454/should-i-return-from-a-function-early-or-use-an-if-statement |
I think this can be simplified by loading I tried the patch and it seems to work, but I'm not sure if the way you store the classloader in the I have thought about this but have not found a perfect solution yet. What we need is some kind of global cache through which we can find the right classloader for the call. We have to consider that it is theoretically possible that a bundle occurs several times. |
@snjeza I was trying to come up with a simpler patch and ended up with this one. It also has the advantage that all the class loading stuff is in the same place. diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
index c7bdbc3..bd318f9 100755
--- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java
+++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
@@ -200,6 +200,13 @@
if (TRANSFORM != null) return;
Main.prependClassLoader(prepend);
+ try {
+ ClassLoader currentClassLoader = Transform.class.getClassLoader();
+ Method prependParentMethod = Util.findMethod(currentClassLoader.getClass(), "prependParent", ClassLoader.class);
+ prependParentMethod.invoke(currentClassLoader, prepend);
+ } catch (Throwable t) {
+ // Ignore
+ }
Class<?> shadowed = Util.shadowLoadClass("lombok.eclipse.TransformEclipseAST");
TRANSFORM = Util.findMethodAnyArgs(shadowed, "transform");
TRANSFORM_SWAPPED = Util.findMethodAnyArgs(shadowed, "transform_swapped");
|
@Rawi01 I have tried your patch. It doesn't fix the issue described at redhat-developer/vscode-java#2887 |
You are right, sorry for wasting your time. I used the Lombok adds a diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
index c7bdbc3..5404ee1 100755
--- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java
+++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
@@ -60,6 +60,8 @@
import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup;
import org.eclipse.jdt.internal.corext.refactoring.structure.MemberVisibilityAdjustor.IncomingMemberVisibilityAdjustment;
+import lombok.permit.Permit;
+
import static lombok.eclipse.EcjAugments.ASTNode_generatedBy;
/** These contain a mix of the following:
@@ -200,6 +202,13 @@
if (TRANSFORM != null) return;
Main.prependClassLoader(prepend);
+ try {
+ ClassLoader currentClassLoader = Transform.class.getClassLoader();
+ Method prependParentMethod = Permit.getMethod(currentClassLoader.getClass(), "prependParent", ClassLoader.class);
+ Permit.invoke(prependParentMethod, currentClassLoader, prepend);
+ } catch (Throwable t) {
+ // Ignore
+ }
Class<?> shadowed = Util.shadowLoadClass("lombok.eclipse.TransformEclipseAST");
TRANSFORM = Util.findMethodAnyArgs(shadowed, "transform");
TRANSFORM_SWAPPED = Util.findMethodAnyArgs(shadowed, "transform_swapped"); |
@Rawi01 It works fine. |
I have closed this PR. |
Fixes #3332