Bug 126271 - [65cat] NPE at com.sun.tools.javac.comp.Flow.visitMethodDef
[65cat] NPE at com.sun.tools.javac.comp.Flow.visitMethodDef
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Compiler
6.x
All All
: P3 (vote)
: 7.2
Assigned To: Dusan Balek
issues@java
http://statistics.netbeans.org/except...
EXCEPTIONS_REPORT
:
: 126273 (view as bug list)
Depends on:
Blocks: 152191
  Show dependency treegraph
 
Reported: 2008-01-30 12:49 UTC by unr303
Modified: 2012-05-25 05:45 UTC (History)
12 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (4.06 KB, text/plain)
2008-01-30 12:49 UTC, unr303
Details
dump file (10.33 KB, text/plain)
2008-01-30 12:51 UTC, unr303
Details
ide log (408.60 KB, text/plain)
2008-01-30 12:52 UTC, unr303
Details
ide log (99.40 KB, text/plain)
2008-02-08 06:53 UTC, unr303
Details
dump file (10.49 KB, text/plain)
2008-02-08 06:53 UTC, unr303
Details
gestures (198.41 KB, text/plain)
2008-02-08 06:53 UTC, unr303
Details
ide log (101.81 KB, text/plain)
2008-02-08 06:58 UTC, unr303
Details
dump (10.45 KB, text/plain)
2008-02-11 06:45 UTC, unr303
Details
ide log (142.03 KB, text/plain)
2008-02-11 06:45 UTC, unr303
Details
gestures (1.21 MB, text/plain)
2008-02-11 06:45 UTC, unr303
Details
stacktrace (2.12 KB, text/plain)
2008-09-15 15:32 UTC, Michel Graciano
Details
Corrupted source file (8.41 KB, text/plain)
2008-09-15 15:37 UTC, Michel Graciano
Details
stacktrace (2.12 KB, text/plain)
2008-09-15 15:52 UTC, _ alexlamsl
Details
Dump file (37.40 KB, application/octet-stream)
2011-11-29 18:13 UTC, _ gtzabari
Details
stacktrace (831 bytes, text/plain)
2011-12-03 08:24 UTC, dbell
Details
stacktrace (838 bytes, text/plain)
2011-12-03 08:27 UTC, dbell
Details
stacktrace (5.40 KB, text/plain)
2011-12-15 09:58 UTC, _ tboudreau
Details
stacktrace (5.41 KB, text/plain)
2011-12-15 10:28 UTC, _ tboudreau
Details
stacktrace (5.10 KB, text/plain)
2012-05-23 11:10 UTC, williambacchi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description unr303 2008-01-30 12:49:53 UTC
Build: NetBeans IDE Dev (Build 200801290002)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Windows XP, 5.1, x86

User Comments: 
editing code
Comment 1 unr303 2008-01-30 12:49:57 UTC
Created attachment 55752 [details]
stacktrace
Comment 2 unr303 2008-01-30 12:51:41 UTC
Created attachment 55754 [details]
dump file
Comment 3 unr303 2008-01-30 12:52:05 UTC
Created attachment 55755 [details]
ide log
Comment 4 Jan Lahoda 2008-01-30 13:13:52 UTC
*** Issue 126273 has been marked as a duplicate of this issue. ***
Comment 5 Jan Lahoda 2008-01-30 13:54:29 UTC
*** Issue 126273 has been marked as a duplicate of this issue. ***
Comment 6 Jan Lahoda 2008-01-30 13:54:52 UTC
From issue #126273:
1. grid1. 
2. <CTRL+SPACE>
3. <SELECT setChoiceColumnVisible>
4. IDE inserted         grid1.setChoiceColumnVisible(rootPaneCheckingEnabled);
5. trying to change selected text "rootPaneCheckingEnabled"
6. exception
Comment 7 Tomas Zezula 2008-02-06 17:37:55 UTC
Unfortunately I am not able to reproduce it yet, even when I used the attached source and created some "dummy" closure
(used classes from these class).
Comment 8 Tomas Zezula 2008-02-06 18:41:46 UTC
I am going to integrate some fix in Flow tomorrow then I will let you know about the build containing the fix (the
problem is similar to the reported one, but probably it's not completely same).
Can you than try the new build?
Thanks,
Tomas
Comment 9 Tomas Zezula 2008-02-07 13:27:49 UTC
Hopefully fixed in: e43ae29fd08d
But I was not able to reproduce the issue, I've fixed one possible trace on which the inits may be assigned to null in
the  Flow, but I don't know if it was the only possible trace. Can you try a new build? I will attach a link when the
build will be done. If you will have still the problem please reopen this issue. I will send you a patched javac logging
the traces in the Flow.
Thanks,
Tomas
Comment 10 Tomas Zezula 2008-02-07 14:59:19 UTC
Here is the first build having the change: http://deadlock.netbeans.org/hudson/job/trunk/275/artifact/nbbuild/dist/zip/
Or you can use a night build which will come tonight or nay later build.
Thanks,
Tomas
Comment 11 unr303 2008-02-08 06:53:02 UTC
Created attachment 56311 [details]
ide log
Comment 12 unr303 2008-02-08 06:53:16 UTC
Created attachment 56312 [details]
dump file
Comment 13 unr303 2008-02-08 06:53:32 UTC
Created attachment 56313 [details]
gestures
Comment 14 unr303 2008-02-08 06:57:07 UTC
Sorry. It is still in netbeans-hudson-trunk-295-java.zip.
Doing same thing: grid1., select "setChoiceColumnVisible", ide inserted
"setChoiceColumnVisible(rootPaneCheckingEnabled);", got exception.
After that i try to move cursor and got another exception:
java.lang.IllegalStateException: Cannot call getCompilationInfo() if current phase < JavaSource.Phase.PARSED. You must
call toPhase(Phase.PARSED) first.
	at org.netbeans.api.java.source.CompilationInfoImpl.getCompilationUnit(CompilationInfoImpl.java:120)
	at org.netbeans.api.java.source.CompilationInfo.getCompilationUnit(CompilationInfo.java:140)
	at org.netbeans.api.java.source.TreeUtilities.pathFor(TreeUtilities.java:184)
	at org.netbeans.modules.editor.java.JavaCodeTemplateFilter.run(JavaCodeTemplateFilter.java:94)
	at org.netbeans.modules.editor.java.JavaCodeTemplateFilter.run(JavaCodeTemplateFilter.java:64)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:656)
	at org.netbeans.api.java.source.JavaSource.runWhenScanFinished(JavaSource.java:788)
	at org.netbeans.modules.editor.java.JavaCodeTemplateFilter.<init>(JavaCodeTemplateFilter.java:78)
	at org.netbeans.modules.editor.java.JavaCodeTemplateFilter.<init>(JavaCodeTemplateFilter.java:64)
	at org.netbeans.modules.editor.java.JavaCodeTemplateFilter$Factory.createFilter(JavaCodeTemplateFilter.java:127)
	at
org.netbeans.lib.editor.codetemplates.CodeTemplateManagerOperation.getTemplateFilters(CodeTemplateManagerOperation.java:232)
	at org.netbeans.lib.editor.codetemplates.SurroundWithFix.getFixes(SurroundWithFix.java:68)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.showSurroundWithHint(AbbrevDetection.java:371)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.access$100(AbbrevDetection.java:90)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection$1.actionPerformed(AbbrevDetection.java:165)
	at javax.swing.Timer.fireActionPerformed(Timer.java:271)
[catch] at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at org.netbeans.core.TimeableEventQueue.dispatchEvent(TimeableEventQueue.java:104)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Comment 15 unr303 2008-02-08 06:58:49 UTC
Created attachment 56314 [details]
ide log
Comment 16 Tomas Zezula 2008-02-08 08:31:52 UTC
The "java.lang.IllegalStateException: Cannot call getCompilationInfo() if current phase < JavaSource.Phase.PARSED. You
must call toPhase(Phase.PARSED) first" is consequence of the above NPE, will disappear when the NPE is fixed.
Comment 17 Tomas Zezula 2008-02-08 13:15:24 UTC
I've added some logging, for now high level logging.
The attribution phase of of javac has 3 phases before flow after parse (Enter - attributes class decl, MemberEnter -
attrtes features (methods, fields), Attr - attributes method bodies)
any of it may leave an empty subtree.
I will attach link to hudson when the build will be available.
Comment 18 Tomas Zezula 2008-02-08 15:59:16 UTC
Here is the link with the build:
http://deadlock.netbeans.org/hudson/job/trunk/306/artifact/nbbuild/dist/zip/
The IDE needs to be started with this additional flag to enable the logging:
-J-Dorg.netbeans.api.java.source.JavaSource.level=400

Just open the JNewFrame and generate the exception, in the messages.log there should be some additional information.
Thanks,
Tomas
Comment 19 unr303 2008-02-11 06:45:18 UTC
Created attachment 56404 [details]
dump
Comment 20 unr303 2008-02-11 06:45:32 UTC
Created attachment 56405 [details]
ide log
Comment 21 unr303 2008-02-11 06:45:57 UTC
Created attachment 56406 [details]
gestures
Comment 22 Tomas Zezula 2008-02-11 12:01:27 UTC
Thanks for the logs, finally I was able to set up a reproduceable case.
Comment 23 Tomas Zezula 2008-02-13 15:13:27 UTC
Next try :-)
Fixed in: e80355b17b61
Comment 24 jonast 2008-09-14 21:55:23 UTC
Seems this issue has appeared again. This appeared in nightly 200809140201.
Comment 25 Tomas Zezula 2008-09-15 10:39:48 UTC
The original reason is fixed, but there can be other reasons why the tree is not attributed.
Please attach the exception if possible file causing the exception.

Comment 26 Michel Graciano 2008-09-15 15:32:12 UTC
Build: NetBeans IDE Dev (Build 200809111401)
VM: Java HotSpot(TM) Client VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06
OS: Linux, 2.6.24-21-generic, i386

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at com.sun.tools.javac.comp.Flow.visitMethodDef(Flow.java:674)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:657)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow.visitClassDef(Flow.java:654)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:588)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
Comment 27 Michel Graciano 2008-09-15 15:32:21 UTC
Created attachment 69878 [details]
stacktrace
Comment 28 Michel Graciano 2008-09-15 15:37:42 UTC
Created attachment 69879 [details]
Corrupted source file
Comment 29 Michel Graciano 2008-09-15 15:39:08 UTC
The exception was thrown when I duplicate the FooForm inner class with Ctrl + Shift + Down
Comment 30 _ alexlamsl 2008-09-15 15:51:56 UTC
Build: NetBeans IDE Dev (Build 200809120201)
VM: Java HotSpot(TM) Client VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06
OS: Windows XP, 5.1, x86

User Comments: 
copy and paste inner static class

Stacktrace: 
java.lang.NullPointerException
        at com.sun.tools.javac.comp.Flow.visitMethodDef(Flow.java:674)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:657)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow.visitClassDef(Flow.java:654)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:588)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
Comment 31 _ alexlamsl 2008-09-15 15:52:02 UTC
Created attachment 69880 [details]
stacktrace
Comment 32 Tomas Zezula 2008-09-15 17:10:35 UTC
Caused by recent compile on save changes
Comment 33 Dusan Balek 2008-09-16 13:55:42 UTC
Fixed.

changeset 44173b08e292 in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=44173b08e292
changeset e672ecbb5afa in main
details: http://hg.netbeans.org/main?cmd=changeset;node=e672ecbb5afa
Comment 34 Quality Engineering 2008-09-17 06:11:10 UTC
Integrated into 'main-golden', will be available in build *200809170201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e672ecbb5afa
User: Dusan Balek <dbalek@netbeans.org>
Log: Issues #126271 and #146996 fixed.
Comment 35 Exceptions Reporter 2008-10-30 14:53:31 UTC
Reopening - reproduced in NetBeans IDE Dev (Build 200810300201)
http://statistics.netbeans.org/exceptions/detail.do?id=134295
Comment 36 Dusan Balek 2008-11-19 12:45:25 UTC
The case with duplicated inner classes is fixed, but there can be other reasons why the tree is not attributed.
Please attach the generated exception dump file if possible.
Comment 37 Jiri Prox 2008-12-05 14:01:45 UTC
Requested information was not provided, so I'm closing this issue for now. If you can still reproduce it
feel free to reopen this issue and provide requested info.
Thanks.
Comment 38 _ gtzabari 2011-11-29 18:13:37 UTC
Created attachment 113633 [details]
Dump file

Here is the requested dump file.
Comment 39 _ gtzabari 2011-11-29 18:14:45 UTC
Please note the dump file was generated under Netbeans 7.1:

Product Version: NetBeans IDE Dev (Build 201111220600)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)

Please update "Version" and "Target Milestone" accordingly.
Comment 40 medeag 2011-11-30 06:56:48 UTC
please refer to http://statistics.netbeans.org/analytics/exception.do?id=547106, there are similar cases in the list, so it maybe useful.
Comment 41 dbell 2011-12-03 08:24:45 UTC
Created attachment 113786 [details]
stacktrace

Pressed Ctrl+Space to invoke code completion
Comment 42 dbell 2011-12-03 08:27:45 UTC
Created attachment 113787 [details]
stacktrace

Invoked code completion
Comment 43 _ tboudreau 2011-12-15 09:58:35 UTC
Created attachment 114216 [details]
stacktrace

Pasted some code into a parent class from a subclass of it.
Comment 44 _ tboudreau 2011-12-15 10:28:36 UTC
Created attachment 114217 [details]
stacktrace

Restarted and cleared var/cache to try to get rid of this issue.  Attempted to rename an interface.
Comment 45 _ tboudreau 2011-12-15 17:52:11 UTC
In case it's useful:  In another project (the file the compiler threw the exception on), there were a number of invalid implementations of the class I was trying to refactor - I'd changed it from an interface to an abstract class and manually copied and pasted a bunch of code into the parent class, changing its signatures.  The file in question also contained an import for a class in a non-existent package.
Comment 46 williambacchi 2012-05-23 11:10:37 UTC
Created attachment 119769 [details]
stacktrace
Comment 48 Quality Engineering 2012-05-25 05:45:08 UTC
Integrated into 'main-golden', will be available in build *201205250002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7ae576ddf660
User: Dusan Balek <dbalek@netbeans.org>
Log: NPEs fixed (see issues #126271, #178114, #192723, #194758, #196863, #199921, #200555, #201317, #202443, #206760, #207651, and #210936).


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo