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 206116 - Jackpot CCE: JCTree$JCBlock cannot be cast to ExpressionTree
Summary: Jackpot CCE: JCTree$JCBlock cannot be cast to ExpressionTree
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-07 23:48 UTC by Jesse Glick
Modified: 2012-04-21 09:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 183544


Attachments
stacktrace (2.73 KB, text/plain)
2011-12-07 23:48 UTC, Jesse Glick
Details
stacktrace (2.73 KB, text/plain)
2012-03-23 19:52 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-12-07 23:48:57 UTC
Build: NetBeans IDE Dev (Build 20111206-9523c3784668)
VM: Java HotSpot(TM) Client VM, 20.4-b02, Java(TM) SE Runtime Environment, 1.6.0_29-b11
OS: Linux

User Comments:
jglick: Trying to apply a hint:

$v.setUseSubstringInQuickSearch($b) :: $v instanceof org.openide.explorer.view.TreeView
=>
;;




Stacktrace: 
java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCBlock cannot be cast to com.sun.source.tree.ExpressionTree
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.rewriteChildren(ImmutableTreeTranslator.java:835)
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.visitExpressionStatement(ImmutableTreeTranslator.java:409)
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.visitExpressionStatement(ImmutableTreeTranslator.java:92)
   at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1178)
   at org.netbeans.modules.java.source.transform.ImmutableTreeTranslator.translate(ImmutableTreeTranslator.java:134)
   at org.netbeans.api.java.source.TreeUtilities$1.translate(TreeUtilities.java:960)
Comment 1 Jesse Glick 2011-12-07 23:48:59 UTC
Created attachment 113940 [details]
stacktrace
Comment 2 Jesse Glick 2012-03-23 19:52:59 UTC
Created attachment 117180 [details]
stacktrace

Accepting hint to remove Templates.setDefinesMainProject(wiz, false); from source code.
Comment 3 Jan Lahoda 2012-04-19 07:33:48 UTC
The given usecase should work now (will basically remove the enclosing expression statement from its parent). Also added a warning when an expression is to be removed from the parent and it is non-void, as that may lead to unintended effects:
http://hg.netbeans.org/main-silver/rev/b119d6984cb6
Comment 4 Quality Engineering 2012-04-19 09:59:44 UTC
Integrated into 'main-golden', will be available in build *201204190400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b119d6984cb6
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #206116: ability to remove expression whose parent is an expression statement, adding a warning to the editor about related suspicious cases.
Comment 5 Quality Engineering 2012-04-21 09:57:37 UTC
Integrated into 'main-golden', will be available in build *201204210400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/49d23b89eaaf
User: Jesse Glick <jglick@netbeans.org>
Log: Fix of #206116 means this should now work.