mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
groovy 1.8 and older allow private and protected top level classes
This commit is contained in:
@@ -1584,7 +1584,7 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
final PsiElement[] modifiers = list.getModifiers();
|
||||
Set<String> set = new THashSet<String>(modifiers.length);
|
||||
for (PsiElement modifier : modifiers) {
|
||||
String name = modifier.getText();
|
||||
@GrModifier.GrModifierConstant String name = modifier.getText();
|
||||
if (set.contains(name)) {
|
||||
final Annotation annotation = holder.createErrorAnnotation(list, GroovyBundle.message("duplicate.modifier", name));
|
||||
annotation.registerFix(new GrModifierFix(member, list, name, false, false));
|
||||
@@ -1620,7 +1620,9 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
holder.createErrorAnnotation(publicModifier, GroovyBundle.message("public.modifier.is.not.allowed.in.interfaces"))
|
||||
.registerFix(new GrModifierFix(member, modifierList, PUBLIC, false, false));
|
||||
}
|
||||
else if (member instanceof PsiClass && member.getContainingClass() == null) {
|
||||
else if (member instanceof PsiClass &&
|
||||
member.getContainingClass() == null &&
|
||||
GroovyConfigUtils.getInstance().isVersionAtLeast(member, GroovyConfigUtils.GROOVY2_0)) {
|
||||
checkModifierIsNotAllowed(modifierList, PRIVATE, GroovyBundle.message("top.level.class.maynot.have.private.modifier"), holder);
|
||||
checkModifierIsNotAllowed(modifierList, PROTECTED, GroovyBundle.message("top.level.class.maynot.have.protected.modifier"), holder);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class GroovyCompiler extends GroovyCompilerBase {
|
||||
}
|
||||
|
||||
if (!LibrariesUtil.hasGroovySdk(module)) {
|
||||
if (!GroovyConfigUtils.getInstance().tryToSetUpGroovyFacetOntheFly(module)) {
|
||||
if (!GroovyConfigUtils.getInstance().tryToSetUpGroovyFacetOnTheFly(module)) {
|
||||
Messages.showErrorDialog(myProject, GroovyBundle.message("cannot.compile.groovy.files.no.facet", module.getName()),
|
||||
GroovyBundle.message("cannot.compile"));
|
||||
ModulesConfigurator.showDialog(module.getProject(), module.getName(), ClasspathEditor.NAME);
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class GroovyConfigUtils extends AbstractConfigUtils {
|
||||
public static final String NO_VERSION = "<no version>";
|
||||
public static final String GROOVY1_7 = "1.7";
|
||||
public static final String GROOVY1_8 = "1.8";
|
||||
public static final String GROOVY1_9 = "1.9";
|
||||
public static final String GROOVY2_0 = "2.0";
|
||||
|
||||
private GroovyConfigUtils() {
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public abstract class GroovyConfigUtils extends AbstractConfigUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean tryToSetUpGroovyFacetOntheFly(final Module module) {
|
||||
public boolean tryToSetUpGroovyFacetOnTheFly(final Module module) {
|
||||
final Project project = module.getProject();
|
||||
final Library[] libraries = getAllSDKLibraries(project);
|
||||
if (libraries.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user