/** * @return true if this instance is a primary ClassNode */ public boolean isPrimaryClassNode() { return redirect().isPrimaryNode || (componentType != null && componentType.isPrimaryClassNode()); }
/** * box top level operand */ @Deprecated public static boolean box(MethodVisitor mv, ClassNode type) { if (type.isPrimaryClassNode()) return false; return box(mv, type.getTypeClass()); }
public void sortClasses(){ if (isEmpty()) return; List<ClassNode> classes = getClasses(); LinkedList<ClassNode> sorted = new LinkedList<ClassNode>(); int level=1; while (!classes.isEmpty()) { for (Iterator<ClassNode> cni = classes.iterator(); cni.hasNext();) { ClassNode cn = cni.next(); ClassNode sn = cn; for (int i=0; sn!=null && i<level; i++) sn = sn.getSuperClass(); if (sn!=null && sn.isPrimaryClassNode()) continue; cni.remove(); sorted.addLast(cn); } level++; } this.classes = sorted; }
public static void unbox(MethodVisitor mv, ClassNode type) { if (type.isPrimaryClassNode()) return; unbox(mv, type.getTypeClass()); }
private static Expression findStaticMethod(ClassNode staticImportType, String methodName, Expression args) { if (staticImportType.isPrimaryClassNode() || staticImportType.isResolved()) { if (staticImportType.hasPossibleStaticMethod(methodName, args)) { return new StaticMethodCallExpression(staticImportType, methodName, args); } } return null; }
private void addToCache(ClassNode node){ if (node == null) return; String name = node.getName(); if (!precompiledDependencies.containsKey(name) && !node.isPrimaryClassNode()) { return; } current.add(node.getName()); addToCache(node.getSuperClass()); addToCache(node.getInterfaces()); }
private static List<AnnotationNode> getMeta(ClassNode cn) { List<AnnotationNode> meta = cn.getNodeMetaData(AnnotationCollector.class); if (meta == null) { if (cn.isPrimaryClassNode()) { meta = getTargetListFromAnnotations(cn); } else { meta = getTargetListFromClass(cn); } cn.setNodeMetaData(AnnotationCollector.class, meta); } return meta; }
private static Expression findStaticField(ClassNode staticImportType, String fieldName) { if (staticImportType.isPrimaryClassNode() || staticImportType.isResolved()) { FieldNode field = getField(staticImportType, fieldName); if (field != null && field.isStatic()) return new PropertyExpression(new ClassExpression(staticImportType), fieldName); } return null; }
public static String getClassInternalName(ClassNode t) { if (t.isPrimaryClassNode() || t instanceof DecompiledClassNode) { if (t.isArray()) return "[L"+getClassInternalName(t.getComponentType())+";"; return getClassInternalName(t.getName()); } return getClassInternalName(t.getTypeClass()); }
ClassExpression ce = (ClassExpression) pe.getObjectExpression(); ClassNode type = ce.getType(); if (type.isEnum() || !(type.isResolved() || type.isPrimaryClassNode())) return exp; if (type.isPrimaryClassNode()) { FieldNode fn = type.redirect().getField(pe.getPropertyAsString()); if (fn != null && fn.isStatic() && fn.isFinal()) {
private static Parameter[] selectAccessibleConstructorFromSuper(ConstructorNode node) { ClassNode type = node.getDeclaringClass(); ClassNode superType = type.getUnresolvedSuperClass(); Parameter[] bestMatch = null; for (ConstructorNode c : superType.getDeclaredConstructors()) { // Only look at things we can actually call if (!c.isPublic() && !c.isProtected()) continue; Parameter[] parameters = c.getParameters(); // workaround for GROOVY-5859: remove generic type info Parameter[] copy = new Parameter[parameters.length]; for (int i = 0; i < copy.length; i++) { Parameter orig = parameters[i]; copy[i] = new Parameter(orig.getOriginType().getPlainNodeReference(), orig.getName()); } if (noExceptionToAvoid(node,c)) return copy; if (bestMatch==null) bestMatch = copy; } if (bestMatch!=null) return bestMatch; // fall back for parameterless constructor if (superType.isPrimaryClassNode()) { return Parameter.EMPTY_ARRAY; } return null; }
private boolean resolve(ClassNode type, boolean testModuleImports, boolean testDefaultImports, boolean testStaticInnerClasses) { resolveGenericsTypes(type.getGenericsTypes()); if (type.isResolved() || type.isPrimaryClassNode()) return true; if (type.isArray()) { ClassNode element = type.getComponentType();
/** * Returns if this instance is a primary ClassNode */ public boolean isPrimaryClassNode(){ return redirect().isPrimaryNode || (componentType!= null && componentType.isPrimaryClassNode()); }
/** * box top level operand */ public static boolean box(MethodVisitor mv, ClassNode type) { if (type.isPrimaryClassNode()) return false; return box(mv, type.getTypeClass()); }
public void unbox(ClassNode type) { if (type.isPrimaryClassNode()) return; unbox(type.getTypeClass()); }
private Expression findStaticMethod(ClassNode staticImportType, String methodName, Expression args) { if (staticImportType.isPrimaryClassNode() || staticImportType.isResolved()) { if (staticImportType.hasPossibleStaticMethod(methodName, args)) { return new StaticMethodCallExpression(staticImportType, methodName, args); } } return null; }
private Expression findStaticMethod(ClassNode staticImportType, String methodName, Expression args) { if (staticImportType.isPrimaryClassNode() || staticImportType.isResolved()) { if (staticImportType.hasPossibleStaticMethod(methodName, args)) { return new StaticMethodCallExpression(staticImportType, methodName, args); } } return null; }
private void addToCache(ClassNode node){ if (node == null) return; String name = node.getName(); if (!precompiledDependencies.containsKey(name) && !node.isPrimaryClassNode()) { return; } current.add(node.getName()); addToCache(node.getSuperClass()); addToCache(node.getInterfaces()); }
private Expression findStaticField(ClassNode staticImportType, String fieldName) { if (staticImportType.isPrimaryClassNode() || staticImportType.isResolved()) { FieldNode field = staticImportType.getField(fieldName); if (field != null && field.isStatic()) return new PropertyExpression(new ClassExpression(staticImportType), fieldName); } return null; }
public static String getClassInternalName(ClassNode t) { if (t.isPrimaryClassNode()) { if (t.isArray()) return "[L"+getClassInternalName(t.getComponentType())+";"; return getClassInternalName(t.getName()); } return getClassInternalName(t.getTypeClass()); }