@Override public Void visitFieldDeclaration(FieldDeclaration node) { visit(node.getKeyword(), " "); visit(node.getFields()); writer.print(";"); return null; }
public void test_visitFieldDeclaration() { ElementHolder holder = new ElementHolder(); ElementBuilder builder = new ElementBuilder(holder); String firstFieldName = "x"; String secondFieldName = "y"; FieldDeclaration fieldDeclaration = fieldDeclaration( false, null, variableDeclaration(firstFieldName), variableDeclaration(secondFieldName)); fieldDeclaration.accept(builder); FieldElement[] fields = holder.getFields(); assertLength(2, fields); FieldElement firstField = fields[0]; assertNotNull(firstField); assertEquals(firstFieldName, firstField.getName()); assertNull(firstField.getInitializer()); assertFalse(firstField.isConst()); assertFalse(firstField.isFinal()); assertFalse(firstField.isSynthetic()); FieldElement secondField = fields[1]; assertNotNull(secondField); assertEquals(secondFieldName, secondField.getName()); assertNull(secondField.getInitializer()); assertFalse(secondField.isConst()); assertFalse(secondField.isFinal()); assertFalse(secondField.isSynthetic()); }
@Override public Void visitFieldDeclaration(FieldDeclaration node) { boolean wasInField = inFieldContext; inFieldContext = true; try { node.visitChildren(this); } finally { inFieldContext = wasInField; } return null; }
@Override public R visitFieldDeclaration(FieldDeclaration node) { node.visitChildren(this); return null; }