@Override public void visitNode(Tree tree) { if (hasSemantic()) { visitClassTree((ClassTree) tree); } }
private void visitClassTree(ClassTree classTree) { Symbol.TypeSymbol symbol = classTree.symbol(); if (isInnerClass(symbol) && directlyImplementsSerializable(symbol)) { Tree reportTree = ExpressionsHelper.reportOnClassTree(classTree); Symbol owner = symbol.owner(); if (owner.isTypeSymbol()) { Symbol.TypeSymbol ownerType = (Symbol.TypeSymbol) owner; if (isMatchingOuterClass(ownerType.type()) && !symbol.isStatic()) { reportIssue(reportTree, "Make this inner class static"); } } else if (owner.isMethodSymbol()) { Symbol.TypeSymbol methodOwner = (Symbol.TypeSymbol) owner.owner(); if (isMatchingOuterClass(methodOwner.type()) && !owner.isStatic()) { String methodName = owner.name(); reportIssue(reportTree, "Make \"" + methodName + "\" static"); } } } }
private void visitClassTree(ClassTree classTree) { Symbol.TypeSymbol symbol = classTree.symbol(); if (isInnerClass(symbol) && directlyImplementsSerializable(symbol)) { Symbol owner = symbol.owner(); if (owner.isTypeSymbol()) { Symbol.TypeSymbol ownerType = (Symbol.TypeSymbol) owner; if (isMatchingOuterClass(ownerType.type()) && !symbol.isStatic()) { addIssue(classTree, "Make this inner class static"); } } else if (owner.isMethodSymbol()) { Symbol.TypeSymbol methodOwner = (Symbol.TypeSymbol) owner.owner(); if (isMatchingOuterClass(methodOwner.type()) && !owner.isStatic()) { String methodName = owner.name(); addIssue(classTree, "Make \"" + methodName + "\" static"); } } } }
private void visitClassTree(ClassTree classTree) { Symbol.TypeSymbol symbol = classTree.symbol(); if (isInnerClass(symbol) && directlyImplementsSerializable(symbol)) { Tree reportTree = ExpressionsHelper.reportOnClassTree(classTree); Symbol owner = symbol.owner(); if (owner.isTypeSymbol()) { Symbol.TypeSymbol ownerType = (Symbol.TypeSymbol) owner; if (isMatchingOuterClass(ownerType.type()) && !symbol.isStatic()) { reportIssue(reportTree, "Make this inner class static"); } } else if (owner.isMethodSymbol()) { Symbol.TypeSymbol methodOwner = (Symbol.TypeSymbol) owner.owner(); if (isMatchingOuterClass(methodOwner.type()) && !owner.isStatic()) { String methodName = owner.name(); reportIssue(reportTree, "Make \"" + methodName + "\" static"); } } } }
@Override public void visitNode(Tree tree) { if (hasSemantic()) { visitClassTree((ClassTree) tree); } }
@Override public void visitNode(Tree tree) { if (hasSemantic()) { visitClassTree((ClassTree) tree); } }