Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-1781

can't open classes in binary .jar (java.lang.ClassCastException: com.sun.tools.javac.code.Type$ClassType cannot be cast to com.sun.tools.javac.code.Type$ErrorType)

    XMLWordPrintableJSON

    Details

      Description

      After updating to nb-javac 1.51, when I try to open a class in a binary .jar file, it often fails with an exception like this

      java.lang.ClassCastException: com.sun.tools.javac.code.Type$ClassType cannot be cast to com.sun.tools.javac.code.Type$ErrorType
          at org.netbeans.modules.java.source.builder.TreeFactory.Type(TreeFactory.java:797)
          at org.netbeans.api.java.source.TreeMaker.Type(TreeMaker.java:1083)
          at org.netbeans.modules.java.classfile.CodeGenerator$TreeBuilder.visitExecutable(CodeGenerator.java:549)
          ...

      This happens whenever the class references a class in a different .jar. For example, create a maven project, add org.apache.httpcomponents:httpclient (but don't download source!) and open the HttpClient class - it fails because of the various classes referenced from the httpcore dependency.

      It looks like this started once http://hg.openjdk.java.net/jdk/jdk/rev/cc2673fa8c20 was merged into nb-javac - TreeFactory's assumption that getKind()==ERROR implies ErrorType is no longer true.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jeffreymorlan Jeffrey Morlan
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m