This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 138391

Summary: AssertionError at com.sun.tools.javac.comp.Attr.visitNewClass
Product: java Reporter: Jan Pokorsky <jpokorsky>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: RESOLVED FIXED    
Severity: blocker CC: abhijeetrajenamdeo, adrianosb83, aldobrucale, alexlamsl, bondolo, cbulcu, Chiana, choces, crimes, crosati, cschlichtherle, dkonecny, eaili, emiddio, engineer, fedind, find_suvro, FrantaM, gtg, gtzabari, hkhan_2004, javacavaj, jglick, jjazzboss, jmichelberger, kvaso, lazarius, lubor, marano, matthies, mgukov, mklaehn, mmirilovic, monezz, obrejla, ovrabec, pblakez, pekarna, pzajac, ralphbenjamin, rcasha, Revivius, rudyment, sairictus, scanti, sreimers, tboudreau, theshadow27, tmysik, williambacchi, yardus, ymajoros, yogeswaran, zn_cn_2
Priority: P2    
Version: 7.0   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=16407
Issue Type: DEFECT Exception Reporter: 16407
Bug Depends on:    
Bug Blocks: 152191    
Attachments: RefactoringActionsProvider.dump
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
Requested dump file
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace

Description Jan Pokorsky 2008-06-26 17:06:27 UTC
Build: NetBeans IDE 6.0 (Build 200711261600)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: Linux, 2.6.22-14-generic, i386
User comments: 
STACKTRACE: (first 10 lines)
java.lang.AssertionError
        at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1547)
        at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1351)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:383)
        at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:400)
        at com.sun.tools.javac.comp.Attr.visitAssign(Attr.java:1616)
        at com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1445)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:383)
        at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:407)
        at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1079)
        at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1147)
Comment 1 Jan Pokorsky 2008-06-26 17:11:26 UTC
Product Version: NetBeans IDE Dev (Build 20080626082658)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Linux version 2.6.22-14-generic running on i386; UTF-8; en_US (nb)

In my case I was modifying constructor params in following snippet

            task = new TreePathHandleTask(new HashSet<Node>(lookup.lookupAll(Node.class)), ) {

                @Override
                protected RefactoringUI createRefactoringUI(Collection<TreePathHandle> handles) {
                    return new WhereUsedQueryUI(handles.iterator().next(), cinfo);
                }
                
            };
Comment 2 Jan Pokorsky 2008-06-26 17:12:27 UTC
Created attachment 63528 [details]
RefactoringActionsProvider.dump
Comment 3 Jan Becicka 2008-07-18 10:52:28 UTC
*** Issue 119994 has been marked as a duplicate of this issue. ***
Comment 4 Jan Becicka 2008-07-24 14:49:45 UTC
It looks like this assert too restrictive?
Attr.java: 1561
assert sym.kind < AMBIGUOUS || tree.constructor == null || tree.constructor.type == null ||
tree.constructor.type.isErroneous();

tree.constructor.type.isErroneous() ... constructor probably is erroneous if being modified.
Comment 5 Jan Becicka 2008-07-24 16:59:56 UTC
*** Issue 137352 has been marked as a duplicate of this issue. ***
Comment 6 Dusan Balek 2008-07-28 09:39:55 UTC
*** Issue 141700 has been marked as a duplicate of this issue. ***
Comment 7 Jan Becicka 2008-08-05 15:59:49 UTC
*** Issue 141699 has been marked as a duplicate of this issue. ***
Comment 8 pzajac 2008-09-24 17:09:04 UTC
Build: NetBeans IDE Dev (Build 20080915015330)
VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02
OS: Linux, 2.6.24-19-generic, i386

User Comments: 


Stacktrace: 
java.lang.AssertionError
        at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1561)
        at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1350)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:387)
        at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:404)
        at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:758)
        at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:713)
Comment 9 pzajac 2008-09-24 17:09:23 UTC
Created attachment 70497 [details]
stacktrace
Comment 10 Jan Becicka 2008-11-12 09:27:43 UTC
*** Issue 126812 has been marked as a duplicate of this issue. ***
Comment 11 _ alexlamsl 2009-01-15 19:04:49 UTC
Build: NetBeans IDE Dev (Build 200812180001)
VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Windows XP, 5.1, x86

User Comments: 
editting code

Stacktrace: 
java.lang.AssertionError
        at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1569)
        at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1350)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:391)
        at com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:452)
        at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1320)
        at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1300)
Comment 12 _ alexlamsl 2009-01-15 19:04:59 UTC
Created attachment 75865 [details]
stacktrace
Comment 13 Dusan Balek 2009-01-20 08:47:16 UTC
Enhanced logging.

changeset 8dd6ea47d34a in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=8dd6ea47d34a
Comment 14 pzajac 2009-03-19 14:42:59 UTC
Build: NetBeans IDE 6.5 (Build 200811100001)
VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02
OS: Linux, 2.6.24-22-generic, i386

User Comments: 
Exception on editing java file

Stacktrace: 
java.lang.AssertionError
        at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1569)
        at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1350)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:391)
        at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:408)
        at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:765)
        at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:713)
Comment 15 pzajac 2009-03-19 14:43:09 UTC
Created attachment 78458 [details]
stacktrace
Comment 16 Dusan Balek 2009-03-27 17:01:17 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/10c7bd4eca7f
Comment 17 pzajac 2009-05-12 11:35:41 UTC
Build: NetBeans IDE 6.5.1 (Build 200903060201)
VM: Java HotSpot(TM) Client VM, 11.2-b01, Java(TM) SE Runtime Environment, 1.6.0_12-b04
OS: Linux, 2.6.24-24-generic, i386

User Comments: 


Stacktrace: 
java.lang.AssertionError
        at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1569)
        at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1350)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:391)
        at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:408)
        at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:765)
        at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:713)
Comment 18 pzajac 2009-05-12 11:35:46 UTC
Created attachment 81945 [details]
stacktrace
Comment 19 J Bachorik 2010-04-20 12:55:59 UTC
Created attachment 97714 [details]
stacktrace
Comment 20 m_potociar 2010-10-26 15:45:12 UTC
Reopening. I have reported an exception in NB 7.0M2 that was classified as a duplicate of this bug:

http://statistics.netbeans.org/analytics/exception.do?id=433269
Comment 21 Dusan Balek 2010-12-02 13:21:33 UTC
*** Bug 177365 has been marked as a duplicate of this bug. ***
Comment 22 Dusan Balek 2010-12-02 13:22:33 UTC
*** Bug 185364 has been marked as a duplicate of this bug. ***
Comment 23 Dusan Balek 2011-04-05 14:14:02 UTC
*** Bug 197034 has been marked as a duplicate of this bug. ***
Comment 24 Jesse Glick 2011-07-20 19:10:58 UTC
Created attachment 109541 [details]
stacktrace
Comment 25 Tomas Mysik 2011-07-25 14:05:06 UTC
Created attachment 109605 [details]
stacktrace

Just wanted to generate anonymous Runnable class
Comment 26 Tomas Mysik 2011-07-25 14:35:06 UTC
Created attachment 109607 [details]
stacktrace
Comment 27 aldobrucale 2011-10-05 09:14:48 UTC
Created attachment 111510 [details]
stacktrace

Autocompletion in java
Comment 28 Ondrej Vrabec 2011-11-23 13:36:53 UTC
Created attachment 113468 [details]
stacktrace
Comment 29 J Bachorik 2011-11-29 10:37:26 UTC
Created attachment 113611 [details]
stacktrace
Comment 30 _ tboudreau 2011-12-07 02:24:59 UTC
Created attachment 113896 [details]
stacktrace

JDialog dlg = new JDialog();
dlg.addWindowListener(new WindowAdapter(){});

exception is thrown once WindowAdapter line is completed
Comment 31 williambacchi 2012-01-13 11:11:49 UTC
Created attachment 114868 [details]
stacktrace
Comment 32 williambacchi 2012-01-13 11:14:49 UTC
Created attachment 114869 [details]
stacktrace

pasting code
Comment 33 Tomas Mysik 2012-02-15 12:54:57 UTC
Created attachment 115748 [details]
stacktrace
Comment 34 J Bachorik 2012-04-03 13:47:16 UTC
Created attachment 117741 [details]
stacktrace
Comment 35 Jesse Glick 2012-04-10 13:37:57 UTC
Created attachment 118061 [details]
Requested dump file
Comment 36 Jesse Glick 2012-04-10 13:38:25 UTC
Created attachment 118062 [details]
stacktrace
Comment 37 David Konecny 2012-05-06 21:15:00 UTC
Created attachment 119136 [details]
stacktrace
Comment 38 Petr Cyhelsky 2012-05-22 10:35:11 UTC
There are already 416 duplicates of this exception report -> P2
Comment 39 theshadow27 2012-06-20 21:50:03 UTC
Created attachment 121128 [details]
stacktrace

Code completion
Comment 40 theshadow27 2012-06-20 21:53:02 UTC
Created attachment 121129 [details]
stacktrace

Seems to be connected to previous report. Trying to do code completion in same class
Comment 41 Dusan Balek 2012-06-21 08:21:43 UTC
I have analyzed the recent exception reports and it seems that all of them fall into one of the following groups: 
1) CouplingAbort is thrown before the AssertionError denoting there is no constructor - strange thing is that ElementCoupling runs on Elements that already come from source files (it means enter and attribution runs twice on a single source tree).
2) cases when a TreeLoader is involved. A reproducible case when enter and attribution can run twice on a single source tree due to bug in TreeLoader. A separate issue has been created to track this case - http://netbeans.org/bugzilla/show_bug.cgi?id=214552).

Since half of the reports are resloved/fixed, downgrading back to P3.
Comment 42 _ tboudreau 2012-07-27 00:54:36 UTC
Created attachment 122436 [details]
stacktrace

Writing field subclass of a nested class in another module.
Comment 43 Chiana 2012-09-24 18:02:10 UTC
Created attachment 124823 [details]
stacktrace

Was cutting and pasting entire methods from one file to an other trying to get rid of one extra step...
Noted: This occured after the "Import Classes" dialog had opened.
Comment 44 Tomas Pavek 2012-10-05 15:54:48 UTC
*** Bug 219610 has been marked as a duplicate of this bug. ***
Comment 45 crimes 2012-10-05 16:18:51 UTC
In the GUI Builder I can reproduce this issue in a completely fresh TopComponent with a single swing control, simply by adding an instance field that contains an instance of a nested class (constructed and assigned inline).  Trying to add an event listener to the component then results in this exception.  Set the field to null instead and everything's fine.
Comment 46 Marian Mirilovic 2012-10-05 19:26:58 UTC
(In reply to comment #41)
> Since half of the reports are resloved/fixed, downgrading back to P3.

Half of opened bugs is still over 200 ... P2 at least
Comment 47 Dusan Balek 2012-10-16 14:49:18 UTC
Fixed in jet-main. Thanks for the reproducible test case.

http://hg.netbeans.org/jet-main/rev/46082e0b6168
http://hg.netbeans.org/main/nb-javac/rev/83678790cb34
Comment 48 Quality Engineering 2012-10-17 02:05:13 UTC
Integrated into 'main-golden', will be available in build *201210170002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/46082e0b6168
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #138391: AssertionError at com.sun.tools.javac.comp.Attr.visitNewClass - fixed.