本文整理汇总了Java中com.intellij.psi.util.PsiUtil.isLocalClass方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtil.isLocalClass方法的具体用法?Java PsiUtil.isLocalClass怎么用?Java PsiUtil.isLocalClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiUtil
的用法示例。
在下文中一共展示了PsiUtil.isLocalClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClassFilter
import com.intellij.psi.util.PsiUtil; //导入方法依赖的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;
}
示例2: getClassVMName
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
public static String getClassVMName(@Nullable PsiClass containingClass) {
// no support for local classes for now
if (containingClass == null || PsiUtil.isLocalClass(containingClass)) return null;
if (containingClass instanceof PsiAnonymousClass) {
String parentName = getClassVMName(PsiTreeUtil.getParentOfType(containingClass, PsiClass.class));
if (parentName == null) {
return null;
}
else {
return parentName + JavaAnonymousClassesHelper.getName((PsiAnonymousClass)containingClass);
}
}
return ClassUtil.getJVMClassName(containingClass);
}
示例3: visitReferenceElement
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
super.visitReferenceElement(reference);
if (reference.getQualifier() != null) {
return;
}
final PsiElement target = reference.resolve();
if (!(target instanceof PsiClass) || !PsiUtil.isLocalClass((PsiClass)target)) {
return;
}
referenceToLocalClass = true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AnonymousInnerClassMayBeStaticInspectionBase.java
示例4: visitReturnStatement
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void visitReturnStatement(PsiReturnStatement statement) {
super.visitReturnStatement(statement);
final PsiExpression expression = ParenthesesUtils.stripParentheses(statement.getReturnValue());
if (expression == null) {
return;
}
final PsiMethod method = PsiTreeUtil.getParentOfType(statement, PsiMethod.class, true, PsiLambdaExpression.class);
if (method == null || method.hasModifierProperty(PsiModifier.PRIVATE)) {
return;
}
else if (ignoreNonPublic &&
(method.hasModifierProperty(PsiModifier.PROTECTED) || method.hasModifierProperty(PsiModifier.PACKAGE_LOCAL))) {
return;
}
if (expression instanceof PsiNewExpression) {
final PsiNewExpression newExpression = (PsiNewExpression)expression;
final PsiAnonymousClass anonymousClass = newExpression.getAnonymousClass();
if (anonymousClass != null) {
registerStatementError(statement, ClassType.ANONYMOUS_CLASS);
return;
}
}
final PsiType type = expression.getType();
if (!(type instanceof PsiClassType)) {
return;
}
final PsiClassType classType = (PsiClassType)type;
final PsiClass aClass = classType.resolve();
if (aClass == null) {
return;
}
if (PsiUtil.isLocalClass(aClass)) {
registerStatementError(statement, ClassType.LOCAL_CLASS, aClass);
return;
}
final PsiClass containingClass = aClass.getContainingClass();
if (containingClass == null || aClass.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
registerStatementError(statement, ClassType.INNER_CLASS, aClass);
}