MCPcopy Create free account
hub / github.com/apache/groovy / isDerivedFrom

Method isDerivedFrom

src/main/java/org/codehaus/groovy/ast/ClassNode.java:1321–1339  ·  view source on GitHub ↗

@param type the ClassNode of interest @return true if this node is derived from the given ClassNode

(ClassNode type)

Source from the content-addressed store, hash-verified

1319 * @return true if this node is derived from the given ClassNode
1320 */
1321 public boolean isDerivedFrom(ClassNode type) {
1322 if (ClassHelper.isPrimitiveVoid(this)) {
1323 return ClassHelper.isPrimitiveVoid(type);
1324 }
1325 if (ClassHelper.isObjectType(type)) {
1326 return true;
1327 }
1328 if (this.isArray() && type.isArray()
1329 && ClassHelper.isObjectType(type.getComponentType())
1330 && !ClassHelper.isPrimitiveType(this.getComponentType())) {
1331 return true;
1332 }
1333 for (ClassNode node = this; node != null; node = node.getSuperClass()) {
1334 if (type.equals(node)) {
1335 return true;
1336 }
1337 }
1338 return false;
1339 }
1340
1341 /**
1342 * Returns whether this {@link ClassNode} represents a type that implements the {@code GroovyObject} interface.

Callers 15

checkGenericsUsageMethod · 0.95
visitEnumExpressionMethod · 0.95
addPropertyMethodMethod · 0.95
writeDirectMethodCallMethod · 0.95
makeGetPropertySiteMethod · 0.95
isScriptMethod · 0.95
lowestUpperBoundMethod · 0.95
parameterizeTypeMethod · 0.95
visitMethod · 0.95

Calls 7

isPrimitiveVoidMethod · 0.95
isObjectTypeMethod · 0.95
isArrayMethod · 0.95
getComponentTypeMethod · 0.95
isPrimitiveTypeMethod · 0.95
getSuperClassMethod · 0.95
equalsMethod · 0.65

Tested by 1