vM5-20020430
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/EvaluateAction.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/EvaluateAction.java
index 2704fd8..e718dce 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/EvaluateAction.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/EvaluateAction.java
@@ -222,9 +222,9 @@
engine = JDIDebugUIPlugin.getDefault().getEvaluationEngine(project, (IJavaDebugTarget)jFrame.getDebugTarget());
if (object == null) {
- engine.evaluate(expression, jFrame, this);
+ engine.evaluate(expression, jFrame, this, DebugEvent.EVALUATION, true);
} else {
- engine.evaluate(expression, object, (IJavaThread)jFrame.getThread(), this);
+ engine.evaluate(expression, object, (IJavaThread)jFrame.getThread(), this, DebugEvent.EVALUATION, true);
}
} catch (CoreException e) {
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java
index 89f98aa..a0e6f2a 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java
@@ -407,7 +407,7 @@
if (getImports() != null) {
getEvaluationEngine().setImports(getImports());
}
- getEvaluationEngine().evaluate(snippet,getThread(), this);
+ getEvaluationEngine().evaluate(snippet,getThread(), this, true);
} catch (DebugException e) {
JDIDebugUIPlugin.log(e);
ErrorDialog.openError(getShell(), SnippetMessages.getString("SnippetEditor.error.evaluating"), null, e.getStatus()); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/EvaluationManager.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/EvaluationManager.java
index 23b87a0..d915df1 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/EvaluationManager.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/EvaluationManager.java
@@ -28,7 +28,6 @@
*/
public class EvaluationManager {
-
/**
* Not to be instantiated
*/
@@ -40,22 +39,28 @@
* performs evaluations for local Java applications
* by deploying class files.
*
- * @param project the java project in which snippets
+ * @param project the Java project in which expressions
* are to be compiled
- * @param vm the java debug target in which snippets
+ * @param target the Java debug target in which expressions
* are to be evaluated
* @param directory the directory where support class files
* are deployed to assist in the evaluation. The directory
* must exist.
+ * @return an evaluation engine
*/
- public static IClassFileEvaluationEngine newClassFileEvaluationEngine(IJavaProject project, IJavaDebugTarget vm, File directory) {
- return new LocalEvaluationEngine(project, vm, directory);
+ public static IClassFileEvaluationEngine newClassFileEvaluationEngine(IJavaProject project, IJavaDebugTarget target, File directory) {
+ return new LocalEvaluationEngine(project, target, directory);
}
/**
- * Creates and returns a new evaluation engine that performs
- * evaluations by creating an abstract syntax tree (AST) represention
- * of an expression.
+ * Creates and returns a new evaluation engine that performs evaluations by
+ * compiling expressions into abstract syntax trees (ASTs), and interpreting
+ * the AST over a JDI connection. This type of evaluation engine is capable of
+ * performing remote evalautions.
+ *
+ * @param project the Java project in which expressions are to be compiled
+ * @param target the Java debug target in which expressions are to be evaluated
+ * @return an evaluation engine
*/
public static ASTEvaluationEngine newAstEvaluationEngine(IJavaProject project, IJavaDebugTarget target) {
return new ASTEvaluationEngine(project, target);
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IAstEvaluationEngine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IAstEvaluationEngine.java
index df355e7..1879ae4 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IAstEvaluationEngine.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IAstEvaluationEngine.java
@@ -14,10 +14,12 @@
/**
* An evaluation engine that performs evaluations by
- * iterpretting abstract syntax trees. An AST evalutaion engine
+ * interpretting abstract syntax trees. An AST evalutaion engine
* is capable of creating compiled expressions that can be
* evaluated multiple times in a given runtime context.
- *
+ * <p>
+ * Clients are not intended to implement this interface.
+ * </p>
* @since 2.0
*/
public interface IAstEvaluationEngine extends IEvaluationEngine {
@@ -25,19 +27,23 @@
/**
* Asynchronously evaluates the given expression in the context of
* the specified stack frame, reporting the result back to the given listener.
- * The expression is evaluated in the context of the Java
- * project this evaluation engine was created on. If the
- * expression is determined to have no errors, the expression
- * is evaluated in the thread associated with the given
- * stack frame. The thread is resumed from the location at which it
- * is currently suspended. When the evaluation completes, the thread
- * will be suspened at this original location.
+ * The thread is resumed from the location at which it
+ * is currently suspended to perform the evaluation. When the evaluation
+ * completes, the thread will be suspened at this original location.
+ * The thread runs the evaluation with the given evaluation detail
+ * (@see IJavaThread#runEvaluation(IEvaluationRunnable, IProgressMonitor, int)).
+ * Compilation and runtime errors are reported in the evaluation result.
*
- * @param snippet code snippet to evaluate
+ * @param expression expression to evaluate
* @param frame the stack frame context in which to run the
* evaluation.
* @param listener the listener that will receive notification
* when/if the evalaution completes
+ * @param evaluationDetail one of <code>DebugEvent.EVALUATION</code> or
+ * <code>DebugEvent.EVALUATION_IMPLICIT</code>
+ * @param hitBreakpoints whether or not breakpoints should be honored
+ * in the evaluation thread during the evaluation. If <code>false</code>,
+ * breakpoints hit in the evaluation thread will be ignored.
* @exception DebugException if this method fails. Reasons include:<ul>
* <li>Failure communicating with the VM. The DebugException's
* status code contains the underlying exception responsible for
@@ -50,7 +56,7 @@
* to perform nested evaluations</li>
* </ul>
*/
- void evaluateExpression(ICompiledExpression expression, IJavaStackFrame frame, IEvaluationListener listener) throws DebugException;
+ public void evaluateExpression(ICompiledExpression expression, IJavaStackFrame frame, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException;
/**
* Asynchronously evaluates the given expression in the context of
@@ -61,6 +67,9 @@
* is evaluated in the thread associated with the given
* stack frame. When the evaluation completes, the thread
* will be suspened at this original location.
+ * The thread runs the evaluation with the given evaluation detail
+ * (@see IJavaThread#runEvaluation(IEvaluationRunnable, IProgressMonitor, int)).
+ * Compilation and runtime errors are reported in the evaluation result.
*
* @param expression the expression to evaluate
* @param thisContext the 'this' context for the evaluation
@@ -68,6 +77,11 @@
* which must be suspended
* @param listener the listener that will receive notification
* when/if the evalaution completes
+ * @param evaluationDetail one of <code>DebugEvent.EVALUATION</code> or
+ * <code>DebugEvent.EVALUATION_IMPLICIT</code>
+ * @param hitBreakpoints whether or not breakpoints should be honored
+ * in the evaluation thread during the evaluation. If <code>false</code>,
+ * breakpoints hit in the evaluation thread will be ignored.
* @exception DebugException if this method fails. Reasons include:<ul>
* <li>Failure communicating with the VM. The DebugException's
* status code contains the underlying exception responsible for
@@ -80,20 +94,45 @@
* to perform nested evaluations</li>
* </ul>
*/
- void evaluateExpression(ICompiledExpression expression, IJavaObject object, IJavaThread thread, IEvaluationListener listener) throws DebugException;
+ public void evaluateExpression(ICompiledExpression expression, IJavaObject object, IJavaThread thread, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException;
/**
- * Synchronously generates a compiled expression from the given snippet
+ * Synchronously generates a compiled expression from the given expression
* in the context of the specified stack frame. The generated expression
* can be stored and evaluated later in a valid runtime context.
+ * Compilation errors are reported in the returned compiled expression.
+ *
+ * @param expression expression to compile
+ * @param frame the context in which to compile the expression
+ * @exception DebugException if this method fails. Reasons include:<ul>
+ * <li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * <li>The associated thread is not currently suspended</li>
+ * <li>The stack frame is not contained in the debug target
+ * associated with this evaluation engine</li>
+ * </ul>
*/
- ICompiledExpression getCompiledExpression(String snippet, IJavaStackFrame frame) throws DebugException;
+ public ICompiledExpression getCompiledExpression(String expression, IJavaStackFrame frame) throws DebugException;
+
/**
- * Synchronously generates a compiled expression from the given snippet
- * in the context of the specified stack frame. The generated expression
+ * Synchronously generates a compiled expression from the given expression
+ * in the context of the specified object. The generated expression
* can be stored and evaluated later in a valid runtime context.
+ * Compilation errors are reported in the returned compiled expression.
+ *
+ * @param expression expression to compile
+ * @param object the context in which to compile the expression
+ * @exception DebugException if this method fails. Reasons include:<ul>
+ * <li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * <li>The associated thread is not currently suspended</li>
+ * <li>The stack frame is not contained in the debug target
+ * associated with this evaluation engine</li>
+ * </ul>
*/
- ICompiledExpression getCompiledExpression(String snippet, IJavaObject object, IJavaThread thread) throws DebugException;
+ public ICompiledExpression getCompiledExpression(String expression, IJavaObject object) throws DebugException;
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IClassFileEvaluationEngine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IClassFileEvaluationEngine.java
index 87287fa..bff662a 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IClassFileEvaluationEngine.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IClassFileEvaluationEngine.java
@@ -13,7 +13,9 @@
/**
* An evaluation engine that performs evaluations by
* deploying and executing class files locally.
- *
+ * <p>
+ * Clients are not intended to implement this interface.
+ * </p>
* @since 2.0
*/
public interface IClassFileEvaluationEngine extends IEvaluationEngine {
@@ -24,7 +26,7 @@
* ImportDeclaration (JLS2 7.5). For example, <code>"java.util.Hashtable"</code>
* or <code>"java.util.*"</code>.
*
- * @param imports the list of import names
+ * @return the list of import names
*/
public String[] getImports();
@@ -49,12 +51,16 @@
* execution from the location at which it is currently suspended.
* When the evaluation completes, the thread will be suspened
* at this original location.
+ * Compilation and runtime errors are reported in the evaluation result.
*
* @param snippet code snippet to evaluate
* @param thread the thread in which to run the evaluation,
* which must be suspended
* @param listener the listener that will receive notification
* when/if the evalaution completes
+ * @param hitBreakpoints whether or not breakpoints should be honored
+ * in the evaluation thread during the evaluation. If <code>false</code>,
+ * breakpoints hit in the evaluation thread will be ignored.
* @exception DebugException if this method fails. Reasons include:<ul>
* <li>Failure communicating with the VM. The DebugException's
* status code contains the underlying exception responsible for
@@ -67,7 +73,7 @@
* to perform nested evaluations</li>
* </ul>
*/
- public void evaluate(String snippet, IJavaThread thread, IEvaluationListener listener) throws DebugException;
+ public void evaluate(String snippet, IJavaThread thread, IEvaluationListener listener, boolean hitBreakpoints) throws DebugException;
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/ICompiledExpression.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/ICompiledExpression.java
index 07210bd..011a1e9 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/ICompiledExpression.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/ICompiledExpression.java
@@ -10,7 +10,7 @@
/**
* A compiled expression can be compiled once and evaluated multiple times
- * in a given runtime context.
+ * in a runtime context.
* <p>
* Clients are not intended to implement this interface.
* </p>
@@ -22,17 +22,23 @@
public interface ICompiledExpression {
/**
- * Returns the source snippet from which this compiled expression was created
+ * Returns the source snippet from which this compiled expression was created.
+ *
+ * @return the source snippet from which this compiled expression was created
*/
public String getSnippet();
/**
- * Returns whether this compiled expression has any compilation errors
+ * Returns whether this compiled expression has any compilation errors.
+ *
+ * @return whether this compiled expression has any compilation errors
*/
public boolean hasErrors();
/**
* Returns any errors which occurred while creating this compiled expression.
+ *
+ * @return any errors which occurred while creating this compiled expression
*/
public Message[] getErrors();
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationEngine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationEngine.java
index c005a87..689cff7 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationEngine.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationEngine.java
@@ -14,17 +14,12 @@
/**
* An evaluation engine performs an evalutaion of a
- * code snippet in a specified thread of a debug target.
+ * code snippet or expression in a specified thread of a debug target.
* An evaluation engine is associated with a specific
- * debug target and Java project at creation.
+ * debug target and Java project on creation.
* <p>
* Clients are not intended to implement this interface.
* </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
* @see IEvaluationResult
* @see IEvaluationListener
* @since 2.0
@@ -39,14 +34,22 @@
* snippet is determined to be a valid expression, the expression
* is evaluated in the thread associated with the given
* stack frame. The thread is resumed from the location at which it
- * is currently suspended. When the evaluation completes, the thread
- * will be suspened at this original location.
+ * is currently suspended to perform the evaluation. When the evaluation
+ * completes, the thread will be suspened at this original location.
+ * The thread runs the evaluation with the given evaluation detail
+ * (@see IJavaThread#runEvaluation(IEvaluationRunnable, IProgressMonitor, int)).
+ * Compilation and runtime errors are reported in the evaluation result.
*
* @param snippet code snippet to evaluate
* @param frame the stack frame context in which to run the
* evaluation.
* @param listener the listener that will receive notification
* when/if the evalaution completes
+ * @param evaluationDetail one of <code>DebugEvent.EVALUATION</code> or
+ * <code>DebugEvent.EVALUATION_IMPLICIT</code>
+ * @param hitBreakpoints whether or not breakpoints should be honored
+ * in the evaluation thread during the evaluation. If <code>false</code>,
+ * breakpoints hit in the evaluation thread will be ignored.
* @exception DebugException if this method fails. Reasons include:<ul>
* <li>Failure communicating with the VM. The DebugException's
* status code contains the underlying exception responsible for
@@ -59,7 +62,7 @@
* to perform nested evaluations</li>
* </ul>
*/
- void evaluate(String snippet, IJavaStackFrame frame, IEvaluationListener listener) throws DebugException;
+ public void evaluate(String snippet, IJavaStackFrame frame, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException;
/**
* Asynchronously evaluates the given snippet in the context of
* the specified type, reporting the result back to the given listener.
@@ -68,8 +71,11 @@
* snippet is determined to be a valid expression, the expression
* is evaluated in the thread associated with the given
* stack frame. The thread is resumed from the location at which it
- * is currently suspended. When the evaluation completes, the thread
- * will be suspened at this original location.
+ * is currently suspended to perform the evaluation. When the evaluation
+ * completes, the thread will be suspened at this original location.
+ * The thread runs the evaluation with the given evaluation detail
+ * (@see IJavaThread#runEvaluation(IEvaluationRunnable, IProgressMonitor, int)).
+ * Compilation and runtime errors are reported in the evaluation result.
*
* @param snippet code snippet to evaluate
* @param thisContext the 'this' context for the evaluation
@@ -77,19 +83,24 @@
* which must be suspended
* @param listener the listener that will receive notification
* when/if the evalaution completes
+ * @param evaluationDetail one of <code>DebugEvent.EVALUATION</code> or
+ * <code>DebugEvent.EVALUATION_IMPLICIT</code>
+ * @param hitBreakpoints whether or not breakpoints should be honored
+ * in the evaluation thread during the evaluation. If <code>false</code>,
+ * breakpoints hit in the evaluation thread will be ignored.
* @exception DebugException if this method fails. Reasons include:<ul>
* <li>Failure communicating with the VM. The DebugException's
* status code contains the underlying exception responsible for
* the failure.</li>
* <li>The associated thread is not currently suspended</li>
- * <li>The stack frame is not contained in the debug target
+ * <li>The specified thread is not contained in the debug target
* associated with this evaluation engine</li>
* <li>The associated thread is suspended in the middle of
* an evaluation that has not completed. It is not possible
* to perform nested evaluations</li>
* </ul>
*/
- void evaluate(String snippet, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener) throws DebugException;
+ public void evaluate(String snippet, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException;
/**
* Returns the Java project in which snippets are
@@ -97,7 +108,7 @@
*
* @return Java project context
*/
- IJavaProject getJavaProject();
+ public IJavaProject getJavaProject();
/**
* Returns the debug target for which evaluations
@@ -105,13 +116,17 @@
*
* @return Java debug target
*/
- IJavaDebugTarget getDebugTarget();
+ public IJavaDebugTarget getDebugTarget();
/**
- * Disposes this evaluation engine. An engine cannot
- * be used after it has been disposed.
+ * Disposes this evaluation engine. This causes the evaluation engine
+ * to cleanup any resources (such as threads) that it maintains. Clients
+ * should call this method when they are finished performing evaluations
+ * with this engine.
+ *
+ * This engine must not be used to perform evaluations after it has been disposed.
*/
- void dispose();
+ public void dispose();
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationListener.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationListener.java
index dab2fc9..e354da0 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationListener.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationListener.java
@@ -15,11 +15,6 @@
* <p>
* Clients may implement this interface.
* </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
* @see IEvaluationResult
* @since 2.0
*/
@@ -33,5 +28,5 @@
* @param result The result from the evaluation
* @see IEvaluationResult
*/
- void evaluationComplete(IEvaluationResult result);
+ public void evaluationComplete(IEvaluationResult result);
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationResult.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationResult.java
index b5702c9..2add2d5 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationResult.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/IEvaluationResult.java
@@ -16,11 +16,6 @@
* <p>
* Clients are not intended to implement this interface.
* </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
* @see IJavaValue
* @since 2.0
*/
@@ -29,19 +24,18 @@
/**
* Returns the value representing the result of the
- * evaluation. Returns <code>null</code> if the
- * associated evaluation failed, or if the result
- * of the evaluation was <code>null</code>. If
+ * evaluation, or <code>null</code> if the
+ * associated evaluation failed. If
* the associated evaluation failed, there will
* be problems, or an exception in this result.
*
* @return the resulting value, possibly
* <code>null</code>
*/
- IJavaValue getValue();
+ public IJavaValue getValue();
/**
- * Returns whether this evaluation had any problems
+ * Returns whether the evaluation had any problems
* or if an exception occurred while performing the
* evaluation.
*
@@ -49,7 +43,7 @@
* @see #getErrors()
* @see #getException()
*/
- boolean hasErrors();
+ public boolean hasErrors();
/**
* Returns an array of problem messages. Each message describes a problem that
@@ -57,20 +51,14 @@
*
* @return compilation error messages, or an empty array if no errors occurred
*/
- Message[] getErrors();
-
- /**
- * Adds the given error to the collection of compilation errors
- * associated with this result.
- */
- void addError(Message error);
-
+ public Message[] getErrors();
+
/**
* Returns the snippet that was evaluated.
*
* @return The string code snippet.
*/
- String getSnippet();
+ public String getSnippet();
/**
* Returns any exception that occurred while performing the evaluation
@@ -83,21 +71,21 @@
* @see com.sun.jdi.InvocationException
* @see org.eclipse.debug.core.DebugException
*/
- DebugException getException();
+ public DebugException getException();
/**
* Returns the thread in which the evaluation was performed.
*
- * @return The thread in which the evaluation was performed
+ * @return the thread in which the evaluation was performed
*/
- IJavaThread getThread();
+ public IJavaThread getThread();
/**
* Returns the evaluation engine used to evaluate the original
* snippet.
*
- * @return The evaluation engine used to evaluate the
+ * @return the evaluation engine used to evaluate the
* original snippet
*/
- IEvaluationEngine getEvaluationEngine();
+ public IEvaluationEngine getEvaluationEngine();
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.java
index 8628bd4..2ca6a05 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.java
@@ -1,9 +1,16 @@
package org.eclipse.jdt.internal.debug.eval;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v0.5
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v05.html
+
+Contributors:
+ IBM Corporation - Initial implementation
+**********************************************************************/
+
import java.util.MissingResourceException;
import java.util.ResourceBundle;
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.properties b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.properties
index 5623b99..359676c 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.properties
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/EvaluationMessages.properties
@@ -1,9 +1,14 @@
-#########################################
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-#########################################
+######################################################################
+# Copyright (c) 2000, 2002 IBM Corp. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v0.5
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v05.html
+#
+# Contributors:
+# IBM Corporation - Initial implementation
+######################################################################
-EvaluationResult.Problem_marker_does_not_exist_in_this_evaluation_result._1=Problem marker does not exist in this evaluation result.
LocalEvaluationEngine.Evaluation_in_context_of_inner_type_not_supported._19=Evaluation in context of inner type not supported.
LocalEvaluationEngine.Evaluation_failed_-_unable_to_determine_receiving_type_context._18=Evaluation failed - unable to determine receiving type context.
LocalEvaluationEngine.Evaluation_failed_-_internal_error_retreiving_result._17=Evaluation failed - internal error retreiving result.
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/LocalEvaluationEngine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/LocalEvaluationEngine.java
index b66c221..d82dce3 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/LocalEvaluationEngine.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/LocalEvaluationEngine.java
@@ -63,6 +63,16 @@
public class LocalEvaluationEngine implements IClassFileEvaluationEngine, ICodeSnippetRequestor , IEvaluationRunnable {
+ private static final String CODE_SNIPPET_NAME= "CodeSnippet.class"; //$NON-NLS-1$
+
+ /**
+ * A count of the number of engines created.
+ * Count is incremented on instantiation and decremented on
+ * dispose. When the count == 0, the special CodeSnippet.class
+ * is deleted as this class file is shared by all.
+ */
+ private static int ENGINE_COUNT= 0;
+
/**
* The Java project context in which to compile snippets.
*/
@@ -156,6 +166,11 @@
* The name of the code snippet class to instantiate
*/
private String fCodeSnippetClassName = null;
+
+ /**
+ * Wether to hit breakpoints in the evaluation thread
+ */
+ private boolean fHitBreakpoints = false;
/**
* Constant for empty array of <code>java.lang.String</code>
@@ -182,6 +197,7 @@
setJavaProject(project);
setDebugTarget(vm);
setOutputDirectory(directory);
+ ENGINE_COUNT++;
}
/**
@@ -337,7 +353,7 @@
if (problemMarker.getAttribute(IMarker.SEVERITY, -1) != IMarker.SEVERITY_ERROR) {
return;
}
- Message message= new Message(problemMarker.getAttribute(IMarker.MESSAGE, ""), problemMarker.getAttribute(IMarker.CHAR_START, 0));
+ Message message= new Message(problemMarker.getAttribute(IMarker.MESSAGE, ""), problemMarker.getAttribute(IMarker.CHAR_START, 0)); //$NON-NLS-1$
getResult().addError(message);
}
@@ -393,14 +409,15 @@
}
/**
- * @see IEvaluationEngine#evaluate(String, IJavaThread, IEvaluationListener)
+ * @see IClassFileEvaluationEngine#evaluate(String, IJavaThread, IEvaluationListener)
*/
- public void evaluate(String snippet, IJavaThread thread, IEvaluationListener listener) throws DebugException {
+ public void evaluate(String snippet, IJavaThread thread, IEvaluationListener listener, boolean hitBreakpoints) throws DebugException {
checkDisposed();
checkEvaluating();
try {
evaluationStarted();
setListener(listener);
+ setHitBreakpoints(hitBreakpoints);
setResult(new EvaluationResult(this, snippet, thread));
checkThread();
// no receiver/stack frame context
@@ -433,15 +450,16 @@
}
/**
- * @see IEvaluationEngine#evaluate(String, IJavaStackFrame, IEvaluationListener)
+ * @see IEvaluationEngine#evaluate(String, IJavaStackFrame, IEvaluationListener, int)
*/
- public void evaluate(String snippet, IJavaStackFrame frame, IEvaluationListener listener) throws DebugException {
+ public void evaluate(String snippet, IJavaStackFrame frame, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException {
checkDisposed();
checkEvaluating();
try {
evaluationStarted();
setListener(listener);
setStackFrame(frame);
+ setHitBreakpoints(hitBreakpoints);
setResult(new EvaluationResult(this, snippet, (IJavaThread)frame.getThread()));
checkThread();
@@ -503,14 +521,15 @@
}
/**
- * @see IEvaluationEngine#evaluate(String, String, IJavaThread, IEvaluationListener)
+ * @see IEvaluationEngine#evaluate(String, IJavaObject, IJavaThread, IEvaluationListener, int)
*/
- public void evaluate(String snippet, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener) throws DebugException {
+ public void evaluate(String snippet, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException {
checkDisposed();
checkEvaluating();
try {
evaluationStarted();
setListener(listener);
+ setHitBreakpoints(hitBreakpoints);
setResult(new EvaluationResult(this, snippet, thread));
checkThread();
@@ -609,8 +628,9 @@
*/
public void dispose() {
fDisposed = true;
+ ENGINE_COUNT--;
if (isEvaluating()) {
- // cannot dispose if in an evalutaion, must
+ // cannot dispose if in an evaluation, must
// wait for evaluation to complete
return;
}
@@ -618,11 +638,16 @@
Iterator iter = snippetFiles.iterator();
while (iter.hasNext()) {
File file = (File)iter.next();
- if (file.exists() && !file.delete()) {
- JDIDebugPlugin.log(
- new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(), DebugException.REQUEST_FAILED,
- MessageFormat.format(EvaluationMessages.getString("LocalEvaluationEngine.Unable_to_delete_temporary_evaluation_class_file_{0}_1"), new String[] {file.getAbsolutePath()}), null) //$NON-NLS-1$
- );
+ if (file.exists()) {
+ if (CODE_SNIPPET_NAME.equals(file.getName()) && ENGINE_COUNT > 0) {
+ continue; //do not delete the common file for other engines
+ }
+ if (!file.delete()) {
+ JDIDebugPlugin.log(
+ new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(), DebugException.REQUEST_FAILED,
+ MessageFormat.format(EvaluationMessages.getString("LocalEvaluationEngine.Unable_to_delete_temporary_evaluation_class_file_{0}_1"), new String[] {file.getAbsolutePath()}), null) //$NON-NLS-1$
+ );
+ }
}
}
List directories = getDirectories();
@@ -630,7 +655,8 @@
int i = directories.size() - 1;
while (i >= 0) {
File dir = (File)directories.get(i);
- if (dir.exists() && !dir.delete()) {
+ String[] listing= dir.list();
+ if (dir.exists() && listing != null && listing.length == 0 && !dir.delete()) {
JDIDebugPlugin.log(
new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(), DebugException.REQUEST_FAILED,
MessageFormat.format(EvaluationMessages.getString("LocalEvaluationEngine.Unable_to_delete_temporary_evaluation_directory_{0}_2"), new String[] {dir.getAbsolutePath()}), null) //$NON-NLS-1$
@@ -1370,4 +1396,21 @@
return true;
}
+ /**
+ * Returns whether to hit breakpoints in the evaluation thread.
+ *
+ * @return whether to hit breakpoints in the evaluation thread
+ */
+ protected boolean getHitBreakpoints() {
+ return fHitBreakpoints;
+ }
+
+ /**
+ * Sets whether to hit breakpoints in the evaluation thread.
+ * @param hit whether to hit breakpoints in the evaluation thread
+ */
+ private void setHitBreakpoints(boolean hit) {
+ fHitBreakpoints = hit;
+ }
+
}
\ No newline at end of file
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 23d55c3..4050602 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
@@ -7,35 +7,48 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
+import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.Message;
import org.eclipse.jdt.debug.core.IEvaluationRunnable;
+import org.eclipse.jdt.debug.core.IJavaArray;
import org.eclipse.jdt.debug.core.IJavaDebugTarget;
import org.eclipse.jdt.debug.core.IJavaObject;
import org.eclipse.jdt.debug.core.IJavaStackFrame;
import org.eclipse.jdt.debug.core.IJavaThread;
import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
import org.eclipse.jdt.debug.eval.IAstEvaluationEngine;
import org.eclipse.jdt.debug.eval.ICompiledExpression;
import org.eclipse.jdt.debug.eval.IEvaluationListener;
+import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
+import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
import org.eclipse.jdt.internal.debug.eval.EvaluationResult;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.InstructionSequence;
-import org.eclipse.jdt.internal.debug.eval.model.EvaluationThread;
-import org.eclipse.jdt.internal.debug.eval.model.EvaluationValue;
-import org.eclipse.jdt.internal.debug.eval.model.IRuntimeContext;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
-import org.eclipse.jdt.internal.debug.eval.model.JavaObjectRuntimeContext;
-import org.eclipse.jdt.internal.debug.eval.model.RuntimeContext;
+import org.eclipse.jdt.internal.debug.eval.ast.instructions.InstructionsEvaluationMessages;
public class ASTEvaluationEngine implements IAstEvaluationEngine {
+
+ /**
+ * Code snippets that return a value generate an exception from
+ * the compiler because void methods cannot return a value. Since the
+ * messages returned by the compilation unit only contain a string and
+ * a position, we have to check if the message's string matches the
+ * message for the "void methods cannot return a value" error.
+ */
+ private static String fVoidMessageError= new DefaultProblemFactory(Locale.getDefault()).getLocalizedMessage(105, new String[0]);
private IJavaProject fProject;
@@ -57,44 +70,50 @@
}
/**
- * @see IEvaluationEngine#evaluate(String, IJavaStackFrame, IEvaluationListener)
+ * @see IEvaluationEngine#evaluate(String, IJavaStackFrame, IEvaluationListener, int, boolean)
*/
- public void evaluate(String snippet, IJavaStackFrame frame, IEvaluationListener listener) throws DebugException {
+ public void evaluate(String snippet, IJavaStackFrame frame, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException {
ICompiledExpression expression= getCompiledExpression(snippet, frame);
- evaluateExpression(expression, frame, listener);
+ evaluateExpression(expression, frame, listener, evaluationDetail, hitBreakpoints);
}
/**
- * @see IEvaluationEngine#evaluate(String, IJavaObject, IJavaThread, IEvaluationListener)
+ * @see IEvaluationEngine#evaluate(String, IJavaObject, IJavaThread, IEvaluationListener, int, boolean)
*/
- public void evaluate(String snippet, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener) throws DebugException {
- ICompiledExpression expression= getCompiledExpression(snippet, thisContext, thread);
- evaluateExpression(expression, thisContext, thread, listener);
+ public void evaluate(String snippet, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException {
+ ICompiledExpression expression= getCompiledExpression(snippet, thisContext);
+ evaluateExpression(expression, thisContext, thread, listener, evaluationDetail, hitBreakpoints);
}
/**
- * @see IEvaluationEngine#evaluate(ICompiledExpression, IJavaStackFrame, IEvaluationListener)
+ * @see IAstEvaluationEngine#evaluateExpression(ICompiledExpression, IJavaStackFrame, IEvaluationListener, int, boolean)
*/
- public void evaluateExpression(ICompiledExpression expression, IJavaStackFrame frame, IEvaluationListener listener) throws DebugException {
+ public void evaluateExpression(ICompiledExpression expression, IJavaStackFrame frame, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException {
RuntimeContext context = new RuntimeContext(getJavaProject(), frame);
- doEvaluation(expression, context, (IJavaThread)frame.getThread(), listener);
+ doEvaluation(expression, context, (IJavaThread)frame.getThread(), listener, evaluationDetail, hitBreakpoints);
}
/**
- * @see IEvaluationEngine#evaluate(ICompiledExpression, IJavaObject, IJavaThread, IEvaluationListener)
+ * @see IAstEvaluationEngine#evaluateExpression(ICompiledExpression, IJavaObject, IJavaThread, IEvaluationListener, int, boolean)
*/
- public void evaluateExpression(ICompiledExpression expression, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener) throws DebugException {
+ public void evaluateExpression(ICompiledExpression expression, IJavaObject thisContext, IJavaThread thread, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException {
IRuntimeContext context = new JavaObjectRuntimeContext(thisContext, getJavaProject(), thread);
- doEvaluation(expression, context, thread, listener);
+ doEvaluation(expression, context, thread, listener, evaluationDetail, hitBreakpoints);
}
/**
* Evaluates the given expression in the given thread and the given runtime context.
*/
- private void doEvaluation(final ICompiledExpression expression, final IRuntimeContext context, final IJavaThread thread, final IEvaluationListener listener) throws DebugException {
- getEvaluationThread().evaluate(expression, context, thread, listener);
+ private void doEvaluation(ICompiledExpression expression, IRuntimeContext context, IJavaThread thread, IEvaluationListener listener, int evaluationDetail, boolean hitBreakpoints) throws DebugException {
+ getEvaluationThread().evaluate(expression, context, thread, listener, evaluationDetail, hitBreakpoints);
}
+ /**
+ * Returns an evaluation thread which can be used to perform an evaluation.
+ * This method will return an existing thread if a one exists that is
+ * currently not performing an evaluation. Otherwise, a new thread will
+ * be created.
+ */
private EvaluationThread getEvaluationThread() {
Iterator iter= fEvaluationThreads.iterator();
EvaluationThread thread= null;
@@ -104,7 +123,7 @@
return thread;
}
}
- thread= new EvaluationThread();
+ thread= new EvaluationThread(this);
fEvaluationThreads.add(thread);
return thread;
}
@@ -116,7 +135,7 @@
* the thread is allowed to keep running - it will be reused for the
* next evaluation.
*/
- private void evaluationThreadFinished(EvaluationThread thread) {
+ protected void evaluationThreadFinished(EvaluationThread thread) {
if (fEvaluationThreads.size() == 1) {
// Always leave at least one thread running
return;
@@ -138,126 +157,37 @@
fEvaluationThreads.remove(thread);
}
}
-
- class EvaluationThread {
- private ICompiledExpression fExpression;
- private IRuntimeContext fContext;
- private IJavaThread fThread;
- private IEvaluationListener fListener;
-
- private boolean fEvaluating= false;
- private Thread fEvaluationThread;
- private boolean fStopped= false;
- private Object fLock= new Object();
-
- public boolean isEvaluating() {
- return fEvaluating;
- }
-
- public void stop() {
- fStopped= true;
- synchronized (fLock) {
- fLock.notify();
- }
- }
-
- public void evaluate(ICompiledExpression expression, IRuntimeContext context, IJavaThread thread, IEvaluationListener listener) {
- fExpression= expression;
- fContext= context;
- fThread= thread;
- fListener= listener;
- if (fEvaluationThread == null) {
- // Create a new thread
- fEvaluationThread= new Thread(new Runnable() {
- public void run() {
- while (!fStopped) {
- synchronized (fLock) {
- doEvaluation();
- try {
- // Sleep until the next evaluation
- fLock.wait();
- } catch (InterruptedException exception) {
- }
- }
- }
- }
- }, "Evaluation thread");
- fEvaluationThread.start();
- } else {
- // Use the existing thread
- synchronized (fLock) {
- fLock.notify();
- }
- }
- }
-
- public synchronized void doEvaluation() {
- fEvaluating= true;
- EvaluationResult result = new EvaluationResult(ASTEvaluationEngine.this, fExpression.getSnippet(), fThread);
- if (fExpression.hasErrors()) {
- Message[] errors= fExpression.getErrors();
- for (int i= 0, numErrors= errors.length; i < numErrors; i++) {
- result.addError(errors[i]);
- }
- fListener.evaluationComplete(result);
- return;
- }
-
- final IValue[] valuez = new IValue[1];
- final InstructionSequence instructionSet = (InstructionSequence)fExpression;
- IEvaluationRunnable er = new IEvaluationRunnable() {
- public void run(IJavaThread jt, IProgressMonitor pm) {
- valuez[0] = instructionSet.evaluate(fContext);
- }
- };
- CoreException exception = null;
- try {
- fThread.runEvaluation(er, null, DebugEvent.EVALUATION);
- } catch (DebugException e) {
- exception = e;
- }
- IValue value = valuez[0];
-
-
- if (exception == null) {
- exception= instructionSet.getException();
- }
-
- if (value != null) {
- IJavaValue jv = ((EvaluationValue)value).getJavaValue();
- result.setValue(jv);
- }
- if (exception != null) {
- result.setException(new DebugException(exception.getStatus()));
- }
- fEvaluating= false;
- evaluationThreadFinished(this);
- fListener.evaluationComplete(result);
- }
- }
/**
* @see IEvaluationEngine#getCompiledExpression(String, IJavaStackFrame)
*/
public ICompiledExpression getCompiledExpression(String snippet, IJavaStackFrame frame) {
- snippet= getCompleteSnippet(snippet);
IJavaProject javaProject = getJavaProject();
RuntimeContext context = new RuntimeContext(javaProject, frame);
EvaluationSourceGenerator mapper = null;
CompilationUnit unit = null;
try {
- IVariable[] locals = context.getLocals();
- int numLocals= locals.length;
- int[] localModifiers = new int[locals.length];
+ IJavaVariable[] localsVar = context.getLocals();
+ int numLocalsVar= localsVar.length;
+ // ******
+ // to hide problems with local variable declare as instance of Local Types
+ IJavaVariable[] locals= new IJavaVariable[numLocalsVar];
+ int numLocals= 0;
+ for (int i = 0; i < numLocalsVar; i++) {
+ if (!isLocalType(localsVar[i].getReferenceTypeName())) {
+ locals[numLocals++]= localsVar[i];
+ }
+ }
+ // to solve and remove
+ // ******
String[] localTypesNames= new String[numLocals];
String[] localVariables= new String[numLocals];
for (int i = 0; i < numLocals; i++) {
localVariables[i] = locals[i].getName();
- localTypesNames[i] = locals[i].getType().getName();
- localModifiers[i]= 0;
+ localTypesNames[i] = locals[i].getReferenceTypeName();
}
- mapper = new EvaluationSourceGenerator(new String[0], localModifiers, localTypesNames, localVariables, snippet);
+ mapper = new EvaluationSourceGenerator(localTypesNames, localVariables, snippet);
unit = AST.parseCompilationUnit(mapper.getSource(frame).toCharArray(), mapper.getCompilationUnitName(), javaProject);
} catch (CoreException e) {
InstructionSequence expression= new InstructionSequence(snippet);
@@ -268,17 +198,36 @@
return createExpressionFromAST(snippet, mapper, unit);
}
+ // ******
+ // to hide problems with local variable declare as instance of Local Types
+ private boolean isLocalType(String typeName) {
+ StringTokenizer strTok= new StringTokenizer(typeName,"$"); //$NON-NLS-1$
+ strTok.nextToken();
+ while (strTok.hasMoreTokens()) {
+ char char0= strTok.nextToken().charAt(0);
+ if ('0' <= char0 && char0 <= '9') {
+ return true;
+ }
+ }
+ return false;
+ }
+ // ******
+
+
/**
* @see IEvaluationEngine#getCompiledExpression(String, IJavaObject, IJavaThread)
*/
- public ICompiledExpression getCompiledExpression(String snippet, IJavaObject thisContext, IJavaThread thread) {
- snippet= getCompleteSnippet(snippet);
+ public ICompiledExpression getCompiledExpression(String snippet, IJavaObject thisContext) {
+ if (thisContext instanceof IJavaArray) {
+ InstructionSequence errorExpression= new InstructionSequence(snippet);
+ errorExpression.addError(new Message(EvaluationEngineMessages.getString("Cannot_perform_an_evaluation_in_the_context_of_an_array_instance_1"), 0)); //$NON-NLS-1$
+ }
IJavaProject javaProject = getJavaProject();
EvaluationSourceGenerator mapper = null;
CompilationUnit unit = null;
- mapper = new EvaluationSourceGenerator(new String[0], new int[0], new String[0], new String[0], snippet);
+ mapper = new EvaluationSourceGenerator(new String[0], new String[0], snippet);
try {
unit = AST.parseCompilationUnit(mapper.getSource(thisContext, javaProject).toCharArray(), mapper.getCompilationUnitName(), javaProject);
@@ -300,38 +249,37 @@
private ICompiledExpression createExpressionFromAST(String snippet, EvaluationSourceGenerator mapper, CompilationUnit unit) {
Message[] messages= unit.getMessages();
if (messages.length != 0) {
- boolean error= false;
+ boolean snippetError= false;
+ boolean runMethodError= false;
InstructionSequence errorSequence= new InstructionSequence(snippet);
- int codeSnippetStartOffset= mapper.getStartPosition();
- int codeSnippetEndOffset= codeSnippetStartOffset + snippet.length();
+ int codeSnippetStart= mapper.getSnippetStart();
+ int codeSnippetEnd= codeSnippetStart + mapper.getSnippet().length();
+ int runMethodStart= mapper.getRunMethodStart();
+ int runMethodEnd= runMethodStart + mapper.getRunMethodLength();
for (int i = 0; i < messages.length; i++) {
Message message= messages[i];
int errorOffset= message.getSourcePosition();
// TO DO: Internationalize "void method..." error message check
- if (codeSnippetStartOffset <= errorOffset && errorOffset <= codeSnippetEndOffset && !"Void methods cannot return a value".equals(message.getMessage())) {
+ if (codeSnippetStart <= errorOffset && errorOffset <= codeSnippetEnd && !fVoidMessageError.equals(message.getMessage())) {
errorSequence.addError(message);
- error = true;
+ snippetError = true;
+ } else if (runMethodStart <= errorOffset && errorOffset <= runMethodEnd && !fVoidMessageError.equals(message.getMessage())) {
+ runMethodError = true;
}
}
- if (error) {
+ if (snippetError || runMethodError) {
+ if (runMethodError) {
+ errorSequence.addError(new Message(EvaluationEngineMessages.getString("ASTEvaluationEngineEvaluations_must_contain_either_an_expression_or_a_block_of_well-formed_statements_1"), 0)); //$NON-NLS-1$
+ }
return errorSequence;
}
}
- ASTInstructionCompiler visitor = new ASTInstructionCompiler(mapper.getStartPosition(), snippet);
+ ASTInstructionCompiler visitor = new ASTInstructionCompiler(mapper.getSnippetStart(), snippet);
unit.accept(visitor);
return visitor.getInstructions();
}
-
- protected String getCompleteSnippet(String codeSnippet) {
- boolean isAnExpression= codeSnippet.indexOf(';') == -1 && codeSnippet.indexOf('{') == -1 && codeSnippet.indexOf('}') == -1 && codeSnippet.indexOf("return") == -1;
-
- if (isAnExpression) {
- codeSnippet = "return " + codeSnippet + ';';
- }
- return codeSnippet;
- }
/*
* @see IEvaluationEngine#getJavaProject()
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java
index 4120d99..e893b22 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java
@@ -11,6 +11,7 @@
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
import org.eclipse.jdt.core.dom.ArrayAccess;
@@ -46,6 +47,7 @@
import org.eclipse.jdt.core.dom.ImportDeclaration;
import org.eclipse.jdt.core.dom.InfixExpression;
import org.eclipse.jdt.core.dom.Initializer;
+import org.eclipse.jdt.core.dom.InstanceofExpression;
import org.eclipse.jdt.core.dom.Javadoc;
import org.eclipse.jdt.core.dom.LabeledStatement;
import org.eclipse.jdt.core.dom.Message;
@@ -120,6 +122,7 @@
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PostfixPlusPlusOperator;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PrefixMinusMinusOperator;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PrefixPlusPlusOperator;
+import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushArrayLength;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushArrayType;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushBoolean;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushChar;
@@ -128,14 +131,16 @@
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushFieldVariable;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushFloat;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushInt;
+import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushLocalVariable;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushLong;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushNull;
+import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushStaticFieldVariable;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushString;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushThis;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushType;
-import org.eclipse.jdt.internal.debug.eval.ast.instructions.PushVariable;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.RemainderAssignmentOperator;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.RemainderOperator;
+import org.eclipse.jdt.internal.debug.eval.ast.instructions.ReturnInstruction;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.RightShiftAssignmentOperator;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.RightShiftOperator;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.SendMessage;
@@ -237,7 +242,7 @@
((CompoundInstruction)instruction).setEnd(fCounter);
}
fInstructions.add(instruction);
- verbose("Add " + instruction.toString());
+ verbose("Add " + instruction.toString()); //$NON-NLS-1$
}
@@ -255,10 +260,10 @@
private String getQualifiedIdentifier(Name name) {
- String typeName = "";
+ String typeName = ""; //$NON-NLS-1$
while (name.isQualifiedName()) {
QualifiedName qualifiedName = (QualifiedName) name;
- typeName = "." + qualifiedName.getName().getIdentifier() + typeName;
+ typeName = "." + qualifiedName.getName().getIdentifier() + typeName; //$NON-NLS-1$
name = qualifiedName.getQualifier();
}
if (name.isSimpleName()) {
@@ -270,23 +275,92 @@
}
private String getTypeName(ITypeBinding typeBinding) {
- String name= typeBinding.getName();
+ StringBuffer name;
+ if (typeBinding.isArray()) {
+ name= new StringBuffer(getTypeName(typeBinding.getElementType()));
+ int dimensions= typeBinding.getDimensions();
+ for (int i= 0; i < dimensions; i++) {
+ name.append("[]"); //$NON-NLS-1$
+ }
+ return name.toString();
+ }
+ name= new StringBuffer(typeBinding.getName());
IPackageBinding packageBinding= typeBinding.getPackage();
typeBinding= typeBinding.getDeclaringClass();
while(typeBinding != null) {
- name= typeBinding.getName() + '$' + name;
+ name.insert(0, '$').insert(0, typeBinding.getName());
typeBinding= typeBinding.getDeclaringClass();
}
if (packageBinding != null && !packageBinding.isUnnamed()) {
- name= packageBinding.getName() + '.' + name;
+ name.insert(0, '.').insert(0, packageBinding.getName());
}
- return name;
+ return name.toString();
}
private String getTypeSignature(ITypeBinding typeBinding) {
return Signature.createTypeSignature(getTypeName(typeBinding), true).replace('.', '/');
}
+
+ private boolean isALocalType(ITypeBinding typeBinding) {
+ while(typeBinding != null) {
+ if (typeBinding.isLocal()) {
+ return true;
+ }
+ typeBinding= typeBinding.getDeclaringClass();
+ }
+ return false;
+ }
+ private boolean containsALocalType(IMethodBinding methodBinding) {
+ ITypeBinding[] typeBindings= methodBinding.getParameterTypes();
+ for (int i= 0, length= typeBindings.length; i < length; i++) {
+ if (isALocalType(typeBindings[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private int getEnclosingLevel(ASTNode node, ITypeBinding referenceTypeBinding) {
+ ASTNode parent= node;
+ do {
+ parent= parent.getParent();
+ } while (!(parent instanceof TypeDeclaration || parent instanceof AnonymousClassDeclaration));
+ if (parent == null) {
+ // throw an exception
+ return 9999;
+ }
+ ITypeBinding parentBinding;
+ if (parent instanceof TypeDeclaration) {
+ parentBinding= (ITypeBinding) ((TypeDeclaration)parent).resolveBinding();
+ } else {
+ parentBinding= (ITypeBinding) ((AnonymousClassDeclaration)parent).resolveBinding();
+ }
+ if (isInstanceOf(parentBinding, referenceTypeBinding)) {
+ return 0;
+ }
+ return getEnclosingLevel(parent, referenceTypeBinding) + 1;
+ }
+
+ private int getSuperLevel(ITypeBinding current, ITypeBinding reference) {
+ if (current.equals(reference)) {
+ return 0;
+ }
+ return getSuperLevel(current.getSuperclass(), reference);
+ }
+
+ private boolean isInstanceOf(ITypeBinding current, ITypeBinding reference) {
+ if (current.equals(reference)) {
+ return true;
+ }
+ ITypeBinding superClass= current.getSuperclass();
+ if (superClass == null) {
+ return false;
+ } else {
+ return isInstanceOf(current.getSuperclass(), reference);
+ }
+ }
+
/**
* End visit methods
*
@@ -497,12 +571,12 @@
Expression expression= node.getExpression();
if (expression instanceof MethodInvocation) {
IMethodBinding methodBinding= (IMethodBinding)((MethodInvocation)expression).getName().resolveBinding();
- if ("void".equals(methodBinding.getReturnType().getName())) {
+ if ("void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$
pop= false;
}
} else if (expression instanceof SuperMethodInvocation) {
IMethodBinding methodBinding= (IMethodBinding)((SuperMethodInvocation)expression).getName().resolveBinding();
- if ("void".equals(methodBinding.getReturnType().getName())) {
+ if ("void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$
pop= false;
}
}
@@ -603,6 +677,15 @@
public void endVisit(Initializer node) {
}
+
+ /**
+ * @see ASTVisitor#endVisit(InstanceofExpression)
+ */
+ public void endVisit(InstanceofExpression node) {
+ if (!isActive() || hasErrors())
+ return;
+ storeInstruction();
+ }
/**
* @see ASTVisitor#endVisit(Javadoc)
@@ -688,9 +771,6 @@
* @see ASTVisitor#endVisit(PrimitiveType)
*/
public void endVisit(PrimitiveType node) {
- if (!isActive() || hasErrors())
- return;
- storeInstruction();
}
/**
@@ -703,7 +783,9 @@
* @see ASTVisitor#endVisit(ReturnStatement)
*/
public void endVisit(ReturnStatement node) {
-
+ if (!isActive() || hasErrors())
+ return;
+ storeInstruction();
}
/**
@@ -881,7 +963,7 @@
return true;
}
setHasError(true);
- addErrorMessage(new Message("Anonymous type declaration cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Anonymous_type_declaration_cannot_be_used_in_an_evaluation_expression_2"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -908,6 +990,12 @@
ArrayType arrayType= node.getType();
+ if (isALocalType(arrayType.resolveBinding().getElementType())) {
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Local_type_array_instance_creation_cannot_be_used_in_an_evaluation_expression_29"), node.getStartPosition())); //$NON-NLS-1$
+ setHasError(true);
+ return true;
+ }
+
push(new ArrayAllocation(arrayType.getDimensions(), node.dimensions().size(), node.getInitializer() != null, fCounter));
return true;
@@ -922,9 +1010,8 @@
}
ITypeBinding typeBinding= node.resolveTypeBinding();
-
int dimension= typeBinding.getDimensions();
- String signature= Signature.createTypeSignature(getQualifiedName(typeBinding.getElementType()), true);
+ String signature= getTypeSignature(typeBinding.getElementType());
push(new ArrayInitializerInstruction(signature, node.expressions().size(), dimension, fCounter));
@@ -938,10 +1025,9 @@
if (!isActive()) {
return false;
}
- ITypeBinding typeBinding= node.getElementType().resolveBinding();
-
- int dimension= node.getDimensions();
- String signature= Signature.createTypeSignature(getQualifiedName(typeBinding), true);
+ ITypeBinding arrayTypeBinding= node.resolveBinding();
+ int dimension= arrayTypeBinding.getDimensions();
+ String signature= getTypeSignature(arrayTypeBinding.getElementType());
push(new PushArrayType(signature, dimension, fCounter));
@@ -956,7 +1042,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Assert statement is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Assert_statement_cannot_be_used_in_an_evaluation_expression_3"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -1031,7 +1117,7 @@
if (unrecognized) {
setHasError(true);
- addErrorMessage(new Message("Unrecognized assignment operator : " + opToken, node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Unrecognized_assignment_operator____4") + opToken, node.getStartPosition())); //$NON-NLS-1$
}
return true;
@@ -1072,7 +1158,7 @@
*/
public boolean visit(BreakStatement node) {
setHasError(true);
- addErrorMessage(new Message("Break Statement cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Break_Statement_cannot_be_used_in_an_evaluation_expression_5"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -1086,9 +1172,11 @@
int typeId = getTypeId(node.getType());
- push(new Cast(typeId, fCounter));
+ push(new Cast(typeId, getTypeName(node.getType().resolveBinding()), fCounter));
- return true;
+ node.getExpression().accept(this);
+
+ return false;
}
/**
@@ -1099,7 +1187,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Catch clause is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Catch_clause_cannot_be_used_in_an_evaluation_expression_6"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -1117,7 +1205,7 @@
}
/**
- * return false, visit name & arguments, don't visit expression & body declaration
+ * return false, visit expression, type name & arguments, don't visit body declaration
* @see ASTVisitor#visit(ClassInstanceCreation)
*/
public boolean visit(ClassInstanceCreation node) {
@@ -1127,39 +1215,60 @@
if (node.getAnonymousClassDeclaration() != null) {
setHasError(true);
- addErrorMessage(new Message("Anonymous type declaration cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Anonymous_type_declaration_cannot_be_used_in_an_evaluation_expression_7"), node.getStartPosition())); //$NON-NLS-1$
}
- if (node.getExpression() != null) {
+
+ IMethodBinding methodBinding= node.resolveConstructorBinding();
+ ITypeBinding typeBinding= methodBinding.getDeclaringClass();
+ ITypeBinding enclosingTypeBinding= typeBinding.getDeclaringClass();
+
+ if (isALocalType(typeBinding)) {
setHasError(true);
- addErrorMessage(new Message("Class Instance Creation Expression is not managed", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Constructor_of_a_local_type_cannot_be_used_in_an_evaluation_expression_8"), node.getStartPosition())); //$NON-NLS-1$
+ }
+
+ if (containsALocalType(methodBinding)) {
+ setHasError(true);
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Constructor_which_contains_a_local_type_as_parameter_cannot_be_used_in_an_evaluation_expression_30"), node.getStartPosition())); //$NON-NLS-1$
}
if (hasErrors()) {
return true;
}
- IMethodBinding methodBinding = node.resolveConstructorBinding();
+ boolean isInstanceMemberType= typeBinding.isMember() &&! Modifier.isStatic(typeBinding.getModifiers());
int argCount= methodBinding.getParameterTypes().length;
+
+ String enclosingTypeSignature= null;
+ if (isInstanceMemberType) {
+ enclosingTypeSignature= getTypeSignature(enclosingTypeBinding);
+ argCount++;
+ }
- String signature= getMethodSignature(methodBinding).replace('.','/');
+ String signature= getMethodSignature(methodBinding, enclosingTypeSignature).replace('.','/');
push(new Constructor(signature, argCount, fCounter));
-// node.getName().accept(this);
- // TO DO: Use the method call above instead of the following code
- push(new PushType(getTypeName(methodBinding.getDeclaringClass()), false));
+ push(new PushType(getTypeName(typeBinding)));
storeInstruction();
+ if (isInstanceMemberType) {
+ Expression optionalExpression= node.getExpression();
+ if (optionalExpression != null) {
+ optionalExpression.accept(this);
+ } else {
+ push(new PushThis(getEnclosingLevel(node, enclosingTypeBinding)));
+ storeInstruction();
+ }
+ }
+
Iterator iterator= node.arguments().iterator();
while (iterator.hasNext()) {
((Expression) iterator.next()).accept(this);
}
-
-
return false;
-
}
/**
@@ -1190,7 +1299,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("this constructor invocation cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.this_constructor_invocation_cannot_be_used_in_an_evaluation_expression_9"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -1199,7 +1308,7 @@
*/
public boolean visit(ContinueStatement node) {
setHasError(true);
- addErrorMessage(new Message("Continue statement cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Continue_statement_cannot_be_used_in_an_evaluation_expression_10"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -1208,7 +1317,7 @@
*/
public boolean visit(DoStatement node) {
setHasError(true);
- addErrorMessage(new Message("Do statement cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Do_statement_cannot_be_used_in_an_evaluation_expression_11"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -1235,12 +1344,12 @@
Expression expression= node.getExpression();
if (expression instanceof MethodInvocation) {
IMethodBinding methodBinding= (IMethodBinding)((MethodInvocation)expression).getName().resolveBinding();
- if ("void".equals(methodBinding.getReturnType().getName())) {
+ if ("void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$
pop= false;
}
} else if (expression instanceof SuperMethodInvocation) {
IMethodBinding methodBinding= (IMethodBinding)((SuperMethodInvocation)expression).getName().resolveBinding();
- if ("void".equals(methodBinding.getReturnType().getName())) {
+ if ("void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$
pop= false;
}
}
@@ -1262,11 +1371,30 @@
return false;
}
- String signature = getTypeSignature(node.getExpression().resolveTypeBinding());
+ SimpleName fieldName= node.getName();
+ IVariableBinding fieldBinding= (IVariableBinding) fieldName.resolveBinding();
+ ITypeBinding declaringTypeBinding= fieldBinding.getDeclaringClass();
+ Expression expression = node.getExpression();
+ String fieldId = fieldName.getIdentifier();
- push(new PushFieldVariable(node.getName().getIdentifier(), signature, fCounter));
-
- node.getExpression().accept(this);
+ if (Modifier.isStatic(fieldBinding.getModifiers())) {
+ push(new PushStaticFieldVariable(fieldId, getTypeName(declaringTypeBinding), fCounter));
+ expression.accept(this);
+ push(new Pop());
+ storeInstruction();
+ } else {
+ if (declaringTypeBinding == null) { // it is a field without declaring type => it is the special length array field
+ push(new PushArrayLength(fCounter));
+ } else {
+ if (isALocalType(declaringTypeBinding)) {
+ setHasError(true);
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Qualified_local_type_field_access_cannot_be_used_in_an_evaluation_expression_31"), node.getStartPosition())); //$NON-NLS-1$
+ return false;
+ }
+ push(new PushFieldVariable(fieldId, getTypeSignature(declaringTypeBinding), fCounter));
+ }
+ expression.accept(this);
+ }
return false;
}
@@ -1275,7 +1403,7 @@
* @see ASTVisitor#visit(FieldDeclaration)
*/
public boolean visit(FieldDeclaration node) {
- return false;
+ return true;
}
/**
@@ -1283,7 +1411,7 @@
*/
public boolean visit(ForStatement node) {
setHasError(true);
- addErrorMessage(new Message("For statement cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.For_statement_cannot_be_used_in_an_evaluation_expression_12"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -1436,11 +1564,6 @@
break;
}
break;
- case 'i': // instanceof
- for (int i = operatorNumber - 1; i >= 0; i--) {
- push(new InstanceOfOperator(fCounter));
- }
- break;
case '=': // equal equal
for (int i = operatorNumber - 1; i >= 0; i--) {
push(new EqualEqualOperator(types[i][1], types[i][2], true, fCounter));
@@ -1497,7 +1620,7 @@
if (unrecognized) {
setHasError(true);
- addErrorMessage(new Message("Unrecognized infix operator : " + opToken, node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Unrecognized_infix_operator____13") + opToken, node.getStartPosition())); //$NON-NLS-1$
}
if (hasErrors()) {
@@ -1572,6 +1695,17 @@
}
/**
+ * @see ASTVisitor#visit(InstanceofExpression)
+ */
+ public boolean visit(InstanceofExpression node) {
+ if (!isActive()) {
+ return false;
+ }
+ push(new InstanceOfOperator(fCounter));
+ return true;
+ }
+
+ /**
* @see ASTVisitor#visit(Javadoc)
*/
public boolean visit(Javadoc node) {
@@ -1583,7 +1717,7 @@
*/
public boolean visit(LabeledStatement node) {
setHasError(true);
- addErrorMessage(new Message("Labaled Statement cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Labeled_Statement_cannot_be_used_in_an_evaluation_expression_14"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -1609,25 +1743,29 @@
return false;
}
+ IMethodBinding methodBinding= (IMethodBinding) node.getName().resolveBinding();
+
+ if (containsALocalType(methodBinding)) {
+ setHasError(true);
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Method_which_contains_a_local_type_as_parameter_cannot_be_used_in_an_evaluation_expression_32"), node.getStartPosition())); //$NON-NLS-1$
+ }
+
if (hasErrors()) {
return true;
}
- IMethodBinding methodBinding= (IMethodBinding) node.getName().resolveBinding();
-
- ITypeBinding[] parameterTypes= methodBinding.getParameterTypes();
- int argCount= parameterTypes.length;
+ int argCount= methodBinding.getParameterTypes().length;
String selector= methodBinding.getName();
- String signature= getMethodSignature(methodBinding).replace('.','/');
+ String signature= getMethodSignature(methodBinding, null).replace('.','/');
boolean isStatic= Flags.isStatic(methodBinding.getModifiers());
Expression expression= node.getExpression();
+ String typeSignature= getTypeSignature(methodBinding.getDeclaringClass());
+
if (isStatic) {
- String typeSignature= Signature.createTypeSignature(getQualifiedName(methodBinding.getDeclaringClass()), true);
push(new SendStaticMessage(typeSignature, selector, signature, argCount, fCounter));
-
if (expression != null) {
node.getExpression().accept(this);
push(new Pop());
@@ -1635,9 +1773,8 @@
}
} else {
push(new SendMessage(selector, signature, argCount, false, fCounter));
-
if (expression == null) {
- push(new PushThis());
+ push(new PushThis(getEnclosingLevel(node, methodBinding.getDeclaringClass())));
storeInstruction();
} else {
node.getExpression().accept(this);
@@ -1738,7 +1875,7 @@
break;
default:
setHasError(true);
- addErrorMessage(new Message("unrecognized postfix operator : " + opToken, node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.unrecognized_postfix_operator____15") + opToken, node.getStartPosition())); //$NON-NLS-1$
break;
}
@@ -1806,7 +1943,7 @@
if (unrecognized) {
setHasError(true);
- addErrorMessage(new Message("unrecognized prefix operator : " + opToken, node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.unrecognized_prefix_operator____16") + opToken, node.getStartPosition())); //$NON-NLS-1$
}
return true;
@@ -1820,8 +1957,6 @@
return false;
}
- push(new PushType(getPrimitiveTypeSignature(node.getPrimitiveTypeCode().toString()), true));
-
return true;
}
@@ -1843,11 +1978,22 @@
node.getName().accept(this);
break;
case IBinding.VARIABLE:
- String signature = getTypeSignature(node.getQualifier().resolveTypeBinding());
-
- push(new PushFieldVariable(node.getName().getIdentifier(), signature, fCounter));
- node.getQualifier().accept(this);
- storeInstruction();
+ SimpleName fieldName= node.getName();
+ IVariableBinding fieldBinding= (IVariableBinding) fieldName.resolveBinding();
+ ITypeBinding declaringTypeBinding= fieldBinding.getDeclaringClass();
+ String fieldId = fieldName.getIdentifier();
+
+ if (Modifier.isStatic(fieldBinding.getModifiers())) {
+ push(new PushStaticFieldVariable(fieldId, getTypeName(declaringTypeBinding), fCounter));
+ storeInstruction();
+ } else {
+ if (declaringTypeBinding == null) {
+ push(new PushArrayLength(fCounter));
+ } else {
+ push(new PushFieldVariable(fieldId, getTypeSignature(declaringTypeBinding), fCounter));
+ }
+ node.getQualifier().accept(this);
+ }
break;
}
@@ -1861,6 +2007,7 @@
if (!isActive()) {
return false;
}
+ push(new ReturnInstruction(fCounter));
return true;
}
@@ -1872,28 +2019,37 @@
return false;
}
+ if (hasErrors()) {
+ return true;
+ }
+
IBinding binding = node.resolveBinding();
+ String variableId = node.getIdentifier();
if (binding == null) {
setHasError(true);
- addErrorMessage(new Message("binding == null for " + node.getIdentifier(), node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.binding_==_null_for__17") + variableId, node.getStartPosition())); //$NON-NLS-1$
return true;
}
switch (binding.getKind()) {
case IBinding.TYPE:
ITypeBinding typeBinding= (ITypeBinding) binding;
- push(new PushType(getTypeName(typeBinding), false));
+ push(new PushType(getTypeName(typeBinding)));
break;
case IBinding.VARIABLE:
IVariableBinding variableBinding= (IVariableBinding) binding;
- if (variableBinding.isField() && Modifier.isStatic(variableBinding.getModifiers())) {
- push(new PushFieldVariable(node.getIdentifier(), false, fCounter));
- typeBinding= variableBinding.getDeclaringClass();
- push(new PushType(getTypeName(typeBinding), false));
- storeInstruction();
+ ITypeBinding declaringTypeBinding= variableBinding.getDeclaringClass();
+ if (variableBinding.isField()) {
+ if (Modifier.isStatic(variableBinding.getModifiers())) {
+ push(new PushStaticFieldVariable(variableId, getTypeName(declaringTypeBinding), fCounter));
+ } else {
+ push(new PushFieldVariable(variableId, getTypeSignature(declaringTypeBinding), fCounter));
+ push(new PushThis(getEnclosingLevel(node, declaringTypeBinding)));
+ storeInstruction();
+ }
} else {
- push(new PushVariable(node.getIdentifier()));
+ push(new PushLocalVariable(variableId));
}
break;
}
@@ -1911,7 +2067,7 @@
}
ITypeBinding typeBinding = node.resolveBinding();
- push(new PushType(getTypeName(typeBinding), false));
+ push(new PushType(getTypeName(typeBinding)));
return false;
}
@@ -1924,7 +2080,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Single variable declaration is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Single_variable_declaration_cannot_be_used_in_an_evaluation_expression_18"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -1949,7 +2105,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("super constructor invocation cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.super_constructor_invocation_cannot_be_used_in_an_evaluation_expression_19"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -1961,11 +2117,26 @@
return false;
}
- push(new PushThis());
- storeInstruction();
+ SimpleName fieldName= node.getName();
+ IVariableBinding fieldBinding= (IVariableBinding) fieldName.resolveBinding();
+ ITypeBinding declaringTypeBinding= fieldBinding.getDeclaringClass();
+ String fieldId = fieldName.getIdentifier();
- push(new PushFieldVariable(node.getName().getIdentifier(), true, fCounter));
-
+ if (Modifier.isStatic(fieldBinding.getModifiers())) {
+ push(new PushStaticFieldVariable(fieldId, getTypeName(declaringTypeBinding), fCounter));
+ } else {
+ Name qualifier = node.getQualifier();
+ int superLevel= 1;
+ int enclosingLevel= 0;
+ if (qualifier != null) {
+ superLevel= getSuperLevel(qualifier.resolveTypeBinding(), declaringTypeBinding);
+ enclosingLevel= getEnclosingLevel(node, (ITypeBinding)qualifier.resolveBinding());
+ }
+ push(new PushFieldVariable(fieldId, superLevel, fCounter));
+ push(new PushThis(enclosingLevel));
+ storeInstruction();
+ }
+
return false;
}
@@ -1979,27 +2150,35 @@
return false;
}
- if (node.getQualifier() != null) {
+ IMethodBinding methodBinding = (IMethodBinding) node.getName().resolveBinding();
+
+ if (containsALocalType(methodBinding)) {
setHasError(true);
- addErrorMessage(new Message("Qualifier for super method invocation is not implemented", node.getStartPosition()));
- return true;
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Method_which_contains_a_local_type_as_parameter_cannot_be_used_in_an_evaluation_expression_32"), node.getStartPosition())); //$NON-NLS-1$
}
if (hasErrors()) {
return true;
}
- IMethodBinding methodBinding = (IMethodBinding) node.getName().resolveBinding();
-
ITypeBinding[] parameterTypes = methodBinding.getParameterTypes();
int argCount = parameterTypes.length;
String selector = methodBinding.getName();
- String signature = getMethodSignature(methodBinding);
-
- push(new SendMessage(selector, signature, argCount, true, fCounter));
-
- push(new PushThis());
- storeInstruction();
+ String signature = getMethodSignature(methodBinding, null);
+
+ Name qualifier= node.getQualifier();
+ if (Modifier.isStatic(methodBinding.getModifiers())) {
+ String typeSignature= getTypeSignature(methodBinding.getDeclaringClass());
+ push(new SendStaticMessage(typeSignature, selector, signature, argCount, fCounter));
+ } else {
+ push(new SendMessage(selector, signature, argCount, true, fCounter));
+ int enclosingLevel= 0;
+ if (qualifier != null) {
+ enclosingLevel= getEnclosingLevel(node, (ITypeBinding)qualifier.resolveBinding());
+ }
+ push(new PushThis(enclosingLevel));
+ storeInstruction();
+ }
Iterator iterator = node.arguments().iterator();
while (iterator.hasNext()) {
@@ -2017,7 +2196,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Switch case is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Switch_case_cannot_be_used_in_an_evaluation_expression_20"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -2029,7 +2208,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Switch statement is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Switch_statement_cannot_be_used_in_an_evaluation_expression_21"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -2050,8 +2229,13 @@
if (!isActive()) {
return false;
}
-
- push(new PushThis());
+
+ Name qualifier= node.getQualifier();
+ int enclosingLevel= 0;
+ if (qualifier != null) {
+ enclosingLevel= getEnclosingLevel(node, (ITypeBinding)qualifier.resolveBinding());
+ }
+ push(new PushThis(enclosingLevel));
return false;
}
@@ -2064,7 +2248,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Throw statement is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Throw_statement_cannot_be_used_in_an_evaluation_expression_22"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -2076,7 +2260,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Try statement is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Try_statement_cannot_be_used_in_an_evaluation_expression_23"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -2088,7 +2272,7 @@
return true;
}
setHasError(true);
- addErrorMessage(new Message("Type declaration cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Type_declaration_cannot_be_used_in_an_evaluation_expression_24"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -2100,7 +2284,7 @@
return true;
}
setHasError(true);
- addErrorMessage(new Message("Type declaration statement cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Type_declaration_statement_cannot_be_used_in_an_evaluation_expression_25"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
@@ -2125,7 +2309,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Variable declaration expression is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Variable_declaration_cannot_be_used_in_an_evaluation_expression_26"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -2133,11 +2317,10 @@
* @see ASTVisitor#visit(VariableDeclarationFragment)
*/
public boolean visit(VariableDeclarationFragment node) {
- if (!isActive()) {
- return false;
- }
- setHasError(true);
- addErrorMessage(new Message("Variable declaration fragment is not implemented", node.getStartPosition()));
+ // Don't add error here. A variable declaration fragment is contained in a
+ // variable declaraction expression or statement, or in a field declaration.
+ // The appropriate error is already added inthe first case, no error should
+ // be added in the second case.
return true;
}
@@ -2149,7 +2332,7 @@
return false;
}
setHasError(true);
- addErrorMessage(new Message("Variable declaration statement is not implemented", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.Variable_declaration_cannot_be_used_in_an_evaluation_expression_27"), node.getStartPosition())); //$NON-NLS-1$
return true;
}
@@ -2158,23 +2341,18 @@
*/
public boolean visit(WhileStatement node) {
setHasError(true);
- addErrorMessage(new Message("While statement cannot be used in an evaluation expression", node.getStartPosition()));
+ addErrorMessage(new Message(EvaluationEngineMessages.getString("ASTInstructionCompiler.While_statement_cannot_be_used_in_an_evaluation_expression_28"), node.getStartPosition())); //$NON-NLS-1$
return false;
}
//--------------------------
- private String getQualifiedName(ITypeBinding typeBinding) {
- IPackageBinding packageBinding = typeBinding.getPackage();
- return ((packageBinding == null || packageBinding.isUnnamed())? "" : packageBinding.getName() + ".") + typeBinding.getName();
- }
-
private int getTypeId(Expression expression) {
ITypeBinding typeBinding = expression.resolveTypeBinding();
String typeName = typeBinding.getName();
if (typeBinding.isPrimitive()) {
return getPrimitiveTypeId(typeName);
- } else if ("String".equals(typeName) && "java.lang".equals(typeBinding.getPackage().getName())){
+ } else if ("String".equals(typeName) && "java.lang".equals(typeBinding.getPackage().getName())){ //$NON-NLS-1$ //$NON-NLS-2$
return Instruction.T_String;
} else {
return Instruction.T_Object;
@@ -2186,7 +2364,7 @@
return getPrimitiveTypeId(((PrimitiveType)type).getPrimitiveTypeCode().toString());
} else if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType) type;
- if ("java.lang.String".equals(simpleType.getName())){
+ if ("java.lang.String".equals(simpleType.getName())){ //$NON-NLS-1$
return Instruction.T_String;
} else {
return Instruction.T_Object;
@@ -2199,14 +2377,25 @@
}
- private String getMethodSignature(IMethodBinding methodBinding) {
+ private String getMethodSignature(IMethodBinding methodBinding, String enclosingTypeSignature) {
ITypeBinding[] parameterTypes = methodBinding.getParameterTypes();
- int argCount = parameterTypes.length;
- String[] parameterSignatures = new String[argCount];
- for (int i = 0; i < argCount; i++) {
- parameterSignatures[i] = Signature.createTypeSignature(getQualifiedName(parameterTypes[i]), true);
+ int i;
+ int argCount;
+ String[] parameterSignatures;
+ if (enclosingTypeSignature == null) {
+ i= 0;
+ argCount= parameterTypes.length;
+ parameterSignatures= new String[argCount];
+ } else {
+ i= 1;
+ argCount= parameterTypes.length + 1;
+ parameterSignatures= new String[argCount];
+ parameterSignatures[0]= enclosingTypeSignature;
}
- String signature = Signature.createMethodSignature(parameterSignatures, Signature.createTypeSignature(getQualifiedName(methodBinding.getReturnType()), true));
+ for (; i < argCount; i++) {
+ parameterSignatures[i]= getTypeSignature(parameterTypes[i]);
+ }
+ String signature= Signature.createMethodSignature(parameterSignatures, getTypeSignature(methodBinding.getReturnType()));
return signature;
}
@@ -2243,23 +2432,23 @@
private String getPrimitiveTypeSignature(String typeName) {
switch (getPrimitiveTypeId(typeName)) {
case Instruction.T_byte:
- return "B";
+ return "B"; //$NON-NLS-1$
case Instruction.T_char:
- return "C";
+ return "C"; //$NON-NLS-1$
case Instruction.T_double:
- return "D";
+ return "D"; //$NON-NLS-1$
case Instruction.T_float:
- return "F";
+ return "F"; //$NON-NLS-1$
case Instruction.T_int:
- return "I";
+ return "I"; //$NON-NLS-1$
case Instruction.T_long:
- return "J";
+ return "J"; //$NON-NLS-1$
case Instruction.T_short:
- return "S";
+ return "S"; //$NON-NLS-1$
case Instruction.T_boolean:
- return "Z";
+ return "Z"; //$NON-NLS-1$
case Instruction.T_void:
- return "V";
+ return "V"; //$NON-NLS-1$
}
// throw exception
return null;
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java
index 5eacf9e..b5b1752 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java
@@ -14,6 +14,7 @@
import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
+import com.sun.jdi.ClassNotPreparedException;
import com.sun.jdi.ClassType;
import com.sun.jdi.Field;
import com.sun.jdi.InterfaceType;
@@ -24,27 +25,28 @@
public class BinaryBasedSourceGenerator {
- private static final String RUN_METHOD_NAME= "___run";
+ private static final String RUN_METHOD_NAME= "___run"; //$NON-NLS-1$
private static final String EVAL_METHOD_NAME= "___eval"; //$NON-NLS-1$
+ private static final String ANONYMOUS_CLASS_NAME= "___EvalClass"; //$NON-NLS-1$
- private int[] fLocalModifiers;
- private String[] fLocalTypesNames;
+ private String[] fLocalVariableTypeNames;
- private String[] fLocalVariables;
+ private String[] fLocalVariableNames;
private boolean fIsInStaticMethod;
private StringBuffer fSource;
+ private int fRunMethodStartOffset;
+ private int fRunMethodLength;
private int fCodeSnippetPosition;
private String fCompilationUnitName;
- public BinaryBasedSourceGenerator(int[] localModifiers, String[] localTypesNames, String[] localVariables, boolean isInStaticMethod) throws DebugException {
- fLocalModifiers= localModifiers;
- fLocalTypesNames= localTypesNames;
- fLocalVariables= localVariables;
+ public BinaryBasedSourceGenerator(String[] localTypesNames, String[] localVariables, boolean isInStaticMethod) throws DebugException {
+ fLocalVariableTypeNames= localTypesNames;
+ fLocalVariableNames= localVariables;
fIsInStaticMethod= isInStaticMethod;
}
@@ -65,10 +67,10 @@
return;
}
ReferenceType refType= (ReferenceType)underlyingType;
- fSource= buildTypeDeclaration(refType, buildRunMethod(refType), null);
+ fSource= buildTypeDeclaration(refType, buildRunMethod(refType), null, false);
String packageName = getPackageName(refType.name());
if (packageName != null) {
- fSource.insert(0, "package " + packageName + ";\n");
+ fSource.insert(0, "package " + packageName + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$
fCodeSnippetPosition += 10 + packageName.length();
}
fCompilationUnitName= getSimpleName(refType.name());
@@ -87,29 +89,27 @@
StringBuffer source = new StringBuffer();
if (isInStaticMethod()) {
- source.append("static ");
+ source.append("static "); //$NON-NLS-1$
}
- source.append("void ");
+ source.append("void "); //$NON-NLS-1$
source.append(getUniqueMethodName(RUN_METHOD_NAME, type));
source.append('(');
- for(int i= 0, length= fLocalModifiers.length; i < length; i++) {
- if (fLocalModifiers[i] != 0) {
- source.append(Flags.toString(fLocalModifiers[i]));
- source.append(' ');
- }
- source.append(getDotName(fLocalTypesNames[i]));
+ for(int i= 0, length= fLocalVariableNames.length; i < length; i++) {
+ source.append(getDotName(fLocalVariableTypeNames[i]));
source.append(' ');
- source.append(fLocalVariables[i]);
+ source.append(fLocalVariableNames[i]);
if (i + 1 < length)
- source.append(", ");
+ source.append(", "); //$NON-NLS-1$
}
- source.append(") throws Throwable {");
+ source.append(") throws Throwable {"); //$NON-NLS-1$
source.append('\n');
fCodeSnippetPosition= source.length();
+ fRunMethodStartOffset= fCodeSnippetPosition;
source.append('\n');
source.append('}').append('\n');
+ fRunMethodLength= source.length();
return source;
}
@@ -117,26 +117,30 @@
ReferenceType referenceType = object.referenceType();
- StringBuffer source = buildTypeDeclaration(referenceType, buffer, nestedTypeName);
-
Field thisField= null;
List fields= referenceType.visibleFields();
for (Iterator iterator= fields.iterator(); iterator.hasNext();) {
Field field= (Field) iterator.next();
- if (field.name().startsWith("this$")) {
+ if (field.name().startsWith("this$")) { //$NON-NLS-1$
thisField = field;
break;
}
}
+ StringBuffer source = buildTypeDeclaration(referenceType, buffer, nestedTypeName, thisField != null);
+
if (thisField == null) {
String packageName = getPackageName(referenceType.name());
if (packageName != null) {
- source.insert(0, "package " + packageName + ";\n");
+ source.insert(0, "package " + packageName + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$
fCodeSnippetPosition += 10 + packageName.length();
}
- fCompilationUnitName= getSimpleName(referenceType.name());
+ if (isAnonymousTypeName(referenceType.name())) {
+ fCompilationUnitName= ANONYMOUS_CLASS_NAME;
+ } else {
+ fCompilationUnitName= getSimpleName(referenceType.name());
+ }
} else {
ObjectReference thisObject= (ObjectReference)object.getValue(thisField);
return buildTypeDeclaration(thisObject, source, referenceType.name());
@@ -145,7 +149,7 @@
return source;
}
- private StringBuffer buildTypeDeclaration(ReferenceType referenceType, StringBuffer buffer, String nestedTypeName) {
+ private StringBuffer buildTypeDeclaration(ReferenceType referenceType, StringBuffer buffer, String nestedTypeName, boolean hasEnclosingInstance) {
StringBuffer source= new StringBuffer();
String typeName= referenceType.name();
@@ -155,68 +159,94 @@
if (isAnonymousType) {
ClassType classType= (ClassType) referenceType;
- source.append("void ");
- source.append(getUniqueMethodName(EVAL_METHOD_NAME, referenceType));
- source.append("() {\n");
- source.append("new ").append(getDotName(classType.superclass().name())).append("()");
+ List interfaceList= classType.interfaces();
+ String superClassName= classType.superclass().name();
+ if (hasEnclosingInstance) {
+ source.append("void "); //$NON-NLS-1$
+ source.append(getUniqueMethodName(EVAL_METHOD_NAME, referenceType));
+ source.append("() {\nnew "); //$NON-NLS-1$
+ if (interfaceList.size() != 0) {
+ source.append(getDotName(((InterfaceType)interfaceList.get(0)).name()));
+ } else {
+ source.append(getDotName(superClassName));
+ }
+ source.append("()"); //$NON-NLS-1$
+ } else {
+ source.append("public class ").append(ANONYMOUS_CLASS_NAME).append(" "); //$NON-NLS-1$ //$NON-NLS-2$
+ if (interfaceList.size() != 0) {
+ source.append(" implements ").append(getDotName(((InterfaceType)interfaceList.get(0)).name())); //$NON-NLS-1$
+ } else {
+ source.append(" implements ").append(getDotName(superClassName)); //$NON-NLS-1$
+ }
+ }
} else {
if (referenceType.isFinal()) {
- source.append("final ");
+ source.append("final "); //$NON-NLS-1$
}
if (referenceType.isStatic()) {
- source.append("static ");
+ source.append("static "); //$NON-NLS-1$
}
if (referenceType instanceof ClassType) {
ClassType classType= (ClassType) referenceType;
if (classType.isAbstract()) {
- source.append("abstract ");
+ source.append("abstract "); //$NON-NLS-1$
}
- source.append("class ");
+ source.append("class "); //$NON-NLS-1$
source.append(getSimpleName(typeName)).append(' ');
ClassType superClass= classType.superclass();
if (superClass != null) {
- source.append("extends ").append(getDotName(superClass.name())).append(' ');
+ source.append("extends ").append(getDotName(superClass.name())).append(' '); //$NON-NLS-1$
}
-
- List interfaces= classType.interfaces();
+
+ List interfaces;
+ try {
+ interfaces= classType.interfaces();
+ } catch (ClassNotPreparedException e) {
+ return new StringBuffer();
+ }
if (interfaces.size() != 0) {
- source.append("implements ");
+ source.append("implements "); //$NON-NLS-1$
Iterator iterator= interfaces.iterator();
InterfaceType interface_= (InterfaceType)iterator.next();
- source.append(interface_.name());
+ source.append(getDotName(interface_.name()));
while (iterator.hasNext()) {
- source.append(',').append(((InterfaceType)iterator.next()).name());
+ source.append(',').append(getDotName(((InterfaceType)iterator.next()).name()));
}
}
} else if (referenceType instanceof InterfaceType) {
InterfaceType interfaceType= (InterfaceType) referenceType;
- source.append("interface ");
+ source.append("interface "); //$NON-NLS-1$
- source.append(getSimpleName(typeName));
+ source.append(getSimpleName(typeName)).append(' ');
- List interfaces= interfaceType.superinterfaces();
+ List interfaces;
+ try {
+ interfaces= interfaceType.superinterfaces();
+ } catch (ClassNotPreparedException e) {
+ return new StringBuffer();
+ }
if (interfaces.size() != 0) {
- source.append("extends ");
+ source.append("extends "); //$NON-NLS-1$
Iterator iterator= interfaces.iterator();
InterfaceType interface_= (InterfaceType)iterator.next();
- source.append(interface_.name());
+ source.append(getDotName(interface_.name()));
while (iterator.hasNext()) {
- source.append(',').append(interface_.name());
+ source.append(',').append(getDotName(((InterfaceType)iterator.next()).name()));
}
}
}
}
- source.append(" {\n");
+ source.append(" {\n"); //$NON-NLS-1$
if (buffer != null) {
fCodeSnippetPosition += source.length();
@@ -226,7 +256,7 @@
List fields= referenceType.fields();
for (Iterator iterator= fields.iterator(); iterator.hasNext();) {
Field field= (Field) iterator.next();
- if (!field.name().startsWith("this$")) {
+ if (!field.name().startsWith("this$")) { //$NON-NLS-1$
source.append(buildFieldDeclaration(field));
}
}
@@ -244,23 +274,23 @@
for (Iterator iterator = nestedTypes.iterator(); iterator.hasNext();) {
ReferenceType nestedType= (ReferenceType) iterator.next();
if (isADirectInnerType(typeName, nestedType.name())) {
- source.append(buildTypeDeclaration(nestedType, null, null));
+ source.append(buildTypeDeclaration(nestedType, null, null, true));
}
}
} else {
for (Iterator iterator = nestedTypes.iterator(); iterator.hasNext();) {
ReferenceType nestedType= (ReferenceType) iterator.next();
if (!nestedTypeName.equals(nestedType.name()) && isADirectInnerType(typeName, nestedType.name())) {
- source.append(buildTypeDeclaration(nestedType, null, null));
+ source.append(buildTypeDeclaration(nestedType, null, null, true));
}
}
}
- if (isAnonymousType) {
- source.append("};\n");
+ if (isAnonymousType & hasEnclosingInstance) {
+ source.append("};\n"); //$NON-NLS-1$
}
- source.append("}\n");
+ source.append("}\n"); //$NON-NLS-1$
return source;
}
@@ -269,22 +299,22 @@
StringBuffer source = new StringBuffer();
if (field.isFinal()) {
- source.append("final ");
+ source.append("final "); //$NON-NLS-1$
}
if (field.isStatic()) {
- source.append("static ");
+ source.append("static "); //$NON-NLS-1$
}
if (field.isPublic()) {
- source.append("public ");
+ source.append("public "); //$NON-NLS-1$
} else if (field.isPrivate()) {
- source.append("private ");
+ source.append("private "); //$NON-NLS-1$
} else if (field.isProtected()) {
- source.append("protected ");
+ source.append("protected "); //$NON-NLS-1$
}
- source.append(field.typeName()).append(' ').append(field.name()).append(';').append('\n');
+ source.append(getDotName(field.typeName())).append(' ').append(field.name()).append(';').append('\n');
return source;
}
@@ -293,43 +323,43 @@
StringBuffer source= new StringBuffer();
if (method.isFinal()) {
- source.append("final ");
+ source.append("final "); //$NON-NLS-1$
}
if (method.isStatic()) {
- source.append("static ");
+ source.append("static "); //$NON-NLS-1$
}
if (method.isNative()) {
- source.append("native ");
+ source.append("native "); //$NON-NLS-1$
} else if (method.isAbstract()) {
- source.append("abstract ");
+ source.append("abstract "); //$NON-NLS-1$
}
if (method.isPublic()) {
- source.append("public ");
+ source.append("public "); //$NON-NLS-1$
} else if (method.isPrivate()) {
- source.append("private ");
+ source.append("private "); //$NON-NLS-1$
} else if (method.isProtected()) {
- source.append("protected ");
+ source.append("protected "); //$NON-NLS-1$
}
- source.append(method.returnTypeName()).append(' ').append(method.name()).append('(');
+ source.append(getDotName(method.returnTypeName())).append(' ').append(method.name()).append('(');
List arguments= method.argumentTypeNames();
int i= 0;
if (arguments.size() != 0) {
Iterator iterator= arguments.iterator();
- source.append((String) iterator.next()).append(" arg").append(i++);
+ source.append(getDotName((String) iterator.next())).append(" arg").append(i++); //$NON-NLS-1$
while (iterator.hasNext()) {
- source.append(',').append(getDotName((String) iterator.next())).append(" arg").append(i++);
+ source.append(',').append(getDotName((String) iterator.next())).append(" arg").append(i++); //$NON-NLS-1$
}
}
source.append(')');
if (method.isAbstract() || method.isNative()) {
// No body for abstract and native methods
- source.append(";\n");
+ source.append(";\n"); //$NON-NLS-1$
} else {
source.append('{').append('\n');
source.append(getReturnStatement(method.returnTypeName()));
@@ -342,14 +372,14 @@
private String getReturnStatement(String returnTypeName) {
String typeName= getSimpleName(returnTypeName);
if (typeName.charAt(typeName.length() - 1) == ']') {
- return "return null;\n";
+ return "return null;\n"; //$NON-NLS-1$
}
switch (typeName.charAt(0)) {
case 'v':
- return "";
+ return ""; //$NON-NLS-1$
case 'b':
if (typeName.charAt(1) == 'o') {
- return "return false;\n";
+ return "return false;\n"; //$NON-NLS-1$
}
case 's':
case 'c':
@@ -357,9 +387,9 @@
case 'l':
case 'd':
case 'f':
- return "return 0;\n";
+ return "return 0;\n"; //$NON-NLS-1$
default:
- return "return null;\n";
+ return "return null;\n"; //$NON-NLS-1$
}
}
@@ -406,8 +436,16 @@
return fCompilationUnitName;
}
- public int getBlockStar() {
+ public int getSnippetStart() {
return fCodeSnippetPosition - 2;
}
+
+ public int getRunMethodStart() {
+ return fCodeSnippetPosition - fRunMethodStartOffset;
+ }
+
+ public int getRunMethodLength() {
+ return fRunMethodLength;
+ }
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
index 233a107..0fbaef5 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
@@ -5,6 +5,15 @@
* All Rights Reserved.
*/
import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.Location;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -40,60 +49,97 @@
private String fCodeSnippet;
- private String[] fImports;
- private int[] fLocalModifiers;
- private String[] fLocalTypesNames;
- private String[] fLocalVariables;
+ private String[] fLocalVariableTypeNames;
+ private String[] fLocalVariableNames;
private String fSource;
private String fCompilationUnitName;
- private int fStartPosition;
+ private int fSnippetStartPosition;
+ private int fRunMethodStartPosition;
+ private int fRunMethodLength;
/**
* Rebuild source in presence of external local variables
*/
- public EvaluationSourceGenerator(String[] imports, int[] localModifiers, String[] localTypesNames, String[] localVariables, String codeSnippet) {
- fImports = imports;
- fLocalModifiers = localModifiers;
- fLocalTypesNames = localTypesNames;
- fLocalVariables = localVariables;
- fCodeSnippet= codeSnippet;
+ public EvaluationSourceGenerator(String[] localVariableTypesNames, String[] localVariableNames, String codeSnippet) {
+ fLocalVariableTypeNames = localVariableTypesNames;
+ fLocalVariableNames = localVariableNames;
+ fCodeSnippet= getCompleteSnippet(codeSnippet);
+ }
+
+ public EvaluationSourceGenerator(String codeSnippet) {
+ this(new String[0], new String[0], codeSnippet);
+ }
+
+ protected String getCompleteSnippet(String codeSnippet) {
+
+ if (isExpression(codeSnippet)) {
+ codeSnippet = "return " + codeSnippet + ';'; //$NON-NLS-1$
+ }
+ return codeSnippet;
+ }
+
+ protected boolean isExpression(String codeSnippet) {
+ return codeSnippet.indexOf(';') == -1 && codeSnippet.indexOf('{') == -1 && codeSnippet.indexOf('}') == -1 && codeSnippet.indexOf("return") == -1; //$NON-NLS-1$
}
public String getCompilationUnitName() {
return fCompilationUnitName;
}
- public int getStartPosition() {
- return fStartPosition;
+ public int getSnippetStart() {
+ return fSnippetStartPosition;
+ }
+ public int getRunMethodStart() {
+ return fRunMethodStartPosition;
+ }
+ public int getRunMethodLength() {
+ return fRunMethodLength;
+ }
+ protected void setSnippetStart(int position) {
+ fSnippetStartPosition= position;
+ }
+ protected void setRunMethodStart(int position) {
+ fRunMethodStartPosition= position;
+ }
+ protected void setRunMethodLength(int length) {
+ fRunMethodLength= length;
+ }
+
+ public String getSnippet() {
+ return fCodeSnippet;
}
private void createEvaluationSourceFromSource(String source, int position, boolean isLineNumber) throws DebugException {
CompilationUnit unit= AST.parseCompilationUnit(source.toCharArray());
- SourceBasedSourceGenerator visitor= new SourceBasedSourceGenerator(unit, position, isLineNumber, fLocalModifiers, fLocalTypesNames, fLocalVariables, fCodeSnippet);
+ SourceBasedSourceGenerator visitor= new SourceBasedSourceGenerator(unit, position, isLineNumber, fLocalVariableTypeNames, fLocalVariableNames, fCodeSnippet);
unit.accept(visitor);
setSource(visitor.getSource());
setCompilationUnitName(visitor.getCompilationUnitName());
- setStartPosition(visitor.getStartPosition());
+ setSnippetStart(visitor.getSnippetStart());
+ setRunMethodStart(visitor.getRunMethodStart());
+ setRunMethodLength(visitor.getRunMethodLength());
}
private void createEvaluationSourceFromJDIObject(BinaryBasedSourceGenerator objectToEvaluationSourceMapper) throws DebugException {
setCompilationUnitName(objectToEvaluationSourceMapper.getCompilationUnitName());
- setStartPosition(objectToEvaluationSourceMapper.getBlockStar());
+ setSnippetStart(objectToEvaluationSourceMapper.getSnippetStart());
+ setRunMethodStart(objectToEvaluationSourceMapper.getRunMethodStart());
+ setRunMethodLength(fCodeSnippet.length() + objectToEvaluationSourceMapper.getRunMethodLength());
setSource(objectToEvaluationSourceMapper.getSource().insert(objectToEvaluationSourceMapper.getCodeSnippetPosition(), fCodeSnippet).toString());
}
private BinaryBasedSourceGenerator getInstanceSourceMapper(JDIObjectValue objectValue, boolean isInStaticMethod) throws DebugException {
- BinaryBasedSourceGenerator objectToEvaluationSourceMapper = new BinaryBasedSourceGenerator(fLocalModifiers, fLocalTypesNames, fLocalVariables, isInStaticMethod);
+ BinaryBasedSourceGenerator objectToEvaluationSourceMapper = new BinaryBasedSourceGenerator(fLocalVariableTypeNames, fLocalVariableNames, isInStaticMethod);
objectToEvaluationSourceMapper.buildSource(objectValue);
return objectToEvaluationSourceMapper;
}
private BinaryBasedSourceGenerator getStaticSourceMapper(JDIClassType classType, boolean isInStaticMethod) throws DebugException {
- BinaryBasedSourceGenerator objectToEvaluationSourceMapper = new BinaryBasedSourceGenerator(fLocalModifiers, fLocalTypesNames, fLocalVariables, isInStaticMethod);
+ BinaryBasedSourceGenerator objectToEvaluationSourceMapper = new BinaryBasedSourceGenerator(fLocalVariableTypeNames, fLocalVariableNames, isInStaticMethod);
objectToEvaluationSourceMapper.buildSource(classType);
return objectToEvaluationSourceMapper;
}
@@ -102,7 +148,8 @@
if (fSource == null) {
try {
String baseSource= getSourceFromFrame(frame);
- if (baseSource != null) {
+ int lineNumber= frame.getLineNumber();
+ if (baseSource != null && lineNumber != -1) {
createEvaluationSourceFromSource(baseSource, frame.getLineNumber(), true);
} else {
JDIObjectValue object= (JDIObjectValue)frame.getThis();
@@ -125,33 +172,42 @@
public String getSource(IJavaObject thisObject, IJavaProject javaProject) throws DebugException {
if (fSource == null) {
- try {
- IType type= getTypeFromProject(thisObject.getJavaType().getName() ,javaProject);
- String baseSource= null;
- if (type != null) {
- ICompilationUnit compilationUnit= type.getCompilationUnit();
- if (compilationUnit != null) {
- baseSource= compilationUnit.getSource();
- } else {
- IClassFile classFile= type.getClassFile();
- if (classFile != null) {
- baseSource= classFile.getSource();
- }
- }
- }
- if (baseSource == null) {
+ String baseSource= getTypeSourceFromProject(thisObject.getJavaType().getName(), javaProject);
+ int lineNumber= getLineNumber((JDIObjectValue) thisObject);
+ if (baseSource == null || lineNumber == -1) {
BinaryBasedSourceGenerator mapper= getInstanceSourceMapper((JDIObjectValue) thisObject, false);
createEvaluationSourceFromJDIObject(mapper);
} else {
- createEvaluationSourceFromSource(baseSource, type.getSourceRange().getOffset(), false);
+ createEvaluationSourceFromSource(baseSource, lineNumber, true);
}
- } catch(JavaModelException e) {
- throw new DebugException(e.getStatus());
- }
}
return fSource;
}
-
+
+ private int getLineNumber(JDIObjectValue objectValue) {
+ ReferenceType referenceType= objectValue.getUnderlyingObject().referenceType();
+ String referenceTypeName= referenceType.name();
+ Location location;
+ Hashtable lineNumbers= new Hashtable();
+ try {
+ for (Iterator iterator = referenceType.allLineLocations().iterator(); iterator.hasNext();) {
+ lineNumbers.put(new Integer(((Location)iterator.next()).lineNumber()), this);
+ }
+ for (Iterator iterator = referenceType.allLineLocations().iterator(); iterator.hasNext();) {
+ location= (Location)iterator.next();
+ if (!location.declaringType().name().equals(referenceTypeName)) {
+ lineNumbers.remove(new Integer(((Location)iterator.next()).lineNumber()));
+ }
+ }
+ if (lineNumbers.size() > 0) {
+ return ((Integer)lineNumbers.keys().nextElement()).intValue();
+ }
+ return -1;
+ } catch(AbsentInformationException e) {
+ return -1;
+ }
+ }
+
protected String getSourceFromFrame(IJavaStackFrame frame) throws JavaModelException {
ILaunch launch= frame.getLaunch();
if (launch == null) {
@@ -171,6 +227,9 @@
if (sourceElement instanceof ICompilationUnit) {
return ((ICompilationUnit)sourceElement).getSource();
}
+ if (sourceElement instanceof IClassFile) {
+ return ((IClassFile)sourceElement).getSource();
+ }
return null;
}
@@ -178,79 +237,36 @@
fCompilationUnitName= name;
}
- protected void setStartPosition(int position) {
- fStartPosition= position;
- }
-
protected void setSource(String source) {
fSource= source;
}
-
- /**
- * Returns the type associated with the specified
- * name in this evaluation engine's associated Java project.
- *
- * @param typeName fully qualified name of type, for
- * example, <code>java.lang.String</code>
- * @return main type associated with source file
- * @exception DebugException if:<ul>
- * <li>the resolved type is an inner type</li>
- * <li>unable to resolve a type</li>
- * <li>a lower level Java exception occurs</li>
- * </ul>
- */
- private IType getTypeFromProject(String typeName, IJavaProject javaProject) throws DebugException {
- String path = typeName.replace('.', IPath.SEPARATOR);
+
+ private String getTypeSourceFromProject(String typeName, IJavaProject javaProject) throws DebugException {
+ String path = typeName;
+ int pos = path.indexOf('$');
+ if (pos != -1) {
+ path= path.substring(0, pos);
+ }
+ pos++;
+ path = path.replace('.', IPath.SEPARATOR);
path+= ".java"; //$NON-NLS-1$
IPath sourcePath = new Path(path);
- IType type = null;
+ String source= null;
try {
IJavaElement result = javaProject.findElement(sourcePath);
- String[] typeNames = getNestedTypeNames(typeName);
if (result != null) {
if (result instanceof IClassFile) {
- type = ((IClassFile)result).getType();
+ source = ((IClassFile)result).getSource();
} else if (result instanceof ICompilationUnit) {
- type = ((ICompilationUnit)result).getType(typeNames[0]);
- } else if (result instanceof IType) {
- type = ((IType)result);
- }
- }
- if (type != null) {
- for (int i = 1; i < typeNames.length; i++) {
- type = type.getType(typeNames[i]);
+ source = ((ICompilationUnit)result).getSource();
}
}
} catch (JavaModelException e) {
throw new DebugException(e.getStatus());
}
- return type;
+ return source;
}
-
- /**
- * Returns an array of simple type names that are
- * part of the given type's qualified name. For
- * example, if the given name is <code>x.y.A$B</code>,
- * an array with <code>["A", "B"]</code> is returned.
- *
- * @param typeName fully qualified type name
- * @return array of nested type names
- */
- protected String[] getNestedTypeNames(String typeName) {
- int index = typeName.lastIndexOf('.');
- if (index >= 0) {
- typeName= typeName.substring(index + 1);
- }
- index = typeName.indexOf('$');
- ArrayList list = new ArrayList(1);
- while (index >= 0) {
- list.add(typeName.substring(0, index));
- typeName = typeName.substring(index + 1);
- index = typeName.indexOf('$');
- }
- list.add(typeName);
- return (String[])list.toArray(new String[list.size()]);
- }
+
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationThread.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationThread.java
index b13f8f9..2446342 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationThread.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationThread.java
@@ -9,6 +9,7 @@
import org.eclipse.jdt.debug.core.IEvaluationRunnable;
import org.eclipse.jdt.debug.core.IJavaThread;
import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
import org.eclipse.jdt.debug.eval.ICompiledExpression;
import org.eclipse.jdt.debug.eval.IEvaluationListener;
import org.eclipse.jdt.debug.eval.IEvaluationResult;
@@ -139,13 +140,13 @@
fException = exception;
} catch (Throwable exception) {
JDIDebugPlugin.log(exception);
- fException = new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.ERROR, InstructionsEvaluationMessages.getString("InstructionSequence.Runtime_exception_occurred_during_evaluation._See_log_for_details_1"), exception)); //$NON-NLS-1$
+ fException = new CoreException(new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(), IStatus.ERROR, InstructionsEvaluationMessages.getString("InstructionSequence.Runtime_exception_occurred_during_evaluation._See_log_for_details_1"), exception)); //$NON-NLS-1$
}
}
};
CoreException exception = null;
try {
- fThread.runEvaluation(er, null, fEvaluationDetail, fHitBreakpoints);
+ fThread.runEvaluation(er, null, fEvaluationDetail);
} catch (DebugException e) {
exception = e;
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/Interpreter.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/Interpreter.java
index 82d4169..3afa791 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/Interpreter.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/Interpreter.java
@@ -7,32 +7,38 @@
import java.util.Stack;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
import org.eclipse.jdt.internal.debug.eval.ast.instructions.Instruction;
-import org.eclipse.jdt.internal.debug.eval.model.IRuntimeContext;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
-import org.eclipse.jdt.internal.debug.eval.model.IVirtualMachine;
+import org.eclipse.jdt.internal.debug.eval.ast.instructions.InstructionSequence;
public class Interpreter {
private Instruction[] fInstructions;
private int fInstructionCounter;
private IRuntimeContext fContext;
private Stack fStack;
+ private IJavaValue fLastValue;
- public Interpreter(Instruction[] instructions, IRuntimeContext context) {
- fInstructions= instructions;
+ private boolean fStopped= false;
+
+ public Interpreter(InstructionSequence instructions, IRuntimeContext context) {
+ fInstructions= instructions.getInstructions();
fContext= context;
}
public void execute() throws CoreException {
reset();
- while(fInstructionCounter < fInstructions.length) {
+ while(fInstructionCounter < fInstructions.length && !fStopped) {
Instruction instruction= fInstructions[fInstructionCounter++];
instruction.setInterpreter(this);
instruction.execute();
instruction.setInterpreter(null);
}
}
+
+ public void stop() {
+ fStopped= true;
+ }
private void reset() {
fStack= new Stack();
@@ -74,21 +80,29 @@
return fContext;
}
- public IValue getResult() {
- if (fStack.isEmpty())
- return getContext().getVM().voidValue();
+ public IJavaValue getResult() {
+ if (fStack == null || fStack.isEmpty()) {
+ if (fLastValue == null) {
+ return getContext().getVM().voidValue();
+ }
+ return fLastValue;
+ }
Object top= fStack.peek();
- if (top instanceof IVariable) {
+ if (top instanceof IJavaVariable) {
try {
- return ((IVariable)top).getValue();
+ return (IJavaValue)((IJavaVariable)top).getValue();
} catch (CoreException exception) {
return getContext().getVM().newValue(exception.getStatus().getMessage());
}
}
- if (top instanceof IValue) {
- return (IValue)top;
+ if (top instanceof IJavaValue) {
+ return (IJavaValue)top;
}
// XXX: exception
return null;
- }
+ }
+
+ public void setLastValue(IJavaValue value) {
+ fLastValue= value;
+ }
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
index 9856e97..e5c731b 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
@@ -31,7 +31,6 @@
import org.eclipse.jdt.core.dom.ContinueStatement;
import org.eclipse.jdt.core.dom.DoStatement;
import org.eclipse.jdt.core.dom.EmptyStatement;
-import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.ExpressionStatement;
import org.eclipse.jdt.core.dom.FieldAccess;
import org.eclipse.jdt.core.dom.FieldDeclaration;
@@ -57,7 +56,6 @@
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.StringLiteral;
import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
import org.eclipse.jdt.core.dom.SuperFieldAccess;
@@ -81,10 +79,10 @@
private static final String RUN_METHOD_NAME= "___run"; //$NON-NLS-1$
private static final String EVAL_METHOD_NAME= "___eval"; //$NON-NLS-1$
-
- private int[] fLocalModifiers;
- private String[] fLocalTypesNames;
- private String[] fLocalVariables;
+ private static final String EVAL_FIELD_NAME= "___field"; //$NON-NLS-1$
+
+ private String[] fLocalVariableTypeNames;
+ private String[] fLocalVariableNames;
private String fCodeSnippet;
private boolean fRightTypeFound;
@@ -105,15 +103,16 @@
private String fCompilationUnitName;
- private int fStartPosOffset;
+ private int fSnippetStartPosition;
+ private int fRunMethodStartOffset;
+ private int fRunMethodLength;
- public SourceBasedSourceGenerator(CompilationUnit unit, int position, boolean isLineNumber, int[] localModifiers, String[] localTypesNames, String[] localVariables, String codeSnippet) {
+ public SourceBasedSourceGenerator(CompilationUnit unit, int position, boolean isLineNumber, String[] localTypesNames, String[] localVariables, String codeSnippet) {
fRightTypeFound= false;
fUnit= unit;
fPosition= position;
- fLocalModifiers= localModifiers;
- fLocalTypesNames= localTypesNames;
- fLocalVariables= localVariables;
+ fLocalVariableTypeNames= localTypesNames;
+ fLocalVariableNames= localVariables;
fCodeSnippet= codeSnippet;
fIsInAStaticMethod= false;
fIsLineNumber= isLineNumber;
@@ -131,8 +130,14 @@
return fCompilationUnitName;
}
- public int getStartPosition() {
- return fStartPosOffset;
+ public int getSnippetStart() {
+ return fSnippetStartPosition;
+ }
+ public int getRunMethodStart() {
+ return fSnippetStartPosition - fRunMethodStartOffset;
+ }
+ public int getRunMethodLength() {
+ return fRunMethodLength;
}
private int getPosition() {
@@ -169,26 +174,24 @@
buffer.append("void "); //$NON-NLS-1$
buffer.append(getUniqueMethodName(RUN_METHOD_NAME, bodyDeclarations));
buffer.append('(');
- for(int i= 0, length= fLocalModifiers.length; i < length; i++) {
- if (fLocalModifiers[i] != 0) {
- buffer.append(Flags.toString(fLocalModifiers[i]));
- buffer.append(' ');
- }
- buffer.append(getDotName(fLocalTypesNames[i]));
+ for(int i= 0, length= fLocalVariableNames.length; i < length; i++) {
+ buffer.append(getDotName(fLocalVariableTypeNames[i]));
buffer.append(' ');
- buffer.append(fLocalVariables[i]);
+ buffer.append(fLocalVariableNames[i]);
if (i + 1 < length)
buffer.append(", "); //$NON-NLS-1$
}
buffer.append(") throws Throwable {"); //$NON-NLS-1$
buffer.append('\n');
- fStartPosOffset= buffer.length() - 2;
+ fSnippetStartPosition= buffer.length() - 2;
+ fRunMethodStartOffset= fSnippetStartPosition;
String codeSnippet= new String(fCodeSnippet).trim();
buffer.append(codeSnippet);
buffer.append('\n');
buffer.append('}').append('\n');
+ fRunMethodLength= buffer.length();
return buffer;
}
@@ -213,7 +216,7 @@
source.append('{').append('\n');
if (buffer != null) {
- fStartPosOffset += source.length();
+ fSnippetStartPosition += source.length();
source.append(buffer);
}
for (Iterator iterator= list.iterator(); iterator.hasNext();) {
@@ -297,7 +300,7 @@
Name name = (Name) iterator.next();
if (first) {
first = false;
- source.append(" throws ");
+ source.append(" throws "); //$NON-NLS-1$
} else {
source.append(',');
}
@@ -306,7 +309,7 @@
if (Flags.isAbstract(modifiers) || Flags.isNative(modifiers)) {
// No body for abstract and native methods
- source.append(";\n");
+ source.append(";\n"); //$NON-NLS-1$
} else {
source.append('{').append('\n');
source.append(getReturnExpression(methodDeclaration.getReturnType()));
@@ -321,15 +324,15 @@
StringBuffer source = new StringBuffer();
source.append(Flags.toString(typeDeclaration.getModifiers()));
if (typeDeclaration.isInterface()) {
- source.append(" interface ");
+ source.append(" interface "); //$NON-NLS-1$
} else {
- source.append(" class ");
+ source.append(" class "); //$NON-NLS-1$
}
source.append(typeDeclaration.getName().getIdentifier());
Name superClass = typeDeclaration.getSuperclass();
if (superClass != null) {
- source.append(" extends ");
+ source.append(" extends "); //$NON-NLS-1$
source.append(getQualifiedIdentifier(superClass));
}
@@ -338,7 +341,7 @@
Name name = (Name) iterator.next();
if (first) {
first = false;
- source.append(" implements ");
+ source.append(" implements "); //$NON-NLS-1$
} else {
source.append(',');
}
@@ -346,7 +349,7 @@
}
if (buffer != null) {
- fStartPosOffset+= source.length();
+ fSnippetStartPosition+= source.length();
}
source.append(buildTypeBody(buffer, typeDeclaration.bodyDeclarations()));
@@ -358,22 +361,22 @@
PackageDeclaration packageDeclaration = compilationUnit.getPackage();
if (packageDeclaration != null) {
- source.append("package ");
+ source.append("package "); //$NON-NLS-1$
source.append(getQualifiedIdentifier(packageDeclaration.getName()));
- source.append(";\n");
+ source.append(";\n"); //$NON-NLS-1$
}
for (Iterator iterator = compilationUnit.imports().iterator(); iterator.hasNext();) {
ImportDeclaration importDeclaration = (ImportDeclaration) iterator.next();
- source.append("import ");
+ source.append("import "); //$NON-NLS-1$
source.append(getQualifiedIdentifier(importDeclaration.getName()));
if (importDeclaration.isOnDemand()) {
- source.append(".*");
+ source.append(".*"); //$NON-NLS-1$
}
- source.append(";\n");
+ source.append(";\n"); //$NON-NLS-1$
}
- fStartPosOffset += source.length();
+ fSnippetStartPosition += source.length();
source.append(buffer);
for (Iterator iterator = compilationUnit.types().iterator(); iterator.hasNext();) {
@@ -385,6 +388,11 @@
source.append(buildTypeDeclaration(null,typeDeclaration));
}
}
+ if (fCompilationUnitName == null) {
+ // If no public class was found, the compilation unit
+ // name doesn't matter.
+ fCompilationUnitName= "Eval"; //$NON-NLS-1$
+ }
return source;
}
@@ -411,11 +419,36 @@
return methodName;
}
+ /**
+ * Returns a field name that will be unique in the generated source.
+ * The generated name is baseName plus as many '_' characters as necessary
+ * to not duplicate an existing method name.
+ */
+ private String getUniqueFieldName(String fieldName, List bodyDeclarations) {
+ Iterator iter= bodyDeclarations.iterator();
+ BodyDeclaration bodyDeclaration;
+ FieldDeclaration fieldDeclaration;
+ String foundName;
+ while (iter.hasNext()) {
+ bodyDeclaration= (BodyDeclaration) iter.next();
+ if (bodyDeclaration instanceof FieldDeclaration) {
+ fieldDeclaration= (FieldDeclaration)bodyDeclaration;
+ for (Iterator iterator= fieldDeclaration.fragments().iterator(); iterator.hasNext();) {
+ foundName= ((VariableDeclarationFragment) iterator.next()).getName().getIdentifier();
+ if (foundName.startsWith(fieldName)) {
+ fieldName= foundName + '_';
+ }
+ }
+ }
+ }
+ return fieldName;
+ }
+
private String getQualifiedIdentifier(Name name) {
- String typeName= "";
+ String typeName= ""; //$NON-NLS-1$
while (name.isQualifiedName()) {
QualifiedName qualifiedName = (QualifiedName) name;
- typeName= "." + qualifiedName.getName().getIdentifier() + typeName;
+ typeName= "." + qualifiedName.getName().getIdentifier() + typeName; //$NON-NLS-1$
name= qualifiedName.getQualifier();
}
if (name.isSimpleName()) {
@@ -434,7 +467,7 @@
ArrayType arrayType= (ArrayType) type;
String res = getTypeName(arrayType.getElementType());
for (int i = 0, dim= arrayType.getDimensions(); i < dim; i++) {
- res += "[]";
+ res += "[]"; //$NON-NLS-1$
}
return res;
} else if (type.isPrimitiveType()) {
@@ -447,18 +480,18 @@
public String getReturnExpression(Type type) {
if (type.isSimpleType() || type.isArrayType()) {
- return "return null;";
+ return "return null;"; //$NON-NLS-1$
} else if (type.isPrimitiveType()) {
String typeName= ((PrimitiveType) type).getPrimitiveTypeCode().toString();
char char0 = typeName.charAt(0);
if (char0 == 'v') {
- return "";
+ return ""; //$NON-NLS-1$
} else {
char char1 = typeName.charAt(1);
if (char0 == 'b' && char1 == 'o') {
- return "return false;";
+ return "return false;"; //$NON-NLS-1$
} else {
- return "return 0;";
+ return "return 0;"; //$NON-NLS-1$
}
}
}
@@ -487,28 +520,54 @@
StringBuffer source = buildTypeBody(fSource, bodyDeclarations);
ASTNode parent = node.getParent();
- while (!(parent instanceof MethodDeclaration)) {
+ while (!(parent instanceof MethodDeclaration || parent instanceof FieldDeclaration)) {
parent= parent.getParent();
}
- MethodDeclaration enclosingMethodDeclaration = (MethodDeclaration) parent;
fSource= new StringBuffer();
-
- if (Flags.isStatic(enclosingMethodDeclaration.getModifiers())) {
- fSource.append("static "); //$NON-NLS-1$
- }
- fSource.append("void "); //$NON-NLS-1$
- fSource.append(getUniqueMethodName(EVAL_METHOD_NAME, bodyDeclarations));
- fSource.append("() {\n"); //$NON-NLS-1$
- fSource.append("new "); //$NON-NLS-1$
- fSource.append(getQualifiedIdentifier(node.getName()));
- fSource.append("()"); //$NON-NLS-1$
-
- fStartPosOffset+= fSource.length();
- fSource.append(source);
- fSource.append(";}\n"); //$NON-NLS-1$
-
+ if (parent instanceof MethodDeclaration) {
+ MethodDeclaration enclosingMethodDeclaration = (MethodDeclaration) parent;
+
+ if (Flags.isStatic(enclosingMethodDeclaration.getModifiers())) {
+ fSource.append("static "); //$NON-NLS-1$
+ }
+
+ fSource.append("void "); //$NON-NLS-1$
+ fSource.append(getUniqueMethodName(EVAL_METHOD_NAME, bodyDeclarations));
+ fSource.append("() {\n"); //$NON-NLS-1$
+ fSource.append("new "); //$NON-NLS-1$
+ fSource.append(getQualifiedIdentifier(node.getName()));
+ fSource.append("()"); //$NON-NLS-1$
+
+ fSnippetStartPosition+= fSource.length();
+ fSource.append(source);
+ fSource.append(";}\n"); //$NON-NLS-1$
+
+ } else if (parent instanceof FieldDeclaration) {
+ FieldDeclaration enclosingFieldDeclaration = (FieldDeclaration) parent;
+
+ if (Flags.isStatic(enclosingFieldDeclaration.getModifiers())) {
+ fSource.append("static "); //$NON-NLS-1$
+ }
+
+ Type type= enclosingFieldDeclaration.getType();
+ while (type instanceof ArrayType) {
+ type= ((ArrayType)type).getComponentType();
+ }
+
+ fSource.append(getQualifiedIdentifier(((SimpleType)type).getName()));
+ fSource.append(' ');
+ fSource.append(getUniqueFieldName(EVAL_FIELD_NAME, bodyDeclarations));
+ fSource.append(" = new "); //$NON-NLS-1$
+ fSource.append(getQualifiedIdentifier(node.getName()));
+ fSource.append("()"); //$NON-NLS-1$
+
+ fSnippetStartPosition+= fSource.length();
+ fSource.append(source);
+ fSource.append(";\n"); //$NON-NLS-1$
+
+ }
fLastTypeName= ""; //$NON-NLS-1$
}
@@ -572,15 +631,15 @@
fSource = new StringBuffer();
if (Flags.isStatic(enclosingMethodDeclaration.getModifiers())) {
- fSource.append("static ");
+ fSource.append("static "); //$NON-NLS-1$
}
- fSource.append("void ___eval() {\n");
- fStartPosOffset+= fSource.length();
+ fSource.append("void ___eval() {\n"); //$NON-NLS-1$
+ fSnippetStartPosition+= fSource.length();
fSource.append(source);
- fSource.append("}\n");
+ fSource.append("}\n"); //$NON-NLS-1$
- fLastTypeName = "";
+ fLastTypeName = ""; //$NON-NLS-1$
} else {
fSource = source;
fLastTypeName = node.getName().getIdentifier();
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndAssignmentOperator.java
index 3140026..6f0cf40 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndAssignmentOperator.java
@@ -11,7 +11,6 @@
}
public String toString() {
- return "'&=' operator";
+ return InstructionsEvaluationMessages.getString("AndAssignmentOperator._&=___operator_1"); //$NON-NLS-1$
}
-
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndOperator.java
index 03c2937..e50c782 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AndOperator.java
@@ -4,8 +4,9 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
+
public class AndOperator extends BinaryOperator {
public AndOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -17,49 +18,49 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getBooleanValue() & ((IPrimitiveValue) rightOperand).getBooleanValue();
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getBooleanValue() & ((IJavaPrimitiveValue) rightOperand).getBooleanValue();
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getIntValue() & ((IPrimitiveValue) rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() & ((IJavaPrimitiveValue) rightOperand).getIntValue();
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getLongValue() & ((IPrimitiveValue) rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() & ((IJavaPrimitiveValue) rightOperand).getLongValue();
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'&' operator";
+ return InstructionsEvaluationMessages.getString("AndOperator_&___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java
index c8ffc36..a241d10 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java
@@ -5,9 +5,13 @@
* All Rights Reserved.
*/
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.*;
-import org.eclipse.jdt.internal.debug.eval.model.EvaluationArrayVariable;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.debug.core.IJavaArray;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
/**
* Resolves an array access - the top of the stack is
@@ -21,13 +25,16 @@
}
public void execute() throws CoreException {
- int index = ((IPrimitiveValue)popValue()).getIntValue();
- IArray array = (IArray)popValue();
- push(new EvaluationArrayVariable(array, index));
+ int index = ((IJavaPrimitiveValue)popValue()).getIntValue();
+ IJavaArray array = (IJavaArray)popValue();
+ if (index >= array.getLength() || index < 0) {
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, MessageFormat.format(InstructionsEvaluationMessages.getString("ArrayAccess.illegal_index"), new Object[] {new Integer(index)}), null)); //$NON-NLS-1$
+ }
+ push(array.getVariables()[index]);
}
public String toString() {
- return "array access";
+ return InstructionsEvaluationMessages.getString("ArrayAccess.array_access_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAllocation.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAllocation.java
index fc77dd8..6cbbbc9 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAllocation.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAllocation.java
@@ -5,10 +5,10 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IArray;
-import org.eclipse.jdt.internal.debug.eval.model.IArrayType;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IType;
+import org.eclipse.jdt.debug.core.IJavaArray;
+import org.eclipse.jdt.debug.core.IJavaArrayType;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaType;
public class ArrayAllocation extends ArrayInstruction {
@@ -18,7 +18,7 @@
private boolean fHasInitializer;
- private IArrayType[] fCachedArrayTypes;
+ private IJavaArrayType[] fCachedArrayTypes;
/**
* Constructor for ArrayAllocation.
@@ -36,7 +36,7 @@
*/
public void execute() throws CoreException {
if (fHasInitializer) {
- IArray array = (IArray) popValue();
+ IJavaArray array = (IJavaArray) popValue();
pop(); // pop the type
push(array);
} else {
@@ -44,19 +44,19 @@
int[] exprDimensions = new int[fExprDimension];
for (int i = fExprDimension - 1; i >= 0; i--) {
- exprDimensions[i] = ((IPrimitiveValue)popValue()).getIntValue();
+ exprDimensions[i] = ((IJavaPrimitiveValue)popValue()).getIntValue();
}
- IType type = (IType) pop();
+ IJavaType type = (IJavaType) pop();
- fCachedArrayTypes = new IArrayType[fDimension + 1];
+ fCachedArrayTypes = new IJavaArrayType[fDimension + 1];
for (int i =fDimension, lim = fDimension - fExprDimension ; i > lim; i--) {
- fCachedArrayTypes[i] = (IArrayType) type;
- type = ((IArrayType)type).getComponentType();
+ fCachedArrayTypes[i] = (IJavaArrayType) type;
+ type = ((IJavaArrayType)type).getComponentType();
}
- IArray array = createArray(fDimension, exprDimensions);
+ IJavaArray array = createArray(fDimension, exprDimensions);
push(array);
}
@@ -65,9 +65,9 @@
/**
* Create and populate an array.
*/
- private IArray createArray(int dimension, int[] exprDimensions) throws CoreException {
+ private IJavaArray createArray(int dimension, int[] exprDimensions) throws CoreException {
- IArray array = fCachedArrayTypes[dimension].newArray(exprDimensions[0]);
+ IJavaArray array = fCachedArrayTypes[dimension].newInstance(exprDimensions[0]);
if (exprDimensions.length > 1) {
int[] newExprDimension = new int[exprDimensions.length - 1];
@@ -85,7 +85,7 @@
}
public String toString() {
- return "array allocation";
+ return InstructionsEvaluationMessages.getString("ArrayAllocation.array_allocation_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java
index 35380fb..65d2b1d 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java
@@ -5,8 +5,8 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IArray;
-import org.eclipse.jdt.internal.debug.eval.model.IArrayType;
+import org.eclipse.jdt.debug.core.IJavaArray;
+import org.eclipse.jdt.debug.core.IJavaArrayType;
public class ArrayInitializerInstruction extends ArrayInstruction {
@@ -32,8 +32,8 @@
*/
public void execute() throws CoreException {
- IArrayType arrayType = getType(fTypeSignature.replace('/','.'), fDimensions);
- IArray array = arrayType.newArray(fLength);
+ IJavaArrayType arrayType = getType(fTypeSignature.replace('/','.'), fDimensions);
+ IJavaArray array = arrayType.newInstance(fLength);
for (int i = fLength - 1; i >= 0; i--) {
array.setValue(i, popValue());
@@ -44,7 +44,7 @@
}
public String toString() {
- return "array initializer";
+ return InstructionsEvaluationMessages.getString("ArrayInitializerInstruction.array_initializer_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInstruction.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInstruction.java
index d6ba6ef..8d60549 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInstruction.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInstruction.java
@@ -6,9 +6,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.internal.debug.eval.model.IArrayType;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IType;
+import org.eclipse.jdt.debug.core.IJavaArrayType;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaType;
public abstract class ArrayInstruction extends CompoundInstruction {
@@ -18,31 +18,31 @@
}
- protected IArrayType getType(String sign, int dimension) throws CoreException {
+ protected IJavaArrayType getType(String sign, int dimension) throws CoreException {
String qualifiedName = Signature.toString(sign);
- String braces = "";
+ String braces = ""; //$NON-NLS-1$
for (int i = 0; i < dimension; i++) {
- qualifiedName += "[]";
- braces += "[";
+ qualifiedName += "[]"; //$NON-NLS-1$
+ braces += "["; //$NON-NLS-1$
}
String signature = braces + sign;
// Force the class to be loaded, and record the class reference
// for later use if there are multiple classes with the same name.
- IObject classReference= classForName(signature);
+ IJavaObject classReference= classForName(signature);
if (classReference == null) {
throw new CoreException(null); // could not resolve type
}
- IType[] types= getVM().classesByName(qualifiedName);
+ IJavaType[] types= getVM().getJavaTypes(qualifiedName);
checkTypes(types);
if (types.length == 1) {
// Found only one class.
- return (IArrayType)types[0];
+ return (IJavaArrayType)types[0];
} else {
// Found many classes, look for the right one for this scope.
for(int i= 0, length= types.length; i < length; i++) {
- IType type= types[i];
+ IJavaType type= types[i];
if (classReference.equals(getClassObject(type))) {
- return (IArrayType)type;
+ return (IJavaArrayType)type;
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java
index 5eba2c7..6c52e4a 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java
@@ -5,9 +5,9 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
public class AssignmentOperator extends CompoundInstruction {
@@ -25,11 +25,11 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IValue value = (IValue) popValue();
- IVariable variable = (IVariable) pop();
+ IJavaValue value = (IJavaValue) popValue();
+ IJavaVariable variable = (IJavaVariable) pop();
- if (value instanceof IPrimitiveValue) {
- IPrimitiveValue primitiveValue = (IPrimitiveValue) value;
+ if (value instanceof IJavaPrimitiveValue) {
+ IJavaPrimitiveValue primitiveValue = (IJavaPrimitiveValue) value;
switch (fVariableTypeId) {
case T_boolean:
variable.setValue(newValue(primitiveValue.getBooleanValue()));
@@ -63,8 +63,6 @@
}
public String toString() {
- return "'=' operator";
+ return InstructionsEvaluationMessages.getString("AssignmentOperator._=___operator_1"); //$NON-NLS-1$
}
-
-
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java
index 19c978d..d58b7a9 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java
@@ -5,9 +5,8 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
public abstract class BinaryOperator extends CompoundInstruction {
protected int fResultTypeId;
@@ -35,9 +34,9 @@
}
private void executeAssignment() throws CoreException {
- IValue value = (IValue) popValue();
- IVariable variable = (IVariable) pop();
- IValue variableValue = variable.getValue();
+ IJavaValue value = (IJavaValue) popValue();
+ IJavaVariable variable = (IJavaVariable) pop();
+ IJavaValue variableValue = (IJavaValue)variable.getValue();
switch (fResultTypeId) {
case T_byte:
@@ -73,8 +72,8 @@
}
private void executeBinary() throws CoreException {
- IValue right= (IValue)popValue();
- IValue left= (IValue)popValue();
+ IJavaValue right= (IJavaValue)popValue();
+ IJavaValue left= (IJavaValue)popValue();
switch (fResultTypeId) {
case T_String:
@@ -98,7 +97,7 @@
}
}
- private IValue getByteValueResult(IValue leftOperand, IValue rightOperand) throws CoreException {
+ private IJavaValue getByteValueResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
switch (getInternResultType()) {
case T_double:
return newValue((byte) getDoubleResult(leftOperand, rightOperand));
@@ -113,7 +112,7 @@
}
}
- private IValue getShortValueResult(IValue leftOperand, IValue rightOperand) throws CoreException {
+ private IJavaValue getShortValueResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
switch (getInternResultType()) {
case T_double:
return newValue((short) getDoubleResult(leftOperand, rightOperand));
@@ -128,7 +127,7 @@
}
}
- private IValue getCharValueResult(IValue leftOperand, IValue rightOperand) throws CoreException {
+ private IJavaValue getCharValueResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
switch (getInternResultType()) {
case T_double:
return newValue((char) getDoubleResult(leftOperand, rightOperand));
@@ -143,7 +142,7 @@
}
}
- private IValue getIntValueResult(IValue leftOperand, IValue rightOperand) throws CoreException {
+ private IJavaValue getIntValueResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
switch (getInternResultType()) {
case T_double:
return newValue((int) getDoubleResult(leftOperand, rightOperand));
@@ -158,7 +157,7 @@
}
}
- private IValue getLongValueResult(IValue leftOperand, IValue rightOperand) throws CoreException {
+ private IJavaValue getLongValueResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
switch (getInternResultType()) {
case T_double:
return newValue((long) getDoubleResult(leftOperand, rightOperand));
@@ -173,7 +172,7 @@
}
}
- private IValue getFloatValueResult(IValue leftOperand, IValue rightOperand) throws CoreException {
+ private IJavaValue getFloatValueResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
switch (getInternResultType()) {
case T_double:
return newValue((float) getDoubleResult(leftOperand, rightOperand));
@@ -188,7 +187,7 @@
}
}
- private IValue getDoubleValueResult(IValue leftOperand, IValue rightOperand) throws CoreException {
+ private IJavaValue getDoubleValueResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
switch (getInternResultType()) {
case T_double:
return newValue((double) getDoubleResult(leftOperand, rightOperand));
@@ -203,25 +202,25 @@
}
}
- private IValue getBooleanValueResult(IValue leftOperand, IValue rightOperand) {
+ private IJavaValue getBooleanValueResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return newValue(getBooleanResult(leftOperand, rightOperand));
}
- private IValue getStringValueResult(IValue leftOperand, IValue rightOperand) {
+ private IJavaValue getStringValueResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return newValue(getStringResult(leftOperand, rightOperand));
}
- protected abstract int getIntResult(IValue leftOperand, IValue rightOperand) throws CoreException;
+ protected abstract int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException;
- protected abstract long getLongResult(IValue leftOperand, IValue rightOperand) throws CoreException;
+ protected abstract long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException;
- protected abstract float getFloatResult(IValue leftOperand, IValue rightOperand);
+ protected abstract float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand);
- protected abstract double getDoubleResult(IValue leftOperand, IValue rightOperand);
+ protected abstract double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand);
- protected abstract boolean getBooleanResult(IValue leftOperand, IValue rightOperand);
+ protected abstract boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand);
- protected abstract String getStringResult(IValue leftOperand, IValue rightOperand);
+ protected abstract String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand);
protected int getInternResultType() {
return getBinaryPromotionType(fLeftTypeId, fRightTypeId);
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java
index 4a05ecb..5263fe6 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java
@@ -4,34 +4,38 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveType;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IType;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
public class Cast extends CompoundInstruction {
- public static final String IS_INSTANCE= "isInstance";
- public static final String IS_INSTANCE_SIGNATURE= "(Ljava/lang/Object;)Z";
+ public static final String IS_INSTANCE= "isInstance"; //$NON-NLS-1$
+ public static final String IS_INSTANCE_SIGNATURE= "(Ljava/lang/Object;)Z"; //$NON-NLS-1$
private int fTypeTypeId;
- public Cast(int typeTypeId, int start) {
+ private String fTypeName;
+
+ public Cast(int typeTypeId, String typeName, int start) {
super(start);
- fTypeTypeId = typeTypeId;
+ fTypeTypeId= typeTypeId;
+ fTypeName= typeName;
}
/*
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IValue value= popValue();
- IType type= (IType)pop();
+ IJavaValue value= popValue();
- if (type instanceof IPrimitiveType) {
- IPrimitiveValue primitiveValue = (IPrimitiveValue) value;
+ if (value instanceof IJavaPrimitiveValue) {
+ IJavaPrimitiveValue primitiveValue = (IJavaPrimitiveValue) value;
switch (fTypeTypeId) {
case T_double:
push(newValue(primitiveValue.getDoubleValue()));
@@ -57,19 +61,14 @@
}
} else {
- IObject object = (IObject) value;
- IObject classObject= getClassObject(type);
+ IJavaObject classObject= getClassObject(getType(fTypeName));
+ IJavaObject objectValue= (IJavaObject)value;
if (classObject == null) {
throw new CoreException(null);
- } else {
- push(classObject);
- push(object);
- SendMessage send= new SendMessage(IS_INSTANCE,IS_INSTANCE_SIGNATURE,1,false, -1);
- execute(send);
-
- IPrimitiveValue resultValue = (IPrimitiveValue)pop();
+ } else {
+ IJavaPrimitiveValue resultValue = (IJavaPrimitiveValue)classObject.sendMessage(IS_INSTANCE, IS_INSTANCE_SIGNATURE, new IJavaValue[] {objectValue}, getContext().getThread(), false);
if (!resultValue.getBooleanValue()) {
- throw new CoreException(null);
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, MessageFormat.format(InstructionsEvaluationMessages.getString("Cast.ClassCastException__Cannot_cast_{0}_as_{1}__1"), new String[]{objectValue.toString(), fTypeName}), null)); //$NON-NLS-1$
}
}
@@ -81,7 +80,7 @@
* @see Object#toString()
*/
public String toString() {
- return "cast";
+ return InstructionsEvaluationMessages.getString("Cast.cast_3"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java
index 0cfd212..ef03bdc 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java
@@ -5,7 +5,7 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
public class ConditionalJump extends Jump {
private boolean fJumpOnTrue;
@@ -18,7 +18,7 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IPrimitiveValue condition= (IPrimitiveValue)popValue();
+ IJavaPrimitiveValue condition= (IJavaPrimitiveValue)popValue();
if (!(fJumpOnTrue ^ condition.getBooleanValue())) {
jump(fOffset);
@@ -29,7 +29,7 @@
* @see Object#toString()
*/
public String toString() {
- return "conditional jump";
+ return InstructionsEvaluationMessages.getString("ConditionalJump.conditional_jump_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java
index 7d431f4..ad3495f 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java
@@ -6,8 +6,8 @@
*/
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IClassType;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaClassType;
+import org.eclipse.jdt.debug.core.IJavaValue;
/**
* Invokes a constructor. The arguments are on the
@@ -26,18 +26,18 @@
}
public void execute() throws CoreException {
- IValue[] args = new IValue[fArgCount];
+ IJavaValue[] args = new IJavaValue[fArgCount];
// args are in reverse order
for (int i= fArgCount - 1; i >= 0; i--) {
- args[i] = (IValue)popValue();
+ args[i] = (IJavaValue)popValue();
}
- IClassType clazz = (IClassType)pop();
- IValue result = clazz.newInstance(fSignature, args, getContext().getThread());
+ IJavaClassType clazz = (IJavaClassType)pop();
+ IJavaValue result = clazz.newInstance(fSignature, args, getContext().getThread());
push(result);
}
public String toString() {
- return "constructor " + fSignature;
+ return InstructionsEvaluationMessages.getString("Constructor.constructor__1") + fSignature; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideAssignmentOperator.java
index d5ed00d..c2b11c3 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'/=' operator";
+ return InstructionsEvaluationMessages.getString("DivideAssignmentOperator._/=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideOperator.java
index 1bfff36..be78781 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/DivideOperator.java
@@ -6,8 +6,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
public class DivideOperator extends BinaryOperator {
public DivideOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -19,57 +20,57 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getDoubleValue() / ((IPrimitiveValue) rightOperand).getDoubleValue();
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() / ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getFloatValue() / ((IPrimitiveValue) rightOperand).getFloatValue();
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() / ((IJavaPrimitiveValue) rightOperand).getFloatValue();
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) throws CoreException {
- int divisor= ((IPrimitiveValue) rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
+ int divisor= ((IJavaPrimitiveValue) rightOperand).getIntValue();
if (divisor == 0) {
- throw new CoreException(new Status(Status.ERROR, "", Status.OK, "Divide by zero", null));
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("DivideOperator.Divide_by_zero_1"), null)); //$NON-NLS-1$
}
- return ((IPrimitiveValue) leftOperand).getIntValue() / divisor;
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() / divisor;
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) throws CoreException {
- long divisor= ((IPrimitiveValue) rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
+ long divisor= ((IJavaPrimitiveValue) rightOperand).getLongValue();
if (divisor == 0) {
- throw new CoreException(new Status(Status.ERROR, "", Status.OK, "Divide by zero", null));
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("DivideOperator.Divide_by_zero_2"), null)); //$NON-NLS-1$
}
- return ((IPrimitiveValue) leftOperand).getLongValue() / divisor;
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() / divisor;
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'/' operator";
+ return InstructionsEvaluationMessages.getString("DivideOperator._/___operator_3"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/EqualEqualOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/EqualEqualOperator.java
index 79a3eb4..37e703a 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/EqualEqualOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/EqualEqualOperator.java
@@ -1,11 +1,11 @@
-/*
+ /*
* (c) Copyright IBM Corp. 2000, 2001, 2002.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.*;
-import org.eclipse.jdt.internal.debug.eval.model.EvaluationValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class EqualEqualOperator extends BinaryOperator {
@@ -17,72 +17,70 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
boolean equals= false;
switch (getInternResultType()) {
case T_double :
- equals= ((IPrimitiveValue) leftOperand).getDoubleValue() == ((IPrimitiveValue) rightOperand).getDoubleValue();
+ equals= ((IJavaPrimitiveValue) leftOperand).getDoubleValue() == ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
break;
case T_float :
- equals= ((IPrimitiveValue) leftOperand).getFloatValue() == ((IPrimitiveValue) rightOperand).getFloatValue();
+ equals= ((IJavaPrimitiveValue) leftOperand).getFloatValue() == ((IJavaPrimitiveValue) rightOperand).getFloatValue();
break;
case T_long :
- equals= ((IPrimitiveValue) leftOperand).getLongValue() == ((IPrimitiveValue) rightOperand).getLongValue();
+ equals= ((IJavaPrimitiveValue) leftOperand).getLongValue() == ((IJavaPrimitiveValue) rightOperand).getLongValue();
break;
case T_int :
- equals= ((IPrimitiveValue) leftOperand).getIntValue() == ((IPrimitiveValue) rightOperand).getIntValue();
+ equals= ((IJavaPrimitiveValue) leftOperand).getIntValue() == ((IJavaPrimitiveValue) rightOperand).getIntValue();
break;
case T_boolean :
- equals= ((IPrimitiveValue) leftOperand).getBooleanValue() == ((IPrimitiveValue) rightOperand).getBooleanValue();
+ equals= ((IJavaPrimitiveValue) leftOperand).getBooleanValue() == ((IJavaPrimitiveValue) rightOperand).getBooleanValue();
break;
default :
- if (leftOperand instanceof EvaluationValue && rightOperand instanceof EvaluationValue) {
- equals= ((EvaluationValue) leftOperand).getJavaValue().equals(((EvaluationValue) rightOperand).getJavaValue());
- }
+ equals= leftOperand.equals(rightOperand);
break;
}
return ((fIsEquals) ? equals : !equals);
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'==' operator";
+ return InstructionsEvaluationMessages.getString("EqualEqualOperator._==___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterEqualOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterEqualOperator.java
index ef06f42..1e3d557 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterEqualOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterEqualOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class GreaterEqualOperator extends BinaryOperator {
public GreaterEqualOperator(int leftTypeId, int rightTypeId, int start) {
@@ -13,60 +13,60 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
switch (getInternResultType()) {
case T_double :
- return ((IPrimitiveValue) leftOperand).getDoubleValue() >= ((IPrimitiveValue) rightOperand).getDoubleValue();
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() >= ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
case T_float :
- return ((IPrimitiveValue) leftOperand).getFloatValue() >= ((IPrimitiveValue) rightOperand).getFloatValue();
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() >= ((IJavaPrimitiveValue) rightOperand).getFloatValue();
case T_long :
- return ((IPrimitiveValue) leftOperand).getLongValue() >= ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() >= ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
- return ((IPrimitiveValue) leftOperand).getIntValue() >= ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() >= ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return false;
}
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'>=' operator";
+ return InstructionsEvaluationMessages.getString("GreaterEqualOperator._>=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterOperator.java
index d7416f6..1d0f2c3 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/GreaterOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class GreaterOperator extends BinaryOperator {
public GreaterOperator(int leftTypeId, int rightTypeId, int start) {
@@ -13,60 +13,60 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
switch (getInternResultType()) {
case T_double :
- return ((IPrimitiveValue) leftOperand).getDoubleValue() > ((IPrimitiveValue) rightOperand).getDoubleValue();
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() > ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
case T_float :
- return ((IPrimitiveValue) leftOperand).getFloatValue() > ((IPrimitiveValue) rightOperand).getFloatValue();
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() > ((IJavaPrimitiveValue) rightOperand).getFloatValue();
case T_long :
- return ((IPrimitiveValue) leftOperand).getLongValue() > ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() > ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
- return ((IPrimitiveValue) leftOperand).getIntValue() > ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() > ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return false;
}
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'>' operator";
+ return InstructionsEvaluationMessages.getString("GreaterOperator._>___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java
index a6795cf..a11dbff 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java
@@ -5,14 +5,13 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IClassType;
-import org.eclipse.jdt.internal.debug.eval.model.IInterfaceType;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IType;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class InstanceOfOperator extends CompoundInstruction {
- public static final String IS_INSTANCE= "isInstance";
- public static final String IS_INSTANCE_SIGNATURE= "(Ljava/lang/Object;)Z";
+ public static final String IS_INSTANCE= "isInstance"; //$NON-NLS-1$
+ public static final String IS_INSTANCE_SIGNATURE= "(Ljava/lang/Object;)Z"; //$NON-NLS-1$
public InstanceOfOperator(int start) {
super(start);
@@ -22,23 +21,19 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IType type= (IType)pop();
- IObject object= (IObject)pop();
+ IJavaType type= (IJavaType)pop();
+ IJavaObject object= (IJavaObject)popValue();
- IObject classObject= getClassObject(type);
+ IJavaObject classObject= getClassObject(type);
if (classObject == null) {
throw new CoreException(null);
} else {
- push(classObject);
- push(object);
- SendMessage send= new SendMessage(IS_INSTANCE,IS_INSTANCE_SIGNATURE,1,false, -1);
- execute(send);
- // Do not pop because the result is left on the stack.
+ push(classObject.sendMessage(IS_INSTANCE, IS_INSTANCE_SIGNATURE, new IJavaValue[] {object}, getContext().getThread(), false));
}
}
public String toString() {
- return "'instanceof' operator";
+ return InstructionsEvaluationMessages.getString("InstanceOfOperator._instanceof___operator_3"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java
index 16ba815..9322c43 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java
@@ -6,15 +6,16 @@
*/
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.ast.engine.*;
-import org.eclipse.jdt.internal.debug.eval.model.IClassType;
-import org.eclipse.jdt.internal.debug.eval.model.IInterfaceType;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IRuntimeContext;
-import org.eclipse.jdt.internal.debug.eval.model.IType;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
-import org.eclipse.jdt.internal.debug.eval.model.IVirtualMachine;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.jdt.debug.core.IJavaClassType;
+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.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+import org.eclipse.jdt.internal.debug.eval.ast.engine.IRuntimeContext;
+import org.eclipse.jdt.internal.debug.eval.ast.engine.Interpreter;
/**
* Common behavoir for instructions.
@@ -28,34 +29,37 @@
public void setInterpreter(Interpreter interpreter) {
fInterpreter= interpreter;
}
+
+ public void setLastValue(IJavaValue value) {
+ fInterpreter.setLastValue(value);
+ }
+
+ public void stop() {
+ fInterpreter.stop();
+ }
+
public static int getBinaryPromotionType(int left, int right) {
return fTypeTable[left][right];
}
public abstract void execute() throws CoreException;
-
- protected void execute(Instruction instruction) throws CoreException {
- instruction.setInterpreter(fInterpreter);
- instruction.execute();
- instruction.setInterpreter(null);
- }
protected IRuntimeContext getContext() {
return fInterpreter.getContext();
}
- protected IVirtualMachine getVM() {
+ protected IJavaDebugTarget getVM() {
return getContext().getVM();
}
/**
* Answers the instance of Class that the given type represents.
*/
- protected IObject getClassObject(IType type) throws CoreException {
- if (type instanceof IClassType) {
- return ((IClassType)type).getClassObject();
+ protected IJavaObject getClassObject(IJavaType type) throws CoreException {
+ if (type instanceof IJavaClassType) {
+ return ((IJavaClassType)type).getClassObject();
}
- if (type instanceof IInterfaceType) {
- return ((IInterfaceType)type).getClassObject();
+ if (type instanceof IJavaInterfaceType) {
+ return ((IJavaInterfaceType)type).getClassObject();
}
return null;
}
@@ -72,19 +76,19 @@
return fInterpreter.pop();
}
- protected IValue popValue() throws CoreException {
+ protected IJavaValue popValue() throws CoreException {
Object element = fInterpreter.pop();
- if (element instanceof IVariable) {
- return ((IVariable)element).getValue();
+ if (element instanceof IJavaVariable) {
+ return (IJavaValue)((IJavaVariable)element).getValue();
}
- return (IValue)element;
+ return (IJavaValue)element;
}
protected void pushNewValue(boolean value) {
fInterpreter.push(newValue(value));
}
- protected IValue newValue(boolean value) {
+ protected IJavaValue newValue(boolean value) {
return getVM().newValue(value);
}
@@ -92,7 +96,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(byte value) {
+ protected IJavaValue newValue(byte value) {
return getVM().newValue(value);
}
@@ -100,7 +104,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(short value) {
+ protected IJavaValue newValue(short value) {
return getVM().newValue(value);
}
@@ -108,7 +112,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(int value) {
+ protected IJavaValue newValue(int value) {
return getVM().newValue(value);
}
@@ -116,7 +120,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(long value) {
+ protected IJavaValue newValue(long value) {
return getVM().newValue(value);
}
@@ -124,7 +128,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(char value) {
+ protected IJavaValue newValue(char value) {
return getVM().newValue(value);
}
@@ -132,7 +136,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(float value) {
+ protected IJavaValue newValue(float value) {
return getVM().newValue(value);
}
@@ -140,7 +144,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(double value) {
+ protected IJavaValue newValue(double value) {
return getVM().newValue(value);
}
@@ -148,7 +152,7 @@
fInterpreter.push(newValue(value));
}
- protected IValue newValue(String value) {
+ protected IJavaValue newValue(String value) {
return getVM().newValue(value);
}
@@ -156,7 +160,7 @@
fInterpreter.push(nullValue());
}
- protected IValue nullValue() {
+ protected IJavaValue nullValue() {
return getVM().nullValue();
}
@@ -164,14 +168,14 @@
return fTypeTable[typeId][T_int];
}
- protected IType getType(String qualifiedName) throws CoreException {
+ protected IJavaType getType(String qualifiedName) throws CoreException {
// Force the class to be loaded, and record the class reference
// for later use if there are multiple classes with the same name.
- IObject classReference= classForName(qualifiedName);
+ IJavaObject classReference= classForName(qualifiedName);
if (classReference == null) {
throw new CoreException(null); // could not resolve type
}
- IType[] types= getVM().classesByName(qualifiedName);
+ IJavaType[] types= getVM().getJavaTypes(qualifiedName);
checkTypes(types);
if (types.length == 1) {
// Found only one class.
@@ -179,7 +183,7 @@
} else {
// Found many classes, look for the right one for this scope.
for(int i= 0, length= types.length; i < length; i++) {
- IType type= types[i];
+ IJavaType type= types[i];
if (classReference.equals(getClassObject(type))) {
return type;
}
@@ -195,21 +199,19 @@
}
- protected IObject classForName(String qualifiedName) throws CoreException {
- IType[] types= getVM().classesByName(CLASS);
+ protected IJavaObject classForName(String qualifiedName) throws CoreException {
+ IJavaType[] types= getVM().getJavaTypes(CLASS);
checkTypes(types);
if (types.length != 1) {
throw new CoreException(null);
}
- push(types[0]);
- pushNewValue(qualifiedName);
- SendMessage send= new SendMessage(FOR_NAME, FOR_NAME_SIGNATURE, 1, false, -1);
- execute(send);
- return (IObject)pop();
+ IJavaType receiver= types[0];
+ IJavaValue[] args = new IJavaValue[] {newValue(qualifiedName)};
+ return (IJavaObject)((IJavaClassType)receiver).sendMessage(FOR_NAME, FOR_NAME_SIGNATURE, args, getContext().getThread());
}
- protected void checkTypes(IType[] types) throws CoreException {
+ protected void checkTypes(IJavaType[] types) throws CoreException {
if (types == null || types.length == 0) {
throw new CoreException(null); // unable to resolve type
}
@@ -246,13 +248,12 @@
/* null */ {T_undefined, T_undefined, T_undefined, T_undefined, T_undefined, T_undefined, T_undefined, T_undefined, T_undefined, T_undefined, T_undefined, T_String, T_undefined},
};
- public static final String CLASS= "java.lang.Class";
+ public static final String CLASS= "java.lang.Class"; //$NON-NLS-1$
+
+ public static final String FOR_NAME= "forName"; //$NON-NLS-1$
- public static final String FOR_NAME= "forName";
-
-
- public static final String FOR_NAME_SIGNATURE= "(Ljava/lang/String;)Ljava/lang/Class;";
+ public static final String FOR_NAME_SIGNATURE= "(Ljava/lang/String;)Ljava/lang/Class;"; //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstructionSequence.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstructionSequence.java
index 6ef1c3e..ae5924d 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstructionSequence.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstructionSequence.java
@@ -8,11 +8,14 @@
import java.util.List;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.dom.Message;
+import org.eclipse.jdt.debug.core.IJavaValue;
import org.eclipse.jdt.debug.eval.ICompiledExpression;
-import org.eclipse.jdt.internal.debug.eval.ast.engine.*;
-import org.eclipse.jdt.internal.debug.eval.model.IRuntimeContext;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
+import org.eclipse.jdt.internal.debug.eval.ast.engine.IRuntimeContext;
+import org.eclipse.jdt.internal.debug.eval.ast.engine.Interpreter;
public class InstructionSequence implements ICompiledExpression {
@@ -32,22 +35,6 @@
}
/**
- * Runs this compiled expression in the given context, and retuns
- * the result.
- *
- * @param context evaluation context
- */
- public IValue evaluate(IRuntimeContext context) {
- Interpreter interpreter= new Interpreter(getInstructions(), context);
- try {
- interpreter.execute();
- } catch (CoreException exception) {
- fException= exception;
- }
- return interpreter.getResult();
- }
-
- /**
* Returns the runtime exception that occurred while evaluating this expression
* or <code>null</code> if no exception occurred.
*/
@@ -87,7 +74,7 @@
/**
* Answers the array of instructions, or an empty array.
*/
- private Instruction[] getInstructions() {
+ public Instruction[] getInstructions() {
int size= fInstructions.size();
Instruction[] instructions= new Instruction[size];
if (size > 0) {
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Jump.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Jump.java
index 8357843..c918da7 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Jump.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Jump.java
@@ -5,7 +5,6 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
public class Jump extends SimpleInstruction {
protected int fOffset;
@@ -25,7 +24,7 @@
* @see Object#toString()
*/
public String toString() {
- return "jump";
+ return InstructionsEvaluationMessages.getString("Jump.jump_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftAssignmentOperator.java
index eb73673..e6d059d 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'<<=' operator";
+ return InstructionsEvaluationMessages.getString("LeftShiftAssignmentOperator._<<=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftOperator.java
index 63fcc97..907207f 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LeftShiftOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class LeftShiftOperator extends BinaryOperator {
public LeftShiftOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -17,66 +17,66 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
// unary type promotion on both operands see 5.6.1 and 15.18
switch (fRightTypeId) {
case T_long :
- return ((IPrimitiveValue) leftOperand).getIntValue() << ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() << ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
case T_short :
case T_byte :
case T_char :
- return ((IPrimitiveValue) leftOperand).getIntValue() << ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() << ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return 0;
}
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
// unary type promotion on both operands see 5.6.1 and 15.18
switch (fRightTypeId) {
case T_long :
- return ((IPrimitiveValue) leftOperand).getLongValue() << ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() << ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
case T_short :
case T_byte :
case T_char :
- return ((IPrimitiveValue) leftOperand).getLongValue() << ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() << ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return 0;
}
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
@@ -86,7 +86,7 @@
}
public String toString() {
- return "'<<' operator";
+ return InstructionsEvaluationMessages.getString("LeftShiftOperator._<<___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessEqualOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessEqualOperator.java
index 7e3a2ae..341e5fe 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessEqualOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessEqualOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class LessEqualOperator extends BinaryOperator {
public LessEqualOperator(int leftTypeId, int rightTypeId, int start) {
@@ -13,59 +13,59 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
switch (getInternResultType()) {
case T_double :
- return ((IPrimitiveValue) leftOperand).getDoubleValue() <= ((IPrimitiveValue) rightOperand).getDoubleValue();
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() <= ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
case T_float :
- return ((IPrimitiveValue) leftOperand).getFloatValue() <= ((IPrimitiveValue) rightOperand).getFloatValue();
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() <= ((IJavaPrimitiveValue) rightOperand).getFloatValue();
case T_long :
- return ((IPrimitiveValue) leftOperand).getLongValue() <= ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() <= ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
- return ((IPrimitiveValue) leftOperand).getIntValue() <= ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() <= ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return false;
}
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'<=' operator";
+ return InstructionsEvaluationMessages.getString("LessEqualOperator._<=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessOperator.java
index 4ad60e0..822153e 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LessOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class LessOperator extends BinaryOperator {
public LessOperator(int leftTypeId, int rightTypeId, int start) {
@@ -13,60 +13,60 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
switch (getInternResultType()) {
case T_double :
- return ((IPrimitiveValue) leftOperand).getDoubleValue() < ((IPrimitiveValue) rightOperand).getDoubleValue();
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() < ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
case T_float :
- return ((IPrimitiveValue) leftOperand).getFloatValue() < ((IPrimitiveValue) rightOperand).getFloatValue();
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() < ((IJavaPrimitiveValue) rightOperand).getFloatValue();
case T_long :
- return ((IPrimitiveValue) leftOperand).getLongValue() < ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() < ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
- return ((IPrimitiveValue) leftOperand).getIntValue() < ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() < ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return false;
}
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'<' operator";
+ return InstructionsEvaluationMessages.getString("LessOperator._<___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusAssignmentOperator.java
index 39237f1..1d109f1 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'-=' operator";
+ return InstructionsEvaluationMessages.getString("MinusAssignmentOperator._-=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusOperator.java
index aed05db..79b2537 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MinusOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class MinusOperator extends BinaryOperator {
@@ -18,49 +18,49 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getDoubleValue() - ((IPrimitiveValue) rightOperand).getDoubleValue();
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() - ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getFloatValue() - ((IPrimitiveValue) rightOperand).getFloatValue();
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() - ((IJavaPrimitiveValue) rightOperand).getFloatValue();
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getIntValue() - ((IPrimitiveValue) rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() - ((IJavaPrimitiveValue) rightOperand).getIntValue();
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getLongValue() - ((IPrimitiveValue) rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() - ((IJavaPrimitiveValue) rightOperand).getLongValue();
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'-' operator";
+ return InstructionsEvaluationMessages.getString("MinusOperator._-___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyAssignmentOperator.java
index 1f5e0a3..3500757 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'*=' operator";
+ return InstructionsEvaluationMessages.getString("MultiplyAssignmentOperator._*=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyOperator.java
index ca1806f..36acb4b 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/MultiplyOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class MultiplyOperator extends BinaryOperator {
public MultiplyOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -17,49 +17,49 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getDoubleValue() * ((IPrimitiveValue) rightOperand).getDoubleValue();
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() * ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getFloatValue() * ((IPrimitiveValue) rightOperand).getFloatValue();
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() * ((IJavaPrimitiveValue) rightOperand).getFloatValue();
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getIntValue() * ((IPrimitiveValue) rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() * ((IJavaPrimitiveValue) rightOperand).getIntValue();
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getLongValue() * ((IPrimitiveValue) rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() * ((IJavaPrimitiveValue) rightOperand).getLongValue();
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'*' operator";
+ return InstructionsEvaluationMessages.getString("MultiplyOperator._*___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NoOp.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NoOp.java
index 669fe7b..53ffb83 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NoOp.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NoOp.java
@@ -5,7 +5,6 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
public class NoOp extends CompoundInstruction {
@@ -23,7 +22,7 @@
* @see Object#toString()
*/
public String toString() {
- return "no op";
+ return InstructionsEvaluationMessages.getString("NoOp.no_op_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NotOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NotOperator.java
index 72830d5..3442c4f 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NotOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/NotOperator.java
@@ -5,8 +5,7 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
public class NotOperator extends UnaryOperator {
@@ -18,12 +17,12 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IPrimitiveValue value= (IPrimitiveValue)popValue();
+ IJavaPrimitiveValue value= (IJavaPrimitiveValue)popValue();
pushNewValue(!value.getBooleanValue());
}
public String toString() {
- return "'!' operator";
+ return InstructionsEvaluationMessages.getString("NotOperator._!___operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrAssignmentOperator.java
index bc8a903..0289dec 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'|=' operator";
+ return InstructionsEvaluationMessages.getString("OrAssignmentOperator._|=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrOperator.java
index cf79314..0cc80c1 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/OrOperator.java
@@ -4,8 +4,9 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
+
public class OrOperator extends BinaryOperator {
public OrOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -17,49 +18,49 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getBooleanValue() | ((IPrimitiveValue) rightOperand).getBooleanValue();
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getBooleanValue() | ((IJavaPrimitiveValue) rightOperand).getBooleanValue();
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getIntValue() | ((IPrimitiveValue) rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() | ((IJavaPrimitiveValue) rightOperand).getIntValue();
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getLongValue() | ((IPrimitiveValue) rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() | ((IJavaPrimitiveValue) rightOperand).getLongValue();
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'|' operator";
+ return InstructionsEvaluationMessages.getString("OrOperator._|___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusAssignmentOperator.java
index 8cbf818..c4b23ca 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'+=' operator";
+ return InstructionsEvaluationMessages.getString("PlusAssignmentOperator._+=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusOperator.java
index 1cad316..df8b85e 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PlusOperator.java
@@ -5,15 +5,14 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
import org.eclipse.jdt.internal.debug.core.model.JDINullValue;
-import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
-import org.eclipse.jdt.internal.debug.eval.model.*;
-import org.eclipse.jdt.internal.debug.eval.model.EvaluationObject;
-import org.eclipse.jdt.internal.debug.eval.model.EvaluationValue;
public class PlusOperator extends BinaryOperator {
- public static final String NULL= "null";
+ public static final String NULL= "null"; //$NON-NLS-1$
public PlusOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
this(resultId, leftTypeId, rightTypeId, false, start);
@@ -23,26 +22,22 @@
super(resultId, leftTypeId, rightTypeId, isAssignmentOperator, start);
}
- private String getString(IValue value, int typeId) {
+ private String getString(IJavaValue value, int typeId) {
// test if value == null
- EvaluationValue eValue = (EvaluationValue)value;
- if (eValue.getJavaValue() instanceof JDINullValue) {
+ if (value instanceof JDINullValue) {
return NULL;
}
- if (value instanceof IObject) {
- EvaluationObject object= (EvaluationObject)value;
- JDIObjectValue javaValue= (JDIObjectValue)object.getJavaObject();
-
+ if (value instanceof IJavaObject) {
try {
- return javaValue.getValueString();
+ return value.getValueString();
} catch (CoreException e) {
e.printStackTrace();
return null;
}
} else {
- IPrimitiveValue primitiveValue= (IPrimitiveValue)value;
+ IJavaPrimitiveValue primitiveValue= (IJavaPrimitiveValue)value;
switch (typeId) {
case T_boolean:
return new Boolean(primitiveValue.getBooleanValue()).toString();
@@ -66,49 +61,49 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue)leftOperand).getDoubleValue() + ((IPrimitiveValue)rightOperand).getDoubleValue();
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue)leftOperand).getDoubleValue() + ((IJavaPrimitiveValue)rightOperand).getDoubleValue();
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue)leftOperand).getFloatValue() + ((IPrimitiveValue)rightOperand).getFloatValue();
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue)leftOperand).getFloatValue() + ((IJavaPrimitiveValue)rightOperand).getFloatValue();
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue)leftOperand).getIntValue() + ((IPrimitiveValue)rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue)leftOperand).getIntValue() + ((IJavaPrimitiveValue)rightOperand).getIntValue();
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue)leftOperand).getLongValue() + ((IPrimitiveValue)rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue)leftOperand).getLongValue() + ((IJavaPrimitiveValue)rightOperand).getLongValue();
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return getString(leftOperand, fLeftTypeId) + getString(rightOperand, fRightTypeId);
}
public String toString() {
- return "'+' operator";
+ return InstructionsEvaluationMessages.getString("PlusOperator._+___operator_2"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Pop.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Pop.java
index 13239d0..a97db08 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Pop.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Pop.java
@@ -19,7 +19,7 @@
* @see Object#toString()
*/
public String toString() {
- return "pop";
+ return InstructionsEvaluationMessages.getString("Pop.pop_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixMinusMinusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixMinusMinusOperator.java
index 147ff34..6a5507b 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixMinusMinusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixMinusMinusOperator.java
@@ -5,8 +5,8 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
public class PostfixMinusMinusOperator extends XfixOperator {
@@ -18,36 +18,36 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IVariable variable = (IVariable) pop();
+ IJavaVariable variable = (IJavaVariable) pop();
push(variable.getValue());
switch (fVariableTypeId) {
case T_byte :
- variable.setValue(newValue((byte)((IPrimitiveValue)variable.getValue()).getByteValue() - 1));
+ variable.setValue(newValue((byte)((IJavaPrimitiveValue)variable.getValue()).getByteValue() - 1));
break;
case T_short :
- variable.setValue(newValue((short)((IPrimitiveValue)variable.getValue()).getShortValue() - 1));
+ variable.setValue(newValue((short)((IJavaPrimitiveValue)variable.getValue()).getShortValue() - 1));
break;
case T_char :
- variable.setValue(newValue((char)((IPrimitiveValue)variable.getValue()).getCharValue() - 1));
+ variable.setValue(newValue((char)((IJavaPrimitiveValue)variable.getValue()).getCharValue() - 1));
break;
case T_int :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getIntValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getIntValue() - 1));
break;
case T_long :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getLongValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getLongValue() - 1));
break;
case T_float :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getFloatValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getFloatValue() - 1));
break;
case T_double :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getDoubleValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getDoubleValue() - 1));
break;
}
}
public String toString() {
- return "postfix '--' operator";
+ return InstructionsEvaluationMessages.getString("PostfixMinusMinusOperator.postfix___--___operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixPlusPlusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixPlusPlusOperator.java
index 57d15d0..7ebe4d2 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixPlusPlusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PostfixPlusPlusOperator.java
@@ -5,8 +5,8 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
public class PostfixPlusPlusOperator extends XfixOperator {
@@ -18,36 +18,36 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IVariable variable = (IVariable) pop();
+ IJavaVariable variable = (IJavaVariable) pop();
push(variable.getValue());
switch (fVariableTypeId) {
case T_byte :
- variable.setValue(newValue((byte)((IPrimitiveValue)variable.getValue()).getByteValue() + 1));
+ variable.setValue(newValue((byte)((IJavaPrimitiveValue)variable.getValue()).getByteValue() + 1));
break;
case T_short :
- variable.setValue(newValue((short)((IPrimitiveValue)variable.getValue()).getShortValue() + 1));
+ variable.setValue(newValue((short)((IJavaPrimitiveValue)variable.getValue()).getShortValue() + 1));
break;
case T_char :
- variable.setValue(newValue((char)((IPrimitiveValue)variable.getValue()).getCharValue() + 1));
+ variable.setValue(newValue((char)((IJavaPrimitiveValue)variable.getValue()).getCharValue() + 1));
break;
case T_int :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getIntValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getIntValue() + 1));
break;
case T_long :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getLongValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getLongValue() + 1));
break;
case T_float :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getFloatValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getFloatValue() + 1));
break;
case T_double :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getDoubleValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getDoubleValue() + 1));
break;
}
}
public String toString() {
- return "postfix '++' operator";
+ return InstructionsEvaluationMessages.getString("PostfixPlusPlusOperator.postfix___++___operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixMinusMinusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixMinusMinusOperator.java
index 4813cae..f9d6163 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixMinusMinusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixMinusMinusOperator.java
@@ -5,8 +5,8 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
public class PrefixMinusMinusOperator extends XfixOperator {
@@ -18,29 +18,29 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IVariable variable = (IVariable) pop();
+ IJavaVariable variable = (IJavaVariable) pop();
switch (fVariableTypeId) {
case T_byte :
- variable.setValue(newValue((byte)((IPrimitiveValue)variable.getValue()).getByteValue() - 1));
+ variable.setValue(newValue((byte)((IJavaPrimitiveValue)variable.getValue()).getByteValue() - 1));
break;
case T_short :
- variable.setValue(newValue((short)((IPrimitiveValue)variable.getValue()).getShortValue() - 1));
+ variable.setValue(newValue((short)((IJavaPrimitiveValue)variable.getValue()).getShortValue() - 1));
break;
case T_char :
- variable.setValue(newValue((char)((IPrimitiveValue)variable.getValue()).getCharValue() - 1));
+ variable.setValue(newValue((char)((IJavaPrimitiveValue)variable.getValue()).getCharValue() - 1));
break;
case T_int :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getIntValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getIntValue() - 1));
break;
case T_long :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getLongValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getLongValue() - 1));
break;
case T_float :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getFloatValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getFloatValue() - 1));
break;
case T_double :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getDoubleValue() - 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getDoubleValue() - 1));
break;
}
@@ -48,7 +48,7 @@
}
public String toString() {
- return "prefix '--' operator";
+ return InstructionsEvaluationMessages.getString("PrefixMinusMinusOperator.prefix___--___operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixPlusPlusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixPlusPlusOperator.java
index 3232cbe..a894674 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixPlusPlusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PrefixPlusPlusOperator.java
@@ -5,8 +5,8 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
public class PrefixPlusPlusOperator extends XfixOperator {
@@ -18,29 +18,29 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IVariable variable = (IVariable) pop();
+ IJavaVariable variable = (IJavaVariable) pop();
switch (fVariableTypeId) {
case T_byte :
- variable.setValue(newValue((byte)((IPrimitiveValue)variable.getValue()).getByteValue() + 1));
+ variable.setValue(newValue((byte)((IJavaPrimitiveValue)variable.getValue()).getByteValue() + 1));
break;
case T_short :
- variable.setValue(newValue((short)((IPrimitiveValue)variable.getValue()).getShortValue() + 1));
+ variable.setValue(newValue((short)((IJavaPrimitiveValue)variable.getValue()).getShortValue() + 1));
break;
case T_char :
- variable.setValue(newValue((char)((IPrimitiveValue)variable.getValue()).getCharValue() + 1));
+ variable.setValue(newValue((char)((IJavaPrimitiveValue)variable.getValue()).getCharValue() + 1));
break;
case T_int :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getIntValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getIntValue() + 1));
break;
case T_long :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getLongValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getLongValue() + 1));
break;
case T_float :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getFloatValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getFloatValue() + 1));
break;
case T_double :
- variable.setValue(newValue(((IPrimitiveValue)variable.getValue()).getDoubleValue() + 1));
+ variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getDoubleValue() + 1));
break;
}
@@ -48,7 +48,7 @@
}
public String toString() {
- return "prefix '++' operator";
+ return InstructionsEvaluationMessages.getString("PrefixPlusPlusOperator.prefix___++___operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushBoolean.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushBoolean.java
index d1276d4..813d00e 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushBoolean.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushBoolean.java
@@ -20,7 +20,7 @@
}
public String toString() {
- return "push " + fValue;
+ return InstructionsEvaluationMessages.getString("PushBoolean.push__1") + fValue; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushChar.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushChar.java
index 2548716..ab5240c 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushChar.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushChar.java
@@ -21,7 +21,7 @@
}
public String toString() {
- return "push " + fValue;
+ return InstructionsEvaluationMessages.getString("PushChar.push__1") + fValue; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushClassLiteralValue.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushClassLiteralValue.java
index c892ef6..f3eb4df 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushClassLiteralValue.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushClassLiteralValue.java
@@ -5,7 +5,7 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IType;
+import org.eclipse.jdt.debug.core.IJavaType;
/**
* Handles code like "new Object().class"
@@ -19,7 +19,7 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IType type = (IType)pop();
+ IJavaType type = (IJavaType)pop();
push(getClassObject(type));
}
@@ -27,7 +27,7 @@
* @see Object#toString()
*/
public String toString() {
- return "push class literal value";
+ return InstructionsEvaluationMessages.getString("PushClassLiteralValue.push_class_literal_value_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushDouble.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushDouble.java
index 750ea0c..c85c71b 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushDouble.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushDouble.java
@@ -21,7 +21,7 @@
}
public String toString() {
- return "push " + fValue;
+ return InstructionsEvaluationMessages.getString("PushDouble.push__1") + fValue; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java
index ba99444..5b21c9b 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java
@@ -1,16 +1,16 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
/*
- * (c) Copyright IBM Corp. 2000, 2001.
+ * (c) Copyright IBM Corp. 2002.
* All Rights Reserved.
*/
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IArray;
-import org.eclipse.jdt.internal.debug.eval.model.IClassType;
-import org.eclipse.jdt.internal.debug.eval.model.IInterfaceType;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
/**
* Pops an object off the stack, and pushes the value
@@ -18,60 +18,44 @@
*/
public class PushFieldVariable extends CompoundInstruction {
+ private String fDeclaringTypeSignature;
+
private String fName;
- private String fTypeSignature;
+ private int fSuperClassLevel;
- private boolean fSuperField;
-
- public static final String LENGTH= "length";
-
- public PushFieldVariable(String name, boolean superField, int start) {
+ public PushFieldVariable(String name, int superClassLevel, int start) {
super(start);
fName= name;
- fSuperField= superField;
+ fSuperClassLevel= superClassLevel;
}
- public PushFieldVariable(String name, String typeSignature, int start) {
+ public PushFieldVariable(String name, String declaringTypeSignature, int start) {
super(start);
fName= name;
- fTypeSignature= typeSignature;
+ fDeclaringTypeSignature= declaringTypeSignature;
}
public void execute() throws CoreException {
- Object receiver= pop();
+ IJavaObject receiver=(IJavaObject) popValue();
- IVariable field= null;
+ IJavaVariable field= null;
- if (receiver instanceof IVariable) {
- receiver = ((IVariable) receiver).getValue();
+ if (fDeclaringTypeSignature == null) {
+ field= ((JDIObjectValue)receiver).getField(fName, fSuperClassLevel);
+ } else {
+ field= ((IJavaObject)receiver).getField(fName, fDeclaringTypeSignature);
}
- if (receiver instanceof IArray && LENGTH.equals(fName)) {
- int length= ((IArray)receiver).getLength();
- pushNewValue(length);
- return;
- } else if (receiver instanceof IObject) {
- if (fTypeSignature == null) {
- field= ((IObject)receiver).getField(fName, fSuperField);
- } else {
- field= ((IObject)receiver).getField(fName, fTypeSignature);
- }
- } else if (receiver instanceof IInterfaceType) {
- field= ((IInterfaceType)receiver).getField(fName);
- } else if (receiver instanceof IClassType) {
- field= ((IClassType)receiver).getField(fName);
- }
if (field == null) {
- throw new CoreException(null); // couldn't find the field
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("PushFieldVariable.Cannot_find_the_field__2") + fName + InstructionsEvaluationMessages.getString("PushFieldVariable._for_the_object__3") + receiver, null)); //$NON-NLS-1$ //$NON-NLS-2$
} else {
push(field);
}
}
public String toString() {
- return "push field " + fName;
+ return InstructionsEvaluationMessages.getString("PushFieldVariable.push_field__4") + fName; //$NON-NLS-1$
}
-
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFloat.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFloat.java
index cf13928..40313da 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFloat.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFloat.java
@@ -21,7 +21,7 @@
}
public String toString() {
- return "push " + fValue;
+ return InstructionsEvaluationMessages.getString("PushFloat.push__1") + fValue; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushInt.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushInt.java
index 3134b7c..2c471ef 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushInt.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushInt.java
@@ -21,7 +21,7 @@
}
public String toString() {
- return "push " + fValue;
+ return InstructionsEvaluationMessages.getString("PushInt.push__1") + fValue; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java
index 9165980..97b4cef 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java
@@ -10,7 +10,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.debug.core.IJavaVariable;
-import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
import org.eclipse.jdt.internal.debug.eval.ast.engine.IRuntimeContext;
/**
@@ -38,7 +38,7 @@
}
}
- throw new CoreException(new Status(Status.ERROR, JDIDebugPlugin.getUniqueIdentifier(), Status.OK, MessageFormat.format(InstructionsEvaluationMessages.getString("PushLocalVariable.Cannot_find_the_variable____1"), new String[]{fName}), null)); //$NON-NLS-1$
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, MessageFormat.format(InstructionsEvaluationMessages.getString("PushLocalVariable.Cannot_find_the_variable____1"), new String[]{fName}), null)); //$NON-NLS-1$
}
/**
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLong.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLong.java
index 507b0c5..873e93e 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLong.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLong.java
@@ -21,7 +21,7 @@
}
public String toString() {
- return "push " + fValue;
+ return InstructionsEvaluationMessages.getString("PushLong.push__1") + fValue; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushNull.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushNull.java
index 519b2b1..c17062c 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushNull.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushNull.java
@@ -6,7 +6,6 @@
*/
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
/**
* Pushes the 'null' onto the stack.
@@ -18,7 +17,7 @@
}
public String toString() {
- return "push 'null'";
+ return InstructionsEvaluationMessages.getString("PushNull.push___null__1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushStaticFieldVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushStaticFieldVariable.java
index 8f3ad8e..a6a1699 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushStaticFieldVariable.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushStaticFieldVariable.java
@@ -13,44 +13,53 @@
import org.eclipse.jdt.debug.core.IJavaInterfaceType;
import org.eclipse.jdt.debug.core.IJavaType;
import org.eclipse.jdt.debug.core.IJavaVariable;
-import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
-
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+
/**
* Pushes the value of the static fields of the given type
* onto the stack.
*/
public class PushStaticFieldVariable extends CompoundInstruction {
-
+
private String fFieldName;
-
+
private String fQualifiedTypeName;
-
- public PushStaticFieldVariable(String fieldName, String qualifiedTypeName, int start) {
+
+ public PushStaticFieldVariable(
+ String fieldName,
+ String qualifiedTypeName,
+ int start) {
super(start);
- fFieldName= fieldName;
- fQualifiedTypeName= qualifiedTypeName;
+ fFieldName = fieldName;
+ fQualifiedTypeName = qualifiedTypeName;
}
-
+
public void execute() throws CoreException {
- IJavaType receiver= getType(fQualifiedTypeName);
-
- IJavaVariable field= null;
+ IJavaType receiver = getType(fQualifiedTypeName);
+
+ IJavaVariable field = null;
if (receiver instanceof IJavaInterfaceType) {
- field= ((IJavaInterfaceType)receiver).getField(fFieldName);
+ field = ((IJavaInterfaceType) receiver).getField(fFieldName);
} else if (receiver instanceof IJavaClassType) {
- field= ((IJavaClassType)receiver).getField(fFieldName);
+ field = ((IJavaClassType) receiver).getField(fFieldName);
}
if (field == null) {
- String message= MessageFormat.format(InstructionsEvaluationMessages.getString("PushStaticFieldVariable.Cannot_find_the_field_{0}_in_{1}_1"), new String[]{fFieldName, fQualifiedTypeName}); //$NON-NLS-1$
- throw new CoreException(new Status(Status.ERROR, JDIDebugPlugin.getUniqueIdentifier(), Status.OK, message, null)); // couldn't find the field
+ String message = MessageFormat.format(InstructionsEvaluationMessages.getString("PushStaticFieldVariable.Cannot_find_the_field_{0}_in_{1}_1"), new String[] { fFieldName, fQualifiedTypeName }); //$NON-NLS-1$
+ throw new CoreException(
+ new Status(
+ Status.ERROR,
+ JDIDebugModel.getPluginIdentifier(),
+ Status.OK,
+ message,
+ null));
+ // couldn't find the field
}
push(field);
}
-
+
public String toString() {
- return MessageFormat.format(InstructionsEvaluationMessages.getString("PushStaticFieldVariable.push_static_field_{0}_2"), new String[]{fFieldName}); //$NON-NLS-1$
+ return MessageFormat.format(InstructionsEvaluationMessages.getString("PushStaticFieldVariable.push_static_field_{0}_2"), new String[] { fFieldName }); //$NON-NLS-1$
}
-}
-
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushString.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushString.java
index f8a1b1b..c9f671b 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushString.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushString.java
@@ -21,7 +21,7 @@
}
public String toString() {
- return "push " + fValue;
+ return InstructionsEvaluationMessages.getString("PushString.push__1") + fValue; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushThis.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushThis.java
index b85f5ac..becb3ad 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushThis.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushThis.java
@@ -6,27 +6,42 @@
*/
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IRuntimeContext;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
+import org.eclipse.jdt.internal.debug.eval.ast.engine.IRuntimeContext;
/**
* Pushes the 'this' object onto the stack.
*/
public class PushThis extends SimpleInstruction {
+ private int fEnclosingLevel;
+
+ public PushThis(int enclosingLevel) {
+ fEnclosingLevel= enclosingLevel;
+ }
+
public void execute() throws CoreException {
IRuntimeContext context= getContext();
- IObject rec = context.getThis();
- if (rec == null) {
+ IJavaObject thisInstance = context.getThis();
+ if (thisInstance == null) {
// static context
push(context.getReceivingType());
} else {
- push(rec);
+ if (fEnclosingLevel != 0) {
+ thisInstance= ((JDIObjectValue)thisInstance).getEnclosingObject(fEnclosingLevel);
+ if (thisInstance == null) {
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("PushThis.Unable_to_retrieve_the_correct_enclosing_instance_of__this__2"), null)); //$NON-NLS-1$
+ }
+ }
+ push(thisInstance);
}
}
public String toString() {
- return "push 'this'";
+ return InstructionsEvaluationMessages.getString("PushThis.push___this__1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushType.java
index 155af55..c3e55a9 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushType.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushType.java
@@ -9,33 +9,25 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.internal.debug.eval.model.*;
-import org.eclipse.jdt.internal.debug.eval.model.EvaluationPrimitiveType;
/**
- * Pushes a type onto the stack.
+ * Pushes a reference type onto the stack.
*/
public class PushType extends SimpleInstruction {
private String fTypeName;
- private boolean fIsBaseType;
- public PushType(String signature, boolean isBaseType) {
+ public PushType(String signature) {
fTypeName= signature;
- fIsBaseType= isBaseType;
}
public void execute() throws CoreException {
- if (fIsBaseType) {
- push(EvaluationPrimitiveType.getType(fTypeName));
- } else {
- push(getType(fTypeName));
- }
+ push(getType(fTypeName));
}
public String toString() {
- return "push type " + fTypeName;
+ return InstructionsEvaluationMessages.getString("PushType.push_type__1") + fTypeName; //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushVariable.java
deleted file mode 100644
index 9ba7274..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushVariable.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.internal.debug.eval.model.IClassType;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IRuntimeContext;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
-
-
-/**
- * Pushes the value of a local, instance, or static
- * variable onto the stack.
- */
-public class PushVariable extends SimpleInstruction {
-
- /**
- * Name of variable to push.
- */
- private String fName;
-
- public PushVariable(String name) {
- fName = name;
- }
-
- public void execute() throws CoreException {
- IRuntimeContext context= getContext();
- IVariable var = null;
- IVariable[] locals = context.getLocals();
- for (int i = 0; i < locals.length; i++) {
- if (locals[i].getName().equals(getName())) {
- push(locals[i]);
- return;
- }
- }
- IObject t = context.getThis();
- if (t != null) {
- var = t.getField(getName(), false);
- if (var != null) {
- push(var);
- return;
- }
- }
- IClassType ty = context.getReceivingType();
- var = ty.getField(getName());
- if (var != null) {
- push(var);
- return;
- }
-
- throw new CoreException(null);
- }
-
- /**
- * Returns the name of the variable to push
- * onto the stack.
- *
- * @return the name of the variable to push
- * onto the stack
- */
- protected String getName() {
- return fName;
- }
-
- public String toString() {
- return "push '" + getName() + "'";
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderAssignmentOperator.java
index 673870b..1061798 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'%=' operator";
+ return InstructionsEvaluationMessages.getString("RemainderAssignmentOperator._%=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java
index e501c61..ec2b641 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java
@@ -6,8 +6,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
public class RemainderOperator extends BinaryOperator {
public RemainderOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -19,57 +20,57 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getDoubleValue() % ((IPrimitiveValue) rightOperand).getDoubleValue();
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() % ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getFloatValue() % ((IPrimitiveValue) rightOperand).getFloatValue();
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getFloatValue() % ((IJavaPrimitiveValue) rightOperand).getFloatValue();
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) throws CoreException {
- int divisor= ((IPrimitiveValue) rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
+ int divisor= ((IJavaPrimitiveValue) rightOperand).getIntValue();
if (divisor == 0) {
- throw new CoreException(new Status(Status.ERROR, "", Status.OK, "Divide by zero", null));
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("RemainderOperator.Divide_by_zero_1"), null)); //$NON-NLS-1$
}
- return ((IPrimitiveValue) leftOperand).getIntValue() % divisor;
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() % divisor;
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) throws CoreException {
- long divisor= ((IPrimitiveValue) rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException {
+ long divisor= ((IJavaPrimitiveValue) rightOperand).getLongValue();
if (divisor == 0) {
- throw new CoreException(new Status(Status.ERROR, "", Status.OK, "Divide by zero", null));
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("RemainderOperator.Divide_by_zero_2"), null)); //$NON-NLS-1$
}
- return ((IPrimitiveValue) leftOperand).getLongValue() % divisor;
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() % divisor;
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'%' operator";
+ return InstructionsEvaluationMessages.getString("RemainderOperator._%___operator_3"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftAssignmentOperator.java
index e0fd13a..0083628 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'>>=' operator";
+ return InstructionsEvaluationMessages.getString("RightShiftAssignmentOperator._>>=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftOperator.java
index 0a720ad..c92bbb7 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RightShiftOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class RightShiftOperator extends BinaryOperator {
public RightShiftOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -17,66 +17,66 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
// unary type promotion on both operands see 5.6.1 and 15.18
switch (fRightTypeId) {
case T_long :
- return ((IPrimitiveValue) leftOperand).getIntValue() >> ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() >> ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
case T_short :
case T_byte :
case T_char :
- return ((IPrimitiveValue) leftOperand).getIntValue() >> ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() >> ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return 0;
}
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
// unary type promotion on both operands see 5.6.1 and 15.18
switch (fRightTypeId) {
case T_long :
- return ((IPrimitiveValue) leftOperand).getLongValue() >> ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() >> ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
case T_short :
case T_byte :
case T_char :
- return ((IPrimitiveValue) leftOperand).getLongValue() >> ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() >> ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return 0;
}
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
@@ -86,7 +86,7 @@
}
public String toString() {
- return "'>>' operator";
+ return InstructionsEvaluationMessages.getString("RightShiftOperator._>>___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java
index a69cc42..9ae3fec 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java
@@ -5,14 +5,17 @@
* All Rights Reserved.
*/
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IClassType;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
/**
- * Sends a message. The arguments are on the
+ * Sends an message to an instance. The arguments are on the
* stack in reverse order, followed by the receiver.
* Pushes the result, if any, onto the stack
*/
@@ -32,34 +35,32 @@
}
public void execute() throws CoreException {
- IValue[] args = new IValue[fArgCount];
+ IJavaValue[] args = new IJavaValue[fArgCount];
// args are in reverse order
for (int i= fArgCount - 1; i >= 0; i--) {
- args[i] = (IValue)popValue();
+ args[i] = (IJavaValue)popValue();
}
Object receiver = pop();
- IValue result = null;
+ IJavaValue result = null;
- if (receiver instanceof IVariable) {
- receiver = ((IVariable) receiver).getValue();
+ if (receiver instanceof IJavaVariable) {
+ receiver = ((IJavaVariable) receiver).getValue();
}
- if (receiver instanceof IObject) {
- result = ((IObject)receiver).sendMessage(fSelector, fSignature, args, fSuperSend, getContext().getThread());
- } else if (receiver instanceof IClassType) {
- result = ((IClassType)receiver).sendMessage(fSelector, fSignature, args, getContext().getThread());
+ if (receiver instanceof IJavaObject) {
+ result = ((IJavaObject)receiver).sendMessage(fSelector, fSignature, args, getContext().getThread(), fSuperSend);
} else {
- throw new CoreException(null);
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("SendMessage.Attempt_to_send_a_message_to_a_non_object_value_1"), null)); //$NON-NLS-1$
}
- if (!fSignature.endsWith(")V")) {
+ setLastValue(result);
+ if (!fSignature.endsWith(")V")) { //$NON-NLS-1$
// only push the result if not a void method
push(result);
}
}
public String toString() {
- return "send message " + fSelector + " " + fSignature;
+ return MessageFormat.format(InstructionsEvaluationMessages.getString("SendMessage.send_message_{0}_{1}_2"), new String[]{fSelector,fSignature}); //$NON-NLS-1$
}
-
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java
index d2dc417..5466349 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java
@@ -5,12 +5,15 @@
* All Rights Reserved.
*/
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.internal.debug.eval.model.IClassType;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
-import org.eclipse.jdt.internal.debug.eval.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaClassType;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
/**
* Sends a message. The arguments are on the
@@ -33,25 +36,28 @@
}
public void execute() throws CoreException {
- IValue[] args = new IValue[fArgCount];
+ IJavaValue[] args = new IJavaValue[fArgCount];
// args are in reverse order
for (int i= fArgCount - 1; i >= 0; i--) {
- args[i] = (IValue)popValue();
+ args[i] = (IJavaValue)popValue();
}
- IClassType receiver= (IClassType)getType(Signature.toString(fTypeSignature));
-
- IValue result= receiver.sendMessage(fSelector, fSignature, args, getContext().getThread());
-
- if (!fSignature.endsWith(")V")) {
+ IJavaType receiver= getType(Signature.toString(fTypeSignature).replace('/', '.'));
+ IJavaValue result;
+ if (receiver instanceof IJavaClassType) {
+ result= ((IJavaClassType)receiver).sendMessage(fSelector, fSignature, args, getContext().getThread());
+ } else {
+ throw new CoreException(new Status(Status.ERROR, JDIDebugModel.getPluginIdentifier(), Status.OK, InstructionsEvaluationMessages.getString("SendStaticMessage.Cannot_send_a_static_message_to_a_non_class_type_object_1"), null)); //$NON-NLS-1$
+ }
+ setLastValue(result);
+ if (!fSignature.endsWith(")V")) { //$NON-NLS-1$
// only push the result if not a void method
push(result);
}
}
public String toString() {
- return "send static message " + fSelector + " " + fSignature;
+ return MessageFormat.format(InstructionsEvaluationMessages.getString("SendStaticMessage.send_static_message_{0}_{1}_2"), new String[]{fSelector, fSignature}); //$NON-NLS-1$
}
-
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SimpleInstruction.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SimpleInstruction.java
index e106e8f..82086b6 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SimpleInstruction.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SimpleInstruction.java
@@ -5,8 +5,6 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IType;
/**
* A simple instruction cannot contain other instructions
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/TwiddleOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/TwiddleOperator.java
index 5c854eb..3bba46f 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/TwiddleOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/TwiddleOperator.java
@@ -5,8 +5,7 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
public class TwiddleOperator extends UnaryOperator {
@@ -18,7 +17,7 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IPrimitiveValue value= (IPrimitiveValue)popValue();
+ IJavaPrimitiveValue value= (IJavaPrimitiveValue)popValue();
switch (fExpressionTypeId) {
case T_long:
pushNewValue(~value.getLongValue());
@@ -33,7 +32,7 @@
}
public String toString() {
- return "'~' operator";
+ return InstructionsEvaluationMessages.getString("TwiddleOperator._~___operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryMinusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryMinusOperator.java
index 523db2d..d1e6036 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryMinusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryMinusOperator.java
@@ -5,8 +5,7 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
public class UnaryMinusOperator extends UnaryOperator {
@@ -18,7 +17,7 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IPrimitiveValue value= (IPrimitiveValue)popValue();
+ IJavaPrimitiveValue value= (IJavaPrimitiveValue)popValue();
switch (fExpressionTypeId) {
case T_double:
pushNewValue(-value.getDoubleValue());
@@ -42,7 +41,7 @@
* @see Object#toString()
*/
public String toString() {
- return "unary minus operator";
+ return InstructionsEvaluationMessages.getString("UnaryMinusOperator.unary_minus_operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryPlusOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryPlusOperator.java
index 66f3ee7..a211d12 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryPlusOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnaryPlusOperator.java
@@ -5,8 +5,7 @@
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.debug.eval.model.IObject;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
public class UnaryPlusOperator extends UnaryOperator {
@@ -18,7 +17,7 @@
* @see Instruction#execute()
*/
public void execute() throws CoreException {
- IPrimitiveValue value= (IPrimitiveValue)popValue();
+ IJavaPrimitiveValue value= (IJavaPrimitiveValue)popValue();
switch (fExpressionTypeId) {
case T_double:
pushNewValue(+value.getDoubleValue());
@@ -39,7 +38,7 @@
}
public String toString() {
- return "unary plus operator";
+ return InstructionsEvaluationMessages.getString("UnaryPlusOperator.unary_plus_operator_1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftAssignmentOperator.java
index 0244726..2839c09 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'>>>=' operator";
+ return InstructionsEvaluationMessages.getString("UnsignedRightShiftAssignmentOperator._>>>=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftOperator.java
index 555cf46..10b5376 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/UnsignedRightShiftOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class UnsignedRightShiftOperator extends BinaryOperator {
public UnsignedRightShiftOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -17,66 +17,66 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return false;
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
// unary type promotion on both operands see 5.6.1 and 15.18
switch (fRightTypeId) {
case T_long :
- return ((IPrimitiveValue) leftOperand).getIntValue() >>> ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() >>> ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
case T_short :
case T_byte :
case T_char :
- return ((IPrimitiveValue) leftOperand).getIntValue() >>> ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() >>> ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return 0;
}
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
// unary type promotion on both operands see 5.6.1 and 15.18
switch (fRightTypeId) {
case T_long :
- return ((IPrimitiveValue) leftOperand).getLongValue() >>> ((IPrimitiveValue) rightOperand).getLongValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() >>> ((IJavaPrimitiveValue) rightOperand).getLongValue();
case T_int :
case T_short :
case T_byte :
case T_char :
- return ((IPrimitiveValue) leftOperand).getLongValue() >>> ((IPrimitiveValue) rightOperand).getIntValue();
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() >>> ((IJavaPrimitiveValue) rightOperand).getIntValue();
default :
return 0;
}
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
@@ -86,7 +86,7 @@
}
public String toString() {
- return "'>>>' operator";
+ return InstructionsEvaluationMessages.getString("UnsignedRightShiftOperator._>>>___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorAssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorAssignmentOperator.java
index 6ceb511..cceab28 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorAssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorAssignmentOperator.java
@@ -11,7 +11,7 @@
}
public String toString() {
- return "'^=' operator";
+ return InstructionsEvaluationMessages.getString("XorAssignmentOperator._^=___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorOperator.java
index a306790..d0e3205 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/XorOperator.java
@@ -4,8 +4,8 @@
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-import org.eclipse.jdt.internal.debug.eval.model.IPrimitiveValue;
-import org.eclipse.jdt.internal.debug.eval.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaValue;
public class XorOperator extends BinaryOperator {
public XorOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
@@ -17,49 +17,49 @@
}
/*
- * @see BinaryOperator#getBooleanResult(IValue, IValue)
+ * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
- protected boolean getBooleanResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getBooleanValue() ^ ((IPrimitiveValue) rightOperand).getBooleanValue();
+ protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getBooleanValue() ^ ((IJavaPrimitiveValue) rightOperand).getBooleanValue();
}
/*
- * @see BinaryOperator#getDoubleResult(IValue, IValue)
+ * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
- protected double getDoubleResult(IValue leftOperand, IValue rightOperand) {
+ protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getFloatResult(IValue, IValue)
+ * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
- protected float getFloatResult(IValue leftOperand, IValue rightOperand) {
+ protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return 0;
}
/*
- * @see BinaryOperator#getIntResult(IValue, IValue)
+ * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
- protected int getIntResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getIntValue() ^ ((IPrimitiveValue) rightOperand).getIntValue();
+ protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getIntValue() ^ ((IJavaPrimitiveValue) rightOperand).getIntValue();
}
/*
- * @see BinaryOperator#getLongResult(IValue, IValue)
+ * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
- protected long getLongResult(IValue leftOperand, IValue rightOperand) {
- return ((IPrimitiveValue) leftOperand).getLongValue() ^ ((IPrimitiveValue) rightOperand).getLongValue();
+ protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
+ return ((IJavaPrimitiveValue) leftOperand).getLongValue() ^ ((IJavaPrimitiveValue) rightOperand).getLongValue();
}
/*
- * @see BinaryOperator#getStringResult(IValue, IValue)
+ * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
- protected String getStringResult(IValue leftOperand, IValue rightOperand) {
+ protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return null;
}
public String toString() {
- return "'^' operator";
+ return InstructionsEvaluationMessages.getString("XorOperator._^___operator_1"); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArray.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArray.java
deleted file mode 100644
index 081c6b2..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArray.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaArray;
-import org.eclipse.jdt.debug.core.IJavaValue;
-
-/**
- * A proxy to a Java debug model array object
- */
-public class EvaluationArray extends EvaluationObject implements IArray {
-
- /**
- * Constructs a proxy to the given array.
- *
- * @param array underlying Java debug model array
- * @return a proxy to the given array
- */
- protected EvaluationArray(IJavaArray array) {
- super(array);
- }
-
- /**
- * @see IArray#getLength()
- */
- public int getLength() throws CoreException {
- return getJavaArray().getLength();
- }
-
- /**
- * @see IArray#getValue(int)
- */
- public IValue getValue(int index) throws CoreException {
- return EvaluationValue.createValue(getJavaArray().getValue(index));
- }
-
- /**
- * @see IArray#setValue(int, IValue)
- */
- public void setValue(int index, IValue value) throws CoreException {
- IJavaValue jv = ((EvaluationValue)value).getJavaValue();
- getJavaArray().setValue(index, jv);
- }
-
- /**
- * Returns the underlying Java debug model array
- *
- * @return the underlying Java debug model array
- */
- protected IJavaArray getJavaArray() {
- return (IJavaArray)getJavaValue();
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArrayType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArrayType.java
deleted file mode 100644
index 1f61a93..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArrayType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaArray;
-import org.eclipse.jdt.debug.core.IJavaArrayType;
-import org.eclipse.jdt.debug.core.IJavaType;
-
-/**
- * The type of an array - a proxy to a Java debug model
- * array type
- */
-public class EvaluationArrayType extends EvaluationType implements IArrayType {
-
- /**
- * Constructs a proxy to the given Java debug model array
- * type.
- *
- * @param type Java debug model array type
- * @return a proxy to the Java debug model array type
- */
- public EvaluationArrayType(IJavaArrayType type) {
- super(type);
- }
-
- /**
- * Returns the underlying Java debug model array type
- *
- * @return the underlying Java debug model array type
- */
- protected IJavaArrayType getJavaArrayType() {
- return (IJavaArrayType)getJavaType();
- }
-
- /**
- * @see IArrayType#getComponentType()
- */
- public IType getComponentType() throws CoreException {
- IJavaType jt = getJavaArrayType().getComponentType();
- return EvaluationType.createType(jt);
- }
-
- /**
- * @see IArrayType#newArray(int)
- */
- public IArray newArray(int length) throws CoreException {
- IJavaArray ja = getJavaArrayType().newInstance(length);
- return (IArray)EvaluationValue.createValue(ja);
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArrayVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArrayVariable.java
deleted file mode 100644
index ce4fbbb..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationArrayVariable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-package org.eclipse.jdt.internal.debug.eval.model;
-
-import org.eclipse.core.runtime.CoreException;
-
-public class EvaluationArrayVariable implements IVariable {
-
- private IArray fArray;
-
- private int fIndex;
-
- public EvaluationArrayVariable(IArray array, int index) {
- fArray = array;
- fIndex = index;
- }
-
- /*
- * @see IVariable#getName()
- */
- public String getName() throws CoreException {
- return fArray.getType().getName() + "[" + fIndex + "]";
- }
-
- /*
- * @see IVariable#getType()
- */
- public IType getType() throws CoreException {
- return ((IArrayType)fArray.getType()).getComponentType();
- }
-
- /*
- * @see IVariable#getValue()
- */
- public IValue getValue() throws CoreException {
- return fArray.getValue(fIndex);
- }
-
- /*
- * @see IVariable#setValue(IValue)
- */
- public void setValue(IValue value) throws CoreException {
- fArray.setValue(fIndex, value);
- }
-
-}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationClassType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationClassType.java
deleted file mode 100644
index f132bb9..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationClassType.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaClassType;
-import org.eclipse.jdt.debug.core.IJavaObject;
-import org.eclipse.jdt.debug.core.IJavaThread;
-import org.eclipse.jdt.debug.core.IJavaValue;
-import org.eclipse.jdt.debug.core.IJavaVariable;
-
-/**
- * The type of an object - provides access to static methods and fields.
- */
-public class EvaluationClassType extends EvaluationType implements IClassType {
-
- /**
- * Cosntructs a new type that represents a the given
- * class.
- */
- public EvaluationClassType(IJavaClassType type) {
- super(type);
- }
-
- /**
- * @see IClassType#newInstance(String, IValue[], IThread)
- */
- public IObject newInstance(String signature, IValue[] args, IThread thread)
- throws CoreException {
- IJavaValue[] javaArgs = getJavaArgs(args);
- IJavaObject jo = getJavaClassType().newInstance(signature, javaArgs, ((EvaluationThread)thread).getJavaThread());
- return (IObject)EvaluationValue.createValue(jo);
- }
-
- /**
- * @see IClassType#sendMessage(String, String, IValue[], IThread)
- */
- public IValue sendMessage(
- String selector,
- String signature,
- IValue[] args,
- IThread thread)
- throws CoreException {
- IJavaValue[] javaArgs =getJavaArgs(args);
- IJavaThread javaThread = ((EvaluationThread)thread).getJavaThread();
- IJavaValue v = getJavaClassType().sendMessage(selector, signature, javaArgs, javaThread);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * Utility method to convert evaluation arguments
- * to Java debug model arguments.
- *
- * @param args array of evaluation arguments (instances
- * of <code>EvaluationValue</code>
- * @return array of underlying associated <code>IJavaValue</code>s
- */
- protected static IJavaValue[] getJavaArgs(IValue[] args) {
- IJavaValue[] javaArgs = null;
- if (args != null) {
- javaArgs = new IJavaValue[args.length];
- for (int i = 0; i < args.length; i++) {
- javaArgs[i] = ((EvaluationValue)args[i]).getJavaValue();
- }
- }
- return javaArgs;
- }
-
- /**
- * @see IClassType#getField(String)
- */
- public IVariable getField(String name) throws CoreException {
- IJavaVariable jv = getJavaClassType().getField(name);
- if (jv != null) {
- return new EvaluationVariable(jv);
- }
- return null;
- }
-
- /**
- * @see IClassType#getName()
- */
- public String getName() throws CoreException {
- return getJavaClassType().getName();
- }
-
- /**
- * Returns the underlying java debug model class type that
- * this a proxy to.
- *
- * @return the underlying java debug model class type that
- * this a proxy to
- */
- protected IJavaClassType getJavaClassType() {
- return (IJavaClassType)getJavaType();
- }
-
- public IObject getClassObject() throws CoreException {
- IJavaObject javaObject = getJavaClassType().getClassObject();
- if (javaObject != null) {
- return new EvaluationObject(javaObject);
- }
- return null;
- }
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationElement.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationElement.java
deleted file mode 100644
index 04339a8..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationElement.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-import org.eclipse.debug.core.model.IDebugElement;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-/**
- * A proxy to an underlying java debug model element
- * used for evaluation.
- */
-public abstract class EvaluationElement {
-
- /**
- * Returns the underlying Java debug model element
- */
- protected abstract Object getUnderlyingModelObject();
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object o) {
- if (o instanceof EvaluationElement) {
- return getUnderlyingModelObject().equals(((EvaluationElement)o).getUnderlyingModelObject());
- }
- return false;
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- return getUnderlyingModelObject().hashCode();
- }
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationInterfaceType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationInterfaceType.java
deleted file mode 100644
index 1d736e1..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationInterfaceType.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaClassType;
-import org.eclipse.jdt.debug.core.IJavaInterfaceType;
-import org.eclipse.jdt.debug.core.IJavaObject;
-import org.eclipse.jdt.debug.core.IJavaThread;
-import org.eclipse.jdt.debug.core.IJavaValue;
-import org.eclipse.jdt.debug.core.IJavaVariable;
-
-/**
- * The type of an object - provides access to static methods and fields.
- */
-public class EvaluationInterfaceType extends EvaluationType implements IInterfaceType {
-
- /**
- * Cosntructs a new type that represents a the given
- * class.
- */
- public EvaluationInterfaceType(IJavaInterfaceType type) {
- super(type);
- }
-
-
- /**
- * @see IClassType#getField(String)
- */
- public IVariable getField(String name) throws CoreException {
- IJavaVariable jv = getJavaInterfaceType().getField(name);
- if (jv != null) {
- return new EvaluationVariable(jv);
- }
- return null;
- }
-
- /**
- * @see IClassType#getName()
- */
- public String getName() throws CoreException {
- return getJavaInterfaceType().getName();
- }
-
- /**
- * Returns the underlying java debug model class type that
- * this a proxy to.
- *
- * @return the underlying java debug model class type that
- * this a proxy to
- */
- protected IJavaInterfaceType getJavaInterfaceType() {
- return (IJavaInterfaceType)getJavaType();
- }
-
- public IObject getClassObject() throws CoreException {
- IJavaObject javaObject = getJavaInterfaceType().getClassObject();
- if (javaObject != null) {
- return new EvaluationObject(javaObject);
- }
- return null;
- }
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationObject.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationObject.java
deleted file mode 100644
index 5b06f5c..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationObject.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaObject;
-import org.eclipse.jdt.debug.core.IJavaValue;
-import org.eclipse.jdt.debug.core.IJavaVariable;
-
-/**
- * A proxy to an object on a Java debug target
- */
-public class EvaluationObject extends EvaluationValue implements IObject {
-
- /**
- * Constructs a proxy to the given object
- *
- * @param object Java debug model object
- * @return a proxy to the given object
- */
- protected EvaluationObject(IJavaObject object) {
- super(object);
- }
-
- /**
- * @see IObject#getField(String)
- */
- public IVariable getField(String name, boolean superField) throws CoreException {
- IJavaVariable jv = getJavaObject().getField(name, superField);
- if (jv != null) {
- return new EvaluationVariable(jv);
- }
- return null;
- }
-
- public IVariable getField(String name, String typeSignature) throws CoreException {
- IJavaVariable jv = getJavaObject().getField(name, typeSignature);
- if (jv != null) {
- return new EvaluationVariable(jv);
- }
- return null;
- }
-
- /**
- * @see IObject#sendMessage(String, String, IValue[], boolean, IThread)
- */
- public IValue sendMessage(
- String selector,
- String signature,
- IValue[] args,
- boolean superSend,
- IThread thread)
- throws CoreException {
- IJavaValue[] javaArgs = EvaluationClassType.getJavaArgs(args);
- IJavaValue result = getJavaObject().sendMessage(selector, signature, javaArgs, ((EvaluationThread)thread).getJavaThread(), superSend);
- return EvaluationValue.createValue(result);
- }
-
- /**
- * Returns the underlying Java debug model object this
- * proxy references
- *
- * @return underlying Java debug model object
- */
- public IJavaObject getJavaObject() {
- return (IJavaObject)getJavaValue();
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationPrimitiveType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationPrimitiveType.java
deleted file mode 100644
index 45bf2c0..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationPrimitiveType.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-package org.eclipse.jdt.internal.debug.eval.model;
-
-import org.eclipse.core.runtime.CoreException;
-
-public class EvaluationPrimitiveType implements IPrimitiveType {
-
- private String fName;
- private String fSignature;
-
- static private final IPrimitiveType byteType = new EvaluationPrimitiveType("byte", "B");
-
- static private final IPrimitiveType charType = new EvaluationPrimitiveType("char", "C");
-
- static private final IPrimitiveType doubleType = new EvaluationPrimitiveType("double", "D");
-
- static private final IPrimitiveType floatType = new EvaluationPrimitiveType("float", "F");
-
- static private final IPrimitiveType intType = new EvaluationPrimitiveType("int", "I");
-
- static private final IPrimitiveType longType = new EvaluationPrimitiveType("long", "J");
-
- static private final IPrimitiveType shortType = new EvaluationPrimitiveType("short", "S");
-
- static private final IPrimitiveType booleanType = new EvaluationPrimitiveType("boolean", "Z");
-
-
-
- static public IPrimitiveType getType(String signature) {
- switch (signature.charAt(0)) {
- case 'B':
- return byteType;
- case 'C':
- return charType;
- case 'D':
- return doubleType;
- case 'F':
- return floatType;
- case 'I':
- return intType;
- case 'J':
- return longType;
- case 'S':
- return shortType;
- case 'Z':
- return booleanType;
- }
- return null;
- }
-
- /**
- * Constructor for EvaluationPrimitiveType.
- * @param type
- */
- protected EvaluationPrimitiveType(String name, String signature) {
- fName = name;
- fSignature = signature;
- }
-
- /*
- * @see IType#getName()
- */
- public String getName() throws CoreException {
- return fName;
- }
-
- /*
- * @see IType#getSignature()
- */
- public String getSignature() throws CoreException {
- return fSignature;
- }
-
-}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationPrimitiveValue.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationPrimitiveValue.java
deleted file mode 100644
index 0d4361c..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationPrimitiveValue.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
-import org.eclipse.jdt.debug.core.IJavaValue;
-
-/**
- * A primitive value
- */
-public class EvaluationPrimitiveValue
- extends EvaluationValue
- implements IPrimitiveValue {
-
- /**
- * Constructs a primitive value.
- *
- * @param value underlying Java debug model value
- */
- protected EvaluationPrimitiveValue(IJavaPrimitiveValue value) {
- super(value);
- }
-
- /**
- * Returns the underlying Java debug model primitive value.
- *
- * @return underlying Java debug model primitive value
- */
- protected IJavaPrimitiveValue getJavaPrimitiveValue() {
- return (IJavaPrimitiveValue)getJavaValue();
- }
-
- /*
- * @see IPrimitiveValue#getBooleanValue()
- */
- public boolean getBooleanValue() {
- return getJavaPrimitiveValue().getBooleanValue();
- }
-
- /*
- * @see IPrimitiveValue#getByteValue()
- */
- public byte getByteValue() {
- return getJavaPrimitiveValue().getByteValue();
- }
-
- /*
- * @see IPrimitiveValue#getCharValue()
- */
- public char getCharValue() {
- return getJavaPrimitiveValue().getCharValue();
- }
-
- /*
- * @see IPrimitiveValue#getDoubleValue()
- */
- public double getDoubleValue() {
- return getJavaPrimitiveValue().getDoubleValue();
- }
-
- /*
- * @see IPrimitiveValue#getFloatValue()
- */
- public float getFloatValue() {
- return getJavaPrimitiveValue().getFloatValue();
- }
-
- /*
- * @see IPrimitiveValue#getIntValue()
- */
- public int getIntValue() {
- return getJavaPrimitiveValue().getIntValue();
- }
-
- /*
- * @see IPrimitiveValue#getLongValue()
- */
- public long getLongValue() {
- return getJavaPrimitiveValue().getLongValue();
- }
-
- /*
- * @see IPrimitiveValue#getShortValue()
- */
- public short getShortValue() {
- return getJavaPrimitiveValue().getShortValue();
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationThread.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationThread.java
deleted file mode 100644
index 06ae689..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationThread.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jdt.debug.core.IJavaThread;
-
-/**
- * A proxy to a Java debug model thread
- */
-public class EvaluationThread extends EvaluationElement implements IThread {
-
- /**
- * Underlying Java debug model thread
- */
- private IJavaThread fJavaThread;
-
- /**
- * Constructs an evaluation thread on the given
- * underlying Java debug model thread.
- *
- * @param thread underlying Java debug model thread
- * @return a thread used for evaluation
- */
- protected EvaluationThread(IJavaThread thread) {
- setJavaThread(thread);
- }
-
- /**
- * Returns the underlying Java debug model thread.
- *
- * @return the underlying Java debug model thread
- */
- protected IJavaThread getJavaThread() {
- return fJavaThread;
- }
-
- /**
- * Sets the underlying Java debug model thread.
- *
- * @param javaThread the underlying Java debug model thread
- */
- private void setJavaThread(IJavaThread javaThread) {
- fJavaThread = javaThread;
- }
-
- /**
- * @see EvaluationElement#getUnderlyingModelObject()
- */
- protected Object getUnderlyingModelObject() {
- return getJavaThread();
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationType.java
deleted file mode 100644
index b644397..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationType.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.jdt.debug.core.IJavaArrayType;
-import org.eclipse.jdt.debug.core.IJavaClassType;
-import org.eclipse.jdt.debug.core.IJavaInterfaceType;
-import org.eclipse.jdt.debug.core.IJavaThread;
-import org.eclipse.jdt.debug.core.IJavaType;
-import org.eclipse.jdt.debug.core.IJavaValue;
-
-/**
- * A type used for evaluation - a proxy to a java
- * type in the java debug model.
- */
-public class EvaluationType extends EvaluationElement implements IType {
-
- /**
- * The underlying java debug model type
- */
- private IJavaType fType;
-
- /**
- * Constructs a type to be used for an evaluation
- * based on the given underlying java debug model
- * type
- *
- * @param type java debug model type
- * @return a type to use for evalaution
- */
- public EvaluationType(IJavaType type) {
- setJavaType(type);
- }
-
- /**
- * @see IType#getSignature()
- */
- public String getSignature() throws CoreException {
- return getJavaType().getSignature();
- }
-
- /**
- * @see IType#getName()
- */
- public String getName() throws CoreException {
- return getJavaType().getName();
- }
-
- /**
- * Sets the type that this evaluation type
- * is a proxy to.
- *
- * @param type the type that this evaluation type
- * is a proxy to
- */
- private void setJavaType(IJavaType type) {
- fType = type;
- }
-
- /**
- * Returns the type that this evaluation type
- * is a proxy to.
- *
- * @param type the type that this evaluation type
- * is a proxy to
- */
- protected IJavaType getJavaType() {
- return fType;
- }
-
- /**
- * @see EvaluationElement#getUnderlyingModelObject()
- */
- protected Object getUnderlyingModelObject() {
- return getJavaType();
- }
-
- /**
- * Returns an equivalent evaluation type for the given
- * java debug model type.
- *
- * @param type a java debug model type
- * @return an equivalent evaluation type for the given
- * java debug model type
- */
- protected static IType createType(IJavaType type) {
- if (type instanceof IJavaClassType) {
- return new EvaluationClassType((IJavaClassType)type);
- }
- if (type instanceof IJavaInterfaceType) {
- return new EvaluationInterfaceType((IJavaInterfaceType)type);
- }
- if (type instanceof IJavaArrayType) {
- return new EvaluationArrayType((IJavaArrayType)type);
- }
- return new EvaluationType(type);
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationVM.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationVM.java
deleted file mode 100644
index 5c66f71..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationVM.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaDebugTarget;
-import org.eclipse.jdt.debug.core.IJavaType;
-import org.eclipse.jdt.debug.core.IJavaValue;
-
-/**
- * Proxy to a Java debug target
- */
-public class EvaluationVM extends EvaluationElement implements IVirtualMachine {
-
- /**
- * Underlying Java debug target
- */
- private IJavaDebugTarget fJavaDebugTarget;
-
- /**
- * Constructs a proxy to the given Java debug target.
- *
- * @param target Java debug target
- * @return prxoxy to the given target
- */
- protected EvaluationVM(IJavaDebugTarget target) {
- setJavaDebugTarget(target);
- }
-
- /**
- * @see EvaluationElement#getUnderlyingModelObject()
- */
- protected Object getUnderlyingModelObject() {
- return getJavaDebugTarget();
- }
-
- /**
- * @see IVirtualMachine#newValue(boolean)
- */
- public IValue newValue(boolean value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(byte)
- */
- public IValue newValue(byte value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(char)
- */
- public IValue newValue(char value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(double)
- */
- public IValue newValue(double value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(float)
- */
- public IValue newValue(float value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(int)
- */
- public IValue newValue(int value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(long)
- */
- public IValue newValue(long value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(short)
- */
- public IValue newValue(short value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#newValue(String)
- */
- public IObject newValue(String value) {
- IJavaValue v = getJavaDebugTarget().newValue(value);
- return (IObject)EvaluationValue.createValue(v);
- }
-
- /**
- * @see IVirtualMachine#classesByName(String)
- */
- public IType[] classesByName(String qualifiedName) throws CoreException {
- IJavaType[] types = getJavaDebugTarget().getJavaTypes(qualifiedName);
- if (types != null) {
- IType[] theTypes = new IType[types.length];
- for (int i = 0; i < types.length; i++) {
- theTypes[i] = EvaluationType.createType(types[i]);
- }
- return theTypes;
- }
- return new IType[0];
- }
-
- /**
- * @see IVirtualMachine#nullValue()
- */
- public IValue nullValue() {
- return EvaluationValue.createValue(getJavaDebugTarget().nullValue());
- }
-
- /**
- * @see IVirtualMachine#voidValue()
- */
- public IValue voidValue() {
- return EvaluationValue.createValue(getJavaDebugTarget().voidValue());
- }
-
- /**
- * Returns the underlying Java debug target.
- *
- * @return the underlying Java debug target
- */
- protected IJavaDebugTarget getJavaDebugTarget() {
- return fJavaDebugTarget;
- }
-
- /**
- * Sets the underlying Java debug target.
- *
- * @param javaDebugTarget Java debug target
- */
- private void setJavaDebugTarget(IJavaDebugTarget javaDebugTarget) {
- fJavaDebugTarget = javaDebugTarget;
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationValue.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationValue.java
deleted file mode 100644
index 6a9d632..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationValue.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaArray;
-import org.eclipse.jdt.debug.core.IJavaObject;
-import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
-import org.eclipse.jdt.debug.core.IJavaValue;
-
-/**
- * An evaluation value - a proxy to an underlying java
- * model value
- */
-public class EvaluationValue extends EvaluationElement implements IValue {
-
- /**
- * Underlying java debug model value
- */
- private IJavaValue fJavaValue;
-
- /**
- * Constructs a new proxy to the given underlying java
- * debug model value
- *
- * @param value underling java debug model value
- * @return a value to be used for evaluation
- */
- protected EvaluationValue(IJavaValue value) {
- setJavaValue(value);
- }
-
- /**
- * @see EvaluationElement#getUnderlyingModelObject()
- */
- protected Object getUnderlyingModelObject() {
- return getJavaValue();
- }
-
- /**
- * @see IValue#getType()
- */
- public IType getType() throws CoreException {
- return EvaluationType.createType(getJavaValue().getJavaType());
- }
-
- /**
- * Returns the underlying java debug model value.
- *
- * @return the underlying java debug model value
- */
- public IJavaValue getJavaValue() {
- return fJavaValue;
- }
-
- /**
- * Sets the underlying java debug model value.
- *
- * @param javaValue the underlying java debug model value
- */
- private void setJavaValue(IJavaValue javaValue) {
- fJavaValue = javaValue;
- }
-
- /**
- * Returns an equivalent evaluation value for the given
- * java debug model value.
- *
- * @param value a java debug model value
- * @return an equivalent evaluation value for the given
- * java debug model value
- */
- protected static IValue createValue(IJavaValue value) {
- if (value instanceof IJavaArray) {
- return new EvaluationArray((IJavaArray)value);
- }
- if (value instanceof IJavaObject) {
- return new EvaluationObject((IJavaObject)value);
- }
- if (value instanceof IJavaPrimitiveValue) {
- return new EvaluationPrimitiveValue((IJavaPrimitiveValue)value);
- }
- return new EvaluationValue(value);
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationVariable.java
deleted file mode 100644
index 5f45713..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/EvaluationVariable.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.debug.core.IJavaValue;
-import org.eclipse.jdt.debug.core.IJavaVariable;
-
-/**
- * An evaluation variable - a proxy to a java variable
- */
-public class EvaluationVariable extends EvaluationElement implements IVariable {
-
- /**
- * Underlying variable
- */
- private IJavaVariable fVariable;
-
- /**
- * Constructs a new evaluation variable on the given
- * Java variable
- *
- * @param variable the underlying java debug model variable
- * @return a variable to be used for evaluation
- */
- public EvaluationVariable(IJavaVariable variable) {
- setJavaVariable(variable);
- }
-
-
- /**
- * @see IVariable#getType()
- */
- public IType getType() throws CoreException {
- return new EvaluationType(getJavaVariable().getJavaType());
- }
-
- /**
- * @see IVariable#getValue()
- */
- public IValue getValue() throws CoreException {
- return EvaluationValue.createValue((IJavaValue)getJavaVariable().getValue());
- }
-
- /**
- * @see IVariable#setValue(IValue)
- */
- public void setValue(IValue value) throws CoreException {
- getJavaVariable().setValue(((EvaluationValue)value).getJavaValue());
- }
-
- /**
- * @see IVariable#getName()
- */
- public String getName() throws CoreException {
- return getJavaVariable().getName();
- }
-
- /**
- * Sets the variable that this evaluation variable
- * is a proxy to.
- *
- * @param variable the variable that this evaluation variable
- * is a proxy to
- */
- private void setJavaVariable(IJavaVariable variable) {
- fVariable = variable;
- }
-
- /**
- * Returns the variable that this evaluation variable
- * is a proxy to.
- *
- * @param variable the variable that this evaluation variable
- * is a proxy to
- */
- private IJavaVariable getJavaVariable() {
- return fVariable;
- }
-
- /**
- * @see EvaluationElement#getUnderlyingModelObject()
- */
- protected Object getUnderlyingModelObject() {
- return getJavaVariable();
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IArray.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IArray.java
deleted file mode 100644
index 0640e30..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IArray.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * An array on a virtual machine.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-
-public interface IArray extends IObject {
-
- /**
- * Returns the length of this array.
- *
- * @return length
- * @exception EvaluationException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- int getLength() throws CoreException;
-
- /**
- * Returns the value at the given index in this array.
- *
- * @param index index in this array
- * @return value at the specified index
- * @exception EvaluationException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- IValue getValue(int index) throws CoreException;
-
- /**
- * Sets the value at the given index in this array.
- *
- * @param index index in this array
- * @param new value for the specified index
- * @exception CoreException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- void setValue(int index, IValue value) throws CoreException;
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IArrayType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IArrayType.java
deleted file mode 100644
index 145b1eb..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IArrayType.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * The type of an array on a virtual machine.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-
-public interface IArrayType extends IType {
-
- /**
- * Returns the type of the elements in this array.
- *
- * @return type
- * @exception EvaluationException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- IType getComponentType() throws CoreException;
-
- /**
- * Creates a new array of the same type as this array with the\
- * given length.
- *
- * @param length the length of the new array
- * @exception CoreException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- IArray newArray(int length) throws CoreException;
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IClassType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IClassType.java
deleted file mode 100644
index 3cadb7a..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IClassType.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * The class of an object on a virtual machine.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public interface IClassType extends IType {
- /**
- * Returns a new instance of this class by invoking the
- * constructor with the specified signature and arguments.
- *
- * @param signature the JNI style signature of the cosntructor to
- * be invoked
- * @param args the arguments of the constructor, which
- * can be <code>null</code> or emtpy if there are none
- * @param thread the thread in which to construct the new object
- * @return the result of invoking the constructor
- * @exception EvaluationException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * <li>This class does not implement the specified constructor</li>
- * <li>An exception occurrs on the target VM while invoking the
- * specified constructor</li>
- * </ul>
- */
- IObject newInstance(String signature, IValue[] args, IThread thread) throws CoreException;
-
- /**
- * Returns the result of sending the specified (static) message to
- * this class with the given arguments.
- *
- * @param selector the selector of the method to be invoked
- * @param signature the JNI style signature of the method to be invoked
- * @param args the arguments of the method, which can be
- * <code>null</code> or emtpy if there are none
- * @param thread the thread in which to perform the message send
- * @return the result of invoking the method
- * @exception CoreException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * <li>This class does not implement the specified method</li>
- * <li>An exception occurrs on the target VM while invoking the
- * specified method</li>
- * </ul>
- */
- IValue sendMessage(String selector, String signature, IValue[] args, IThread thread) throws CoreException;
-
- /**
- * Returns the (static) field of this class with the specified name,
- * or <code>null</code> if none exists.
- *
- * @return the field of this class with the specified name, or
- * <code>null</code>
- * @exception CoreException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IVariable getField(String name) throws CoreException;
-
- /**
- * Returns the fully qualified name of this class.
- *
- * @return the fully qualified name of this class
- */
- String getName() throws CoreException;
-
- /**
- * Returns the Class object for this type
- */
- IObject getClassObject() throws CoreException;
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IInterfaceType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IInterfaceType.java
deleted file mode 100644
index 61c41ab..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IInterfaceType.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * The class of an object on a virtual machine.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public interface IInterfaceType extends IType {
- /**
- * Returns the (static) field of this class with the specified name,
- * or <code>null</code> if none exists.
- *
- * @return the field of this class with the specified name, or
- * <code>null</code>
- * @exception CoreException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IVariable getField(String name) throws CoreException;
-
- /**
- * Returns the fully qualified name of this class.
- *
- * @return the fully qualified name of this class
- */
- String getName() throws CoreException;
-
- /**
- * Returns the Class object for this type
- */
- IObject getClassObject() throws CoreException;
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IObject.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IObject.java
deleted file mode 100644
index 0d13383..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IObject.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A object on a virtual machine.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-
-public interface IObject extends IValue {
-
- /**
- * Returns the field of this object with the specified name.
- * Static and instance fields are available from this method.
- *
- * @return the field of this object with the specified name
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IVariable getField(String name, boolean superField) throws CoreException;
-
- IVariable getField(String name, String typeSignature) throws CoreException;
-
- /**
- * Returns the result of sending the specified message to
- * this object with the given arguments.
- *
- * @param selector the selector of the method to be invoked
- * @param signature the JNI style signature of the method to be invoked
- * @param args the arguments of the method, which can be
- * <code>null</code> or emtpy if there are none
- * @param superSend whether method lookup will being in this object's
- * superclass
- * @param thread the thread in which to perform the message send
- * @return the result of invoking the method
- * @exception EvaluationException if this method fails. Reasons include:<ul>
- * <li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * <li>This class does not implement the specified method</li>
- * <li>An exception occurrs on the target VM while invoking the
- * specified method</li>
- * </ul>
- */
- IValue sendMessage(String selector, String signature, IValue[] args, boolean superSend, IThread thread) throws CoreException;
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IPrimitiveType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IPrimitiveType.java
deleted file mode 100644
index cd7cdc2..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IPrimitiveType.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-package org.eclipse.jdt.internal.debug.eval.model;
-
-import org.eclipse.jdt.internal.debug.eval.model.*;
-
-public interface IPrimitiveType extends IType {
-}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IPrimitiveValue.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IPrimitiveValue.java
deleted file mode 100644
index e559619..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IPrimitiveValue.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-/**
- * A primitive value.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public interface IPrimitiveValue extends IValue {
-
- /**
- * Returns this value as a boolean.
- *
- * @return this value as a boolean
- */
- public boolean getBooleanValue();
-
- /**
- * Returns this value as a byte
- *
- * @return this value as a byte
- */
- public byte getByteValue();
-
- /**
- * Returns this value as a char
- *
- * @return this value as a char
- */
- public char getCharValue();
-
- /**
- * Returns this value as a double
- *
- * @return this value as a double
- */
- public double getDoubleValue();
-
- /**
- * Returns this value as a float
- *
- * @return this value as a float
- */
- public float getFloatValue();
-
- /**
- * Returns this value as an int
- *
- * @return this value as an int
- */
- public int getIntValue();
-
- /**
- * Returns this value as a long
- *
- * @return this value as a long
- */
- public long getLongValue();
-
- /**
- * Returns this value as a short
- *
- * @return this value as a short
- */
- public short getShortValue();
-}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IRuntimeContext.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IRuntimeContext.java
deleted file mode 100644
index 0963d6d..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IRuntimeContext.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaProject;
-
-/**
- * The context in which an evaluation is to be performed. An
- * evaluation is performed in the context of an object or class.
- * The evaluation may be in the context of a method, in which case
- * there could be local variables.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-
-public interface IRuntimeContext {
-
- /**
- * Returns the virtual machine in which to perform the
- * evaluation.
- *
- * @return virtual machine
- */
- IVirtualMachine getVM();
-
- /**
- * Returns the receiving object context in which to perform
- * the evaluation - equivalent to 'this'. Returns <code>null</code>
- * if the context of an evaluation is in a class rather than
- * an object.
- *
- * @return 'this', or <code>null</code>
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IObject getThis() throws CoreException;
-
- /**
- * Returns the receiving type context in which to perform
- * the evaluation. The type of 'this', or in the case of a
- * static context, the class in which the evaluation is being
- * performed.
- *
- * @return receiving class
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IClassType getReceivingType() throws CoreException;
-
- /**
- * Returns the local variables visible for the evaluation.
- * This includes method arguments, if any. Does not return
- * <code>null</code> returns an empty collection if there
- * are no locals.
- *
- * @return local variables
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IVariable[] getLocals() throws CoreException;
-
- /**
- * Returns the Java project context in which this expression
- * should be compiled.
- *
- * @return project
- */
- IJavaProject getProject();
-
- /**
- * Returns the thread in which message sends may be performed.
- *
- * @return thread
- */
- IThread getThread();
-
- /**
- * Returns whether the context of this evaluation is within
- * a constructor.
- *
- * @return whether the context of this evaluation is within
- * a constructor
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- public boolean isConstructor() throws CoreException;
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IThread.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IThread.java
deleted file mode 100644
index 8942343..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IThread.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A thread in which a message send may be performed.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public interface IThread {
-
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IType.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IType.java
deleted file mode 100644
index 4881b72..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IType.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * The type of a value on a virtual machine - a primitive
- * data type, class, interface, or array.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public interface IType {
- /**
- * Returns the JNI-style signature for this type.
- *
- * @return signature
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- String getSignature() throws CoreException;
-
- /**
- * Returns the name of this type, for example
- * <code>java.lang.String</code>.
- *
- * @return name
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- String getName() throws CoreException;
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IValue.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IValue.java
deleted file mode 100644
index 9b18d46..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IValue.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A value assigned to a field or variable on a virtual
- * machine.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public interface IValue {
-
- /**
- * Returns the type of this vlaue.
- *
- * @return the type of this value
- * @exception CoreException if unable to retrieve this value's type
- */
- IType getType() throws CoreException;
-
-}
-
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IVariable.java
deleted file mode 100644
index 3b623da..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IVariable.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A variable on a virtual machine - local variable, argument,
- * or field of an object.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-
-public interface IVariable {
-
- /**
- * Returns the (declared) type of this variable.
- *
- * @return type
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IType getType() throws CoreException;
-
-
- /**
- * Returns the current value of this variable.
- *
- * @return value
- * @exception EvaluationException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- IValue getValue() throws CoreException;
-
- /**
- * Sets the value of this variable.
- *
- * @param value the new value
- * @exception CoreException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * <li>The given value is of an uncompatible type, or did not
- * orginate from the same virtual machine as this variable.</li>
- * </ul>
- */
- void setValue(IValue vale) throws CoreException;
-
- /**
- * Returns the name of this variable.
- *
- * @return the name of this variable
- * @exception CoreException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The exception's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- String getName() throws CoreException;
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IVirtualMachine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IVirtualMachine.java
deleted file mode 100644
index 76fbc7d..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/IVirtualMachine.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * The virtual machine on which an evaluation is being
- * performed.
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-
-public interface IVirtualMachine {
-
- /**
- * Creates and returns a new boolean value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value boolean value to create
- * @return value
- */
- IValue newValue(boolean value);
-
- /**
- * Creates and returns a new byte value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value byte value to create
- * @return value
- */
- IValue newValue(byte value);
-
- /**
- * Creates and returns a new char value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value char value to create
- * @return value
- */
- IValue newValue(char value);
-
- /**
- * Creates and returns a new double value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value double value to create
- * @return value
- */
- IValue newValue(double value);
-
- /**
- * Creates and returns a new float value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value float value to create
- * @return value
- */
- IValue newValue(float value);
-
- /**
- * Creates and returns a new int value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value int value to create
- * @return value
- */
- IValue newValue(int value);
-
- /**
- * Creates and returns a new long value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value long value to create
- * @return value
- */
- IValue newValue(long value);
-
- /**
- * Creates and returns a new short value that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value short value to create
- * @return value
- */
- IValue newValue(short value);
-
- /**
- * Creates and returns a new String object that can be
- * used for comparing and setting values on the target VM.
- *
- * @param value String value to create
- * @return value
- */
- IObject newValue(String value);
-
- /**
- * Returns the loaded types (class or interfaces) on the target
- * VM with the given fully qualified name.
- *
- * @param name fully qualified type name, for example,
- * <code>java.lang.String</code>
- * @return type
- */
- IType[]classesByName(String qualifiedName) throws CoreException;
-
- /**
- * Returns the value representing a null value in the target VM.
- *
- * @return null value
- */
- IValue nullValue();
-
- /**
- * Returns the value representing a void value in the target VM.
- *
- * @return void value
- */
- IValue voidValue();
-}
-
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/JavaObjectRuntimeContext.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/JavaObjectRuntimeContext.java
deleted file mode 100644
index 64ee305..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/JavaObjectRuntimeContext.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.debug.core.IJavaDebugTarget;
-import org.eclipse.jdt.debug.core.IJavaObject;
-import org.eclipse.jdt.debug.core.IJavaThread;
-
-public class JavaObjectRuntimeContext implements IRuntimeContext {
-
- /**
- * <code>this</code> object or this context.
- */
- private IJavaObject fThisObject;
-
- /**
- * The project for this context.
- */
- private IJavaProject fJavaProject;
-
- /**
- * The thread for this context.
- */
- private IJavaThread fThread;
-
- /**
- * ObjectValueRuntimeContext constructor.
- *
- * @param thisObject <code>this</code> object of this context.
- * @param javaProject the project for this context.
- * @param thread the thread for this context.
- */
- public JavaObjectRuntimeContext(IJavaObject thisObject, IJavaProject javaProject, IJavaThread thread) {
- fThisObject= thisObject;
- fJavaProject= javaProject;
- fThread= thread;
- }
-
- /**
- * @see IRuntimeContext#getVM()
- */
- public IVirtualMachine getVM() {
- return new EvaluationVM((IJavaDebugTarget)fThisObject.getDebugTarget());
- }
-
- /**
- * @see IRuntimeContext#getThis()
- */
- public IObject getThis() throws CoreException {
- return (IObject)EvaluationObject.createValue(fThisObject);
- }
-
- /**
- * @see IRuntimeContext#getReceivingType()
- */
- public IClassType getReceivingType() throws CoreException {
- return (IClassType)getThis().getType();
- }
-
- /**
- * @see IRuntimeContext#getLocals()
- */
- public IVariable[] getLocals() throws CoreException {
- return new IVariable[0];
- }
-
- /**
- * @see IRuntimeContext#getProject()
- */
- public IJavaProject getProject() {
- return fJavaProject;
- }
-
- /**
- * @see IRuntimeContext#getThread()
- */
- public IThread getThread() {
- return new EvaluationThread(fThread);
- }
-
- /**
- * @see IRuntimeContext#isConstructor()
- */
- public boolean isConstructor() throws CoreException {
- return false;
- }
-
-}
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/RuntimeContext.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/RuntimeContext.java
deleted file mode 100644
index d833e21..0000000
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/model/RuntimeContext.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.jdt.internal.debug.eval.model;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.debug.core.IJavaClassType;
-import org.eclipse.jdt.debug.core.IJavaDebugTarget;
-import org.eclipse.jdt.debug.core.IJavaObject;
-import org.eclipse.jdt.debug.core.IJavaStackFrame;
-import org.eclipse.jdt.debug.core.IJavaThread;
-import org.eclipse.jdt.debug.core.IJavaVariable;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public class RuntimeContext implements IRuntimeContext {
-
- /**
- * Java project context
- */
- private IJavaProject fProject;
-
- /**
- * Stack frame context
- */
- private IJavaStackFrame fFrame;
-
- /**
- * Creates a runtime context for the given java project and
- * stack frame.
- *
- * @param project Java project context used to compile expressions in
- * @param frame stack frame used to define locals and receiving type
- * context
- * @return a new runtime context
- */
- public RuntimeContext(IJavaProject project, IJavaStackFrame frame) {
- setProject(project);
- setFrame(frame);
- }
-
- /**
- * @see IRuntimeContext#getVM()
- */
- public IVirtualMachine getVM() {
- return new EvaluationVM((IJavaDebugTarget)getFrame().getDebugTarget());
- }
-
- /**
- * @see IRuntimeContext#getThis()
- */
- public IObject getThis() throws CoreException {
- IJavaObject jo = getFrame().getThis();
- if (jo != null) {
- return new EvaluationObject(getFrame().getThis());
- }
- return null;
- }
-
- /**
- * @see IRuntimeContext#getReceivingType()
- */
- public IClassType getReceivingType() throws CoreException {
- IObject rec = getThis();
- if (rec != null) {
- return (IClassType)rec.getType();
- }
- IJavaClassType type = getFrame().getDeclaringType();
- return (IClassType)EvaluationType.createType(type);
- }
-
- /**
- * @see IRuntimeContext#getLocals()
- */
- public IVariable[] getLocals() throws CoreException {
- IJavaVariable[] locals = getFrame().getLocalVariables();
- IVariable[] vars = new IVariable[locals.length];
- for (int i = 0; i < locals.length; i++) {
- vars[i] = new EvaluationVariable(locals[i]);
- }
- return vars;
- }
-
- /**
- * @see IRuntimeContext#getProject()
- */
- public IJavaProject getProject() {
- return fProject;
- }
-
- /**
- * Sets the project context used to compile expressions
- *
- * @param project the project context used to compile expressions
- */
- private void setProject(IJavaProject project) {
- fProject = project;
- }
-
- /**
- * Sets the stack frame context used to compile/run expressions
- *
- * @param frame the stack frame context used to compile/run expressions
- */
- protected IJavaStackFrame getFrame() {
- return fFrame;
- }
-
- /**
- * Sets the stack frame context used to compile/run expressions
- *
- * @param frame the stack frame context used to compile/run expressions
- */
- private void setFrame(IJavaStackFrame frame) {
- fFrame = frame;
- }
-
- /**
- * @see IRuntimeContext#getThread()
- */
- public IThread getThread() {
- return new EvaluationThread((IJavaThread)getFrame().getThread());
- }
-
- /**
- * @see IRuntimeContext#isConstructor()
- */
- public boolean isConstructor() throws CoreException {
- return getFrame().isConstructor();
- }
-
-}
-
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
index 4b0be70..ae077bb 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
@@ -15,6 +15,7 @@
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IValue;
@@ -401,7 +402,7 @@
return !suspendForEvent(event, thread);
}
fSuspendEvents.put(thread, event);
- engine.evaluateExpression(fCompiledExpression, frame, listener);
+ engine.evaluateExpression(fCompiledExpression, frame, listener, DebugEvent.EVALUATION, false);
// Do not resume. When the evaluation returns, the evaluation listener
// will resume the thread if necessary or update for suspension.
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIObjectValue.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIObjectValue.java
index 56fbe75..9f13087 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIObjectValue.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIObjectValue.java
@@ -20,6 +20,7 @@
import com.sun.jdi.ClassType;
import com.sun.jdi.Field;
+import com.sun.jdi.InterfaceType;
import com.sun.jdi.Method;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.ReferenceType;
@@ -118,25 +119,52 @@
/**
* @see IJavaObject#getField(String, String)
*/
- public IJavaFieldVariable getField(String name, String typeSignature) throws DebugException {
+ public IJavaFieldVariable getField(String name, String declaringTypeSignature) throws DebugException {
ReferenceType ref= getUnderlyingReferenceType();
try {
Field field= null, enclosingThis= null, fieldTmp= null;
- Iterator fields= ref.fields().iterator();
+ Iterator fields= ref.allFields().iterator();
while (fields.hasNext()) {
fieldTmp = (Field)fields.next();
- if (name.equals(fieldTmp.name()) && typeSignature.equals(fieldTmp.declaringType().signature())) {
+ if (name.equals(fieldTmp.name()) && declaringTypeSignature.equals(fieldTmp.declaringType().signature())) {
field= fieldTmp;
break;
}
- if (fieldTmp.name().startsWith("this$")) {
- enclosingThis= fieldTmp;
- }
}
if (field != null) {
return new JDIFieldVariable((JDIDebugTarget)getDebugTarget(), field, getUnderlyingObject());
- } else {
- return ((JDIObjectValue)(new JDIFieldVariable((JDIDebugTarget)getDebugTarget(), enclosingThis, getUnderlyingObject())).getValue()).getField(name, typeSignature);
+ }
+ } catch (RuntimeException e) {
+ targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIObjectValue.exception_retrieving_field"), new String[]{e.toString()}), e); //$NON-NLS-1$
+ }
+ // it is possible to return null
+ return null;
+ }
+
+ /**
+ * Returns a variable representing the field in this object
+ * with the given name, or <code>null</code> if there is no
+ * field with the given name, or the name is ambiguous.
+ *
+ * @param name field name
+ * @param superClassLevel the level of the desired field in the
+ * hierarchy. Level 0 returns the field from the current type, level 1 from the
+ * super type, etc.
+ * @return the variable representing the field, or <code>null</code>
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public IJavaFieldVariable getField(String name, int superClassLevel) throws DebugException {
+ ReferenceType ref= getUnderlyingReferenceType();
+ try {
+ for (int i= 0 ; i < superClassLevel; i++) {
+ ref= ((ClassType)ref).superclass();
+ }
+ Field field = ref.fieldByName(name);
+ if (field != null) {
+ return new JDIFieldVariable((JDIDebugTarget)getDebugTarget(), field, getUnderlyingObject());
}
} catch (RuntimeException e) {
targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIObjectValue.exception_retrieving_field"), new String[]{e.toString()}), e); //$NON-NLS-1$
@@ -165,5 +193,34 @@
}
+ /**
+ * Return the enclosing object of this object at the specified level.
+ * Level 0 returns the object, level 1 returns the enclosing object, etc.
+ */
+ public IJavaObject getEnclosingObject(int enclosingLevel) throws DebugException {
+ JDIObjectValue res= this;
+ for (int i= 0; i < enclosingLevel; i ++) {
+ ReferenceType ref= res.getUnderlyingReferenceType();
+ try {
+ Field enclosingThis= null, fieldTmp= null;
+ Iterator fields= ref.fields().iterator();
+ while (fields.hasNext()) {
+ fieldTmp = (Field)fields.next();
+ if (fieldTmp.name().startsWith("this$")) {
+ enclosingThis= fieldTmp;
+ }
+ }
+ if (enclosingThis != null) {
+ res= (JDIObjectValue)(new JDIFieldVariable((JDIDebugTarget)getDebugTarget(), enclosingThis, res.getUnderlyingObject())).getValue();
+ } else {
+ // it is possible to return null
+ return null;
+ }
+ } catch (RuntimeException e) {
+ targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIObjectValue.exception_retrieving_field"), new String[]{e.toString()}), e); //$NON-NLS-1$
+ }
+ }
+ return res;
+ }
}