### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java,v retrieving revision 1.37 diff -u -r1.37 DebugEvaluationTest.java --- src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java 27 May 2008 23:54:01 -0000 1.37 +++ src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java 5 Jun 2008 08:44:01 -0000 @@ -3868,6 +3868,56 @@ removeTempClass("A62"); } } +public void test066() { + if (this.complianceLevel < ClassFileConstants.JDK1_5) return; + try { + String sourceA66 = + "public class A66 {\n" + + "\tprivate int i;\n" + + "\tpublic A66() {;\n" + + "\t}\n" + + "\tprivate int foo(int i) {;\n" + + "\t\treturn i;\n" + + "\t}\n" + + "\tpublic void bar() {\n" + + "\t}\n" + + "}"; + compileAndDeploy15(sourceA66, "A66"); + + String userCode = "new A66().bar();"; + JDIStackFrame stackFrame = + new JDIStackFrame(this.jdiVM, this, userCode, "A66", "bar", -1); + + DebugRequestor requestor = new DebugRequestor(); + char[] snippet = "return this.foo(3);".toCharArray(); + try { + context.evaluate( + snippet, + stackFrame.localVariableTypeNames(), + stackFrame.localVariableNames(), + stackFrame.localVariableModifiers(), + stackFrame.declaringTypeName(), + stackFrame.isStatic(), + stackFrame.isConstructorCall(), + getEnv(), + getCompilerOptions(), + requestor, + getProblemFactory()); + } catch (InstallException e) { + assertTrue("No targetException " + e.getMessage(), false); + } + assertTrue( + "Should get one result but got " + (requestor.resultIndex + 1), + requestor.resultIndex == 0); + EvaluationResult result = requestor.results[0]; + assertTrue("Code snippet should not have problems", !result.hasProblems()); + assertTrue("Result should have a value", result.hasValue()); + assertEquals("Value", "3".toCharArray(), result.getValueDisplayString()); + assertEquals("Type", "int".toCharArray(), result.getValueTypeName()); + } finally { + removeTempClass("A66"); + } +} /** * https://bugs.eclipse.org/bugs/show_bug.cgi?id=178861 */