Bug 317046 - Exception during debugging when hover mouse over a field
Summary: Exception during debugging when hover mouse over a field
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 338629 341930 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-16 10:06 EDT by Lysathor CLA
Modified: 2011-04-05 12:12 EDT (History)
7 users (show)

See Also:


Attachments
avoiding the cast (2.04 KB, patch)
2010-07-30 19:29 EDT, Stephan Herrmann CLA
srikanth_sankaran: iplog+
srikanth_sankaran: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lysathor CLA 2010-06-16 10:06:09 EDT
What steps will reproduce the problem?
1. Move mouse over variable
2. 
3. 


-- Error Details --
Date: Wed Jun 16 16:04:33 CEST 2010
Message: Exception processing async thread queue
Severity: Error
Product: Eclipse 1.3.0.20100609-1425 (org.eclipse.epp.package.java.product)
Plugin: org.eclipse.jdt.debug
Session Data:
eclipse.buildId=I20100603-1500
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product



-- Error Details --
Date: Wed Jun 16 16:04:33 CEST 2010
Message: Exception processing async thread queue
Severity: Error
Product: Eclipse 1.3.0.20100609-1425 (org.eclipse.epp.package.java.product)
Plugin: org.eclipse.jdt.debug
Exception Stack Trace:
java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding
	at org.eclipse.jdt.internal.compiler.lookup.TypeBinding.isProvablyDistinct(TypeBinding.java:633)
	at org.eclipse.jdt.internal.compiler.ast.Expression.checkUnsafeCast(Expression.java:526)
	at org.eclipse.jdt.internal.compiler.ast.Expression.checkCastTypesCompatibility(Expression.java:486)
	at org.eclipse.jdt.core.dom.TypeBinding.isCastCompatible(TypeBinding.java:1014)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.getEnclosingLevel(ASTInstructionCompiler.java:404)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:2715)
	at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:237)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:2571)
	at org.eclipse.jdt.core.dom.InfixExpression.accept0(InfixExpression.java:364)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2528)
	at org.eclipse.jdt.core.dom.ReturnStatement.accept0(ReturnStatement.java:136)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2551)
	at org.eclipse.jdt.core.dom.Block.accept0(Block.java:136)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2528)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:504)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2551)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:484)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2551)
	at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:219)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.createExpressionFromAST(ASTEvaluationEngine.java:414)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:361)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:331)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager.getCompiledExpression(JavaDetailFormattersManager.java:395)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager.resolveFormatter(JavaDetailFormattersManager.java:158)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager.access$1(JavaDetailFormattersManager.java:143)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager$2.run(JavaDetailFormattersManager.java:138)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread$ThreadJob.run(JDIThread.java:2756)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Lysathor CLA 2010-06-16 10:07:49 EDT
Remark:
When pasing the variable name to "expressions", it is displayed without problems.
Comment 2 Darin Wright CLA 2010-06-16 10:32:40 EDT
Which version of Eclipse does this happen on? i.e. what is the "Build id" on the "Help > About Eclipse" diaog?
Comment 3 Lysathor CLA 2010-06-16 15:49:08 EDT
It is the Helios RC4.
Comment 4 Darin Wright CLA 2010-06-16 16:51:55 EDT
What is the type of the field? Does the type of the field you are hovering over have a detail formatter associated with it?
Comment 5 Lysathor CLA 2010-06-17 10:07:45 EDT
Yes, I use Detail Formatters. But not all variables seem to be influenced.
I get an Error for a HashMap. The Formatter I use is:
getClass().getSimpleName()+":"+toString()
When the formatter is disabled, the exception does not occur.
When pasting the expression 
abc.getClass().getSimpleName()+":"+abc.toString()
with instance abc to the "expressions" view, the value is correctly displayed.
Comment 6 Markus Kuppe CLA 2010-07-30 09:58:19 EDT
I see the same behavior with today's version of 3.6.1 with a simple "toString()" formatter on java.lang.Object.
Comment 7 Darin Wright CLA 2010-07-30 11:49:38 EDT
I can reproduce the problem with the following steps. The CCE is happenning in JDT Core code, but I'm not sure if Debug is doing anything wrong. Moving to JCore for comment.

* Create a Detail Formatter for java.util.HashMap with the following snippet:
     getClass().getSimpleName()+":"+toString()

* Debug a Junit test like this, stopping at Breakppint

	public void testCapacity() {
		int size= fFullest.size();
		HashMap map = new HashMap();
		for (int i= 0; i < 100; i++) { // BREAKPOINT
			fFullest.addElement(new Integer(i));
			map.put(new Integer(i), new Integer(i));
		}
		assertTrue(fFullest.size() == 100+size);
	}

* Select "map" in the variables view or hover over it:

java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding
	at org.eclipse.jdt.internal.compiler.lookup.TypeBinding.isProvablyDistinct(TypeBinding.java:633)
	at org.eclipse.jdt.internal.compiler.ast.Expression.checkUnsafeCast(Expression.java:526)
	at org.eclipse.jdt.internal.compiler.ast.Expression.checkCastTypesCompatibility(Expression.java:486)
	at org.eclipse.jdt.core.dom.TypeBinding.isCastCompatible(TypeBinding.java:1014)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.getEnclosingLevel(ASTInstructionCompiler.java:406)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:2757)
	at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:237)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:2616)
	at org.eclipse.jdt.core.dom.InfixExpression.accept0(InfixExpression.java:364)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2528)
	at org.eclipse.jdt.core.dom.ReturnStatement.accept0(ReturnStatement.java:136)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2551)
	at org.eclipse.jdt.core.dom.Block.accept0(Block.java:136)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2528)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:504)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2551)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:484)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2551)
	at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:219)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.createExpressionFromAST(ASTEvaluationEngine.java:448)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:395)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:365)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager.getCompiledExpression(JavaDetailFormattersManager.java:395)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager.resolveFormatter(JavaDetailFormattersManager.java:158)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager.access$1(JavaDetailFormattersManager.java:143)
	at org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersManager$2.run(JavaDetailFormattersManager.java:138)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread$ThreadJob.run(JDIThread.java:2756)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 8 Stephan Herrmann CLA 2010-07-30 19:29:28 EDT
Created attachment 175634 [details]
avoiding the cast

I haven't tried your scenario but the offending cast is definitely
unnecessary as my patch shows.
Comment 9 Srikanth Sankaran CLA 2010-08-23 00:03:36 EDT
Thanks for the patch, Stephen, I'll follow up for M2.
Comment 10 Srikanth Sankaran CLA 2010-09-08 07:12:02 EDT
Comment on attachment 175634 [details]
avoiding the cast

Patch looks good. I'll release the patch with
minor cleanup shortly.
Comment 11 Srikanth Sankaran CLA 2010-09-08 07:14:55 EDT
Released in HEAD for 3.7 M2.

Note to verifier:

Please verify by code inspection and checking that
the scenario in comment# 7 is addressed by this patch.
I didn't have much luck reducing it to a junit with
reasonable effort.
Comment 12 Ayushman Jain CLA 2010-09-14 06:49:44 EDT
Verified for 3.7M2 using build I20100909-1700.
Comment 13 Michael Rennie CLA 2011-03-31 11:06:20 EDT
*** Bug 338629 has been marked as a duplicate of this bug. ***
Comment 14 Michael Rennie CLA 2011-04-05 12:12:43 EDT
*** Bug 341930 has been marked as a duplicate of this bug. ***