@Override public void visitVariable(VariableTree tree) { Symbol symbol = tree.symbol(); if (symbol != null && !symbol.isStatic()) { super.visitVariable(tree); } }
private static boolean isFirstParentStatic(Deque<Symbol> outerClasses) { if (outerClasses.size() == 1) { return true; } for (Symbol outerClass : outerClasses) { if (outerClass.isStatic()) { return true; } } return false; }
private int referenceInstance(Symbol symbol) { Symbol owner = symbol.owner(); if (owner != null && owner.isMethodSymbol()) { // local variable, use owner of the method owner = owner.owner(); } int result = -1; if (owner != null && !outerClasses.peek().equals(owner)) { if (symbol.isUnknown()) { result = atLeastOneReference.size() - 1; } else if (!symbol.isStatic()) { result = fromInstance(symbol, owner); } } return result; }