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


Java LibraryUtil类代码示例

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


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

示例1: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  if (!TestNGUtil.hasTest(method)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TestNGMethodNamingConventionInspection.java

示例2: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  if (!TestUtils.isJUnit4TestMethod(method) || !TestUtils.isRunnable(method)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JUnit4MethodNamingConventionInspectionBase.java

示例3: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  if (!TestUtils.isJUnit3TestMethod(method) || !TestUtils.isRunnable(method)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JUnit3MethodNamingConventionInspectionBase.java

示例4: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  if (method.isConstructor()) {
    return;
  }
  if (!method.hasModifierProperty(PsiModifier.NATIVE)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NativeMethodNamingConventionInspectionBase.java

示例5: typeIsConcreteClass

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
public static boolean typeIsConcreteClass(@Nullable PsiType type, boolean ignoreCastToAbstractClass) {
  if (type == null) {
    return false;
  }
  final PsiType baseType = type.getDeepComponentType();
  if (!(baseType instanceof PsiClassType)) {
    return false;
  }
  final PsiClassType classType = (PsiClassType)baseType;
  final PsiClass aClass = classType.resolve();
  if (aClass == null) {
    return false;
  }
  if (ignoreCastToAbstractClass && aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return false;
  }
  if (aClass.isInterface() || aClass.isEnum() || aClass.isAnnotationType()) {
    return false;
  }
  if (aClass instanceof PsiTypeParameter) {
    return false;
  }
  return !LibraryUtil.classIsInLibrary(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ConcreteClassUtil.java

示例6: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  if (ignorePrivateMethodsAndFields &&
      method.hasModifierProperty(PsiModifier.PRIVATE)) {
    return;
  }
  if (isOnTheFly() && !isCheapEnoughToSearch(method)) {
    return;
  }
  final PsiType type = method.getReturnType();
  if (!CollectionUtils.isConcreteCollectionClass(type) || LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }

  checkToWeaken(type, method.getReturnTypeElement(), method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DeclareCollectionAsInterfaceInspection.java

示例7: visitVariable

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitVariable(@NotNull PsiVariable variable) {
  super.visitVariable(variable);
  final PsiType type = variable.getType();
  if (!isObsoleteCollectionType(type)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethodParameter(variable)) {
    return;
  }
  final PsiTypeElement typeElement = variable.getTypeElement();
  if (typeElement == null) {
    return;
  }
  if (ignoreRequiredObsoleteCollectionTypes &&
      isUsedAsParameterForLibraryMethod(variable)) {
    return;
  }
  registerError(typeElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ObsoleteCollectionInspection.java

示例8: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  final PsiType returnType = method.getReturnType();
  if (!isObsoleteCollectionType(returnType)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  final PsiTypeElement typeElement = method.getReturnTypeElement();
  if (typeElement == null) {
    return;
  }
  if (ignoreRequiredObsoleteCollectionTypes &&
      isUsedAsParameterForLibraryMethod(method)) {
    return;
  }
  registerError(typeElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ObsoleteCollectionInspection.java

示例9: visitTypeElement

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitTypeElement(PsiTypeElement typeElement) {
  if (!isNewDateTimeApiPresent(typeElement)) {
    return;
  }
  super.visitTypeElement(typeElement);
  final PsiType type = typeElement.getType();
  if (!isObsoleteDateTimeType(type)) {
    return;
  }
  final PsiElement parent = typeElement.getParent();
  if (parent instanceof PsiMethod) {
    final PsiMethod method = (PsiMethod)parent;
    if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
      return;
    }
  }
  else if (parent instanceof PsiParameter) {
    final PsiParameter parameter = (PsiParameter)parent;
    if (LibraryUtil.isOverrideOfLibraryMethodParameter(parameter)) {
      return;
    }
  }
  registerError(typeElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:UseOfObsoleteDateTimeApiInspection.java

示例10: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  if (ignoreLibraryOverrides && LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  final PsiReferenceList throwsList = method.getThrowsList();
  final PsiJavaCodeReferenceElement[] references = throwsList.getReferenceElements();
  for (PsiJavaCodeReferenceElement reference : references) {
    final PsiElement element = reference.resolve();
    if (!(element instanceof PsiClass)) {
      continue;
    }
    final PsiClass thrownClass = (PsiClass)element;
    final String qualifiedName = thrownClass.getQualifiedName();
    if (qualifiedName != null && exceptions.contains(qualifiedName)) {
      registerError(reference, reference);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BadExceptionDeclaredInspectionBase.java

示例11: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  if (method.isConstructor()) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  final int parametersCount = parameterList.getParametersCount();
  if (parametersCount <= getLimit()) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, Integer.valueOf(parametersCount));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ParametersPerMethodInspection.java

示例12: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  if (method.isConstructor() || method.hasModifierProperty(PsiModifier.STATIC)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly()) {
    if (MethodUtils.hasSuper(method)) {
      return;
    }
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:InstanceMethodNamingConventionInspection.java

示例13: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method)
{
	super.visitMethod(method);
	if(ignorePrivateMethodsAndFields && method.hasModifierProperty(PsiModifier.PRIVATE))
	{
		return;
	}
	if(isOnTheFly() && DeclarationSearchUtils.isTooExpensiveToSearch(method, false))
	{
		return;
	}
	final PsiType type = method.getReturnType();
	if(!CollectionUtils.isConcreteCollectionClass(type) || LibraryUtil.isOverrideOfLibraryMethod(method))
	{
		return;
	}

	checkToWeaken(type, method.getReturnTypeElement(), method);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:DeclareCollectionAsInterfaceInspection.java

示例14: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  final PsiType returnType = method.getReturnType();
  if (returnType == null) {
    return;
  }
  else if (!returnType.equals(PsiType.BOOLEAN)) {
    if (ignoreBooleanMethods || !returnType.equalsToText(CommonClassNames.JAVA_LANG_BOOLEAN)) {
      return;
    }
  }
  if (ignoreInAnnotationInterface) {
    final PsiClass containingClass = method.getContainingClass();
    if (containingClass != null && containingClass.isAnnotationType()) {
      return;
    }
  }
  final String name = method.getName();
  for (String question : questionList) {
    if (name.startsWith(question)) {
      return;
    }
  }
  if (onlyWarnOnBaseMethods) {
    if (MethodUtils.hasSuper(method)) {
      return;
    }
  }
  else if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:BooleanMethodNameMustStartWithQuestionInspectionBase.java

示例15: visitMethod

import com.siyeh.ig.psiutils.LibraryUtil; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  final PsiType returnType = method.getReturnType();
  if (returnType == null || returnType.equals(PsiType.BOOLEAN)) {
    return;
  }
  if (ignoreBooleanMethods && returnType.equalsToText(CommonClassNames.JAVA_LANG_BOOLEAN)) {
    return;
  }
  final String name = method.getName();
  boolean startsWithQuestionWord = false;
  for (String question : questionList) {
    if (name.startsWith(question)) {
      if (name.length() == question.length()) {
        startsWithQuestionWord = true;
        break;
      }
      final char nextChar = name.charAt(question.length());
      if (Character.isUpperCase(nextChar) || nextChar == '_') {
        startsWithQuestionWord = true;
        break;
      }
    }
  }
  if (!startsWithQuestionWord) {
    return;
  }
  if (onlyWarnOnBaseMethods) {
    if (MethodUtils.hasSuper(method)) {
      return;
    }
  }
  else if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:NonBooleanMethodNameMayNotStartWithQuestionInspectionBase.java


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