Exemplo n.º 1
0
 public TypeExpression(final Project project, PsiType[] types) {
   final SmartTypePointerManager manager = SmartTypePointerManager.getInstance(project);
   myItems = new LinkedHashSet<SmartTypePointer>();
   for (final PsiType type : types) {
     myItems.add(manager.createSmartTypePointer(type));
   }
 }
Exemplo n.º 2
0
 public MethodReturnTypeFix(
     @NotNull PsiMethod method, @NotNull PsiType returnType, boolean fixWholeHierarchy) {
   super(method);
   myReturnTypePointer =
       SmartTypePointerManager.getInstance(method.getProject()).createSmartTypePointer(returnType);
   myFixWholeHierarchy = fixWholeHierarchy;
   myName = method.getName();
   myCanonicalText = returnType.getCanonicalText();
 }
 @NotNull
 @Override
 protected InspectionGadgetsFix[] buildFixes(Object... infos) {
   final PsiElement context = (PsiElement) infos[1];
   final SmartTypePointerManager pointerManager =
       SmartTypePointerManager.getInstance(context.getProject());
   final List<PsiType> maskedTypes = (List<PsiType>) infos[0];
   final List<InspectionGadgetsFix> fixes = new ArrayList<>();
   for (PsiType thrown : maskedTypes) {
     final String typeText = thrown.getCanonicalText();
     if (CommonClassNames.JAVA_LANG_RUNTIME_EXCEPTION.equals(typeText)) {
       fixes.add(new ReplaceWithRuntimeExceptionFix());
     } else {
       fixes.add(new AddCatchSectionFix(pointerManager.createSmartTypePointer(thrown), typeText));
     }
   }
   final InspectionGadgetsFix fix = SuppressForTestsScopeFix.build(this, context);
   if (fix != null) {
     fixes.add(fix);
   }
   return fixes.toArray(new InspectionGadgetsFix[fixes.size()]);
 }