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 235421 - ClassCastException: com.sun.tools.javac.tree.JCTree$JCErroneous cannot be cast to com.sun.tools.javac.tree.JCTree$JCIdent
Summary: ClassCastException: com.sun.tools.javac.tree.JCTree$JCErroneous cannot be cas...
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 7.4
Hardware: All All
: P1 normal (vote)
Assignee: Dusan Balek
URL:
Keywords: 7.4_HR_FIX
Depends on:
Blocks:
 
Reported: 2013-09-02 15:13 UTC by aldobrucale
Modified: 2013-09-16 11:50 UTC (History)
19 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 203520


Attachments
stacktrace (1.44 KB, text/plain)
2013-09-02 15:13 UTC, aldobrucale
Details
stacktrace (1.44 KB, text/plain)
2013-09-03 10:04 UTC, aldobrucale
Details
stacktrace (1.44 KB, text/plain)
2013-09-03 11:25 UTC, Ralph Ruijs
Details
stacktrace (1.44 KB, text/plain)
2013-09-05 09:52 UTC, stefan79
Details
stacktrace (1.44 KB, text/plain)
2013-09-05 10:40 UTC, Exceptions Reporter
Details
stacktrace (1.37 KB, text/plain)
2013-09-06 09:16 UTC, MackSix
Details
Project to use for reproduction. (140.00 KB, application/x-zip-compressed)
2013-09-06 09:28 UTC, MackSix
Details
stacktrace (1.37 KB, text/plain)
2013-09-09 14:02 UTC, Jiri Skrivanek
Details
stacktrace (1.44 KB, text/plain)
2013-09-09 16:26 UTC, theshadow27
Details
stacktrace (1.44 KB, text/plain)
2013-09-09 16:32 UTC, theshadow27
Details
stacktrace (1.44 KB, text/plain)
2013-09-10 07:21 UTC, J Bachorik
Details
stacktrace (1.44 KB, text/plain)
2013-09-11 09:20 UTC, mslama
Details
stacktrace (1.44 KB, text/plain)
2013-09-11 09:50 UTC, Ondrej Vrabec
Details
stacktrace (1.44 KB, text/plain)
2013-09-11 13:14 UTC, J Bachorik
Details
stacktrace (1.37 KB, text/plain)
2013-09-11 16:02 UTC, gholmer
Details
stacktrace (1.37 KB, text/plain)
2013-09-11 21:59 UTC, sreimers
Details
stacktrace (1.44 KB, text/plain)
2013-09-12 07:59 UTC, muellermi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aldobrucale 2013-09-02 15:13:48 UTC
Build: NetBeans IDE Dev (Build 201309020001)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.25-b01, Java(TM) SE Runtime Environment, 1.7.0_25-b15
OS: Linux

User Comments:
aldobrucale: copied and pasted java code




Stacktrace: 
java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCErroneous cannot be cast to com.sun.tools.javac.tree.JCTree$JCIdent
   at com.sun.tools.javac.tree.TreeInfo.getEndPos(TreeInfo.java:587)
   at com.sun.tools.javac.tree.JCTree.getEndPosition(JCTree.java:476)
   at com.sun.tools.javac.util.JCDiagnostic.getIntEndPosition(JCDiagnostic.java:483)
   at com.sun.tools.javac.util.JCDiagnostic.getEndPosition(JCDiagnostic.java:495)
   at org.netbeans.modules.java.source.parsing.CompilationInfoImpl$DiagnosticListenerImpl$D.getEndPosition(CompilationInfoImpl.java:599)
   at org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider.computeErrors(ErrorHintsProvider.java:198)
Comment 1 aldobrucale 2013-09-02 15:13:51 UTC
Created attachment 139586 [details]
stacktrace
Comment 2 aldobrucale 2013-09-03 10:04:33 UTC
Created attachment 139613 [details]
stacktrace

Deleted a line in java. An if statement is missing the closing brace. The code looks like this:

                while (reader.hasNext()) {
                    final String name = reader.nextName();
                    if ("sections".equals(name)) {
--- deleted line here
//                    } else {
//                        reader.skipValue();
//                    }
                }
Comment 3 Ralph Ruijs 2013-09-03 11:25:33 UTC
Created attachment 139616 [details]
stacktrace

Added try { to a long piece of code.
Comment 4 Exceptions Reporter 2013-09-03 19:16:36 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=203520
Comment 5 stefan79 2013-09-05 09:52:41 UTC
Created attachment 139694 [details]
stacktrace

Exception occured while editing Java-Code.
Comment 6 Exceptions Reporter 2013-09-05 10:40:41 UTC
Created attachment 139696 [details]
stacktrace

Just editing code in java editor
Comment 7 MackSix 2013-09-06 09:16:44 UTC
Created attachment 139744 [details]
stacktrace

1. had an ArrayList<String> tempWordList = new ArrayList<string>();
2. changed delcreation to ListModel<String> tempWordList= new DefaultListModel<String>();
3. attmepted to changed line tempWordList.add(line) to tempWordList.addElement(line)
4. while backspacking out the part "addElement(line)", I think I backspaced and removed the dot and when I typed the dot again, this exception was thrown.

Will try to reproduce
Comment 8 MackSix 2013-09-06 09:28:24 UTC
1. Open attached project Illuminator_1.zip and file.
2. Open UserWordListModel.java in editor.
3. Go to line 82 and remove the comments "//".
4. Go to line 83 and remove the comments "//".

This exception is thrown.

Product Version: NetBeans IDE Dev (Build 201309040001)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b55
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b40
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 9 MackSix 2013-09-06 09:28:56 UTC
Created attachment 139745 [details]
Project to use for reproduction.
Comment 10 Exceptions Reporter 2013-09-07 18:22:49 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=203520
Comment 11 Jiri Skrivanek 2013-09-09 14:02:58 UTC
Created attachment 139839 [details]
stacktrace

Editing in editor when cursor at the end of

try{ Thread.sl
Comment 12 Svata Dedic 2013-09-09 15:06:35 UTC
The scenario from comment #8 is reproducable in dev build. Possibly the defect is in com.sun.tools.javac.tree.TreeInfo.getEndPos(), the switch branch for ERRONEOUS contains a hardly intended fall-through to the IDENT case.
Comment 13 theshadow27 2013-09-09 16:26:57 UTC
Created attachment 139849 [details]
stacktrace

created inner class
Comment 14 theshadow27 2013-09-09 16:32:57 UTC
Created attachment 139850 [details]
stacktrace

typed else {
Comment 15 J Bachorik 2013-09-10 07:21:11 UTC
Created attachment 139872 [details]
stacktrace

Typing the closing bracket in the try clause

try {
        ProcessBuilder pb = new ProcessBuilder(LAUNCHER, p.toString(), TEST_CLASSES, "TestApplication");
        Process prc = pb.start();
        monitorProcess(prc.getInputStream(), "TestApplication", null);
        prc.waitFor();
        }
Comment 16 Jan Lahoda 2013-09-10 07:23:37 UTC
(In reply to Svata Dedic from comment #12)
> The scenario from comment #8 is reproducable in dev build. Possibly the
> defect is in com.sun.tools.javac.tree.TreeInfo.getEndPos(), the switch
> branch for ERRONEOUS contains a hardly intended fall-through to the IDENT
> case.

Yes, that is not intended, there should be a break in the erroneous section. Sorry for that.
Comment 17 mslama 2013-09-11 09:20:42 UTC
Created attachment 139923 [details]
stacktrace

edit java code
Comment 18 Ondrej Vrabec 2013-09-11 09:50:44 UTC
Created attachment 139926 [details]
stacktrace

finishing: } catch (IllegalArgumentException ex)
Comment 19 Exceptions Reporter 2013-09-11 09:50:48 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=203520
Comment 20 J Bachorik 2013-09-11 13:14:47 UTC
Created attachment 139934 [details]
stacktrace

typing
Comment 21 gholmer 2013-09-11 16:02:51 UTC
Created attachment 139941 [details]
stacktrace

Editing Java code. Error comes up repeatedly.
Comment 22 sreimers 2013-09-11 21:59:56 UTC
Created attachment 139955 [details]
stacktrace

Writing generics code with jdk8
Comment 23 muellermi 2013-09-12 07:59:57 UTC
Created attachment 139968 [details]
stacktrace

edit after paste
Comment 25 Jiri Prox 2013-09-12 14:25:03 UTC
verified in trunk
Comment 26 Tomas Zezula 2013-09-13 19:27:19 UTC
The fix is OK.
Comment 27 Dusan Balek 2013-09-14 17:41:04 UTC
Integrated into release74.

http://hg.netbeans.org/releases/rev/cc09ed195044
Comment 28 Quality Engineering 2013-09-15 01:26:24 UTC
Integrated into 'main-silver', will be available in build *201309150002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/33dfbc4b9364
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #235421: ClassCastException: com.sun.tools.javac.tree.JCTree$JCErroneous cannot be cast to com.sun.tools.javac.tree.JCTree$JCIdent - fixed.
Comment 29 Jiri Prox 2013-09-16 11:50:00 UTC
verified in 7.4 rc1