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 230708

Summary: ClassCastException: java.lang.String cannot be cast to java.lang.Number
Product: java Reporter: aldobrucale <aldobrucale>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: RESOLVED WONTFIX    
Severity: normal CC: mmirilovic, mpetras, yardus
Priority: P3    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 201151
Attachments: stacktrace
patched nb-javac

Description aldobrucale 2013-06-04 08:34:42 UTC
Build: NetBeans IDE Dev (Build 201306022301)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b11
OS: Linux

User Comments:
aldobrucale: Starting netbeans




Stacktrace: 
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
   at com.sun.tools.javac.jvm.Items$ImmediateItem.coerce(Items.java:648)
   at com.sun.tools.javac.jvm.Items$Item.coerce(Items.java:269)
   at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:937)
   at com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:954)
   at com.sun.tools.javac.jvm.Gen.visitNewClass(Gen.java:1888)
   at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1514)
Comment 1 aldobrucale 2013-06-04 08:34:43 UTC
Created attachment 135305 [details]
stacktrace
Comment 2 Dusan Balek 2013-06-04 11:28:56 UTC
Is the issue reproducible with a clean userdir? Do you have a reproducible test case? Thanks.
Comment 3 karamba84 2013-08-05 12:06:46 UTC
As soon as i kill my m2/repository, netbeans will throw this all time long. Its really annoying!
Comment 4 Dusan Balek 2013-08-06 13:19:32 UTC
*** Bug 233232 has been marked as a duplicate of this bug. ***
Comment 5 Dusan Balek 2013-09-05 14:12:59 UTC
Unfortunately, I'm not able to reproduce the problem. Could you please provide a reproducible test case? Thanks.
Comment 6 Marian Petras 2013-09-16 14:23:56 UTC
This happens every time I open a certain Java source file (J2EE entity bean).

I tried to use the trick of starting with a clean userdir. So I did not close the problematic file (to make the IDE open it after the next startup), shut the IDE down, deleted the "userdir" and started the IDE again. It did not help, the exception occurred again.

I cannot provide the problematic source code file but I can help with finding the cause - e.g. by installing a custom patch with extensive logging (preferred) or by trying to find the root cause by reducing it progressively (pretty much time-consuming for me).

I reopened this bug because it has almost 20 duplicates and I because I want to help fix it.
Comment 7 Dusan Balek 2013-09-17 14:00:16 UTC
Created attachment 140173 [details]
patched nb-javac
Comment 8 Dusan Balek 2013-09-17 14:09:41 UTC
Fine Marian, if you are willing to help please replace the original nb-javac-impl.jar (located in java/modules/ext) with the patched version that should add more information to the ClassCastExceptions being thrown. Then try to reproduce the problem and attach the additional information provided. Thanks.
Comment 9 Marian Petras 2013-09-18 09:52:14 UTC
I did not get the exception with the patched nb-javac. When I replaced it with the original nb-javac from NB 7.4 Beta, I got the exception again. Maybe the bug is already fixed in recent development versions of NB 7.4?
Comment 10 Marian Petras 2013-09-19 13:49:35 UTC
I downloaded and installed dev. version of NetBeans 7.4 (build 201309180002) and installed the patched nb-javac-impl.jar there. But I did not get any exception.
Comment 11 Martin Balin 2015-09-17 11:30:10 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.