-
-
Notifications
You must be signed in to change notification settings - Fork 364
Open
Description
Describe the bug
In short, calling CtElement
#getParent(P) using as a parameter CtModule.class always returns the unnamed module even when using types such as String that are definitely in a valid jigsaw module. You can find an example below and various snippets I tried.
To Reproduce
Input:
public class TestInput {
private static final String ABC = String.valueOf("");
}
Processing with Spoon:
public class FieldTransformer extends AbstractProcessor<CtField<?>> {
@Override
public boolean isToBeProcessed(CtField<?> element) {
return true;
}
@Override
public void process(CtField<?> element) {
if (element.getAssignment() == null) {
return;
}
element.getParent(CtModule.class); // Unnamed module
element.getType().getParent(CtModule.class); // Unnamed module
element.getType().getPackage().getParent(CtModule.class); // Unnamed module
}
}
- OS: Windows 11
- JDK: openjdk version "16" 2021-03-16
- Spoon version: 10.2.0-beta-10
Metadata
Metadata
Assignees
Labels
No labels