public boolean hasNonFinalField() {
ArrayList<ClassElement> classesToVisit = new ArrayList<ClassElement>();
HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
classesToVisit.add(this);
while (!classesToVisit.isEmpty()) {
ClassElement currentElement = classesToVisit.remove(0);
if (visitedClasses.add(currentElement)) {
// check fields
for (FieldElement field : currentElement.getFields()) {
if (!field.isFinal() && !field.isConst() && !field.isStatic() && !field.isSynthetic()) {
return true;
}
}
// check mixins
for (InterfaceType mixinType : currentElement.getMixins()) {
ClassElement mixinElement = mixinType.getElement();
classesToVisit.add(mixinElement);
}
// check super
InterfaceType supertype = currentElement.getSupertype();
if (supertype != null) {
ClassElement superElement = supertype.getElement();
if (superElement != null) {
classesToVisit.add(superElement);
}
}
}