org.burningwave.core.classes.JavaMemoryCompiler$Compilation$Exception: Annotation processing is enabled because one or more processors were found on the class path #35
Answered
by
andreachirico79
andreachirico79
asked this question in
Q&A
-
Hi, I cannot make my code work. I use Intellij and Lombok. here is my code: UnitSourceGenerator unitSGNestedObject = UnitSourceGenerator.create("vf.com.AdminToolBE.bean").addClass(
ClassSourceGenerator.create(
TypeDeclarationSourceGenerator.create("EReturnReasonAutoGenerated")
).addModifier(
Modifier.PUBLIC
//generating new method that override MyInterface.convert(LocalDateTime)
).addAnnotation(AnnotationSourceGenerator.create(Data.class))
.addAnnotation(AnnotationSourceGenerator.create(NoArgsConstructor.class))
.addAnnotation(AnnotationSourceGenerator.create(AllArgsConstructor.class))
.addField(
VariableSourceGenerator.create(
TypeDeclarationSourceGenerator.create(String.class),
"returnType"
))
.addField(
VariableSourceGenerator.create(
TypeDeclarationSourceGenerator.create(Set.class)
.addGeneric(GenericSourceGenerator.create(String.class)),
"returnReasons"
))
.addField(
VariableSourceGenerator.create(
TypeDeclarationSourceGenerator.create(Set.class)
.addGeneric(GenericSourceGenerator.create(String.class)),
"returnSeasons"
))
.addField(
VariableSourceGenerator.create(
TypeDeclarationSourceGenerator.create(Set.class)
.addGeneric(GenericSourceGenerator.create(String.class)),
"customers"
))
);
System.out.println("\nGenerated code:\n" + unitSGNestedObject.make());
unitSGNestedObject.storeToClassPath("outofClassPath");
ComponentSupplier componentSupplier = ComponentContainer.getInstance();
ClassFactory classFactory = componentSupplier.getClassFactory();
ClassFactory.ClassRetriever classRetriever = classFactory.loadOrBuildAndDefine(
unitSGNestedObject
);
Class<?> nestedGeneratedClass = classRetriever.get(
"vf.com.AdminToolBE.bean.EReturnReasonAutoGenerated"
); ... And after the code: classRetriever.get(
"vf.com.AdminToolBE.bean.EReturnReasonAutoGenerated"
); ... I receive this exception:
|
Beta Was this translation helpful? Give feedback.
Answered by
andreachirico79
Mar 5, 2024
Replies: 1 comment 10 replies
-
It's probably an issue with Lombok try to replace the ClassFactory.ClassRetriever classRetriever = classFactory.loadOrBuildAndDefine(
LoadOrBuildAndDefineConfig.forUnitSourceGenerator(unitSGNestedObject)
.modifyCompilationConfig(compilationConfig -> compilationConfig.putExtraParameter("-proc", "none"))
); |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have found a workaround in this way