private static boolean resolvesToDefaultConstructor(GrCall call) { PsiMethod method = call.resolveMethod(); if (method != null && method.isConstructor() && method.getParameterList().getParametersCount() == 0) return true; if (call instanceof GrConstructorCall) { PsiElement resolved = PsiImplUtil.extractUniqueResult(((GrConstructorCall) call).multiResolveClass()) .getElement(); if (resolved instanceof PsiClass) return true; } return false; }
@Override public void visitAnnotationNameValuePair(GrAnnotationNameValuePair nameValuePair) { if (myExpression.equals(nameValuePair.getValue())) { final PsiClass annot = ResolveUtil.resolveAnnotation(nameValuePair.getParent()); if (annot != null) { final String name = nameValuePair.getName(); if (name != null) { final PsiMethod[] attrs = annot.findMethodsByName(name, false); if (attrs.length > 0) { PsiType type = attrs[0].getReturnType(); while (type instanceof PsiArrayType) type = ((PsiArrayType) type).getComponentType(); if (type != null && isAcceptableAnnotationValueType(type)) { myResult = createSimpleSubTypeResult(type); } } } else { final PsiMethod[] valueAttr = annot.findMethodsByName("value", false); boolean canHaveSimpleExpr = valueAttr.length > 0; final PsiMethod[] methods = annot.getMethods(); for (PsiMethod method : methods) { if (!("value".equals(method.getName()) || method instanceof PsiAnnotationMethod && ((PsiAnnotationMethod) method).getDefaultValue() != null)) { canHaveSimpleExpr = false; } } if (canHaveSimpleExpr) { PsiType type = valueAttr[0].getReturnType(); while (type instanceof PsiArrayType) type = ((PsiArrayType) type).getComponentType(); if (type != null && isAcceptableAnnotationValueType(type)) { myResult = createSimpleSubTypeResult(type); } } } } } }