本文整理汇总了Java中com.intellij.psi.util.PsiUtil.isIgnoredName方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtil.isIgnoredName方法的具体用法?Java PsiUtil.isIgnoredName怎么用?Java PsiUtil.isIgnoredName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiUtil
的用法示例。
在下文中一共展示了PsiUtil.isIgnoredName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkCatchSection
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private void checkCatchSection(PsiCatchSection section) {
final PsiCodeBlock block = section.getCatchBlock();
if (block == null || !isEmpty(block)) {
return;
}
final PsiParameter parameter = section.getParameter();
if (parameter == null) {
return;
}
final PsiIdentifier identifier = parameter.getNameIdentifier();
if (identifier == null) {
return;
}
@NonNls final String parameterName = parameter.getName();
if (m_ignoreIgnoreParameter && PsiUtil.isIgnoredName(parameterName)) {
return;
}
final PsiElement catchToken = section.getFirstChild();
if (catchToken == null) {
return;
}
registerError(catchToken, catchToken);
}
示例2: checkCatchSection
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private void checkCatchSection(PsiCatchSection section) {
final PsiParameter parameter = section.getParameter();
if (parameter == null) {
return;
}
@NonNls final String parameterName = parameter.getName();
final PsiCodeBlock block = section.getCatchBlock();
if (block == null) {
return;
}
if (m_ignoreCatchBlocksWithComments) {
final PsiElement[] children = block.getChildren();
for (final PsiElement child : children) {
if (child instanceof PsiComment) {
return;
}
}
}
final CatchParameterUsedVisitor visitor =
new CatchParameterUsedVisitor(parameter);
block.accept(visitor);
final boolean namedIgnore = PsiUtil.isIgnoredName(parameterName);
if (visitor.isUsed()) {
if (namedIgnore) {
registerVariableError(parameter, Boolean.TRUE, parameter);
}
return;
}
else if (namedIgnore) {
return;
}
registerVariableError(parameter, Boolean.FALSE, parameter);
}
示例3: visitThrowStatement
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void visitThrowStatement(PsiThrowStatement statement) {
super.visitThrowStatement(statement);
final PsiCatchSection catchSection = PsiTreeUtil.getParentOfType(statement, PsiCatchSection.class, true, PsiClass.class);
if (catchSection == null) {
return;
}
final PsiParameter parameter = catchSection.getParameter();
if (parameter == null) {
return;
}
@NonNls final String parameterName = parameter.getName();
if (PsiUtil.isIgnoredName(parameterName)) {
return;
}
final PsiExpression exception = statement.getException();
if (exception == null) {
return;
}
if (ignoreCantWrap) {
final PsiType thrownType = exception.getType();
if (thrownType instanceof PsiClassType) {
final PsiClassType classType = (PsiClassType)thrownType;
final PsiClass exceptionClass = classType.resolve();
if (exceptionClass != null) {
final PsiMethod[] constructors = exceptionClass.getConstructors();
final PsiClassType throwableType = TypeUtils.getType(CommonClassNames.JAVA_LANG_THROWABLE, statement);
boolean canWrap = false;
outer:
for (PsiMethod constructor : constructors) {
final PsiParameterList parameterList = constructor.getParameterList();
final PsiParameter[] parameters = parameterList.getParameters();
for (PsiParameter constructorParameter : parameters) {
final PsiType type = constructorParameter.getType();
if (throwableType.equals(type)) {
canWrap = true;
break outer;
}
}
}
if (!canWrap) {
return;
}
}
}
}
final ReferenceFinder visitor = new ReferenceFinder(parameter);
exception.accept(visitor);
if (visitor.usesParameter()) {
return;
}
registerStatementError(statement);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:ExceptionFromCatchWhichDoesntWrapInspection.java