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

APT problem: StackOverflowError in RoundDispatcher.handleProcessor #195

Open
kriegaex opened this issue Nov 27, 2022 · 2 comments
Open

APT problem: StackOverflowError in RoundDispatcher.handleProcessor #195

kriegaex opened this issue Nov 27, 2022 · 2 comments
Assignees

Comments

@kriegaex
Copy link
Contributor

kriegaex commented Nov 27, 2022

This issue came up in dev-aspectj/aspectj-maven-plugin#108, but it is not a problem concerning the Maven plugin. Instead, it seems to be related to annotation processing (APT) support for AJC:

There is an annotation processor on the classpath, namely com.querydsl:querydsl-apt:5.0.0-jakarta. It contains a file META-INF/services/javax.annotation.processing.Processor with the following content:

com.querydsl.apt.jpa.JPAAnnotationProcessor

That annotation processor handles the @jakarta.persistence.MappedSuperclass annotations found on two classes in the sample repository.

While Javac (used by Maven Compiler Plugin) can correctly generate code, it seems as if the annotation processor throws off AJC like this (error message with additional line breaks):

...\baz\src\main\java\com\foobar\showme\baz\TimestampedJPADurable.java [error]
Internal compiler error: java.lang.Exception:
java.lang.StackOverflowError at 
  org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:172)
(no source information available)

A reproducer is at https://github.com/zenbones/showme. Thanks to @zenbones for reporting the problem.

See also dev-aspectj/aspectj-maven-plugin#108 (comment) for an AspectJ Maven workaround which can also be applied to the AJC command line: letting Javac take care of annotation processing and then using -proc:none for AJC.

@kriegaex kriegaex added the bug Something isn't working label Nov 27, 2022
@kriegaex kriegaex changed the title StackOverflowError in RoundDispatcher.handleProcessor APT problem: StackOverflowError in RoundDispatcher.handleProcessor Nov 27, 2022
@kriegaex
Copy link
Contributor Author

kriegaex commented Nov 28, 2022

I debugged into AJC, because unfortunately the upstream Eclipse Jave Compiler (ACJ) underneath AJC does not log a full stack trace for the stack overflow error. Here it is:

java.lang.StackOverflowError
	at com.querydsl.apt.ExtendedTypeFactory$2.visitBase(ExtendedTypeFactory.java:207)
	at com.querydsl.apt.ExtendedTypeFactory$2.visitTypeVariable(ExtendedTypeFactory.java:252)
	at com.querydsl.apt.ExtendedTypeFactory$2.visitTypeVariable(ExtendedTypeFactory.java:201)
	at org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.TypeVariableImpl.accept(TypeVariableImpl.java:77)
	at [email protected]/javax.lang.model.util.AbstractTypeVisitor6.visit(AbstractTypeVisitor6.java:91)
	at com.querydsl.apt.ExtendedTypeFactory$2.visitTypeVariable(ExtendedTypeFactory.java:254)
	at com.querydsl.apt.ExtendedTypeFactory$2.visitTypeVariable(ExtendedTypeFactory.java:201)
	at org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.TypeVariableImpl.accept(TypeVariableImpl.java:77)
	at [email protected]/javax.lang.model.util.AbstractTypeVisitor6.visit(AbstractTypeVisitor6.java:91)
	at com.querydsl.apt.ExtendedTypeFactory$2.visitTypeVariable(ExtendedTypeFactory.java:254)
	at com.querydsl.apt.ExtendedTypeFactory$2.visitTypeVariable(ExtendedTypeFactory.java:201)
       (and many more repetitions of the last 4 lines)

It would be interesting to see if that works in plain vanilla ECJ or is AJC-specific. I will try that next after work.

@kriegaex
Copy link
Contributor Author

kriegaex commented Nov 28, 2022

Update (CC @zenbones): I quickly checked during a break, and it definitely is not an AJC problem. The same occurs when compiling the project with plain vanilla ECJ 3.31.0. And also there -proc:none makes the project compile, but of course in that case no code generation via APT takes place.

Update: Bug ticket eclipse-jdt/eclipse.jdt.core#565 created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant