static boolean methodMatch(AsmMethod method) { return SERIALIZABLE_CONTRACT_METHODS.contains(method.getName()); }
public String formatMessage(AsmMethod asmMethod) { if (asmMethod.isConstructor()) { return "Constructor '" + getShortClassName(asmMethod.getParent()) + "(...)' is deprecated."; } else { return "Method '" + getShortClassName(asmMethod.getParent()) + "." + asmMethod.getName() + "(...)' is deprecated."; } }
@Override public void visitMethod(AsmMethod asmMethod) { if (isPrivateUnused(asmMethod) && !isExcludedFromCheck(asmMethod)) { String messageStr = "Private method '" + asmMethod.getName() + "' is never used."; if ("<init>".equals(asmMethod.getName())) { messageStr = "Private constructor '" + asmClass.getDisplayName() + "("; List<String> params = Lists.newArrayList(); for (Parameter param : MethodSignatureScanner.scan(asmMethod.getGenericKey()).getArgumentTypes()) { String paramName = param.getClassName(); if (StringUtils.isEmpty(paramName)) { paramName = MethodSignatureScanner.getReadableType(param.getJvmJavaType()); } params.add(paramName + (param.isArray() ? "[]" : "")); } messageStr += Joiner.on(",").join(params) + ")' is never used."; } CheckMessage message = new CheckMessage(this, messageStr); int line = getMethodLineNumber(asmMethod); if (line > 0) { message.setLine(line); } SourceFile file = getSourceFile(asmClass); file.log(message); } }
@Override public void visitMethod(AsmMethod asmMethod) { if (!asmMethod.isUsed() && asmMethod.isProtected() && !asmClass.isAbstract() && !SerializableContract.methodMatch(asmMethod) && !asmMethod.isInherited()) { CheckMessage message = new CheckMessage(this, "Protected method '" + asmMethod.getName() + "(...)' is never used."); int line = getMethodLineNumber(asmMethod); if (line > 0) { message.setLine(line); } SourceFile file = getSourceFile(asmClass); file.log(message); } }