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

Opening java class files causes IllegalArgumentException from JavacTool

    XMLWordPrintableJSON

Details

    Description

      I often open class files when browsing the maven dependencies of a project. With netbeans 9 I get exceptions from the JavacTool. It does not matter whether the maven project has sources associated or if the disassembler is used.

      The exception:

      java.lang.IllegalArgumentException: Compilation unit is not of SOURCE kind: "Encoder.class"
          at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:161)
          at org.netbeans.modules.java.source.parsing.JavacParser.createJavacTask(JavacParser.java:873)
          at org.netbeans.modules.java.source.parsing.JavacParser.createJavacTask(JavacParser.java:727)
          at org.netbeans.modules.java.source.parsing.CompilationInfoImpl.getJavacTask(CompilationInfoImpl.java:374)
          at org.netbeans.modules.java.source.parsing.ClassParser.getResult(ClassParser.java:160)
          at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)
          at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:239)
          at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)
          at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
          at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
      [catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
          at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
          at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
          at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

      Steps to reproduce:

      • open a maven project with dependencies
      • open the dependencies node
      • select on dependency and expand it
      • open a class file by double clicking on it

      When selecting a class file in the favorites window. It does not happen if the file is opened by the "Go to source" action invoked on the import statement for the corresponding class.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              matthiasblaesing Matthias Bläsing
              Votes:
              2 Vote for this issue
              Watchers:
              3 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 - 1h 10m
                  1h 10m