@SuppressWarnings("unchecked") @Override public <T, U> U getValue(T element) { return ((U) ((Object) (castTarget(element).getLabel()))); }
@Override public void scanCtStatement(CtStatement s) { final CtStatement peek = (CtStatement) this.other; final String leftLabel = s.getLabel(); final String rightLabel = peek.getLabel(); if (leftLabel == null && rightLabel == null) { super.scanCtStatement(s); return; } if (leftLabel == null || !leftLabel.equals(rightLabel)) { setNotEqual(CtRole.LABEL); } super.scanCtStatement(s); }
/** * Scans an abstract statement. */ // auto-generated, see spoon.generating.CloneVisitorGenerator public void scanCtStatement(spoon.reflect.code.CtStatement s) { ((spoon.reflect.code.CtStatement) (other)).setLabel(s.getLabel()); super.scanCtStatement(s); }
@Override public CtStatement getLabelledStatement() { List<CtStatement> listParents = this.map(new ParentFunction().includingSelf(true)).list(); for (CtElement parent : listParents) { if (parent instanceof CtStatement) { CtStatement statement = (CtStatement) parent; if (statement.getLabel() != null && statement.getLabel().equals(this.getTargetLabel())) { return statement; } } } return null; }
@Override public CtStatement getLabelledStatement() { List<CtStatement> listParents = this.map(new ParentFunction().includingSelf(true)).list(); for (CtElement parent : listParents) { if (parent instanceof CtStatement) { CtStatement statement = (CtStatement) parent; if (statement.getLabel() != null && statement.getLabel().equals(this.getTargetLabel())) { return statement; } } } return null; }
/** * Enters a statement. */ protected void enterCtStatement(CtStatement s) { elementPrinterHelper.writeComment(s, CommentOffset.BEFORE); getPrinterHelper().mapLine(s, sourceCompilationUnit); if (!context.isNextForVariable()) { //TODO AnnotationLoopTest#testAnnotationDeclaredInForInit expects that annotations of next for variables are not printed //but may be correct is that the next variables are not annotated, because they might have different annotation then first param! elementPrinterHelper.writeAnnotations(s); } if (!context.isFirstForVariable() && !context.isNextForVariable()) { if (s.getLabel() != null) { printer.writeIdentifier(s.getLabel()).writeSpace().writeSeparator(":").writeSpace(); } } }
if (block.getStatements().size() == 1) { CtStatement childStmt = block.getStatement(0); if (childStmt.getLabel() == null) {