本文整理汇总了Java中com.sun.jdi.ReferenceType类的典型用法代码示例。如果您正苦于以下问题:Java ReferenceType类的具体用法?Java ReferenceType怎么用?Java ReferenceType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReferenceType类属于com.sun.jdi包,在下文中一共展示了ReferenceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustBoxingType
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
public static ReferenceType adjustBoxingType(ReferenceType type, PrimitiveType primitiveType,
EvaluationContext evaluationContext) {
Class typeClass = null;
if (primitiveType instanceof BooleanType) {
typeClass = Boolean.class;
} else
if (primitiveType instanceof ByteType) {
typeClass = Byte.class;
} else
if (primitiveType instanceof CharType) {
typeClass = Character.class;
} else
if (primitiveType instanceof ShortType) {
typeClass = Short.class;
} else
if (primitiveType instanceof IntegerType) {
typeClass = Integer.class;
} else
if (primitiveType instanceof LongType) {
typeClass = Long.class;
} else
if (primitiveType instanceof FloatType) {
typeClass = Float.class;
} else
if (primitiveType instanceof DoubleType) {
typeClass = Double.class;
}
if (typeClass != null) {
type = evaluationContext.getVMCache().getClass(typeClass.getName());
}
return type;
}
示例2: ExceptionRequestImpl
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
ExceptionRequestImpl(ReferenceType refType,
boolean notifyCaught, boolean notifyUncaught) {
exception = refType;
caught = notifyCaught;
uncaught = notifyUncaught;
{
ReferenceTypeImpl exc;
if (exception == null) {
exc = new ClassTypeImpl(vm, 0);
} else {
exc = (ReferenceTypeImpl)exception;
}
filters.add(JDWP.EventRequest.Set.Modifier.ExceptionOnly.
create(exc, caught, uncaught));
}
requestList().add(this);
}
示例3: genericSignature
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
public String genericSignature() {
// This gets both the signature and the generic signature
if (vm.canGet1_5LanguageFeatures() && !genericSignatureGotten) {
// Does not need synchronization, since worst-case
// static info is fetched twice
JDWP.ReferenceType.SignatureWithGeneric result;
try {
result = JDWP.ReferenceType.SignatureWithGeneric.
process(vm, this);
} catch (JDWPException exc) {
throw exc.toJDIException();
}
signature = result.signature;
setGenericSignature(result.genericSignature);
}
return genericSignature;
}
示例4: getArrayClass
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
static ArrayType getArrayClass(VirtualMachine vm, String name) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper {
List<ReferenceType> classList = VirtualMachineWrapper.classesByName(vm, name);
ReferenceType clazz = null;
for (ReferenceType c : classList) {
if (ReferenceTypeWrapper.classLoader(c) == null) {
clazz = c;
break;
}
}
return (ArrayType) clazz;
}
示例5: isAssignableTo
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
boolean isAssignableTo(ReferenceType destType) {
if (destType instanceof ArrayType) {
try {
Type destComponentType = ((ArrayType)destType).componentType();
return isComponentAssignable(destComponentType, componentType());
} catch (ClassNotLoadedException e) {
// One or both component types has not yet been
// loaded => can't assign
return false;
}
} else if (destType instanceof InterfaceType) {
// Only valid InterfaceType assignee is Cloneable
return destType.name().equals("java.lang.Cloneable");
} else {
// Only valid ClassType assignee is Object
return destType.name().equals("java.lang.Object");
}
}
示例6: selectListenerClass
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
private String selectListenerClass(JavaComponentInfo ci) {
List<ReferenceType> attachableListeners = RemoteServices.getAttachableListeners(ci);
//System.err.println("Attachable Listeners = "+attachableListeners);
String[] listData = new String[attachableListeners.size()];
for (int i = 0; i < listData.length; i++) {
listData[i] = attachableListeners.get(i).name();
}
JList jl = new JList(listData);
JScrollPane jsp = new JScrollPane(jl);
NotifyDescriptor nd = new DialogDescriptor(jsp,
NbBundle.getMessage(EventsModel.class, "TTL_SelectListener"),
true, null);
Object res = DialogDisplayer.getDefault().notify(nd);
if (DialogDescriptor.OK_OPTION.equals(res)) {
String clazz = (String) jl.getSelectedValue();
return clazz;
} else {
return null;
}
}
示例7: JPDABreakpointEvent
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
/**
* Creates a new instance of JPDABreakpointEvent. This method should be
* called from debuggerjpda module only. Do not create a new instances
* of this class!
*
* @param sourceBreakpoint a breakpoint
* @param debugger a debugger this
* @param conditionResult a result of condition
* @param thread a context thread
* @param referenceType a context class
* @param variable a context variable
*/
public JPDABreakpointEvent (
JPDABreakpoint sourceBreakpoint,
JPDADebugger debugger,
int conditionResult,
JPDAThread thread,
ReferenceType referenceType,
Variable variable
) {
super (sourceBreakpoint);
this.conditionResult = conditionResult;
this.thread = thread;
this.debugger = debugger;
this.referenceType = referenceType;
this.variable = variable;
}
示例8: getOrLoadClass
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
private static ReferenceType getOrLoadClass(VirtualMachine vm, String name) {
List<ReferenceType> types = vm.classesByName(name);
if (types.size() > 0) {
if (types.size() == 1) {
return types.get(0);
}
try {
ReferenceType preferedType = JPDAUtils.getPreferredReferenceType(types, null);
if (preferedType != null) {
return preferedType;
}
} catch (VMDisconnectedExceptionWrapper ex) {
throw ex.getCause();
}
// No preferred, just take the first one:
return types.get(0);
}
// DO NOT TRY TO LOAD CLASSES AT ALL! See http://www.netbeans.org/issues/show_bug.cgi?id=168949
return null;
}
示例9: methods1_4
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
private List<Method> methods1_4() {
List<Method> methods;
JDWP.ReferenceType.Methods.MethodInfo[] declared;
try {
declared = JDWP.ReferenceType.Methods.
process(vm, this).declared;
} catch (JDWPException exc) {
throw exc.toJDIException();
}
methods = new ArrayList<Method>(declared.length);
for (int i=0; i<declared.length; i++) {
JDWP.ReferenceType.Methods.MethodInfo mi = declared[i];
Method method = MethodImpl.createMethodImpl(vm, this,
mi.methodID,
mi.name, mi.signature,
null,
mi.modBits);
methods.add(method);
}
return methods;
}
示例10: isInstanceOf
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
@Override
public boolean isInstanceOf(String className) {
List<ReferenceType> classTypes;
try {
classTypes = VirtualMachineWrapper.classesByName(MirrorWrapper.virtualMachine(classType), className);
} catch (InternalExceptionWrapper | VMDisconnectedExceptionWrapper ex) {
return false;
}
for (ReferenceType rt : classTypes) {
try {
if (EvaluatorVisitor.instanceOf(classType, rt)) {
return true;
}
} catch (VMDisconnectedException vmdex) {
return false;
} catch (InternalException iex) {
// procceed
}
}
return false;
}
示例11: isSyntheticMethod
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
/**
* Test whether the method is considered to be synthetic
* @param m The method
* @param loc The current location in that method
* @return 0 when not synthetic
* positive when suggested step depth is returned
* negative when is synthetic and no further step depth is suggested.
*/
public static int isSyntheticMethod(Method m, Location loc) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper {
String name = TypeComponentWrapper.name(m);
if (name.startsWith("lambda$")) { // NOI18N
int lineNumber = LocationWrapper.lineNumber(loc);
if (lineNumber == 1) {
// We're in the initialization of the Lambda. We need to step over it.
return StepRequest.STEP_OVER;
}
return 0; // Do not treat Lambda methods as synthetic, because they contain user code.
} else {
// Do check the class for being Lambda synthetic class:
ReferenceType declaringType = LocationWrapper.declaringType(loc);
try {
String className = ReferenceTypeWrapper.name(declaringType);
if (className.contains("$$Lambda$")) { // NOI18N
// Lambda synthetic class
return -1;
}
} catch (ObjectCollectedExceptionWrapper ex) {
}
}
return TypeComponentWrapper.isSynthetic(m) ? -1 : 0;
}
示例12: signature
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
public String signature() {
if (signature == null) {
// Does not need synchronization, since worst-case
// static info is fetched twice
if (vm.canGet1_5LanguageFeatures()) {
/*
* we might as well get both the signature and the
* generic signature.
*/
genericSignature();
} else {
try {
signature = JDWP.ReferenceType.Signature.
process(vm, this).signature;
} catch (JDWPException exc) {
throw exc.toJDIException();
}
}
}
return signature;
}
示例13: getConcreteMethod
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
private static Method getConcreteMethod(ReferenceType type, String methodName,
String firstParamSignature,
List<? extends TypeMirror> typeArguments) throws UnsuitableArgumentsException {
List<Method> methods = type.methodsByName(methodName);
String signature = createSignature(firstParamSignature, typeArguments);
boolean constructor = "<init>".equals(methodName);
for (Method method : methods) {
if (!method.isAbstract() &&
(!constructor || type.equals(method.declaringType())) &&
equalMethodSignatures(method.signature(), signature)) {
return method;
}
}
if (methods.size() > 0) {
throw new UnsuitableArgumentsException();
}
return null;
}
示例14: isAssignableTo
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
@Override
boolean isAssignableTo(ReferenceType type) {
ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
if (this.equals(type)) {
return true;
} else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
return true;
} else {
List<InterfaceType> interfaces = interfaces();
Iterator<InterfaceType> iter = interfaces.iterator();
while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
if (interfaze.isAssignableTo(type)) {
return true;
}
}
return false;
}
}
示例15: findEnclosingType
import com.sun.jdi.ReferenceType; //导入依赖的package包/类
private ReferenceType findEnclosingType(ReferenceType type, String name, VMCache cache) {
if (type.name().equals(name)) {
return type;
}
ReferenceType enclosingType;
enclosingType = cache.getEnclosingType(type, name);
if (enclosingType == null) {
List<ReferenceType> classes = type.virtualMachine().classesByName(name);
if (classes.size() == 1) {
enclosingType = classes.get(0);
} else {
for (ReferenceType clazz : classes) {
if (isNestedOf(clazz, type)) {
enclosingType = clazz;
break;
}
}
}
if (enclosingType != null) {
cache.setEnclosingType(type, name, enclosingType);
}
}
long end = System.nanoTime();
return enclosingType;
}