当前位置: 首页>>代码示例>>Java>>正文


Java JVMNameUtil类代码示例

本文整理汇总了Java中com.intellij.debugger.engine.JVMNameUtil的典型用法代码示例。如果您正苦于以下问题:Java JVMNameUtil类的具体用法?Java JVMNameUtil怎么用?Java JVMNameUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JVMNameUtil类属于com.intellij.debugger.engine包,在下文中一共展示了JVMNameUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertToWrapper

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
private static Value convertToWrapper(EvaluationContextImpl context, PrimitiveValue value, String wrapperTypeName) throws
                                                                                                                          EvaluateException {
  final DebugProcessImpl process = context.getDebugProcess();
  final ClassType wrapperClass = (ClassType)process.findClass(context, wrapperTypeName, null);
  final String methodSignature = "(" + JVMNameUtil.getPrimitiveSignature(value.type().name()) + ")L" + wrapperTypeName.replace('.', '/') + ";";

  List<Method> methods = wrapperClass.methodsByName("valueOf", methodSignature);
  if (methods.size() == 0) { // older JDK version
    methods = wrapperClass.methodsByName(JVMNameUtil.CONSTRUCTOR_NAME, methodSignature);
  }
  if (methods.size() == 0) {
    throw new EvaluateException("Cannot construct wrapper object for value of type " + value.type() + ": Unable to find either valueOf() or constructor method");
  }

  return process.invokeMethod(context, wrapperClass, methods.get(0), Collections.singletonList(value));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BoxingEvaluator.java

示例2: visitArrayInitializerExpression

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Override
public void visitArrayInitializerExpression(PsiArrayInitializerExpression expression) {
  PsiExpression[] initializers = expression.getInitializers();
  Evaluator[] evaluators = new Evaluator[initializers.length];
  final PsiType type = expression.getType();
  boolean primitive = type instanceof PsiArrayType && ((PsiArrayType)type).getComponentType() instanceof PsiPrimitiveType;
  for (int idx = 0; idx < initializers.length; idx++) {
    PsiExpression initializer = initializers[idx];
    initializer.accept(this);
    if (myResult != null) {
      final Evaluator coerced =
        primitive ? handleUnaryNumericPromotion(initializer.getType(), myResult) : new BoxingEvaluator(myResult);
      evaluators[idx] = new DisableGC(coerced);
    }
    else {
      throwExpressionInvalid(initializer);
    }
  }
  myResult = new ArrayInitializerEvaluator(evaluators);
  if (type != null && !(expression.getParent() instanceof PsiNewExpression)) {
    myResult = new NewArrayInstanceEvaluator(new TypeEvaluator(JVMNameUtil.getJVMQualifiedName(type)),
                                             null,
                                             myResult);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:EvaluatorBuilderImpl.java

示例3: addBreakpoint

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Nullable
@Override
public XBreakpoint<JavaExceptionBreakpointProperties> addBreakpoint(final Project project, JComponent parentComponent) {
  final PsiClass throwableClass =
    JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_THROWABLE, GlobalSearchScope.allScope(project));
  TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
    .createInheritanceClassChooser(DebuggerBundle.message("add.exception.breakpoint.classchooser.title"),
                                   GlobalSearchScope.allScope(project), throwableClass, true, true, null);
  chooser.showDialog();
  final PsiClass selectedClass = chooser.getSelected();
  final String qName = selectedClass == null ? null : JVMNameUtil.getNonAnonymousClassName(selectedClass);

  if (qName != null && qName.length() > 0) {
    return ApplicationManager.getApplication().runWriteAction(new Computable<XBreakpoint<JavaExceptionBreakpointProperties>>() {
     @Override
     public XBreakpoint<JavaExceptionBreakpointProperties> compute() {
       return XDebuggerManager.getInstance(project).getBreakpointManager().addBreakpoint(
         JavaExceptionBreakpointType.this, new JavaExceptionBreakpointProperties(qName, ((PsiClassOwner)selectedClass.getContainingFile()).getPackageName()));
     }
   });
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaExceptionBreakpointType.java

示例4: createURLArray

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
private static ArrayReference createURLArray(EvaluationContext context)
  throws EvaluateException, InvocationException, InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException {
  DebugProcess process = context.getDebugProcess();
  ArrayType arrayType = (ArrayType)process.findClass(context, "java.net.URL[]", context.getClassLoader());
  ArrayReference arrayRef = arrayType.newInstance(1);
  DebuggerUtilsEx.keep(arrayRef, context);
  ClassType classType = (ClassType)process.findClass(context, "java.net.URL", context.getClassLoader());
  VirtualMachineProxyImpl proxy = (VirtualMachineProxyImpl)process.getVirtualMachineProxy();
  StringReference url = proxy.mirrorOf("file:a");
  DebuggerUtilsEx.keep(url, context);
  ObjectReference reference = process.newInstance(context,
                                                  classType,
                                                  classType.concreteMethodByName(JVMNameUtil.CONSTRUCTOR_NAME, "(Ljava/lang/String;)V"),
                                                  Collections.singletonList(url));
  DebuggerUtilsEx.keep(reference, context);
  arrayRef.setValues(Collections.singletonList(reference));
  return arrayRef;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ClassLoadingUtils.java

示例5: appendJvmSignature

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
private static boolean appendJvmSignature(@NonNull StringBuilder buffer, @Nullable PsiType type) {
  if (type == null) {
    return false;
  }
  final PsiType psiType = TypeConversionUtil.erasure(type);
  if (psiType instanceof PsiArrayType) {
    buffer.append('[');
    appendJvmSignature(buffer, ((PsiArrayType)psiType).getComponentType());
  }
  else if (psiType instanceof PsiClassType) {
    PsiClass resolved = ((PsiClassType)psiType).resolve();
    if (resolved == null) {
      return false;
    }
    if (!appendJvmTypeName(buffer, resolved)) {
      return false;
    }
  }
  else if (psiType instanceof PsiPrimitiveType) {
    buffer.append(JVMNameUtil.getPrimitiveSignature(psiType.getCanonicalText()));
  }
  else {
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:IntellijLintUtils.java

示例6: convertToWrapper

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
private static Value convertToWrapper(EvaluationContextImpl context, PrimitiveValue value, String wrapperTypeName) throws
                                                                                                                          EvaluateException {
  final DebugProcessImpl process = context.getDebugProcess();
  final ClassType wrapperClass = (ClassType)process.findClass(context, wrapperTypeName, null);
  final String methodSignature = "(" + JVMNameUtil.getPrimitiveSignature(value.type().name()) + ")L" + wrapperTypeName.replace('.', '/') + ";";

  List<Method> methods = wrapperClass.methodsByName("valueOf", methodSignature);
  if (methods.size() == 0) { // older JDK version
    methods = wrapperClass.methodsByName("<init>", methodSignature);
  }
  if (methods.size() == 0) {
    throw new EvaluateException("Cannot construct wrapper object for value of type " + value.type() + ": Unable to find either valueOf() or constructor method");
  }
  
  final Method factoryMethod = methods.get(0);

  final ArrayList args = new ArrayList();
  args.add(value);
  
  return process.invokeMethod(context, wrapperClass, factoryMethod, args);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:BoxingEvaluator.java

示例7: visitInstanceOfExpression

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Override
    public void visitInstanceOfExpression(PsiInstanceOfExpression expression) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("visitInstanceOfExpression " + expression);
      }
      PsiTypeElement checkType = expression.getCheckType();
      if(checkType == null) {
        throwEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", expression.getText()));
        return;
      }
      PsiType type = checkType.getType();
      expression.getOperand().accept(this);
//    ClassObjectEvaluator typeEvaluator = new ClassObjectEvaluator(type.getCanonicalText());
      Evaluator operandEvaluator = myResult;
      myResult = new InstanceofEvaluator(operandEvaluator, new TypeEvaluator(JVMNameUtil.getJVMQualifiedName(type)));
    }
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:EvaluatorBuilderImpl.java

示例8: addBreakpoint

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Override
public Breakpoint addBreakpoint(Project project) {
  ExceptionBreakpoint breakpoint = null;
  final PsiClass throwableClass =
    JavaPsiFacade.getInstance(project).findClass("java.lang.Throwable", GlobalSearchScope.allScope(project));
  TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
    .createInheritanceClassChooser(DebuggerBundle.message("add.exception.breakpoint.classchooser.title"),
                                   GlobalSearchScope.allScope(project), throwableClass, true, true, null);
  chooser.showDialog();
  PsiClass selectedClass = chooser.getSelected();
  String qName = selectedClass == null ? null : JVMNameUtil.getNonAnonymousClassName(selectedClass);

  if (qName != null && qName.length() > 0) {
    breakpoint = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager()
      .addExceptionBreakpoint(qName, ((PsiClassOwner)selectedClass.getContainingFile()).getPackageName());
  }
  return breakpoint;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ExceptionBreakpointFactory.java

示例9: visitInstanceOfExpression

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Override
public void visitInstanceOfExpression(PsiInstanceOfExpression expression)
{
	if(LOG.isDebugEnabled())
	{
		LOG.debug("visitInstanceOfExpression " + expression);
	}
	PsiTypeElement checkType = expression.getCheckType();
	if(checkType == null)
	{
		throwExpressionInvalid(expression);
	}
	PsiType type = checkType.getType();
	expression.getOperand().accept(this);
	//    ClassObjectEvaluator typeEvaluator = new ClassObjectEvaluator(type.getCanonicalText());
	Evaluator operandEvaluator = myResult;
	myResult = new InstanceofEvaluator(operandEvaluator, new TypeEvaluator(JVMNameUtil.getJVMQualifiedName(type)));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:EvaluatorBuilderImpl.java

示例10: addBreakpoint

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Nullable
@Override
public XBreakpoint<JavaExceptionBreakpointProperties> addBreakpoint(final Project project, JComponent parentComponent)
{
	final PsiClass throwableClass = JavaPsiFacade.getInstance(project).findClass("java.lang.Throwable", GlobalSearchScope.allScope(project));
	TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project).createInheritanceClassChooser(DebuggerBundle.message("add.exception" +
			".breakpoint.classchooser.title"), GlobalSearchScope.allScope(project), throwableClass, true, true, null);
	chooser.showDialog();
	final PsiClass selectedClass = chooser.getSelected();
	final String qName = selectedClass == null ? null : JVMNameUtil.getNonAnonymousClassName(selectedClass);

	if(qName != null && qName.length() > 0)
	{
		return ApplicationManager.getApplication().runWriteAction(new Computable<XBreakpoint<JavaExceptionBreakpointProperties>>()
		{
			@Override
			public XBreakpoint<JavaExceptionBreakpointProperties> compute()
			{
				return XDebuggerManager.getInstance(project).getBreakpointManager().addBreakpoint(JavaExceptionBreakpointType.this,
						new JavaExceptionBreakpointProperties(qName, ((PsiClassOwner) selectedClass.getContainingFile()).getPackageName()));
			}
		});
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:JavaExceptionBreakpointType.java

示例11: getClassLoader

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
public static ClassLoaderReference getClassLoader(EvaluationContext context, DebugProcess process) throws EvaluateException
{
	try
	{
		// TODO [egor]: cache?
		ClassType loaderClass = (ClassType) process.findClass(context, "java.net.URLClassLoader", context.getClassLoader());
		Method ctorMethod = loaderClass.concreteMethodByName(JVMNameUtil.CONSTRUCTOR_NAME, "([Ljava/net/URL;Ljava/lang/ClassLoader;)V");
		ClassLoaderReference reference = (ClassLoaderReference) process.newInstance(context, loaderClass, ctorMethod, Arrays.asList(createURLArray(context), context.getClassLoader()));
		DebuggerUtilsEx.keep(reference, context);
		return reference;
	}
	catch(Exception e)
	{
		throw new EvaluateException("Error creating evaluation class loader: " + e, e);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:ClassLoadingUtils.java

示例12: evaluate

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
  DebugProcessImpl debugProcess = context.getDebugProcess();
  Object obj = myClassTypeEvaluator.evaluate(context);
  if (!(obj instanceof ClassType)) {
    throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.evaluate.class.type"));
  }
  ClassType classType = (ClassType)obj;
  // find constructor
  Method method = DebuggerUtils.findMethod(classType, JVMNameUtil.CONSTRUCTOR_NAME, myConstructorSignature.getName(debugProcess));
  if (method == null) {
    throw EvaluateExceptionUtil.createEvaluateException(
      DebuggerBundle.message("evaluation.error.cannot.resolve.constructor", myConstructorSignature.getDisplayName(debugProcess)));
  }
  // evaluate arguments
  List<Object> arguments;
  if (myParamsEvaluators != null) {
    arguments = new ArrayList<Object>(myParamsEvaluators.length);
    for (Evaluator evaluator : myParamsEvaluators) {
      arguments.add(evaluator.evaluate(context));
    }
  }
  else {
    arguments = Collections.emptyList();
  }
  ObjectReference objRef;
  try {
    objRef = debugProcess.newInstance(context, classType, method, arguments);
  }
  catch (EvaluateException e) {
    throw EvaluateExceptionUtil.createEvaluateException(e);
  }
  return objRef;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:NewClassInstanceEvaluator.java

示例13: createClassFilter

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
public static TargetClassFilter createClassFilter(PsiClass psiClass) {
  if (psiClass instanceof PsiAnonymousClass) {
    return TargetClassFilter.ALL;
  }
  if (PsiUtil.isLocalClass(psiClass)) {
    return new LocalClassFilter(psiClass.getName());
  }
  final String name = JVMNameUtil.getNonAnonymousClassName(psiClass);
  return name != null? new FQNameClassFilter(name) : TargetClassFilter.ALL;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FieldEvaluator.java

示例14: visitInstanceOfExpression

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Override
    public void visitInstanceOfExpression(PsiInstanceOfExpression expression) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("visitInstanceOfExpression " + expression);
      }
      PsiTypeElement checkType = expression.getCheckType();
      if(checkType == null) {
        throwExpressionInvalid(expression);
      }
      PsiType type = checkType.getType();
      expression.getOperand().accept(this);
//    ClassObjectEvaluator typeEvaluator = new ClassObjectEvaluator(type.getCanonicalText());
      Evaluator operandEvaluator = myResult;
      myResult = new InstanceofEvaluator(operandEvaluator, new TypeEvaluator(JVMNameUtil.getJVMQualifiedName(type)));
    }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:EvaluatorBuilderImpl.java

示例15: visitClassObjectAccessExpression

import com.intellij.debugger.engine.JVMNameUtil; //导入依赖的package包/类
@Override
public void visitClassObjectAccessExpression(PsiClassObjectAccessExpression expression) {
  PsiType type = expression.getOperand().getType();

  if (type instanceof PsiPrimitiveType) {
    final JVMName typeName = JVMNameUtil.getJVMRawText(((PsiPrimitiveType)type).getBoxedTypeName());
    myResult = new FieldEvaluator(new TypeEvaluator(typeName), FieldEvaluator.TargetClassFilter.ALL, "TYPE");
  }
  else {
    myResult = new ClassObjectEvaluator(new TypeEvaluator(JVMNameUtil.getJVMQualifiedName(type)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:EvaluatorBuilderImpl.java


注:本文中的com.intellij.debugger.engine.JVMNameUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。