Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 88064 - CCE when selecting a subtype of AbstractCollection in Variables view with DetailFormatter for AbstractCollection
Summary: CCE when selecting a subtype of AbstractCollection in Variables view with Det...
Status: RESOLVED DUPLICATE of bug 75643
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-15 10:56 EST by Markus Keller CLA
Modified: 2005-03-15 17:14 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-03-15 10:56:25 EST
M200503110845 (3.0.2 RC2)

Set a Detail Formatter for java.util.AbstractCollection with code snippet:
------------------------
//from AbstractCollection#toString():
StringBuffer buf = new StringBuffer();
buf.append("[\n");

    Iterator i = iterator();
    boolean hasNext = i.hasNext();
    while (hasNext) {
        Object o = i.next();
        buf.append(o == this ? "(this Collection)" : String.valueOf(o));
        hasNext = i.hasNext();
        if (hasNext)
            buf.append(",\n");
    }

buf.append("\n]");
return buf.toString();
------------------------

Debug this java application with breakpoints where indicated in the code:
------------------------
package p;
import java.util.Collection;
import java.util.HashMap;
class A {
	public static void main(String[] args) {
		HashMap hm= new HashMap();
		hm.put("a", "b");
		Collection c= hm.values();
		System.out.println(c); // breakpoint here,
		                       // then select 'c' in variables view
		c= new ArrayList();
		c.add("b");
		System.out.println(c); // breakpoint here,
		                       // then select 'c' in variables view
	}
}
------------------------

With a Sun VM (I used jdk1.4.2_06), the variables view detail pane shows for c
at the first breakpoint:
------------------------
Detail formatter error: 
		The method iterator() is undefined for the type HashMap
------------------------

At the second breakpoint, I get the CCE below. With a J9 VM (I tried
j9n142-20040928a and j9n142sr1a-20050202), I always get the CCE.

Error Mrz 15, 2005 16:34:09.947 Exception processing async thread queue
java.lang.ClassCastException:
org.eclipse.jdt.internal.debug.core.model.JDIObjectValue
	at
org.eclipse.jdt.internal.debug.eval.ast.instructions.ConditionalJump.execute(ConditionalJump.java:27)
	at
org.eclipse.jdt.internal.debug.eval.ast.engine.Interpreter.execute(Interpreter.java:50)
	at
org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine$1$EvaluationRunnable.run(ASTEvaluationEngine.java:317)
	at
org.eclipse.jdt.internal.debug.core.model.JDIThread.runEvaluation(JDIThread.java:659)
	at
org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine$EvalRunnable.run(ASTEvaluationEngine.java:351)
	at
org.eclipse.jdt.internal.debug.core.model.JDIThread$ThreadJob.run(JDIThread.java:2516)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 1 Markus Keller CLA 2005-03-15 11:18:21 EST
BTW: the detail formatter seems to work fine as long as the collections are empty.
Also works fine in I20050308-1510 (latest 3.1).
Comment 2 Darin Wright CLA 2005-03-15 17:14:45 EST

*** This bug has been marked as a duplicate of 75643 ***