本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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()]);
}
示例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();
}
示例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);
}
示例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());
}
示例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()]);
}
示例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();
}
示例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();
}
示例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);
}
示例13: buildFix
import com.siyeh.ig.InspectionGadgetsFix; //导入依赖的package包/类
@Override
public InspectionGadgetsFix buildFix(Object... infos) {
if (infos.length == 0) {
return null;
}
return new AutoBoxingFix();
}
示例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()
};
}
}
示例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();
}