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


Java InheritanceUtil类代码示例

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


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

示例1: visitClass

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
    return;
  }
  if (aClass instanceof PsiTypeParameter) {
    return;
  }
  if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return;
  }
  if (!InheritanceUtil.hasOneInheritor(aClass)) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AbstractClassWithOnlyOneDirectInheritorInspection.java

示例2: visitClass

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (!aClass.isInterface() || aClass.isAnnotationType()) {
    return;
  }
  if (ignoreInterfacesThatOnlyDeclareConstants &&
      aClass.getMethods().length == 0) {
    if (aClass.getFields().length != 0) {
      return;
    }
  }
  if (InheritanceUtil.hasImplementation(aClass)) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InterfaceNeverImplementedInspection.java

示例3: visitClass

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (!aClass.isInterface() || aClass.isAnnotationType()) {
    return;
  }
  if (!InheritanceUtil.hasOneInheritor(aClass)) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:InterfaceWithOnlyOneDirectInheritorInspection.java

示例4: visitClass

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (aClass.isInterface() || aClass.isAnnotationType()) {
    return;
  }
  if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return;
  }
  if (InheritanceUtil.hasImplementation(aClass)) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AbstractClassNeverImplementedInspection.java

示例5: visitInstanceOfExpression

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitInstanceOfExpression(@NotNull PsiInstanceOfExpression expression) {
  super.visitInstanceOfExpression(expression);
  final PsiTypeElement castTypeElement = expression.getCheckType();
  if (castTypeElement == null) {
    return;
  }
  final PsiType castType = castTypeElement.getType();
  if (!(castType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType castClassType = (PsiClassType)castType;
  final PsiExpression operand = expression.getOperand();
  final PsiType operandType = operand.getType();
  if (!(operandType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType operandClassType = (PsiClassType)operandType;
  final PsiClass castClass = castClassType.resolve();
  if (castClass == null || !castClass.isInterface()) {
    return;
  }
  final PsiClass operandClass = operandClassType.resolve();
  if (operandClass == null || operandClass.isInterface()) {
    return;
  }
  if (InheritanceUtil.existsMutualSubclass(operandClass, castClass, isOnTheFly())) {
    return;
  }
  registerError(castTypeElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:InstanceofIncompatibleInterfaceInspection.java

示例6: visitTypeCastExpression

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitTypeCastExpression(@NotNull PsiTypeCastExpression expression) {
  super.visitTypeCastExpression(expression);
  final PsiTypeElement castTypeElement = expression.getCastType();
  if (castTypeElement == null) {
    return;
  }
  final PsiType castType = castTypeElement.getType();
  if (!(castType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType castClassType = (PsiClassType)castType;
  final PsiExpression operand = expression.getOperand();
  if (operand == null) {
    return;
  }
  final PsiType operandType = operand.getType();
  if (!(operandType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType operandClassType = (PsiClassType)operandType;
  final PsiClass castClass = castClassType.resolve();
  if (castClass == null || !castClass.isInterface()) {
    return;
  }
  final PsiClass operandClass = operandClassType.resolve();
  if (operandClass == null || operandClass.isInterface()) {
    return;
  }
  if (InheritanceUtil.existsMutualSubclass(operandClass, castClass, isOnTheFly())) {
    return;
  }
  registerError(castTypeElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:CastToIncompatibleInterfaceInspection.java

示例7: visitInstanceOfExpression

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitInstanceOfExpression(
  @NotNull PsiInstanceOfExpression expression) {
  super.visitInstanceOfExpression(expression);
  final PsiTypeElement castTypeElement = expression.getCheckType();
  if (castTypeElement == null) {
    return;
  }
  final PsiType castType = castTypeElement.getType();
  if (!(castType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType castClassType = (PsiClassType)castType;
  final PsiExpression operand = expression.getOperand();
  final PsiType operandType = operand.getType();
  if (!(operandType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType operandClassType = (PsiClassType)operandType;
  final PsiClass castClass = castClassType.resolve();
  if (castClass == null) {
    return;
  }
  if (!castClass.isInterface()) {
    return;
  }
  final PsiClass operandClass = operandClassType.resolve();
  if (operandClass == null) {
    return;
  }
  if (operandClass.isInterface()) {
    return;
  }
  if (InheritanceUtil.existsMutualSubclass(operandClass, castClass)) {
    return;
  }
  registerError(castTypeElement);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:39,代码来源:InstanceofIncompatibleInterfaceInspection.java

示例8: visitTypeCastExpression

import com.siyeh.ig.psiutils.InheritanceUtil; //导入依赖的package包/类
@Override
public void visitTypeCastExpression(
  @NotNull PsiTypeCastExpression expression) {
  super.visitTypeCastExpression(expression);
  final PsiTypeElement castTypeElement = expression.getCastType();
  if (castTypeElement == null) {
    return;
  }
  final PsiType castType = castTypeElement.getType();
  if (!(castType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType castClassType = (PsiClassType)castType;
  final PsiExpression operand = expression.getOperand();
  if (operand == null) {
    return;
  }
  final PsiType operandType = operand.getType();
  if (!(operandType instanceof PsiClassType)) {
    return;
  }
  final PsiClassType operandClassType = (PsiClassType)operandType;
  final PsiClass castClass = castClassType.resolve();
  if (castClass == null) {
    return;
  }
  if (!castClass.isInterface()) {
    return;
  }
  final PsiClass operandClass = operandClassType.resolve();
  if (operandClass == null) {
    return;
  }
  if (operandClass.isInterface()) {
    return;
  }
  if (InheritanceUtil.existsMutualSubclass(operandClass, castClass)) {
    return;
  }
  registerError(castTypeElement);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:42,代码来源:CastToIncompatibleInterfaceInspection.java


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