1 11 package org.eclipse.jdt.internal.debug.core.model; 12 13 14 import java.util.Collections ; 15 import java.util.List ; 16 17 import org.eclipse.debug.core.DebugException; 18 import org.eclipse.jdt.core.Signature; 19 import org.eclipse.jdt.debug.core.IJavaFieldVariable; 20 import org.eclipse.jdt.debug.core.IJavaObject; 21 import org.eclipse.jdt.debug.core.IJavaThread; 22 import org.eclipse.jdt.debug.core.IJavaType; 23 import org.eclipse.jdt.debug.core.IJavaValue; 24 25 import com.ibm.icu.text.MessageFormat; 26 27 30 public class JDINullValue extends JDIObjectValue { 31 32 33 37 public JDINullValue(JDIDebugTarget target) { 38 super(target, null); 39 } 40 41 44 protected List getVariablesList() { 45 return Collections.EMPTY_LIST; 46 } 47 48 51 public String getReferenceTypeName() { 52 return "null"; } 54 55 58 public String getValueString() { 59 return "null"; } 61 62 65 public String getSignature() { 66 return null; 67 } 68 69 72 public int getArrayLength() { 73 return -1; 74 } 75 76 79 public IJavaType getJavaType() { 80 return null; 81 } 82 83 86 public boolean equals(Object obj) { 87 return obj instanceof JDINullValue; 88 } 89 90 93 public int hashCode() { 94 return getClass().hashCode(); 95 } 96 97 100 public String toString() { 101 return "null"; } 103 104 107 public IJavaFieldVariable getField(String name, boolean superField) { 108 return null; 109 } 110 111 114 public IJavaFieldVariable getField(String name, String typeSignature) { 115 return null; 116 } 117 118 121 public IJavaThread[] getWaitingThreads() { 122 return null; 123 } 124 125 128 public IJavaThread getOwningThread() { 129 return null; 130 } 131 132 135 public IJavaObject[] getReferringObjects(long max) { 136 return new IJavaObject[0]; 137 } 138 139 142 public IJavaValue sendMessage(String selector, String signature, IJavaValue[] args, IJavaThread thread, boolean superSend) throws DebugException{ 143 return npe(selector, signature); 144 } 145 146 149 public IJavaValue sendMessage(String selector, String signature, IJavaValue[] args, IJavaThread thread, String typeSignature) throws DebugException{ 150 return npe(selector, signature); 151 } 152 153 160 private IJavaValue npe(String selector, String signature) throws DebugException { 161 StringBuffer buffer = new StringBuffer (); 162 buffer.append(selector); 163 String [] parameterTypes = Signature.getParameterTypes(signature); 164 buffer.append('('); 165 for (int i = 0; i < parameterTypes.length; i++) { 166 buffer.append(Signature.getSignatureSimpleName(parameterTypes[i].replace('/', '.'))); 167 if (i+1 < parameterTypes.length) { 168 buffer.append(", "); } 170 } 171 buffer.append(')'); 172 requestFailed(MessageFormat.format(JDIDebugModelMessages.JDINullValue_0, new String []{buffer.toString()}), null); 173 return null; 174 } 175 } 176 | Popular Tags |