Community
Participate
Working Groups
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)
BTW: the detail formatter seems to work fine as long as the collections are empty. Also works fine in I20050308-1510 (latest 3.1).
*** This bug has been marked as a duplicate of 75643 ***