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 254934 - ClassCastException: com.sun.tools.jdi.StringReferenceImpl cannot be cast to com.sun.jdi.ClassType
Summary: ClassCastException: com.sun.tools.jdi.StringReferenceImpl cannot be cast to c...
Status: RESOLVED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-02 14:12 UTC by franciscocpg
Modified: 2015-09-24 01:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 219622


Attachments
stacktrace (3.75 KB, text/plain)
2015-09-02 14:12 UTC, franciscocpg
Details
Test case (735 bytes, text/x-java)
2015-09-02 15:59 UTC, Martin Entlicher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description franciscocpg 2015-09-02 14:12:37 UTC
This bug was originally marked as duplicate of bug 177528, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 8.0.2 (Build 201411181905)
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:
franciscocpg: dont know




Stacktrace: 
java.lang.ClassCastException: com.sun.tools.jdi.StringReferenceImpl cannot be cast to com.sun.jdi.ClassType
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitNewClass(EvaluatorVisitor.java:2562)
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitNewClass(EvaluatorVisitor.java:205)
   at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1538)
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitMethodInvocation(EvaluatorVisitor.java:282)
   at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitMethodInvocation(EvaluatorVisitor.java:205)
   at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1483)
Comment 1 franciscocpg 2015-09-02 14:12:39 UTC
Created attachment 155823 [details]
stacktrace
Comment 2 Martin Entlicher 2015-09-02 15:45:29 UTC
I'm not able to reproduce the exception, can you please provide some sample code? Some Java class as a context and the expression that triggers this exception when evaluated?
Comment 3 Martin Entlicher 2015-09-02 15:56:03 UTC
I managed to reproduce it.

The code must not be compilable when doing the evaluation, thus you have probably made some modifications during debugging.
Comment 4 Martin Entlicher 2015-09-02 15:59:53 UTC
Created attachment 155834 [details]
Test case

To reproduce, use the attached class.
Submit a line breakpoint to line 21 and debug file.

When the breakpoint is hit, select the expression on lines 21-25 and hold the mouse upon the selected text to get a tooltip.
The code will evaluate and you'll get the result in a tooltip.

Then uncomment line 20 and comment line 9. Save the file.

Select the same expression again and wait for a tooltip. This exception is thrown instead.
Comment 5 Martin Entlicher 2015-09-02 16:21:23 UTC
Fixed by changeset:   291514:68c3f0590819
http://hg.netbeans.org/core-main/rev/68c3f0590819

In the attached test case, error message 'Unknown type "URL"' is displayed instead of the exception, after this fix.
Comment 6 Quality Engineering 2015-09-04 01:23:56 UTC
Integrated into 'main-silver', will be available in build *201509040002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/68c3f0590819
User: mentlicher@netbeans.org
Log: #254934: When a class type can not be resolved, report it as an unknown type.
Comment 7 Martin Entlicher 2015-09-22 14:02:01 UTC
Because of issue #255429, this fix was changed:
changeset:   292396:57c29cf25c7f
http://hg.netbeans.org/core-main/rev/57c29cf25c7f
Comment 8 Quality Engineering 2015-09-24 01:29:00 UTC
Integrated into 'main-silver', will be available in build *201509240002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/57c29cf25c7f
User: mentlicher@netbeans.org
Log: #255429: Change the fix of issue #254934 not to be sensitive for error elements.