Skip to content

Commit

Permalink
Support Java17
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellansun committed Aug 7, 2021
1 parent 1dc57a8 commit 225a49e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ install:

matrix:
include:
- env: BC='indy' FEATURE='17' TARGET_JAVA_HOME="/home/travis/openjdk$FEATURE" LICENSE='GPL'
jdk: openjdk11
- env: BC='indy' FEATURE='16' TARGET_JAVA_HOME="/home/travis/openjdk$FEATURE" LICENSE='GPL'
jdk: openjdk11
- env: BC='indy'
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/codehaus/groovy/ast/ClassNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.codehaus.groovy.ast.stmt.Statement;
import org.codehaus.groovy.ast.tools.ParameterUtils;
import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.reflection.ReflectionUtils;
import org.codehaus.groovy.transform.ASTTransformation;
import org.codehaus.groovy.transform.GroovyASTTransformation;
import org.codehaus.groovy.vmplugin.VMPluginFactory;
Expand Down Expand Up @@ -164,7 +165,7 @@ void remove(Object key, MethodNode value) {
private ClassNode superClass;
protected boolean isPrimaryNode;
protected List<InnerClassNode> innerClasses;
final private List<ClassNode> permittedSubclasses = new ArrayList<>();
private final List<ClassNode> permittedSubclasses = new ArrayList<>(4);
private List<AnnotationNode> typeAnnotations = Collections.emptyList();

/**
Expand Down Expand Up @@ -1349,7 +1350,7 @@ public boolean isAbstract() {
}

public boolean isSealed() {
return !getAnnotations(SEALED_TYPE).isEmpty() || !permittedSubclasses.isEmpty();
return !getAnnotations(SEALED_TYPE).isEmpty() || !permittedSubclasses.isEmpty() || (null != clazz && ReflectionUtils.isSealed(clazz));
}

public boolean isResolved() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import static java.util.stream.Collectors.toSet;
import static org.apache.groovy.ast.tools.ClassNodeUtils.addGeneratedMethod;
Expand Down Expand Up @@ -197,7 +198,10 @@ public void visit(final ASTNode[] nodes, final SourceUnit source) {

if (skipInterfaces) return;

final Set<ClassNode> allInterfaces = getInterfacesAndSuperInterfaces(delegate.type);
final Set<ClassNode> allInterfaces =
getInterfacesAndSuperInterfaces(delegate.type).stream()
.filter(c -> !c.redirect().isSealed())
.collect(Collectors.toSet());
final Set<ClassNode> ownerIfaces = delegate.owner.getAllInterfaces();
Map<String,ClassNode> genericsSpec = createGenericsSpec(delegate.owner);
genericsSpec = createGenericsSpec(delegate.type, genericsSpec);
Expand Down

0 comments on commit 225a49e

Please sign in to comment.