boolean hasPrivateConstructor(PsiClass aClass) {
   final PsiMethod[] constructors = aClass.getConstructors();
   for (final PsiMethod constructor : constructors) {
     if (constructor.hasModifierProperty(PsiModifier.PRIVATE)) {
       return true;
     }
   }
   return false;
 }
 private boolean hasOnlyMain(PsiClass aClass) {
   final PsiMethod[] methods = aClass.getMethods();
   if (methods.length == 0) {
     return false;
   }
   for (PsiMethod method : methods) {
     if (method.isConstructor()) {
       continue;
     }
     if (!method.hasModifierProperty(PsiModifier.STATIC)) {
       return false;
     }
     if (method.hasModifierProperty(PsiModifier.PRIVATE)) {
       continue;
     }
     if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
       return false;
     }
     final String name = method.getName();
     if (!name.equals(HardcodedMethodConstants.MAIN)) {
       return false;
     }
     final PsiType returnType = method.getReturnType();
     if (!PsiType.VOID.equals(returnType)) {
       return false;
     }
     final PsiParameterList parameterList = method.getParameterList();
     if (parameterList.getParametersCount() != 1) {
       return false;
     }
     final PsiParameter[] parameters = parameterList.getParameters();
     final PsiParameter parameter = parameters[0];
     final PsiType type = parameter.getType();
     if (!type.equalsToText("java.lang.String[]")) {
       return false;
     }
   }
   return true;
 }
 private static PsiSubstitutor checkRaw(
     boolean isRaw,
     @NotNull PsiElementFactory factory,
     @NotNull PsiMethod candidateMethod,
     @NotNull PsiSubstitutor substitutor) {
   if (isRaw
       && !candidateMethod.hasModifierProperty(
           PsiModifier.STATIC)) { // static methods are not erased due to raw overriding
     PsiTypeParameter[] methodTypeParameters = candidateMethod.getTypeParameters();
     substitutor = factory.createRawSubstitutor(substitutor, methodTypeParameters);
   }
   return substitutor;
 }
 @NotNull
 private List<PsiMethod> getMethodsToImport() {
   PsiShortNamesCache cache = PsiShortNamesCache.getInstance(myMethodCall.getProject());
   PsiMethodCallExpression element = myMethodCall.getElement();
   PsiReferenceExpression reference = element.getMethodExpression();
   PsiExpressionList argumentList = element.getArgumentList();
   String name = reference.getReferenceName();
   List<PsiMethod> list = new ArrayList<PsiMethod>();
   if (name == null) return list;
   GlobalSearchScope scope = element.getResolveScope();
   PsiMethod[] methods = cache.getMethodsByNameIfNotMoreThan(name, scope, 20);
   List<PsiMethod> applicableList = new ArrayList<PsiMethod>();
   final PsiResolveHelper resolveHelper =
       JavaPsiFacade.getInstance(element.getProject()).getResolveHelper();
   for (PsiMethod method : methods) {
     ProgressManager.checkCanceled();
     if (JavaCompletionUtil.isInExcludedPackage(method)) continue;
     if (!method.hasModifierProperty(PsiModifier.STATIC)) continue;
     PsiFile file = method.getContainingFile();
     if (file instanceof PsiJavaFile
         // do not show methods from default package
         && ((PsiJavaFile) file).getPackageName().length() != 0
         && PsiUtil.isAccessible(method, element, method.getContainingClass())) {
       list.add(method);
       PsiSubstitutor substitutorForMethod =
           resolveHelper.inferTypeArguments(
               method.getTypeParameters(),
               method.getParameterList().getParameters(),
               argumentList.getExpressions(),
               PsiSubstitutor.EMPTY,
               element.getParent(),
               DefaultParameterTypeInferencePolicy.INSTANCE);
       if (PsiUtil.isApplicable(method, substitutorForMethod, argumentList)) {
         applicableList.add(method);
       }
     }
   }
   List<PsiMethod> result = applicableList.isEmpty() ? list : applicableList;
   for (int i = result.size() - 1; i >= 0; i--) {
     ProgressManager.checkCanceled();
     PsiMethod method = result.get(i);
     PsiClass containingClass = method.getContainingClass();
     for (int j = i + 1; j < result.size(); j++) {
       PsiMethod exMethod = result.get(j);
       if (!Comparing.strEqual(exMethod.getName(), method.getName())) continue;
       PsiClass exContainingClass = exMethod.getContainingClass();
       if (containingClass != null
           && exContainingClass != null
           && !Comparing.equal(
               containingClass.getQualifiedName(), exContainingClass.getQualifiedName())) continue;
       // same named methods, drop one
       result.remove(i);
       break;
     }
     // check for manually excluded
     if (isExcluded(method)) {
       result.remove(i);
     }
   }
   Collections.sort(result, new PsiProximityComparator(argumentList));
   return result;
 }