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

NullPointerException during copy/paste of Java 12 code (in the attached project)

    XMLWordPrintableJSON

Details

    Description

      I got the exception below in a fresh installation of Netbeans 11.1.  This is after I installed nb-javac 1.6, but zero other plugins.  I'm using Gradle 5.5 on Windows 10, but that probably makes no difference here.  Netbeans is running on OpenJDK 12 and the project is also being built using Java 12.

      The bug can be reproduced using the attached small project, which I painstakingly distilled out from a large code base where this bug was first found. To trigger the exception, you need to copy "CopyMe" from Source.java and paste it into Destination.java.  Upon pasting, the "Import Classes" dialog will appear.  Immediately after pressing the "OK" button, this exception happens:

       

      java.lang.NullPointerExceptionjava.lang.NullPointerException at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:334) at org.netbeans.lib.nbjavac.services.NBResolve.isAccessible(NBResolve.java:72) at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:379) at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:441) at org.netbeans.lib.nbjavac.services.NBResolve.isAccessible(NBResolve.java:66) at com.sun.tools.javac.api.JavacTrees.isAccessible(JavacTrees.java:913) at org.netbeans.api.java.source.GeneratorUtilities.getImportedElement(GeneratorUtilities.java:1826) at org.netbeans.api.java.source.GeneratorUtilities.addImports(GeneratorUtilities.java:1173) at org.netbeans.api.java.source.SourceUtils.resolveImport(SourceUtils.java:403) at org.netbeans.modules.java.editor.imports.ClipboardHandler$1.run(ClipboardHandler.java:154) at org.netbeans.modules.java.editor.imports.ClipboardHandler$1.run(ClipboardHandler.java:126) at org.netbeans.api.java.source.JavaSource$1.run(JavaSource.java:673) at org.netbeans.api.java.source.JavaSource$1.run(JavaSource.java:663) at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:502) at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586) at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130) at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114) at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181) at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178) at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153) at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335) at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118) at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67) at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178) at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81) at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:452) at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:423) at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:684) at org.netbeans.modules.java.editor.imports.ClipboardHandler.doImport(ClipboardHandler.java:126) at org.netbeans.modules.java.editor.imports.ClipboardHandler.access$100(ClipboardHandler.java:113) at org.netbeans.modules.java.editor.imports.ClipboardHandler$4$1.run(ClipboardHandler.java:216) 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)[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

      Attachments

        Issue Links

          Activity

            People

              jlahoda Jan Lahoda
              Furrer Travis
              Votes:
              0 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 - 40m
                  40m