Compiler crash with -parameters - need help to open a bug

Eric McCorkle eric.mccorkle at oracle.com
Tue Mar 25 22:59:27 UTC 2014


Coming in a bit late here, see replies inline.

On 03/25/14 12:03, Boaz Nahum wrote:
> Hi.
> 
> 
> First, with your help, I managed to isolate some piece of code that
> reproduce similar crash ( By 'isolate' I mean 45 files that I can send
> you out of 80K).
> 
> ('Similar' means 'Information:java: java.lang.ClassCastException:
> com.sun.tools.javac.jvm.ClassFile$NameAndType cannot be cast to
> com.sun.tools.javac.util.Name <http://com.sun.tools.javac.util.Name>' )

My intuition, based on what I've seen earlier in the thread, is that
there's a problem with javac reading method parameter data back out of a
class file.  That is why you are seeing it only on source that depends
on something compiled with -parameters.  The problem isn't with the
source you're compiling; it's with the class files that get read.

> 
> But now the crash only with 1.8.0u20 but not with
> http://hg.openjdk.java.net/jdk8/tl/

That is strange.  I'm not aware that parameter reflection has been
changed in 8u20 yet.

> On the other hand, in our huge project it happens also with
> http://hg.openjdk.java.net/jdk8/tl/
> 
> So I guess I didn't isolated it completely.
> 
> Second. this crash happens only if 'annotation processor' is involved.

That is helpful, though I'm not sure what it means offhand.

> So, I don't know if it worth the effort to send you the files (and short
> description how to build them) ?
> 
> Thanks
> Boaz
> 
> 
> 
> On Mon, Mar 24, 2014 at 9:54 PM, Vicente-Arturo Romero-Zaldivar
> <vicente.romero at oracle.com <mailto:vicente.romero at oracle.com>> wrote:
> 
>     On 24/03/14 19:41, Boaz Nahum wrote:
>>
>>     Of curse you can ( why not mention my name :) ? )
>>
> 
>     :) just in case you didn't want but I have no problem with adding
>     your name and / or mail
> 
> 
>>     Anyway, do you already know what the bug is ? Can you share the
>>     bug ID with me ?
>>
> 
>     I haven't created it yet but I will send you the id once I have it.
> 
> 
>>     I will try to isolate the code and send it to you.
>>
> 
>     Thanks,
>     Vicente
> 
> 
>>     The
>>     Boaz
>>
>>     On Mar 24, 2014 9:34 PM, "Vicente-Arturo Romero-Zaldivar"
>>     <vicente.romero at oracle.com <mailto:vicente.romero at oracle.com>> wrote:
>>
>>         Thanks Boaz,
>>
>>         I will add all this info in a bug report. Can I use this test
>>         case to write a mail, probably a blog in the future, about
>>         obtaining extra information from hard bugs? I won't mention
>>         your name. My idea is to write some info that may help other
>>         users to provide more information associated to a crash or bug.
>>
>>         Thanks,
>>         Vicente
>>
>>         On 24/03/14 17:31, Boaz Nahum wrote:
>>>         Comment out
>>>          //@NotNull
>>>             //public static <T> T createSingleton(final Class<?
>>>         extends DIGlobalCxPDD<Void, T, Void>> dd) {
>>>             //
>>>             //    return Singletons.createNonNull(dd, new
>>>         Factory0Adapter<T>() {
>>>             //        @Override
>>>             //        public T get() {
>>>             //            return createWithContext(dd, null, null);
>>>             //        }
>>>             //    });
>>>             //}
>>>
>>>         ---------------------------------------------------------------------
>>>         Brings a new exception:
>>>
>>>
>>>
>>>         ********************* error in file
>>>         F:\views2\BoazMainWF_JDK8_LANG_ON_p\Qsnap\Qrelease\Jar\Core.jar(wf/core/util/factory/di/glob
>>>         al/DIFW.class)
>>>         ********************* while trying to read constant pool entry 72
>>>
>>>            #70 = Utf8               all
>>>            #71 = Utf8              
>>>         Ljava/util/List<+Lwf/core/util/factory/Factory<+TT;-TP;>;>;
>>>            #72 = Utf8               Ljava/util/List;
>>>            #73 = Utf8               get0
>>>            #74 = Utf8              
>>>         (Ljava/lang/Class;)Lwf/core/util/factory/Factory0;
>>>
>>>         Comment out:
>>>
>>>                 //List<? extends Factory<? extends T, ? super P>> all
>>>         = DIFWImp.getAll(dd, context);
>>>
>>>                 //noinspection unchecked
>>>                 return null;//(List<Factory<T, P>>)all;
>>>
>>>         ---------------------------------------------------------------------
>>>
>>>         Brings a new exception:
>>>
>>>         ********************* while trying to read constant pool
>>>         entry 162
>>>
>>>           #161 = Utf8              
>>>         Ljava/lang/Class<+Lwf/core/util/factory/di/core/DIAbstractDD<-Ljava/lang/Void;+TT;-TP;>;>;
>>>           #162 = Utf8               wf/core/util/packing/Params2
>>>           #163 = Class              #162          // 
>>>         wf/core/util/packing/Params2
>>>           #164 = Utf8              
>>>         (Ljava/lang/Object;Ljava/lang/Object;)Lwf/core/util/packing/Params2;
>>>           #165 = NameAndType        #34:#164      // 
>>>         create:(Ljava/lang/Object;Ljava/lang/Object;)Lwf/core/util/packing/Params2;
>>>           #166 = Methodref          #163.#165     // 
>>>         wf/core/util/packing/Params2.create:(Ljava/lang/Object;Ljava/lang/Object;)Lwf/core/util/packing/Params2;
>>>           #167 = Utf8              
>>>         Ljava/lang/Class<+Lwf/core/util/factory/di/factory/DIGlobalCxPDD<Ljava/lang/Void;TT;Lwf/core/util/packing/Params2<TP1;TP2;>;>;>;
>>>
>>>
>>>
>>>         Thx
>>>         Boaz
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>         On Mon, Mar 24, 2014 at 6:40 PM, Boaz Nahum
>>>         <boaznahum at gmail.com <mailto:boaznahum at gmail.com>> wrote:
>>>
>>>             Thx
>>>
>>>             ********************* error in file
>>>             F:\views2\BoazMainWF_JDK8_LANG_ON_p\Qsnap\Qrelease\Jar\Core.jar(wf/core/util/factory/di/glob
>>>             al/DIFW.class)
>>>               ********************* while trying to read constant
>>>             pool entry 64
>>>
>>>             Attachedfiles DIFW{.java, .class,$*.class}
>>>
>>>
>>>
>>>
>>>
>>>
>>>             On Mon, Mar 24, 2014 at 3:52 PM, Vicente-Arturo
>>>             Romero-Zaldivar <vicente.romero at oracle.com
>>>             <mailto:vicente.romero at oracle.com>> wrote:
>>>
>>>                 On 24/03/14 13:50, Boaz Nahum wrote:
>>>>                 is repo http://hg.openjdk.java.net/jdk8/jdk8 is good
>>>>                 enough, or maybe other
>>>
>>>                 Please use this one: http://hg.openjdk.java.net/jdk8/tl/
>>>
>>>
>>>>
>>>>
>>>>                 On Mon, Mar 24, 2014 at 3:45 PM, Vicente-Arturo
>>>>                 Romero-Zaldivar <vicente.romero at oracle.com
>>>>                 <mailto:vicente.romero at oracle.com>> wrote:
>>>>
>>>>                     I usually do this with Linux, if you have Linux
>>>>                     you can go to your jdk repo, to the langtools
>>>>                     folder and do:
>>>>
>>>>                     patch -p1 < /path/to/mypatch
>>>>
>>>>                     after that you can rebuild again the jdk and you
>>>>                     will have the patched javac.
>>>>
>>>>                     Vicente
>>>>
>>>>
>>>>                     On 24/03/14 13:41, Boaz Nahum wrote:
>>>>>                     Please send my link to instruction how to apply
>>>>>                     pathc (I know how to compile JDK, never before
>>>>>                     applied a patch)
>>>>>
>>>>>
>>>>>                     On Mon, Mar 24, 2014 at 3:34 PM, Vicente-Arturo
>>>>>                     Romero-Zaldivar <vicente.romero at oracle.com
>>>>>                     <mailto:vicente.romero at oracle.com>> wrote:
>>>>>
>>>>>                         Hi Boaz,
>>>>>
>>>>>                         Please try the attached patch and send me
>>>>>                         the obtained information along with the
>>>>>                         failing .class file.
>>>>>
>>>>>                         Thanks,
>>>>>                         Vicente
>>>>>
>>>>>
>>>>>                         On 24/03/14 13:07, Boaz Nahum wrote:
>>>>>>                         It happens both with 1.8.0_20-ea and
>>>>>>                         1.8.0-b132
>>>>>>
>>>>>>                         The javac (with -verbose) output
>>>>>>                         https://drive.google.com/file/d/0B4MyZ6FK5jswZVZWV0VMSnE3c0k/edit?usp=sharing
>>>>>>
>>>>>>                         I didn't tired with
>>>>>>                         http://hg.openjdk.java.net/jdk9/dev/langtools/
>>>>>>                         I need to re-setup by jdk build environment 
>>>>>>
>>>>>>
>>>>>>                         many thanks
>>>>>>                         Boaz
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>                         On Mon, Mar 24, 2014 at 1:24 PM,
>>>>>>                         Vicente-Arturo Romero-Zaldivar
>>>>>>                         <vicente.romero at oracle.com
>>>>>>                         <mailto:vicente.romero at oracle.com>> wrote:
>>>>>>
>>>>>>                             Hi Boaz,
>>>>>>
>>>>>>                             OK it seems like we both need more
>>>>>>                             information :)
>>>>>>
>>>>>>                             What version of javac is this? Can you
>>>>>>                             get the last javac from
>>>>>>                             http://hg.openjdk.java.net/jdk9/dev/langtools/
>>>>>>                             and try to reproduce the issue? Do you
>>>>>>                             get any meaningful information after
>>>>>>                             executing javac with plain "-verbose"
>>>>>>                             option?
>>>>>>
>>>>>>                             Thanks,
>>>>>>                             Vicente
>>>>>>
>>>>>>
>>>>>>                             On 24/03/14 07:10, Boaz Nahum wrote:
>>>>>>>
>>>>>>>                             That what I'm asking help for - to
>>>>>>>                             isolate  the problematic source.
>>>>>>>                             But from what I learnt - it is
>>>>>>>                             combination of source and
>>>>>>>                             dependencies. The same source
>>>>>>>                             ***passed*** if it is complied with a
>>>>>>>                             dependency that wasn't compile with
>>>>>>>                             "-parameters".
>>>>>>>                             What I need is a flag (or a patch)
>>>>>>>                             that causes the compiler to emit
>>>>>>>                             verbose information
>>>>>>>
>>>>>>>                             Thanks
>>>>>>>                             Boaz
>>>>>>>
>>>>>>>                             On Mar 23, 2014 9:18 PM,
>>>>>>>                             "Vicente-Arturo Romero-Zaldivar"
>>>>>>>                             <vicente.romero at oracle.com
>>>>>>>                             <mailto:vicente.romero at oracle.com>>
>>>>>>>                             wrote:
>>>>>>>
>>>>>>>                                 Hi Boaz,
>>>>>>>
>>>>>>>                                 Do you have an isolated test case?
>>>>>>>
>>>>>>>                                 Thanks,
>>>>>>>                                 Vicente
>>>>>>>
>>>>>>>                                 On 23/03/14 12:40, Boaz Nahum wrote:
>>>>>>>>                                 Actaully
>>>>>>>>                                 '-XDverboseCompilePolicy and
>>>>>>>>                                 -Xdiags:verbose' are not
>>>>>>>>                                 ignored, it is just that the
>>>>>>>>                                 exception occurs too early. If I
>>>>>>>>                                 remove '-parameters' then they
>>>>>>>>                                 do the work ....
>>>>>>>>
>>>>>>>>
>>>>>>>>                                 On Sun, Mar 23, 2014 at 2:29 PM,
>>>>>>>>                                 Boaz Nahum <boaznahum at gmail.com
>>>>>>>>                                 <mailto:boaznahum at gmail.com>> wrote:
>>>>>>>>
>>>>>>>>                                     When compiling our code with
>>>>>>>>                                     '-parameters' (1.8.0_20-ea
>>>>>>>>                                     and  1.8.0-b132), we got
>>>>>>>>                                     this exception:
>>>>>>>>
>>>>>>>>                                     An exception has occurred in
>>>>>>>>                                     the compiler (1.8.0). Please
>>>>>>>>                                     file a bug at the Java
>>>>>>>>                                     Developer/bugreport)  after
>>>>>>>>                                     checking the Bug Parade for
>>>>>>>>                                     duplicates. Include your
>>>>>>>>                                     program and the following
>>>>>>>>                                     diagnostic in your report. 
>>>>>>>>                                     Thank you.
>>>>>>>>                                       
>>>>>>>>                                     java.lang.ClassCastException: java.lang.String
>>>>>>>>                                     cannot be cast to
>>>>>>>>                                     com.sun.tools.javac.util.Name <http://com.sun.tools.javac.util.Name>
>>>>>>>>                                            at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.readName(ClassReader.java:602)
>>>>>>>>                                            at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.setParameterNames(ClassReader.java:2130)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.readMethod(ClassReader.java:2031)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:2234)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2306)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2493)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2424)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.access$000(ClassReader.java:76)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader$1.complete(ClassReader.java:244)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.code.Symbol.complete(Symbol.java:560)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1024)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.jvm.ClassReader.loadClass(ClassReader.java:2605)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:1868)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:2107)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3358)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3257)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1891)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Attr.attribType(Attr.java:658)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Attr.attribType(Attr.java:651)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.MemberEnter.attribImportType(MemberEnter.java:836)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.MemberEnter.visitImport(MemberEnter.java:556)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.tree.JCTree$JCImport.accept(JCTree.java:571)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:435)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:447)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:526)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:518)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:435)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1038)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.code.Symbol.complete(Symbol.java:560)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1024)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Enter.complete(Enter.java:497)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.comp.Enter.main(Enter.java:475)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:985)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.main.Main.compile(Main.java:523)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.main.Main.compile(Main.java:381)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.main.Main.compile(Main.java:370)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.main.Main.compile(Main.java:361)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.Main.compile(Main.java:56)
>>>>>>>>                                             at
>>>>>>>>                                     com.sun.tools.javac.Main.main(Main.java:42)
>>>>>>>>
>>>>>>>>
>>>>>>>>                                     Thanks
>>>>>>>>                                     Boaz
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                                     In order to isolate the
>>>>>>>>                                     problematic code, I add 
>>>>>>>>                                     -XDverboseCompilePolicy and
>>>>>>>>                                     -Xdiags:verbose, without luck.
>>>>>>>>                                     Why they are ignored ?
>>>>>>>>
>>>>>>>>                                     Please note that an
>>>>>>>>                                     annotation processor is
>>>>>>>>                                     involved.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eric_mccorkle.vcf
Type: text/x-vcard
Size: 303 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140325/214bf9c4/eric_mccorkle-0001.vcf>


More information about the compiler-dev mailing list