mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[by peter] do not generate final modifier for enums
This commit is contained in:
@@ -16,7 +16,11 @@
|
||||
package org.jetbrains.groovy.compiler.rt;
|
||||
|
||||
import groovy.lang.GroovyClassLoader;
|
||||
import org.codehaus.groovy.ast.*;
|
||||
import groovyjarjarasm.asm.Opcodes;
|
||||
import org.codehaus.groovy.ast.AnnotatedNode;
|
||||
import org.codehaus.groovy.ast.AnnotationNode;
|
||||
import org.codehaus.groovy.ast.ClassCodeVisitorSupport;
|
||||
import org.codehaus.groovy.ast.ClassNode;
|
||||
import org.codehaus.groovy.classgen.GeneratorContext;
|
||||
import org.codehaus.groovy.control.*;
|
||||
import org.codehaus.groovy.control.messages.WarningMessage;
|
||||
@@ -418,6 +422,13 @@ public class GroovycRunner {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void visitClass(ClassNode node) {
|
||||
if (node.isEnum()) {
|
||||
node.setModifiers(node.getModifiers() & ~Opcodes.ACC_FINAL);
|
||||
}
|
||||
super.visitClass(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAnnotations(AnnotatedNode node) {
|
||||
List<AnnotationNode> annotations = node.getAnnotations();
|
||||
|
||||
@@ -154,6 +154,12 @@ public abstract class GroovyCompilerTest extends GroovyCompilerTestCase {
|
||||
assertEmpty(make());
|
||||
}
|
||||
|
||||
public void testJavaDependsOnGroovyEnum() throws Throwable {
|
||||
myFixture.addFileToProject("Foo.groovy", "enum Foo { FOO }")
|
||||
myFixture.addClass("class Bar { Foo f; }")
|
||||
assertEmpty(make())
|
||||
}
|
||||
|
||||
public void testDeleteTransitiveJavaClass() throws Throwable {
|
||||
myFixture.addClass("public interface IFoo { int foo(); }");
|
||||
myFixture.addClass("public class Foo implements IFoo {" +
|
||||
|
||||
Reference in New Issue
Block a user