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


Java PsiUtil.isLocalOrAnonymousClass方法代码示例

本文整理汇总了Java中com.intellij.psi.util.PsiUtil.isLocalOrAnonymousClass方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtil.isLocalOrAnonymousClass方法的具体用法?Java PsiUtil.isLocalOrAnonymousClass怎么用?Java PsiUtil.isLocalOrAnonymousClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.util.PsiUtil的用法示例。


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

示例1: getNonAnonymousClassName

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
public static String getNonAnonymousClassName(PsiClass aClass) {
  if (PsiUtil.isLocalOrAnonymousClass(aClass)) {
    return null;
  }
  String name = aClass.getName();
  if (name == null) {
    return null;
  }
  PsiClass parentClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class, true);
  if (parentClass != null) {
    final String parentName = getNonAnonymousClassName(parentClass);
    if (parentName == null) {
      return null;
    }
    return parentName + "$" + name;
  }
  return DebuggerManager.getInstance(aClass.getProject()).getVMClassQualifiedName(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JVMNameUtil.java

示例2: createInitialStates

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
private Collection<DfaMemoryState> createInitialStates(@NotNull PsiElement psiBlock, InstructionVisitor visitor) {
  PsiClass containingClass = PsiTreeUtil.getParentOfType(psiBlock, PsiClass.class);
  if (containingClass != null && PsiUtil.isLocalOrAnonymousClass(containingClass)) {
    final PsiElement parent = containingClass.getParent();
    final PsiCodeBlock block = DfaPsiUtil.getTopmostBlockInSameClass(parent);
    if ((parent instanceof PsiNewExpression || parent instanceof PsiDeclarationStatement) && block != null) {
      final RunnerResult result = analyzeMethod(block, visitor);
      if (result == RunnerResult.OK) {
        final Collection<DfaMemoryState> closureStates = myNestedClosures.get(DfaPsiUtil.getTopmostBlockInSameClass(psiBlock));
        if (!closureStates.isEmpty()) {
          return closureStates;
        }
      }
      return null;
    }
  }

  return Collections.singletonList(createMemoryState());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DataFlowRunner.java

示例3: analyzeCodeBlock

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private void analyzeCodeBlock(@Nullable final PsiElement scope, ProblemsHolder holder, final boolean onTheFly) {
  if (scope == null) return;

  PsiClass containingClass = PsiTreeUtil.getParentOfType(scope, PsiClass.class);
  if (containingClass != null && PsiUtil.isLocalOrAnonymousClass(containingClass) && !(containingClass instanceof PsiEnumConstantInitializer)) return;

  final StandardDataFlowRunner dfaRunner = new StandardDataFlowRunner(TREAT_UNKNOWN_MEMBERS_AS_NULLABLE, !isInsideConstructorOrInitializer(
    scope)) {
    @Override
    protected boolean shouldCheckTimeLimit() {
      if (!onTheFly) return false;
      return super.shouldCheckTimeLimit();
    }
  };
  analyzeDfaWithNestedClosures(scope, holder, dfaRunner, Arrays.asList(dfaRunner.createMemoryState()), onTheFly);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DataFlowInspectionBase.java

示例4: getSuperClass

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
@Override
public ResolvedClass getSuperClass() {
  if (myClass != null) {
    PsiClass superClass = myClass.getSuperClass();
    // When you make an anonymous inner class from an interface like this,
    // we want to treat the interface itself as the "super class"
    //   public View.OnClickListener onSave = new View.OnClickListener() {
    //     @Override
    //     public void onClick(View v) {
    //       ..
    if (PsiUtil.isLocalOrAnonymousClass(myClass)) {
      PsiClass[] interfaces = myClass.getInterfaces();
      if (interfaces.length > 0) {
        return new ResolvedPsiClass(interfaces[0]);
      }
    }
    if (superClass != null) {
      return new ResolvedPsiClass(superClass);
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:LombokPsiParser.java


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