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

Cancel build during Annotation processing does not work #3317

Open
jukzi opened this issue Nov 15, 2024 · 0 comments
Open

Cancel build during Annotation processing does not work #3317

jukzi opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jukzi
Copy link
Contributor

jukzi commented Nov 15, 2024

Compiler keeps compiling even after annotation processing, as annotation processor can catch the AbortCompilation Exception and later checks in JDT (org.eclipse.jdt.internal.core.builder.BuildNotifier.checkCancelWithinCompiler()) think cancel is already in progress (org.eclipse.jdt.internal.core.builder.BuildNotifier.cancelling == true)
image
Example with hibernate:

!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-11-15 15:54:31.857
!MESSAGE java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at org.hibernate.processor.validation.Mocker.lambda$variadic$1(Mocker.java:59)
	at org.hibernate.processor.validation.ProcessorSessionFactory.create(ProcessorSessionFactory.java:79)
	at org.hibernate.processor.annotation.AnnotationMeta.handleNamedQuery(AnnotationMeta.java:104)
	at org.hibernate.processor.annotation.AnnotationMeta.handleNamedQueryRepeatableAnnotation(AnnotationMeta.java:77)
	at org.hibernate.processor.annotation.AnnotationMeta.checkNamedQueries(AnnotationMeta.java:56)
	at org.hibernate.processor.annotation.AnnotationMetaEntity.init(AnnotationMetaEntity.java:454)
	at org.hibernate.processor.annotation.AnnotationMetaEntity.create(AnnotationMetaEntity.java:188)
	at org.hibernate.processor.HibernateProcessor.handleRootElementAnnotationMirrors(HibernateProcessor.java:577)
	at org.hibernate.processor.HibernateProcessor.processClasses(HibernateProcessor.java:375)
	at org.hibernate.processor.HibernateProcessor.process(HibernateProcessor.java:323)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:149)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:126)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:173)
	at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134)
	at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:998)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:471)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:447)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:442)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:250)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:373)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:118)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:314)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:220)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.hibernate.processor.validation.Mocker.lambda$variadic$1(Mocker.java:56)
	... 35 more
Caused by: org.eclipse.jdt.internal.compiler.problem.AbortCompilation: 
	at org.eclipse.jdt.internal.core.builder.BuildNotifier.checkCancelWithinCompiler(BuildNotifier.java:136)
	at org.eclipse.jdt.internal.core.builder.NameEnvironment.findClass(NameEnvironment.java:542)
	at org.eclipse.jdt.internal.core.builder.NameEnvironment.findType(NameEnvironment.java:618)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.lambda$0(LookupEnvironment.java:286)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(LookupEnvironment.java:421)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:285)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getType(LookupEnvironment.java:1856)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getType(LookupEnvironment.java:1825)
	at org.eclipse.jdt.internal.compiler.apt.model.ElementsImpl9.getTypeElement(ElementsImpl9.java:89)
	at org.eclipse.jdt.internal.compiler.apt.model.ElementsImpl9.getTypeElement(ElementsImpl9.java:61)
	at org.hibernate.processor.validation.ProcessorSessionFactory.<init>(ProcessorSessionFactory.java:109)
	at org.hibernate.processor.validation.ProcessorSessionFactory$ByteBuddy$gHcoemPf.<init>(Unknown Source)
	... 41 more
@jukzi jukzi added the bug Something isn't working label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant