use of org.checkerframework.dataflow.cfg.node.ClassDeclarationNode in project checker-framework by typetools.
the class CFGTranslationPhaseOne method visitClass.
@Override
public Node visitClass(ClassTree tree, Void p) {
declaredClasses.add(tree);
Node classbody = new ClassDeclarationNode(tree);
extendWithNode(classbody);
return classbody;
}
use of org.checkerframework.dataflow.cfg.node.ClassDeclarationNode in project checker-framework by typetools.
the class CFGTranslationPhaseOne method visitNewClass.
@Override
public Node visitNewClass(NewClassTree tree, Void p) {
// see JLS 15.9
Tree enclosingExpr = tree.getEnclosingExpression();
if (enclosingExpr != null) {
scan(enclosingExpr, p);
}
// Convert constructor arguments
ExecutableElement constructor = TreeUtils.elementFromUse(tree);
List<? extends ExpressionTree> actualExprs = tree.getArguments();
List<Node> arguments = convertCallArguments(constructor, actualExprs);
// TODO: for anonymous classes, don't use the identifier alone.
// See Issue 890.
Node constructorNode = scan(tree.getIdentifier(), p);
// Handle anonymous classes in visitClass.
// Note that getClassBody() and therefore classbody can be null.
ClassDeclarationNode classbody = (ClassDeclarationNode) scan(tree.getClassBody(), p);
Node node = new ObjectCreationNode(tree, constructorNode, arguments, classbody);
List<? extends TypeMirror> thrownTypes = constructor.getThrownTypes();
Set<TypeMirror> thrownSet = new LinkedHashSet<>(thrownTypes.size() + uncheckedExceptionTypes.size());
// Add exceptions explicitly mentioned in the throws clause.
thrownSet.addAll(thrownTypes);
// Add types to account for unchecked exceptions
thrownSet.addAll(uncheckedExceptionTypes);
extendWithNodeWithExceptions(node, thrownSet);
return node;
}
Aggregations