[ https://issues.apache.org/jira/browse/MCOMPILER-566?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexander Kriegisch updated MCOMPILER-566: ------------------------------------------ Description: When analysing MCOMPILER-424, at some point I wanted to know what happens if I set {{fork=true}} or {{forceJavacCompilerUse=true}}. The result was bad: No matter if I compile with {{mvn -e -X}} or {{verbose=true}}, I only see a {{CompilationFailureException: Compilation failure}}. There seems to be no way to actually see the underlying root cause. I have to compile in process via Plexus {{JavaxToolsCompiler}} to see the {{AnnotationTypeMismatchException}} from [this comment|https://issues.apache.org/jira/browse/MCOMPILER-424?focusedCommentId=17797351&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17797351]. It is not helpful to know _that_ compilation failed, but not _why_. Intermediate result: I added some debug statements into {{org.codehaus.plexus.compiler.javac.JavacCompiler::compileOutOfProcess}}: {code:java} returnCode = CommandLineUtils.executeCommandLine(cli, out, out); System.out.println("### plexus javac return code: " + returnCode); System.out.println("### plexus javac output:\n" + out.getOutput()); messages = parseModernStream(returnCode, new BufferedReader(new StringReader(out.getOutput()))); System.out.println("### plexus javac messages: " + messages); {code} The Maven console log when running with the latest Maven Compiler and latest Plexus Compiler (sorry for interspersed German messages due to locale auto detection): {code:none} [INFO] Compiling 1 source file with javac [forked debug release 17] to target\classes ### plexus javac return code: 3 ### plexus javac output: Processor ran! [org.example.MyFirstAnnotation] [errorRaised=false, rootElements=[org.example.AnnotatedClass], processingOver=false] Warnung: No SupportedSourceVersion annotation found on org.example.Processor, returning RELEASE_6. Warnung: Unterst�tzte Quellversion "RELEASE_6" von Annotationsprozessor "org.example.Processor" kleiner als -source "17" 2 Warnungen Ein Annotationsprozessor hat eine nicht abgefangene Ausnahme ausgel�st. Details finden Sie im folgenden Stacktrace. java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract org.example.MySecondAnnotation org.example.MyFirstAnnotation.secondAnnotation() (Found data of type org.example.MySecondAnnotation) at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor$1AnnotationTypeMismatchExceptionProxy.generateException(AnnotationProxyMaker.java:271) at java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:89) at jdk.proxy3/jdk.proxy3.$Proxy3.secondAnnotation(Unknown Source) at org.example.Processor.process(Processor.java:23) at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1021) at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:937) at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1265) at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1380) at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1271) at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:948) at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319) at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178) at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) {code} As you can see, Plexus {{JavacCompiler}} gets all the output from _javac_, but then somehow discards it while parsing it in {{JavacCompiler::parseModernStream}}. I have not debugged into that part yet, but it looks like a Plexus Compiler Javac bug. Do I need to create a separate issue in that project, or are we dealing with the same players here? was: When analysing MCOMPILER-424, at some point I wanted to know what happens if I set {{fork=true}} or {{forceJavacCompilerUse=true}}. The result was bad: No matter if I compile with {{mvn -e -X}} or {{verbose=true}}, I only see a {{CompilationFailureException: Compilation failure}}. There seems to be no way to actually see the underlying root cause. I have to compile in process via Plexus {{JavaxToolsCompiler}} to see the {{AnnotationTypeMismatchException}} from [this comment|https://issues.apache.org/jira/browse/MCOMPILER-424?focusedCommentId=17797351&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17797351]. It is not helpful to know _that_ compilation failed, but not _why_. > Display forked compiler stacktrace on error > ------------------------------------------- > > Key: MCOMPILER-566 > URL: https://issues.apache.org/jira/browse/MCOMPILER-566 > Project: Maven Compiler Plugin > Issue Type: Improvement > Affects Versions: 3.11.0, 3.12.0 > Reporter: Alexander Kriegisch > Priority: Major > > When analysing MCOMPILER-424, at some point I wanted to know what happens if > I set {{fork=true}} or {{forceJavacCompilerUse=true}}. The result was bad: No > matter if I compile with {{mvn -e -X}} or {{verbose=true}}, I only see a > {{CompilationFailureException: Compilation failure}}. There seems to be no > way to actually see the underlying root cause. I have to compile in process > via Plexus {{JavaxToolsCompiler}} to see the > {{AnnotationTypeMismatchException}} from [this > comment|https://issues.apache.org/jira/browse/MCOMPILER-424?focusedCommentId=17797351&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17797351]. > It is not helpful to know _that_ compilation failed, but not _why_. > Intermediate result: I added some debug statements into > {{org.codehaus.plexus.compiler.javac.JavacCompiler::compileOutOfProcess}}: > {code:java} > returnCode = CommandLineUtils.executeCommandLine(cli, out, out); > System.out.println("### plexus javac return code: " + returnCode); > System.out.println("### plexus javac output:\n" + out.getOutput()); > messages = parseModernStream(returnCode, new BufferedReader(new > StringReader(out.getOutput()))); > System.out.println("### plexus javac messages: " + messages); > {code} > The Maven console log when running with the latest Maven Compiler and latest > Plexus Compiler (sorry for interspersed German messages due to locale auto > detection): > {code:none} > [INFO] Compiling 1 source file with javac [forked debug release 17] to > target\classes > ### plexus javac return code: 3 > ### plexus javac output: > Processor ran! > [org.example.MyFirstAnnotation] > [errorRaised=false, rootElements=[org.example.AnnotatedClass], > processingOver=false] > Warnung: No SupportedSourceVersion annotation found on org.example.Processor, > returning RELEASE_6. > Warnung: Unterst�tzte Quellversion "RELEASE_6" von Annotationsprozessor > "org.example.Processor" kleiner als -source "17" > 2 Warnungen > Ein Annotationsprozessor hat eine nicht abgefangene Ausnahme ausgel�st. > Details finden Sie im folgenden Stacktrace. > java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data > found for annotation element public abstract org.example.MySecondAnnotation > org.example.MyFirstAnnotation.secondAnnotation() (Found data of type > org.example.MySecondAnnotation) > at > jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor$1AnnotationTypeMismatchExceptionProxy.generateException(AnnotationProxyMaker.java:271) > at > java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:89) > at jdk.proxy3/jdk.proxy3.$Proxy3.secondAnnotation(Unknown Source) > at org.example.Processor.process(Processor.java:23) > at > jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1021) > at > jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:937) > at > jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1265) > at > jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1380) > at > jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1271) > at > jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:948) > at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319) > at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178) > at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) > at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) > {code} > As you can see, Plexus {{JavacCompiler}} gets all the output from _javac_, > but then somehow discards it while parsing it in > {{JavacCompiler::parseModernStream}}. I have not debugged into that part yet, > but it looks like a Plexus Compiler Javac bug. Do I need to create a separate > issue in that project, or are we dealing with the same players here? -- This message was sent by Atlassian Jira (v8.20.10#820010)