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 227429

Summary: ClassCastException: com.sun.tools.javac.tree.JCTree$JCExpressionStatement cannot be cast to com.sun.source.tree.ExpressionTree
Product: java Reporter: theshadow27 <theshadow27>
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: VERIFIED FIXED    
Severity: normal CC: mmirilovic
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 199583
Attachments: stacktrace

Description theshadow27 2013-03-13 17:00:56 UTC
Build: NetBeans IDE 7.3 (Build 201302132200)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.7-b01, Java(TM) SE Runtime Environment, 1.7.0_15-b03
OS: Mac OS X

User Comments:
theshadow27: Clicked correct with the tooltip for the StringEqualsIgnoreCase.hint below

------- START SNIP ---------

<!description="String.equalsIgnoreCase is inefficient">
$f.equalsIgnoreCase($g) :: $f instanceof java.lang.String && $g instanceof java.lang.String
=> StringUtil.equalsIgnoreCase($f, $g);
;;

------ END SNIP --------

I should file a general RFE on the inspector system in general, but that is a seperate topic all together.

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_15; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Mac OS X version 10.8.2 running on x86_64; US-ASCII; en_US (nb)
User directory: /Users/theshadow/Library/Application Support/NetBeans/7.3
Cache directory: /Users/theshadow/Library/Caches/NetBeans/7.3




Stacktrace: 
java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCExpressionStatement cannot be cast to com.sun.source.tree.ExpressionTree
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.rewriteChildren(ImmutableTreeTranslator.java:987)
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.visitAssignment(ImmutableTreeTranslator.java:441)
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.visitAssignment(ImmutableTreeTranslator.java:94)
   at com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1476)
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.translate(ImmutableTreeTranslator.java:136)
   at org.netbeans.api.java.source.TreeUtilities$1.translate(TreeUtilities.java:963)
Comment 1 theshadow27 2013-03-13 17:00:58 UTC
Created attachment 132576 [details]
stacktrace
Comment 2 Jan Lahoda 2013-04-03 17:40:57 UTC
Conversion from expression to expression statement works the same as conversion from the expression into the embedded expression from the statement after this change:
http://hg.netbeans.org/jet-main/rev/134a187ce1d9
Comment 3 Jiri Prox 2013-04-15 14:41:57 UTC
verified
Comment 4 Jan Lahoda 2013-05-03 07:32:07 UTC
release73:
http://hg.netbeans.org/releases/rev/63a232d7d373
Comment 5 Quality Engineering 2013-05-05 00:26:23 UTC
Integrated into 'releases', will be available in build *201305042200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/63a232d7d373
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #227429: tolerate rewrite of expression to expression statement.