-
Notifications
You must be signed in to change notification settings - Fork 8
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
Mixing ADT4j and Immutables: Strange jcodemodel issue mixing generated classes #40
Comments
Can you test it with 3.2-alpha1? I think the actual error is that adt4j tries to generate new class with the name of some existing class. The error is like that, because adt4 tries to access some inner class. There are two classes with the same name simultaneously. To access inner class adt4j first access it's enclosing class, but it chooses wrong, and as a result get confused as there is no inner class there... |
I tried it with the alpha that's currently released but got the same issue. Interestingly it even happened when the ADT4j class contained a class that inturn included an Immutables class - so it indirectly hit the issue as well. |
Can you submit any small example? |
I'll try and make a reproducible example project later this morning once I get to the office. |
Should be fixed when jcodemodel pull request is merged. |
Finally this issue should be fixed with new jcodemodel release. Check out 3.2-beta1 version. |
As an advertisment, There is some new stuff in 3.2 release, you can find it interesting: Since 3.2
|
I'm adding to this issue as we're seeing an issue with AutoValue, even when using 3.2-beta1. This happens when we have a
|
@rouzwawi Thank you for your report. I appreciate any help with project maintenance. The cause of the problem seems to be the same. I've failed to manually check the exhaustiveness of the conditional expression. Hope that it's finally right. I'll wait for new jcodemodel release and than release adt4j-3.2-beta2 |
3.2-beta2 is released. This issue should be fixed. |
For some reason, when I updated one of our ADT4j (3.1) based types to include a reference to an interface that's built using immutables.github.io ( generated in the same project ) the following deep internal error occurs.
If I use the
ImmutableNNNN
generated variant of the class the problem goes away, but then just causes issues further in the code base.It looks like ADT4j may not be not liking that Immutables use inner-interfaces.
[ERROR] java.lang.IllegalStateException: Inner class should always be defined if outer class is defined: inner class org.immutables.value.Value.Immutable, enclosing class com.helger.jcodemodel.JDefinedClass(org.immutables.value.Value)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.getClass(DecidedErrorTypesModelsAdapter.java:177)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.ref(DecidedErrorTypesModelsAdapter.java:289)
[ERROR] at com.helger.jcodemodel.meta.TypeMirrorToJTypeVisitor.visitDeclared(TypeMirrorToJTypeVisitor.java:143)
[ERROR] at com.helger.jcodemodel.meta.TypeMirrorToJTypeVisitor.visitDeclared(TypeMirrorToJTypeVisitor.java:68)
[ERROR] at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:944)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.toJType(DecidedErrorTypesModelsAdapter.java:298)
[ERROR] at com.helger.jcodemodel.meta.Annotator.annotate(Annotator.java:97)
[ERROR] at com.helger.jcodemodel.meta.Annotator.annotate(Annotator.java:89)
[ERROR] at com.helger.jcodemodel.meta.ClassFiller.fillClass(ClassFiller.java:85)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.defineTopLevelClass(DecidedErrorTypesModelsAdapter.java:227)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.defineClass(DecidedErrorTypesModelsAdapter.java:191)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.getClass(DecidedErrorTypesModelsAdapter.java:161)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.ref(DecidedErrorTypesModelsAdapter.java:289)
[ERROR] at com.helger.jcodemodel.meta.TypeMirrorToJTypeVisitor.visitDeclared(TypeMirrorToJTypeVisitor.java:143)
[ERROR] at com.helger.jcodemodel.meta.TypeMirrorToJTypeVisitor.visitDeclared(TypeMirrorToJTypeVisitor.java:68)
[ERROR] at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:944)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.toJType(DecidedErrorTypesModelsAdapter.java:298)
[ERROR] at com.helger.jcodemodel.meta.TypeMirrorToJTypeVisitor.visitDeclared(TypeMirrorToJTypeVisitor.java:146)
[ERROR] at com.helger.jcodemodel.meta.TypeMirrorToJTypeVisitor.visitDeclared(TypeMirrorToJTypeVisitor.java:68)
[ERROR] at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:944)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.toJType(DecidedErrorTypesModelsAdapter.java:298)
[ERROR] at com.helger.jcodemodel.meta.ClassFiller.fillClass(ClassFiller.java:143)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.defineTopLevelClass(DecidedErrorTypesModelsAdapter.java:227)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.defineClass(DecidedErrorTypesModelsAdapter.java:191)
[ERROR] at com.helger.jcodemodel.meta.DecidedErrorTypesModelsAdapter.getClass(DecidedErrorTypesModelsAdapter.java:161)
[ERROR] at com.helger.jcodemodel.meta.JCodeModelJavaxLangModelAdapter.getClass(JCodeModelJavaxLangModelAdapter.java:145)
[ERROR] at com.helger.jcodemodel.meta.JCodeModelJavaxLangModelAdapter.getClassWithErrorTypes(JCodeModelJavaxLangModelAdapter.java:109)
[ERROR] at com.github.sviperll.adt4j.GenerateValueClassForVisitorProcessor$ElementProcessor.processStage0(GenerateValueClassForVisitorProcessor.java:202)
[ERROR] at com.github.sviperll.adt4j.GenerateValueClassForVisitorProcessor$ElementProcessor.generateClassesWithErrors(GenerateValueClassForVisitorProcessor.java:127)
[ERROR] at com.github.sviperll.adt4j.GenerateValueClassForVisitorProcessor$ElementProcessor.generateClassesWithoutErrors(GenerateValueClassForVisitorProcessor.java:139)
[ERROR] at com.github.sviperll.adt4j.GenerateValueClassForVisitorProcessor.process(GenerateValueClassForVisitorProcessor.java:109)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:523)
[ERROR] at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
[ERROR] at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
[ERROR] at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
[ERROR] at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:171)
[ERROR] at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:886)
[ERROR] at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] -> [Help 1]
The text was updated successfully, but these errors were encountered: