use of com.intellij.psi.PsiAnnotation in project azure-tools-for-java by Microsoft.
the class FunctionUtils method generateConfigurations.
private static Map<String, FunctionConfiguration> generateConfigurations(final PsiMethod[] methods) throws AzureExecutionException {
final Map<String, FunctionConfiguration> configMap = new HashMap<>();
for (final PsiMethod method : methods) {
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, FunctionUtils.AZURE_FUNCTION_ANNOTATION_CLASS);
final String functionName = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "value");
configMap.put(functionName, generateConfiguration(method));
}
return configMap;
}
use of com.intellij.psi.PsiAnnotation in project intellij by bazelbuild.
the class TestSizeAnnotationMap method getTestSize.
@Nullable
public static TestSize getTestSize(PsiClass psiClass) {
PsiModifierList psiModifierList = psiClass.getModifierList();
if (psiModifierList == null) {
return null;
}
PsiAnnotation[] annotations = psiModifierList.getAnnotations();
TestSize testSize = getTestSize(annotations);
if (testSize == null) {
return null;
}
return testSize;
}
use of com.intellij.psi.PsiAnnotation in project intellij by bazelbuild.
the class TestSizeAnnotationMap method getTestSize.
@Nullable
public static TestSize getTestSize(PsiMethod psiMethod) {
PsiAnnotation[] annotations = psiMethod.getModifierList().getAnnotations();
TestSize testSize = getTestSize(annotations);
if (testSize != null) {
return testSize;
}
return getTestSize(psiMethod.getContainingClass());
}
use of com.intellij.psi.PsiAnnotation in project qi4j-sdk by Qi4j.
the class AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection method checkMethod.
@Override
public final ProblemDescriptor[] checkMethod(@NotNull PsiMethod method, @NotNull InspectionManager manager, boolean isOnTheFly) {
PsiParameterList parameterList = method.getParameterList();
PsiParameter[] parameters = parameterList.getParameters();
if (method.isConstructor()) {
List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
for (PsiParameter parameter : parameters) {
PsiAnnotation annotation = getAnnotationToCheck(parameter);
if (annotation != null) {
ProblemDescriptor[] descriptors = verifyAnnotationDeclaredCorrectly(parameter, annotation, manager);
if (descriptors != null) {
problems.addAll(asList(descriptors));
}
}
}
return problems.toArray(new ProblemDescriptor[problems.size()]);
} else {
List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
for (PsiParameter parameter : parameters) {
PsiAnnotation annotationToCheck = getAnnotationToCheck(parameter);
if (annotationToCheck != null) {
String message = getInjectionAnnotationValidDeclarationMessage();
AbstractFix removeAnnotationFix = createRemoveAnnotationFix(annotationToCheck);
ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(annotationToCheck, message, removeAnnotationFix, GENERIC_ERROR_OR_WARNING);
problems.add(problemDescriptor);
}
}
return problems.toArray(new ProblemDescriptor[problems.size()]);
}
}
use of com.intellij.psi.PsiAnnotation in project qi4j-sdk by Qi4j.
the class ReplaceWithStructureAnnotation method applyFix.
public final void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiAnnotation structureAnnotation = createStructureAnnotation(project, annotation);
annotation.replace(structureAnnotation);
}
Aggregations