This is an automated email from the ASF dual-hosted git repository. emilles pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 8e9f1b15ffa158aab497c32b9d213bf70bd7afa3 Author: Eric Milles <[email protected]> AuthorDate: Mon Jun 12 11:40:59 2023 -0500 minor items --- .../java/org/codehaus/groovy/ast/ClassNode.java | 49 +++++++++++----------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/ast/ClassNode.java b/src/main/java/org/codehaus/groovy/ast/ClassNode.java index ae44899316..e6543cbac6 100644 --- a/src/main/java/org/codehaus/groovy/ast/ClassNode.java +++ b/src/main/java/org/codehaus/groovy/ast/ClassNode.java @@ -1371,10 +1371,30 @@ public class ClassNode extends AnnotatedNode { return ClassNodeUtils.hasPossibleStaticMethod(this, name, arguments, false); } + public boolean isAbstract() { + return (getModifiers() & ACC_ABSTRACT) != 0; + } + public boolean isInterface() { return (getModifiers() & ACC_INTERFACE) != 0; } + public boolean isAnnotationDefinition() { + return isInterface() && (getModifiers() & ACC_ANNOTATION) != 0; + } + + public boolean isEnum() { + return (getModifiers() & ACC_ENUM) != 0; + } + + public boolean isArray() { + return (componentType != null); + } + + public ClassNode getComponentType() { + return componentType; + } + /** * Checks if the {@link ClassNode} instance represents a native {@code record}. * Check instead for the {@code RecordBase} annotation if looking for records and @@ -1416,10 +1436,6 @@ public class ClassNode extends AnnotatedNode { } } - public boolean isAbstract() { - return (getModifiers() & ACC_ABSTRACT) != 0; - } - /** * @return {@code true} for native and emulated (annotation based) sealed classes * @since 4.0.0 @@ -1427,7 +1443,6 @@ public class ClassNode extends AnnotatedNode { @Incubating public boolean isSealed() { if (redirect != null) return redirect.isSealed(); - lazyClassInit(); return !getAnnotations(SEALED_TYPE).isEmpty() || !getPermittedSubclasses().isEmpty(); } @@ -1437,14 +1452,6 @@ public class ClassNode extends AnnotatedNode { return (componentType != null && componentType.isResolved()); } - public boolean isArray() { - return (componentType != null); - } - - public ClassNode getComponentType() { - return componentType; - } - /** * Returns the concrete class this classnode relates to. However, this method * is inherently unsafe as it may return null depending on the compile phase you are @@ -1467,6 +1474,10 @@ public class ClassNode extends AnnotatedNode { return (redirect().name.indexOf('.') > 0); } + public boolean isAnnotated() { + return this.annotated; + } + /** * Marks if the current class uses annotations or not. */ @@ -1474,10 +1485,6 @@ public class ClassNode extends AnnotatedNode { this.annotated = annotated; } - public boolean isAnnotated() { - return this.annotated; - } - public GenericsType asGenericsType() { if (!isGenericsPlaceHolder()) { return new GenericsType(this); @@ -1531,10 +1538,6 @@ public class ClassNode extends AnnotatedNode { return getPlainNodeReference(true); } - public boolean isAnnotationDefinition() { - return isInterface() && (getModifiers() & ACC_ANNOTATION) != 0; - } - @Override public List<AnnotationNode> getAnnotations() { if (redirect != null) @@ -1581,10 +1584,6 @@ public class ClassNode extends AnnotatedNode { index.remove(oldName); } - public boolean isEnum() { - return (getModifiers() & ACC_ENUM) != 0; - } - /** * @return iterator of inner classes defined inside this one */
