Search in sources :

Example 1 with CtCodeElement

use of spoon.reflect.code.CtCodeElement in project spoon by INRIA.

the class DefaultJavaPrettyPrinter method printConstructorCall.

private <T> void printConstructorCall(CtConstructorCall<T> ctConstructorCall) {
    try (Writable _context = context.modify()) {
        if (ctConstructorCall.getTarget() != null) {
            scan(ctConstructorCall.getTarget());
            printer.writeSeparator(".");
            _context.ignoreEnclosingClass(true);
        }
        if (hasDeclaringTypeWithGenerics(ctConstructorCall.getType())) {
            _context.ignoreEnclosingClass(true);
        }
        printer.writeKeyword("new").writeSpace();
        if (ctConstructorCall.getActualTypeArguments().size() > 0) {
            elementPrinterHelper.writeActualTypeArguments(ctConstructorCall);
        }
        scan(ctConstructorCall.getType());
    }
    try (ListPrinter lp = elementPrinterHelper.createListPrinter(false, "(", false, false, ",", true, false, ")")) {
        for (CtCodeElement exp : ctConstructorCall.getArguments()) {
            lp.printSeparatorIfAppropriate();
            scan(exp);
        }
    }
}
Also used : CtCodeElement(spoon.reflect.code.CtCodeElement) Writable(spoon.reflect.visitor.PrintingContext.Writable)

Aggregations

CtCodeElement (spoon.reflect.code.CtCodeElement)1 Writable (spoon.reflect.visitor.PrintingContext.Writable)1