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 203371 - ClassCastException: com.sun.tools.javac.tree.JCTree$JCMethodDecl cannot be cast to com.sun.source.tree.VariableTree
Summary: ClassCastException: com.sun.tools.javac.tree.JCTree$JCMethodDecl cannot be ca...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1
Hardware: All All
: P2 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-08 21:12 UTC by Maksim Khramov
Modified: 2011-10-11 14:09 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 181785


Attachments
stacktrace (5.16 KB, text/plain)
2011-10-08 21:12 UTC, Maksim Khramov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Khramov 2011-10-08 21:12:33 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-7965-on-20110925)
VM: Java HotSpot(TM) 64-Bit Server VM, 17.1-b03, Java(TM) SE Runtime Environment, 1.6.0_22-b04
OS: Windows 7

User Comments:
mkhramov: /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



import java.io.File;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author Maks
 */
@ManagedBean(name="IndexBean")
@RequestScoped
public class IndexBean {


    private File[] roots = File.listRoots();

    public File[] getRoots() {
        return roots;
    }

    /** Creates a new instance of IndexBean */
    public IndexBean() {
    }
    @PostConstruct
    public void init() {
        doSome();
    }
    
    private void doSome() {
        System.out.println("hh");
    }
}

Calls Rrefactioring-Inline on doSome() inside init() function. Has no this exceptoin on first attempt (only some window blinks). Has this exception on next attempts...




Stacktrace: 
java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCMethodDecl cannot be cast to com.sun.source.tree.VariableTree
   at org.netbeans.modules.refactoring.java.plugins.InlineVariableTransformer.replaceUsageIfMatch(InlineVariableTransformer.java:126)
   at org.netbeans.modules.refactoring.java.plugins.InlineVariableTransformer.visitIdentifier(InlineVariableTransformer.java:70)
   at org.netbeans.modules.refactoring.java.plugins.InlineVariableTransformer.visitIdentifier(InlineVariableTransformer.java:66)
   at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:1716)
   at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
   at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
Comment 1 Maksim Khramov 2011-10-08 21:12:37 UTC
Created attachment 111714 [details]
stacktrace
Comment 2 Ralph Ruijs 2011-10-10 08:21:42 UTC
Changeset: fff70558a434
Author:    Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Date:      2011-10-10 10:18
Message:   
Issue #203371 - ClassCastException: com.sun.tools.javac.tree.JCTree$JCMethodDecl cannot be cast to com.sun.source.tree.VariableTree
Comment 3 Quality Engineering 2011-10-11 14:09:47 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/fff70558a434
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Issue #203371 - ClassCastException: com.sun.tools.javac.tree.JCTree$JCMethodDecl cannot be cast to com.sun.source.tree.VariableTree