private MemberInfo getMistakeFix(MethodDefinition md) { if (md.getName().equals("hashcode") && md.getSignature().equals("()I")) { return new MemberInfo("java/lang/Object", "hashCode", md.getSignature()); } if (md.getName().equals("tostring") && md.getSignature().equals("()Ljava/lang/String;")) { return new MemberInfo("java/lang/Object", "toString", md.getSignature()); } if (md.getName().equals("equal") && md.getSignature().equals("(Ljava/lang/Object;)Z")) { return new MemberInfo("java/lang/Object", "equals", md.getSignature()); } return null; }
private static MethodDefinition findReplacement(String name, TypeDefinition target) { for (MethodDefinition md : target.getDeclaredMethods()) { if (!md.isPublic() || !md.getSignature().equals("()V")) continue; if (name.equals("wait") && md.getName().equals("await")) return md; if (name.equals("notify") && (md.getName().equals("signal") || md.getName().equals("countDown"))) return md; if (name.equals("notifyAll") && (md.getName().equals("signalAll") || md.getName().equals("countDown"))) return md; } return null; } }
@MethodVisitor public boolean check(MethodDefinition md, TypeDefinition td) { // Skip some autogenerated methods if(md.getName().equals("yyparse") && md.getReturnType().getInternalName().equals("java/lang/Object")) return false; if(md.getName().startsWith("jj") && td.getName().endsWith("TokenManager")) return false; if(md.getName().equals("getNextToken") && md.getSignature().equals("()I")) return false; return true; }
@SuppressWarnings("ConstantConditions") public MethodBody readBody() { try { return readBodyCore(); } catch (final Throwable t) { throw new MethodBodyParseException( format( "An error occurred while parsing the bytecode of method '%s:%s'.", _methodDefinition.getFullName(), _methodDefinition.getSignature() ), t); } }
@SuppressWarnings("ConstantConditions") public MethodBody readBody() { try { return readBodyCore(); } catch (final Throwable t) { throw new MethodBodyParseException( format( "An error occurred while parsing the bytecode of method '%s:%s'.", _methodDefinition.getFullName(), _methodDefinition.getSignature() ), t); } }
@SuppressWarnings("ConstantConditions") public MethodBody readBody() { try { return readBodyCore(); } catch (final Throwable t) { throw new MethodBodyParseException( format( "An error occurred while parsing the bytecode of method '%s:%s'.", _methodDefinition.getFullName(), _methodDefinition.getSignature() ), t); } }
public boolean isApplicable(MethodDefinition md) { if (!anno.methodName().isEmpty() && !anno.methodName().equals(md.getName())) return false; if (!anno.methodSignature().isEmpty() && !anno.methodSignature().equals(md.getSignature())) return false; if (anno.minVersion() > 0 && md.getDeclaringType().getCompilerMajorVersion() - 44 < anno.minVersion()) return false; return true; } }
}); } else if((md.getName().equals("readResolve") || md.getName().equals("readObjectNoData")) && md.getSignature().startsWith("()") || md.getName().equals("readObject") && md.getSignature().equals("(Ljava/io/ObjectInputStream;)V")){ cf.fields.forEach((mi, fd) -> { if(fd.isStatic()) {
switch(md.getName()) { case "readResolve": if(md.getSignature().startsWith("()")) { if(!md.getSignature().equals("()Ljava/lang/Object;")) { mc.report("ReadResolveMustReturnObject", 0); } else if(md.isStatic()) { if(md.getSignature().equals("(Ljava/io/ObjectInputStream;)V")) { if(!md.isPrivate()) mc.report("SerializationMethodMustBePrivate", 0); 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);
private Expression findOverloadCall(MethodDefinition md, Block block) { return (Expression)Nodes.find(block, node -> { if (Nodes.isOp(node, md.isConstructor() ? AstCode.InvokeSpecial : md.isStatic() ? AstCode.InvokeStatic : AstCode.InvokeVirtual)) { Expression expr = (Expression) node; MethodReference mr = (MethodReference) expr.getOperand(); if (mr.getDeclaringType().isEquivalentTo(md.getDeclaringType()) && mr.getName().equals(md.getName()) && !mr.getSignature().equals(md.getSignature())) { return true; } } return false; }); } }
"Beginning bytecode AST construction for %s:%s...", body.getMethod().getFullName(), body.getMethod().getSignature() "Finished bytecode AST construction for %s:%s.", body.getMethod().getFullName(), body.getMethod().getSignature()
"Beginning bytecode AST construction for %s:%s...", body.getMethod().getFullName(), body.getMethod().getSignature() "Finished bytecode AST construction for %s:%s.", body.getMethod().getFullName(), body.getMethod().getSignature()
"Beginning bytecode AST construction for %s:%s...", body.getMethod().getFullName(), body.getMethod().getSignature() "Finished bytecode AST construction for %s:%s.", body.getMethod().getFullName(), body.getMethod().getSignature()
mdata.fullyAnalyzed = true; } catch (Throwable t) { ctx.addError(new ErrorMessage(null, type.getFullName(), md.getFullName(), md.getSignature(), -1, t));
"Could not load method body for '%s:%s'; wrong magic number in class header: 0x%8X.", getFullName(), getSignature(), magic
"Could not load method body for '%s:%s'; wrong magic number in class header: 0x%8X.", getFullName(), getSignature(), magic
"Could not load method body for '%s:%s'; wrong magic number in class header: 0x%8X.", getFullName(), getSignature(), magic
!MetadataHelper.isEnclosedBy(resolvedMethod.getDeclaringType(), context.getCurrentType()) || (StringUtilities.equals(resolvedMethod.getFullName(), context.getCurrentMethod().getFullName()) && StringUtilities.equals(resolvedMethod.getSignature(), context.getCurrentMethod().getSignature()))) {
!MetadataHelper.isEnclosedBy(resolvedMethod.getDeclaringType(), context.getCurrentType()) || (StringUtilities.equals(resolvedMethod.getFullName(), context.getCurrentMethod().getFullName()) && StringUtilities.equals(resolvedMethod.getSignature(), context.getCurrentMethod().getSignature()))) {