public AnnotationNode visit(AnnotationNode node) { this.annotation = node; this.reportClass = node.getClassNode(); if (!isValidAnnotationClass(node.getClassNode())) { addError("class " + node.getClassNode().getName() + " is not an annotation"); return node; } // check if values have been passed for all annotation attributes that don't have defaults if (!checkIfMandatoryAnnotationValuesPassed(node)) { return node; } // if enum constants have been used, check if they are all valid if (!checkIfValidEnumConstsAreUsed(node)) { return node; } Map<String, Expression> attributes = node.getMembers(); for (Map.Entry<String, Expression> entry : attributes.entrySet()) { String attrName = entry.getKey(); ClassNode attrType = getAttributeType(node, attrName); Expression attrExpr = transformInlineConstants(entry.getValue(), attrType); entry.setValue(attrExpr); visitExpression(attrName, attrExpr, attrType); } VMPluginFactory.getPlugin().configureAnnotation(node); return this.annotation; }
public void checkReturnType(ClassNode attrType, ASTNode node) { if (attrType.isArray()) { checkReturnType(attrType.getComponentType(), node); } else if (ClassHelper.isPrimitiveType(attrType)) { } else if (ClassHelper.STRING_TYPE.equals(attrType)) { } else if (ClassHelper.CLASS_Type.equals(attrType)) { } else if (attrType.isDerivedFrom(ClassHelper.Enum_Type)) { } else if (isValidAnnotationClass(attrType)) { } else { addError("Unexpected return type " + attrType.getName(), node); } }
public void checkCircularReference(ClassNode searchClass, ClassNode attrType, Expression startExp) { if (!isValidAnnotationClass(attrType)) return; if (!(startExp instanceof AnnotationConstantExpression)) { addError("Found '" + startExp.getText() + "' when expecting an Annotation Constant", startExp); return; } AnnotationConstantExpression ace = (AnnotationConstantExpression) startExp; AnnotationNode annotationNode = (AnnotationNode) ace.getValue(); if (annotationNode.getClassNode().equals(searchClass)) { addError("Circular reference discovered in " + searchClass.getName(), startExp); return; } ClassNode cn = annotationNode.getClassNode(); for (MethodNode method : cn.getMethods()) { if (method.getReturnType().equals(searchClass)) { addError("Circular reference discovered in " + cn.getName(), startExp); } ReturnStatement code = (ReturnStatement) method.getCode(); if (code == null) continue; checkCircularReference(searchClass, method.getReturnType(), code.getExpression()); } }
addError("Expected enum value for attribute " + attrName, attrExp); } else if (isValidAnnotationClass(attrType)) { if (attrExp instanceof AnnotationConstantExpression) { visitAnnotationExpression(attrName, (AnnotationConstantExpression) attrExp, attrType);
public AnnotationNode visit(AnnotationNode node) { this.annotation = node; this.reportClass = node.getClassNode(); if(!isValidAnnotationClass(node.getClassNode())) { addError("class " + node.getClassNode().getName() + " is not an annotation"); return node; } Map attributes = node.getMembers(); // check if values have been passed for all annotation attributes that don't have defaults if(!checkIfMandatoryAnnotationValuesPassed(node)) { return node; } for(Iterator it = attributes.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry) it.next(); String attrName = (String) entry.getKey(); Expression attrExpr = (Expression) entry.getValue(); ClassNode attrType = getAttributeType(node, attrName); visitExpression(attrName, attrExpr, attrType); } VMPluginFactory.getPlugin().configureAnnotation(node); return this.annotation; }
public AnnotationNode visit(AnnotationNode node) { this.annotation = node; this.reportClass = node.getClassNode(); if(!isValidAnnotationClass(node.getClassNode())) { addError("class " + node.getClassNode().getName() + " is not an annotation"); return node; } Map attributes = node.getMembers(); // check if values have been passed for all annotation attributes that don't have defaults if(!checkIfMandatoryAnnotationValuesPassed(node)) { return node; } for(Iterator it = attributes.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry) it.next(); String attrName = (String) entry.getKey(); Expression attrExpr = (Expression) entry.getValue(); ClassNode attrType = getAttributeType(node, attrName); visitExpression(attrName, attrExpr, attrType); } VMPluginFactory.getPlugin().configureAnnotation(node); return this.annotation; }
public AnnotationNode visit(AnnotationNode node) { if(!isValidAnnotationClass(node)) { node.setValid(false); return node;
public AnnotationNode visit(AnnotationNode node) { this.annotation = node; this.reportClass = node.getClassNode(); if (!isValidAnnotationClass(node.getClassNode())) { addError("class " + node.getClassNode().getName() + " is not an annotation"); return node; } // check if values have been passed for all annotation attributes that don't have defaults if (!checkIfMandatoryAnnotationValuesPassed(node)) { return node; } // if enum constants have been used, check if they are all valid if (!checkIfValidEnumConstsAreUsed(node)) { return node; } Map<String, Expression> attributes = node.getMembers(); for (Map.Entry<String, Expression> entry : attributes.entrySet()) { String attrName = entry.getKey(); Expression attrExpr = transformInlineConstants(entry.getValue()); entry.setValue(attrExpr); ClassNode attrType = getAttributeType(node, attrName); visitExpression(attrName, attrExpr, attrType); } VMPluginFactory.getPlugin().configureAnnotation(node); return this.annotation; }
public void checkcircularReference(ClassNode searchClass, ClassNode attrType,Expression startExp) { if (!isValidAnnotationClass(attrType)) return; AnnotationConstantExpression ace = (AnnotationConstantExpression) startExp; AnnotationNode annotationNode = (AnnotationNode) ace.getValue(); if (annotationNode.getClassNode().equals(searchClass)) { addError ("Cirecular reference discovered in "+searchClass.getName(),startExp); return; } ClassNode cn = annotationNode.getClassNode(); List methods = cn.getMethods(); for(Iterator it=methods.iterator(); it.hasNext();) { MethodNode method = (MethodNode) it.next(); if (method.getReturnType().equals(searchClass)) { addError ("Cirecular reference discovered in "+cn.getName(),startExp); } ReturnStatement code = (ReturnStatement) method.getCode(); if (code==null) continue; checkcircularReference(searchClass,method.getReturnType(),code.getExpression()); } }
public void checkcircularReference(ClassNode searchClass, ClassNode attrType,Expression startExp) { if (!isValidAnnotationClass(attrType)) return; AnnotationConstantExpression ace = (AnnotationConstantExpression) startExp; AnnotationNode annotationNode = (AnnotationNode) ace.getValue(); if (annotationNode.getClassNode().equals(searchClass)) { addError ("Cirecular reference discovered in "+searchClass.getName(),startExp); return; } ClassNode cn = annotationNode.getClassNode(); List methods = cn.getMethods(); for(Iterator it=methods.iterator(); it.hasNext();) { MethodNode method = (MethodNode) it.next(); if (method.getReturnType().equals(searchClass)) { addError ("Cirecular reference discovered in "+cn.getName(),startExp); } ReturnStatement code = (ReturnStatement) method.getCode(); if (code==null) continue; checkcircularReference(searchClass,method.getReturnType(),code.getExpression()); } }
public void checkReturnType(ClassNode attrType,ASTNode node) { if(attrType.isArray()) { checkReturnType(attrType.getComponentType(),node); } else if (ClassHelper.isPrimitiveType(attrType)) { return; } else if (ClassHelper.STRING_TYPE.equals(attrType)) { return; } else if (ClassHelper.CLASS_Type.equals(attrType)) { return; } else if (attrType.isDerivedFrom(ClassHelper.Enum_Type)) { return; } else if (isValidAnnotationClass(attrType)) { return; } else { addError("Unexpected return type "+attrType.getName(),node); } }
public void checkReturnType(ClassNode attrType, ASTNode node) { if (attrType.isArray()) { checkReturnType(attrType.getComponentType(), node); } else if (ClassHelper.isPrimitiveType(attrType)) { return; } else if (ClassHelper.STRING_TYPE.equals(attrType)) { return; } else if (ClassHelper.CLASS_Type.equals(attrType)) { return; } else if (attrType.isDerivedFrom(ClassHelper.Enum_Type)) { return; } else if (isValidAnnotationClass(attrType)) { return; } else { addError("Unexpected return type " + attrType.getName(), node); } }
public void checkReturnType(ClassNode attrType,ASTNode node) { if(attrType.isArray()) { checkReturnType(attrType.getComponentType(),node); } else if (ClassHelper.isPrimitiveType(attrType)) { return; } else if (ClassHelper.STRING_TYPE.equals(attrType)) { return; } else if (ClassHelper.CLASS_Type.equals(attrType)) { return; } else if (attrType.isDerivedFrom(ClassHelper.Enum_Type)) { return; } else if (isValidAnnotationClass(attrType)) { return; } else { addError("Unexpected return type "+attrType.getName(),node); } }
public void checkCircularReference(ClassNode searchClass, ClassNode attrType, Expression startExp) { if (!isValidAnnotationClass(attrType)) return; if (!(startExp instanceof AnnotationConstantExpression)) { addError("Found '" + startExp.getText() + "' when expecting an Annotation Constant", startExp); return; } AnnotationConstantExpression ace = (AnnotationConstantExpression) startExp; AnnotationNode annotationNode = (AnnotationNode) ace.getValue(); if (annotationNode.getClassNode().equals(searchClass)) { addError("Circular reference discovered in " + searchClass.getName(), startExp); return; } ClassNode cn = annotationNode.getClassNode(); for (MethodNode method : cn.getMethods()) { if (method.getReturnType().equals(searchClass)) { addError("Circular reference discovered in " + cn.getName(), startExp); } ReturnStatement code = (ReturnStatement) method.getCode(); if (code == null) continue; checkCircularReference(searchClass, method.getReturnType(), code.getExpression()); } }
addError("Expected enum value for attribute " + attrName, attrExp); } else if (isValidAnnotationClass(attrType)) { if (attrExp instanceof AnnotationConstantExpression) { visitAnnotationExpression(attrName, (AnnotationConstantExpression) attrExp, attrType);
addError("Expected enum value for attribute " + attrName, attrExp); } else if (isValidAnnotationClass(attrType)) { if (attrExp instanceof AnnotationConstantExpression) { visitAnnotationExpression(attrName, (AnnotationConstantExpression) attrExp, attrType);
addError("Expected enum value for attribute " + attrName, attrExp); } else if (isValidAnnotationClass(attrType)) { if (attrExp instanceof AnnotationConstantExpression) { visitAnnotationExpression(attrName, (AnnotationConstantExpression) attrExp, attrType);