private static int getPriority(MethodDefinition md) { int priority = 0; if (md.isProtected()) priority += 10; else if (md.isPackagePrivate() || md.isPrivate()) priority += 20; return priority; }
@MethodVisitor public boolean checkMethod(MethodDefinition md, TypeDefinition td) { return td.isPublic() && !td.isFinal() && !md.isPrivate() && !md.isPackagePrivate(); }
return; for(MethodDefinition md : td.getDeclaredMethods()) { if(md.isPrivate() && !md.isSpecialName() && !Methods.isSerializationMethod(md) && !md.getName().toLowerCase(Locale.ENGLISH).contains("debug") .hasCompleteHierarchy(td)) { for(MethodDefinition md : td.getDeclaredMethods()) { if (!md.isSpecialName() && !md.isPrivate() && !md.isSynthetic() && Methods.findSuperMethod( md) == null) { MemberInfo mi = new MemberInfo(md);
case "readObject": if(md.getSignature().equals("(Ljava/io/ObjectInputStream;)V")) { if(!md.isPrivate()) mc.report("SerializationMethodMustBePrivate", 0); if(Flags.testAny(md.getFlags(), Flags.SYNCHRONIZED)) if(md.getSignature().equals("()V") && !md.isPrivate()) mc.report("SerializationMethodMustBePrivate", 0); break; case "writeObject": if(md.getSignature().equals("(Ljava/io/ObjectOutputStream;)V")) { if(!md.isPrivate()) mc.report("SerializationMethodMustBePrivate", 0); if(Flags.testAny(md.getFlags(), Flags.SYNCHRONIZED) &&
if (node instanceof Loop && !phiArgs.stream().allMatch(src -> Nodes.find(node, src::equals) != null)) { if (md.getName().equals("initialise") && md.isStatic() && md.isPrivate() && Types.isString(md.getReturnType()) && td.getSimpleName().equals("ParseException"))
@Override protected void visitType(TypeDefinition td) { for (MethodDefinition md : td.getDeclaredMethods()) { MethodData mdata = getMethodData(md); if (md.isFinal() || td.isFinal() || md.isStatic() || md.isPrivate()) { mdata.flags |= METHOD_FINAL; } visitMethod(mdata, md); for (MethodDefinition superMethod : Methods.findSuperMethods(md)) { getMethodData(superMethod).addSubMethod(mdata); } } }
else if (md.isPackagePrivate()) priority += 6; else if (md.isPrivate()) priority += 10;
return; int priority = 0; if(md.isPrivate() || td.isPrivate()) priority += 20; else if(!md.isPublic() || !td.isPublic())
@AstVisitor(nodes = AstNodes.EXPRESSIONS) public void visit(Expression expr, NodeChain nc, MethodContext mc, MethodDefinition md, TypeDefinition td) { if (expr.getCode() == AstCode.Return && !expr.getArguments().isEmpty()) { Expression child = Exprs.getChild(expr, 0); if (child.getCode() == AstCode.AConstNull) { MethodDefinition curMethod = nc.getLambdaMethod(); if (curMethod == null) curMethod = md; String warningType = curMethod.getReturnType().isArray() ? "ArrayReturnNull" : TYPE_TO_WARNING .get(curMethod.getReturnType().getInternalName()); if (warningType != null) { int priority = 0; if (!td.isPublic() || md.isPrivate() || md.isPackagePrivate()) priority = 20; else if (md.isProtected() || md != curMethod) priority = 10; // Method which simply contains "return null": probably stub or something if(nc.getParent() == null && nc.isOnlyChild(expr)) priority += 10; mc.report(warningType, priority, expr.getArguments().get(0), RETURN_TYPE.create(md .getReturnType())); } } } } }
public static boolean isOverride(final MethodDefinition method, final MethodReference ancestorMethod) { final MethodDefinition resolvedAncestor = ancestorMethod.resolve(); if (resolvedAncestor == null || resolvedAncestor.isFinal() || resolvedAncestor.isPrivate() || resolvedAncestor.isStatic()) { return false;
public static boolean isOverride(final MethodDefinition method, final MethodReference ancestorMethod) { final MethodDefinition resolvedAncestor = ancestorMethod.resolve(); if (resolvedAncestor == null || resolvedAncestor.isFinal() || resolvedAncestor.isPrivate() || resolvedAncestor.isStatic()) { return false;
public static boolean isOverride(final MethodDefinition method, final MethodReference ancestorMethod) { final MethodDefinition resolvedAncestor = ancestorMethod.resolve(); if (resolvedAncestor == null || resolvedAncestor.isFinal() || resolvedAncestor.isPrivate() || resolvedAncestor.isStatic()) { return false;