vicricker opened a new issue #3667:
URL: https://github.com/apache/netbeans/issues/3667


   ### Apache NetBeans version
   
   Apache NetBeans 12.6
   
   ### What happened
   
   Creating two same-named inner classes in a class causes an exception.
   
   I realize that it is dumb to create two classes with the same name.  It was 
actually caused by Netbeans.  I updated a class and told the IDE to generate 
tests for the new methods.  Since the class is abstract, it needs an Impl class 
for the test.  The test already had one.  Netbeans created a second one.
   
   At work, if I try to save the file, it hang the IDE.  I have to kill -9.
   At home, it shows an error with this exception:
   
   Caused: java.lang.NullPointerException: Cannot invoke 
"com.sun.tools.javac.code.Type.hasTag(com.sun.tools.javac.code.TypeTag)" 
because the return value of "com.sun.tools.javac.code.Type.getEnclosingType()" 
is null
        at 
jdk.compiler/com.sun.tools.javac.code.Symbol.hasOuterInstance(Symbol.java:504)
        at 
org.netbeans.modules.java.source.PostFlowAnalysis.visitClassDef(PostFlowAnalysis.java:114)
        at 
jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:819)
        at 
jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at 
org.netbeans.modules.java.source.PostFlowAnalysis.scan(PostFlowAnalysis.java:104)
        at 
jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at 
jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitClassDef(TreeScanner.java:119)
        at 
org.netbeans.modules.java.source.PostFlowAnalysis.visitClassDef(PostFlowAnalysis.java:116)
        at 
jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:819)
        at 
jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at 
org.netbeans.modules.java.source.PostFlowAnalysis.scan(PostFlowAnalysis.java:104)
        at 
jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at 
jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitTopLevel(TreeScanner.java:66)
        at 
jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:544)
        at 
jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at 
org.netbeans.modules.java.source.PostFlowAnalysis.scan(PostFlowAnalysis.java:104)
        at 
org.netbeans.modules.java.source.PostFlowAnalysis.analyze(PostFlowAnalysis.java:90)
        at 
org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:729)
        at 
org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:515)
        at 
org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:139)
        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:539)
        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)
   
   
   ### How to reproduce
   
   1. Create a class
   2. Create an inner class
   3. Make another copy of that inner class below the first one in the same 
class
   
   public class Outer {
   
       public class Inner {        
       }
   
       public class Inner {        
       }
   }
   
   
   
   ### Did this work correctly in an earlier version?
   
   No
   
   ### Operating System
   
   Fedora 35 Linux
   
   ### JDK
   
   OpenJDK 17.0.2
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   _No response_
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to