Skip to content

Commit

Permalink
[fixes projectlombok#3332] Prepend jdt.core SCL to compiler SCL
Browse files Browse the repository at this point in the history
The latest eclipse version properly splits the jdt.core module and the
compiler. To load jdt.core classes during compilation the compiler SCL
needs a reference to the jdt.core SCL.
  • Loading branch information
Rawi01 committed Feb 8, 2023
1 parent e5c324c commit 2f7ea35
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/eclipseAgent/lombok/launch/PatchFixesHider.java
Expand Up @@ -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:
Expand Down Expand Up @@ -200,6 +202,13 @@ private static synchronized void init(ClassLoader prepend) {
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");
Expand Down

0 comments on commit 2f7ea35

Please sign in to comment.