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 187898 - ClassCastException: com.sun.tools.javac.code.Type$JCNoType cannot be cast to com.sun.tools.javac.code.Type$ClassType
Summary: ClassCastException: com.sun.tools.javac.code.Type$JCNoType cannot be cast to ...
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 6.x
Hardware: All All
: P4 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-21 17:07 UTC by Exceptions Reporter
Modified: 2012-11-08 12:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 170849


Attachments
stacktrace (3.90 KB, text/plain)
2010-06-21 17:07 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2010-06-21 17:07:13 UTC
This issue was reported manually by eugene-71.
It already has 1 duplicates 


Build: NetBeans IDE 6.9 (Build 201006101454)
VM: Java HotSpot(TM) Client VM, 16.3-b01, Java(TM) SE Runtime Environment, 1.6.0_20-b02
OS: Linux

User Comments:
GUEST: Source file just ends incorrectly:

--------------------
...
    private static String padr( String s, int len )
    {
        int toAdd = len - s.length();
        StringBuilder b = new StringBuilder( len + 1 );
        b.append( s );
        for ( int i = 0; i < toAdd; i++ ) {
            b.append( ' ' );
        }
        return b.toString();
    }

    getClass().getResource("/er/jconsultant/images/page_delete.png").
}
--------------------




Stacktrace: 
java.lang.ClassCastException: com.sun.tools.javac.code.Type$JCNoType cannot be cast to com.sun.tools.javac.code.Type$ClassType
   at com.sun.tools.javac.code.Types.capture(Types.java:2959)
   at com.sun.tools.javac.comp.Attr.capture(Attr.java:3001)
   at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1450)
   at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1304)
   at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
   at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1988)
Comment 1 Exceptions Reporter 2010-06-21 17:07:17 UTC
Created attachment 100284 [details]
stacktrace
Comment 2 David Strupl 2012-10-25 13:41:51 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 3 David Strupl 2012-10-26 09:58:42 UTC
Correction: is this reproducible? If so please reopen.
Comment 4 eugene-71 2012-10-26 10:16:41 UTC
Yes, this still reproducible.

Just add string "getClass().getResource("test.png")." to the end of source, before closed bracket like this:

    // here is class source

    getClass().getResource("test.png"). // <--- we add this line
} // here bracket closing the class definition

Expected result: error indicated, line underlined with red.

Real result: No errors indicated, NetBeans displays "Unexpected exception" on status line. Further error checking for this file does not work.
Comment 5 Petr Cyhelsky 2012-11-08 12:10:52 UTC
works for me now - have tried adding your line and the lines from previous cases before the end of class or even an inner class but no exception ever occurred and hints and error checking just works. Closing as worksforme - reopen if you are able to reproduce it on recent dev build and please attach exact steps to reproduce.