use of lombok.javac.JavacNode in project lombok by rzwitserloot.
the class HandleConstructor method findAllFields.
public static List<JavacNode> findAllFields(JavacNode typeNode, boolean evenFinalInitialized) {
ListBuffer<JavacNode> fields = new ListBuffer<JavacNode>();
for (JavacNode child : typeNode.down()) {
if (child.getKind() != Kind.FIELD)
continue;
JCVariableDecl fieldDecl = (JCVariableDecl) child.get();
// Skip fields that start with $
if (fieldDecl.name.toString().startsWith("$"))
continue;
long fieldFlags = fieldDecl.mods.flags;
// Skip static fields.
if ((fieldFlags & Flags.STATIC) != 0)
continue;
// Skip initialized final fields
boolean isFinal = (fieldFlags & Flags.FINAL) != 0;
if (evenFinalInitialized || !isFinal || fieldDecl.init == null)
fields.append(child);
}
return fields.toList();
}
Aggregations