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 70448 - ClassCastException from ClassFileInfoUtil.parseTypeParams()
Summary: ClassCastException from ClassFileInfoUtil.parseTypeParams()
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-15 08:03 UTC by Nam Nguyen
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ClassCastException most likely when edit java with generics (79.10 KB, text/plain)
2005-12-15 08:05 UTC, Nam Nguyen
Details
Fixed CCE when type parameter is bounded by another type parameter (1.10 KB, text/plain)
2005-12-15 10:18 UTC, Pavel Flaska
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nam Nguyen 2005-12-15 08:03:32 UTC
release50 Build 200512132030

java.lang.RuntimeException: java.lang.ClassCastException:
org.netbeans.modules.javacore.parser.TypeParamRef
	at
org.netbeans.modules.java.hints.JavaHintsProvider.getHints(JavaHintsProvider.java:153)
Comment 1 Nam Nguyen 2005-12-15 08:05:47 UTC
Created attachment 27863 [details]
ClassCastException most likely when edit java with generics
Comment 2 Pavel Flaska 2005-12-15 09:12:49 UTC
I was unable to reproduce. Could you, please, provide the source, where it occured?
Comment 3 Pavel Flaska 2005-12-15 09:47:42 UTC
We no longer need the source and steps, we are able to reproduce.
Comment 4 Tomas Hurka 2005-12-15 09:59:52 UTC
The CCE happens if you have class like this: 
public class NewClass<E> {
    <T extends E> void hhhh(T x) {   
    }
}

This class must be read from classfile (this happen when source is to available). Important think is that 
type parameter T must extends another type parameter.

There is easy way how to reproduce this CCE in a different scenario. 
1) Add above class to j2se project.
2) complie this class
3) go to Files Tab and in build firectory find the class file corresponding to the NewClass.
4) still in the Files Tab expand NewClass node.
5) CCE is here. :-)

We already have trivial fix, which will go to release50 branch.
Comment 5 Pavel Flaska 2005-12-15 10:16:08 UTC
Fixed in trunk.

Checking in src/org/netbeans/modules/javacore/parser/ClassFileInfoUtil.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/ClassFileInfoUtil.java,v
 <--  ClassFileInfoUtil.java
new revision: 1.38; previous revision: 1.37
done
Comment 6 Pavel Flaska 2005-12-15 10:18:44 UTC
Created attachment 27870 [details]
Fixed CCE when type parameter is bounded by another type parameter
Comment 7 Tomas Hurka 2005-12-15 10:50:23 UTC
I reviewed the fix and it can be merged to release50 branch.
Comment 8 Milan Kubec 2005-12-16 10:12:43 UTC
Fix verified in trunk build 200512151900.
Comment 9 Pavel Flaska 2005-12-16 12:17:12 UTC
Merged to release50 branch.

Checking in ./src/org/netbeans/modules/javacore/parser/ClassFileInfoUtil.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/ClassFileInfoUtil.java,v
 <--  ClassFileInfoUtil.java
new revision: 1.37.2.1; previous revision: 1.37
done
Comment 10 Milan Kubec 2006-01-05 11:14:25 UTC
Verified in release50-200601042030.
Comment 11 Quality Engineering 2007-09-20 12:07:53 UTC
Reorganization of java component