diff options
Diffstat (limited to 'org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThisVariable.java')
-rw-r--r-- | org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThisVariable.java | 89 |
1 files changed, 56 insertions, 33 deletions
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThisVariable.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThisVariable.java index a81a6b00f..03e96fb7d 100644 --- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThisVariable.java +++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThisVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,38 +10,38 @@ *******************************************************************************/ package org.eclipse.jdt.internal.debug.core.model; - -import com.ibm.icu.text.MessageFormat; - import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IVariable; +import org.eclipse.jdt.debug.core.IJavaVariable; +import com.ibm.icu.text.MessageFormat; import com.sun.jdi.ObjectReference; import com.sun.jdi.ReferenceType; import com.sun.jdi.Type; import com.sun.jdi.Value; - /** * Represents the receiver in a stack frame. */ public class JDIThisVariable extends JDIVariable { /** - * The wrappered object + * The wrapped object */ private ObjectReference fObject; - + /** * Constructs a variable representing 'this' in a stack frame. */ public JDIThisVariable(JDIDebugTarget target, ObjectReference object) { super(target); - fObject= object; + fObject = object; } /** * Returns this variable's current Value. */ + @Override protected Value retrieveValue() { return fObject; } @@ -52,7 +52,7 @@ public class JDIThisVariable extends JDIVariable { public String getName() { return "this"; //$NON-NLS-1$ } - + /** * @see IJavaVariable#getSignature() */ @@ -60,14 +60,19 @@ public class JDIThisVariable extends JDIVariable { try { return retrieveValue().type().signature(); } catch (RuntimeException e) { - targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThisVariableexception_retrieving_type_signature, new String[] {e.toString()}), e); + targetRequestFailed( + MessageFormat.format( + JDIDebugModelMessages.JDIThisVariableexception_retrieving_type_signature, + e.toString()), e); // execution will not reach this line, as // #targetRequestFailed will thrown an exception - return null; + return null; } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.jdt.debug.core.IJavaVariable#getGenericSignature() */ public String getGenericSignature() throws DebugException { @@ -81,51 +86,64 @@ public class JDIThisVariable extends JDIVariable { try { return getValue().getReferenceTypeName(); } catch (RuntimeException e) { - targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThisVariableexception_retrieving_reference_type_name, new String[] {e.toString()}), e); + targetRequestFailed( + MessageFormat.format( + JDIDebugModelMessages.JDIThisVariableexception_retrieving_reference_type_name, + e.toString()), e); // execution will not reach this line, as // #targetRequestFailed will thrown an exception - return null; + return null; } } - + /** * @see JDIVariable#getUnderlyingType() */ + @Override protected Type getUnderlyingType() throws DebugException { try { return retrieveValue().type(); } catch (RuntimeException e) { - targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThisVariable_exception_while_retrieving_type_this, new String[]{e.toString()}), e); + targetRequestFailed( + MessageFormat.format( + JDIDebugModelMessages.JDIThisVariable_exception_while_retrieving_type_this, + e.toString()), e); } - // this line will not be exceucted as an exception + // this line will not be executed as an exception // will be throw in type retrieval fails return null; - } - + } + /** * @see org.eclipse.jdt.debug.core.IJavaModifiers#isPrivate() */ + @Override public boolean isPrivate() throws DebugException { try { - return ((ReferenceType)getUnderlyingType()).isPrivate(); + return ((ReferenceType) getUnderlyingType()).isPrivate(); } catch (RuntimeException e) { - targetRequestFailed(JDIDebugModelMessages.JDIThisVariable_Exception_occurred_while_retrieving_modifiers__1, e); + targetRequestFailed( + JDIDebugModelMessages.JDIThisVariable_Exception_occurred_while_retrieving_modifiers__1, + e); } - // this line will not be exceucted as an exception - // will be throw + // this line will not be executed as an exception + // will be throw return false; } /** * @see org.eclipse.jdt.debug.core.IJavaModifiers#isProtected() */ + @Override public boolean isProtected() throws DebugException { try { - return ((ReferenceType)getUnderlyingType()).isProtected(); + return ((ReferenceType) getUnderlyingType()).isProtected(); } catch (RuntimeException e) { - targetRequestFailed(JDIDebugModelMessages.JDIThisVariable_Exception_occurred_while_retrieving_modifiers__1, e); - } - // this line will not be exceucted as an exception + targetRequestFailed( + JDIDebugModelMessages.JDIThisVariable_Exception_occurred_while_retrieving_modifiers__1, + e); + } + // this line will not be executed as an exception // will be throw return false; } @@ -133,23 +151,27 @@ public class JDIThisVariable extends JDIVariable { /** * @see org.eclipse.jdt.debug.core.IJavaModifiers#isPublic() */ + @Override public boolean isPublic() throws DebugException { try { - return ((ReferenceType)getUnderlyingType()).isPublic(); + return ((ReferenceType) getUnderlyingType()).isPublic(); } catch (RuntimeException e) { - targetRequestFailed(JDIDebugModelMessages.JDIThisVariable_Exception_occurred_while_retrieving_modifiers__1, e); - } - // this line will not be exceucted as an exception - // will be throw + targetRequestFailed( + JDIDebugModelMessages.JDIThisVariable_Exception_occurred_while_retrieving_modifiers__1, + e); + } + // this line will not be executed as an exception + // will be throw return false; } /** * @see java.lang.Object#equals(Object) */ + @Override public boolean equals(Object o) { if (o instanceof JDIThisVariable) { - return ((JDIThisVariable)o).fObject.equals(fObject); + return ((JDIThisVariable) o).fObject.equals(fObject); } return false; } @@ -157,6 +179,7 @@ public class JDIThisVariable extends JDIVariable { /** * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { return fObject.hashCode(); } |