private static String getDefinitionPlace(Symbol symbol, Symbol knownMemberSymbol) { if (sameOwner(symbol, knownMemberSymbol)) { return "on line " + getDeclarationLine(knownMemberSymbol); } return "in " + (knownMemberSymbol.owner().isInterface() ? "interface" : "superclass") + " \"" + knownMemberSymbol.owner().type().fullyQualifiedName() + "\""; }
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; }
private static boolean sameOwner(Symbol currentMember, Symbol knownMember) { return currentMember.owner().equals(knownMember.owner()); }
private static boolean isObjectsMethod(Symbol symbol, String methodName) { return symbol.isMethodSymbol() && symbol.owner().type().is("java.util.Objects") && methodName.equals(symbol.name()); }