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


Java InspectionGadgetsFix类代码示例

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


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

示例1: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
@Nullable
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiJavaFile file = (PsiJavaFile)infos[0];
  final String fileName = file.getName();
  final int prefixIndex = fileName.indexOf((int)'.');
  final String filenameWithoutPrefix = fileName.substring(0, prefixIndex);
  final PsiClass[] classes = file.getClasses();
  for (PsiClass psiClass : classes) {
    final String className = psiClass.getName();
    if (filenameWithoutPrefix.equals(className)) {
      return null;
    }
  }
  return new RenameFix(filenameWithoutPrefix);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ClassNameDiffersFromFileNameInspection.java

示例2: buildFixes

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
  final Object info = infos[0];
  if (!(info instanceof PsiModifierListOwner)) {
    return InspectionGadgetsFix.EMPTY_ARRAY;
  }
  return AddToIgnoreIfAnnotatedByListQuickFix.build((PsiModifierListOwner)info, ignorableAnnotations);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:EmptyClassInspectionBase.java

示例3: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Nullable
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiExpression expression = (PsiExpression)infos[0];
  final Object value = ExpressionUtils.computeConstantExpression(expression);
  if (!(value instanceof  Integer)) {
    return null;
  }
  final int roundingMode = ((Integer)value).intValue();
  if (roundingMode < 0 || roundingMode > 7) {
    return null;
  }
  return new BigDecimalLegacyMethodFix();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:BigDecimalLegacyMethodInspection.java

示例4: buildFixes

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
@NotNull
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
  final Iterable<PsiClass> weakerClasses = (Iterable<PsiClass>)infos[1];
  final Collection<InspectionGadgetsFix> fixes = new ArrayList();
  for (PsiClass weakestClass : weakerClasses) {
    final String className = getClassName(weakestClass);
    if (className == null) {
      continue;
    }
    fixes.add(new TypeMayBeWeakenedFix(className));
  }
  return fixes.toArray(new InspectionGadgetsFix[fixes.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TypeMayBeWeakenedInspection.java

示例5: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiMethod method = (PsiMethod)infos[0];
  if (method.getBody() == null) {
    return null;
  }
  return new SynchronizedMethodFix();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SynchronizedMethodInspection.java

示例6: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
public InspectionGadgetsFix buildFix(Object... infos) {
  final PsiArrayType type = (PsiArrayType)infos[0];
  final PsiType componentType = type.getComponentType();
  if (componentType instanceof PsiArrayType) {
    return new ArrayEqualityFix(true);
  }
  return new ArrayEqualityFix(false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ArrayEqualityInspection.java

示例7: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiTypeCastExpression typeCastExpression =
    (PsiTypeCastExpression)infos[0];
  final StringBuilder replacementText =
    buildReplacementText(typeCastExpression, new StringBuilder());
  return new DoubleLiteralMayBeFloatLiteralFix(replacementText.toString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DoubleLiteralMayBeFloatLiteralInspection.java

示例8: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Nullable
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiMethod method = (PsiMethod)infos[0];
  if (MethodUtils.isOverridden(method)) {
    return null;
  }
  return new MakeMethodFinalFix(method.getName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DesignForExtensionInspection.java

示例9: buildFixes

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
  final List<InspectionGadgetsFix> fixes = new ArrayList<InspectionGadgetsFix>();
  final PsiField field = (PsiField)infos[0];
  fixes.add(new EncapsulateVariableFix(field.getName()));
  AddToIgnoreIfAnnotatedByListQuickFix.build(field, ignorableAnnotations, fixes);
  return fixes.toArray(new InspectionGadgetsFix[fixes.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PublicFieldInspection.java

示例10: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiTypeCastExpression expression = (PsiTypeCastExpression)infos[0];
  final PsiElement parent = expression.getParent();
  if (!(parent instanceof PsiPolyadicExpression)) {
    return null;
  }
  final PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression)parent;
  final IElementType tokenType = polyadicExpression.getOperationTokenType();
  if (JavaTokenType.ASTERISK != tokenType) {
    return null;
  }
  return new MathRandomCastToIntegerFix();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MathRandomCastToIntInspection.java

示例11: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
  final boolean annotationWarning = ((Boolean)infos[0]).booleanValue();
  if (!annotationWarning) {
    return null;
  }
  return new MissingDeprecatedAnnotationFix();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MissingDeprecatedAnnotationInspection.java

示例12: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
@Nullable
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiExpression expression = (PsiExpression)infos[0];
  final boolean removeToString = ((Boolean)infos[1]).booleanValue();
  final PsiArrayType type = (PsiArrayType)expression.getType();
  if (type != null) {
    final PsiType componentType = type.getComponentType();
    if (componentType instanceof PsiArrayType) {
      return new ImplicitArrayToStringFix(true, removeToString);
    }
  }
  return new ImplicitArrayToStringFix(false, removeToString);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ImplicitArrayToStringInspection.java

示例13: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
public InspectionGadgetsFix buildFix(Object... infos) {
  if (infos.length == 0) {
    return null;
  }
  return new AutoBoxingFix();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AutoBoxingInspection.java

示例14: buildFixes

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
@NotNull
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
  final Boolean onTheFly = (Boolean)infos[0];
  if (onTheFly.booleanValue()) {
    return new InspectionGadgetsFix[]{
      new RenameFix(), new MethodNameSameAsClassNameFix()};
  }
  else {
    return new InspectionGadgetsFix[]{
      new MethodNameSameAsClassNameFix()
    };
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MethodNameSameAsClassNameInspection.java

示例15: buildFix

import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
@Nullable
protected InspectionGadgetsFix buildFix(Object... infos) {
  final PsiMethod containingMethod = (PsiMethod)infos[0];
  if (!mayBeReplacedByIterativeMethod(containingMethod)) {
    return null;
  }
  return new RemoveTailRecursionFix();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TailRecursionInspection.java


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