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:$JCNoType cannot be cast to$ClassType
Summary: ClassCastException:$JCNoType cannot be cast to ...
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 6.x
Hardware: All All
: P4 normal (vote)
Assignee: Dusan Balek
Depends on:
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

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

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();


java.lang.ClassCastException:$JCNoType cannot be cast to$ClassType
Comment 1 Exceptions Reporter 2010-06-21 17:07:17 UTC
Created attachment 100284 [details]
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.