mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diamonds checking
This commit is contained in:
@@ -151,6 +151,10 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent instanceof GrCodeReferenceElement) {
|
||||
if (!checkDiamonds((GrCodeReferenceElement)parent, myHolder)) return;
|
||||
}
|
||||
|
||||
final PsiTypeParameter[] parameters = ((PsiTypeParameterListOwner)resolved).getTypeParameters();
|
||||
final GrTypeElement[] arguments = typeArgumentList.getTypeArgumentElements();
|
||||
|
||||
@@ -873,8 +877,6 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
GrCodeReferenceElement refElement = newExpression.getReferenceElement();
|
||||
if (refElement == null) return;
|
||||
|
||||
checkDiamonds(refElement, myHolder);
|
||||
|
||||
final PsiElement element = refElement.resolve();
|
||||
if (element instanceof PsiClass) {
|
||||
PsiClass clazz = (PsiClass)element;
|
||||
@@ -903,15 +905,17 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkDiamonds(GrCodeReferenceElement refElement, AnnotationHolder holder) {
|
||||
private static boolean checkDiamonds(GrCodeReferenceElement refElement, AnnotationHolder holder) {
|
||||
final GroovyConfigUtils configUtils = GroovyConfigUtils.getInstance();
|
||||
if (configUtils.isVersionAtLeast(refElement, GroovyConfigUtils.GROOVY1_8)) return;
|
||||
if (configUtils.isVersionAtLeast(refElement, GroovyConfigUtils.GROOVY1_8)) return true;
|
||||
|
||||
GrTypeArgumentList typeArgumentList = refElement.getTypeArgumentList();
|
||||
if (typeArgumentList != null && typeArgumentList.isDiamond()) {
|
||||
final String message = GroovyBundle.message("diamonds.are.not.allowed.in.groovy.0", configUtils.getSDKVersion(refElement));
|
||||
holder.createErrorAnnotation(typeArgumentList, message);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user