Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 309604

Summary: IAE when debugging with invalid Detail Formatter
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2010-04-18 14:58:17 EDT
N20100414-2000, same problem in 3.5.2 and 3.4.2

- add a Detail Formatter for type "java.util.Map" with this code snippet (the snippet works fine for java.util.HashMap, but not for other maps):

	StringBuffer buf = new StringBuffer();
	buf.append("{");

	Iterator i = this.entrySet().iterator();
        boolean hasNext = i.hasNext();
        while (hasNext) {
	    Entry e = (Entry) (i.next());
            Object key = e.getKey();
            Object value = e.getValue();
            buf.append((key == this ?  "(this Map)" : key) + "=" + 
                       (value == this ? "(this Map)": value));

            hasNext = i.hasNext();
            if (hasNext)
                buf.append("\n,");
        }

	buf.append("}");
	return buf.toString();


- debug this CU:

package xy;
import java.util.Properties;
public class Try {
    public static void main(String[] args) {
        Properties p= new Properties();
        p.put("ky", "val");
        System.out.println(p); // breakpoint
    }
}

- in Variables view, select variable "p"


=> When debugging with JDK 1.6.0_18 (or 1.5.0_22), I get this IAE:

Error
Sun Apr 18 20:40:11 CEST 2010
Exception processing async thread queue

java.lang.IllegalArgumentException: java.util.Hashtable<Object,Object>$Entry
at org.eclipse.jdt.core.Signature.createCharArrayTypeSignature(Signature.java:635)
at org.eclipse.jdt.core.Signature.createTypeSignature(Signature.java:607)
at org.eclipse.jdt.core.Signature.createTypeSignature(Signature.java:899)
at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.getTypeSignature(ASTInstructionCompiler.java:365)
at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:3735)
at org.eclipse.jdt.core.dom.VariableDeclarationFragment.accept0(VariableDeclarationFragment.java:221)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:3762)
at org.eclipse.jdt.core.dom.VariableDeclarationStatement.accept0(VariableDeclarationStatement.java:266)
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.WhileStatement.accept0(WhileStatement.java:166)
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)


=> When debugging with 1.4.2, I get this:

Detail formatter error:
The type Entry is not visible
The type Entry is not visible
The type Hashtable.Entry is not visible
The type Hashtable.Entry is not visible
Void methods cannot return a value
The blank final field serialVersionUID may not have been initialized
The blank final field keyValueSeparators may not have been initialized
The blank final field strictKeyValueSeparators may not have been initialized
The blank final field specialSaveChars may not have been initialized
The blank final field whiteSpaceChars may not have been initialized
The blank final field hexDigit may not have been initialized
...
Comment 1 Eclipse Genie CLA 2019-09-27 15:12:22 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.