diff options
author | Sarika Sinha | 2014-02-20 16:17:26 +0000 |
---|---|---|
committer | Mike Rennie | 2014-03-07 17:15:12 +0000 |
commit | 961971c1763194c42beafc12a7a8bf272cab1498 (patch) | |
tree | 766122a3df502d94a6b21e1f5c550d6449de591a | |
parent | 9f07abedb80e4dbe979fcdeb31b532f95ff63190 (diff) | |
download | eclipse.jdt.debug-961971c1763194c42beafc12a7a8bf272cab1498.tar.gz eclipse.jdt.debug-961971c1763194c42beafc12a7a8bf272cab1498.tar.xz eclipse.jdt.debug-961971c1763194c42beafc12a7a8bf272cab1498.zip |
Bug 427077 - [1.8] Unable to evaluate expressions in the context of an
interface
Change-Id: I31c558a720802827a815ed145a3d2233e16b9558
Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
5 files changed, 28 insertions, 26 deletions
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java index 0007d104c..49ae57567 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java @@ -452,6 +452,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation if (!loaded18) { jp = createProject(ONE_EIGHT_PROJECT_NAME, JavaProjectHelper.TEST_1_8_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_1_8_EE_NAME, false); cfgs.add(createLaunchConfiguration(jp, "EvalTest18")); + cfgs.add(createLaunchConfiguration(jp, "EvalTestIntf18")); loaded18 = true; waitForBuild(); } diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java index 3fd10428b..89fa901da 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java @@ -16,6 +16,7 @@ package org.eclipse.jdt.debug.tests.eval; import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.debug.core.IJavaLineBreakpoint; import org.eclipse.jdt.debug.core.IJavaThread; import org.eclipse.jdt.debug.tests.AbstractDebugTest; @@ -60,5 +61,28 @@ public class Java8Tests extends AbstractDebugTest { } } + /** + * Evaluates a snippet in the context of interface method + * generic statement + * + * @throws Exception + */ + public void testEvalInterfaceMethod() throws Exception { + IJavaThread thread = null; + try { + String type = "EvalTestIntf18"; + IJavaLineBreakpoint bp = createLineBreakpoint(23, "", "EvalTestIntf18.java", "Intf18"); + assertNotNull("should have created breakpoint", bp); + thread = launchToBreakpoint(type); + assertNotNull("The program did not suspend", thread); + String snippet = "a + 2"; + doEval(thread, snippet); + } + finally { + removeAllBreakpoints(); + terminateAndRemove(thread); + } + } + } diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java index f35e2da1c..c67ed9e89 100644 --- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java +++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,7 +39,6 @@ import org.eclipse.jdt.debug.core.IEvaluationRunnable; import org.eclipse.jdt.debug.core.IJavaArray; import org.eclipse.jdt.debug.core.IJavaArrayType; import org.eclipse.jdt.debug.core.IJavaDebugTarget; -import org.eclipse.jdt.debug.core.IJavaInterfaceType; import org.eclipse.jdt.debug.core.IJavaObject; import org.eclipse.jdt.debug.core.IJavaReferenceType; import org.eclipse.jdt.debug.core.IJavaStackFrame; @@ -47,7 +46,6 @@ import org.eclipse.jdt.debug.core.IJavaThread; import org.eclipse.jdt.debug.core.IJavaType; import org.eclipse.jdt.debug.core.IJavaValue; import org.eclipse.jdt.debug.core.IJavaVariable; -import org.eclipse.jdt.debug.core.JDIDebugModel; import org.eclipse.jdt.debug.eval.IAstEvaluationEngine; import org.eclipse.jdt.debug.eval.ICompiledExpression; import org.eclipse.jdt.debug.eval.IEvaluationListener; @@ -130,7 +128,6 @@ public class ASTEvaluationEngine implements IAstEvaluationEngine { IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException { traceCaller(snippet, frame.getThread()); - checkInterface(frame); ICompiledExpression expression = getCompiledExpression(snippet, frame); evaluateExpression(expression, frame, listener, evaluationDetail, hitBreakpoints); @@ -182,24 +179,6 @@ public class ASTEvaluationEngine implements IAstEvaluationEngine { } } - /** - * Checks if the stack frame is declared in an interface an aborts if so. - * - * @param frame - * stack frame - * @throws DebugException - * if declaring type is an interface - */ - private void checkInterface(IJavaStackFrame frame) throws DebugException { - if (frame.getReferenceType() instanceof IJavaInterfaceType) { - IStatus status = new Status(IStatus.ERROR, - JDIDebugModel.getPluginIdentifier(), - DebugException.REQUEST_FAILED, - EvaluationEngineMessages.ASTEvaluationEngine_0, null); - throw new DebugException(status); - } - } - /* * (non-Javadoc) * diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java index ca6fc9702..43a9423ae 100644 --- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java +++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -61,7 +61,6 @@ public class EvaluationEngineMessages extends NLS { NLS.initializeMessages(BUNDLE_NAME, EvaluationEngineMessages.class); } - public static String ASTEvaluationEngine_0; public static String ASTEvaluationEngine_1; public static String ArrayRuntimeContext_0; } diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties index e3cfb4b20..d40620425 100644 --- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties +++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2013 IBM Corporation and others. +# Copyright (c) 2000, 2014 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -49,6 +49,5 @@ ASTInstructionCompiler_1=Unable to resolve type binding of constructor: {0} ASTInstructionCompiler_2=Unable to resolve type binding of declaring type of: {0} ASTInstructionCompiler_4=The ASTInstruction compiler failed to store instruction at counter: {0} ASTInstructionCompiler_5=Unable to resolve binding for: {0} -ASTEvaluationEngine_0=Unable to evaluate expressions in the context of an interface ASTEvaluationEngine_1=Unable to retrieve type for java.lang.Object ArrayRuntimeContext_0=Unable to retrieve type for java.lang.Object |