private String getMemberName(JavaClass c, String className, int memberNameIndex, int signatureIndex) { return className + "." + ((ConstantUtf8) c.getConstantPool().getConstant(memberNameIndex, Const.CONSTANT_Utf8)).getBytes() + " : " + ((ConstantUtf8) c.getConstantPool().getConstant(signatureIndex, Const.CONSTANT_Utf8)).getBytes(); }
public static int getNextSourceLine(LineNumberTable lineNumbers, int sourceLine) { int result = Integer.MAX_VALUE; for (LineNumber ln : lineNumbers.getLineNumberTable()) { int thisLine = ln.getLineNumber(); if (sourceLine < thisLine && thisLine < result) { result = thisLine; } } return result; } }
Scanner(JavaClass theClass, Method targetMethod, int targetPC) { if(DEBUG) { System.out.println("Scanning " + theClass.getClassName() + "." + targetMethod.getName()); } this.theClass = theClass; this.targetMethod = targetMethod; this.targetPC = targetPC; }
public static boolean hasInterestingClass(ConstantPool cp, Collection<String> classes) { for(Constant c : cp.getConstantPool()) { if(c instanceof ConstantClass) { String className = ((ConstantUtf8)cp.getConstant(((ConstantClass)c).getNameIndex())).getBytes(); if(classes.contains(className)) { return true; } } } return false; }
private boolean hasRequestMapping(JavaClass clazz) { Method[] methods = clazz.getMethods(); for (Method m: methods) { AnnotationEntry[] annotations = m.getAnnotationEntries(); for (AnnotationEntry ae: annotations) { if (REQUEST_MAPPING_ANNOTATION_TYPES.contains(ae.getAnnotationType())) { return true; } } } return false; }
private String getSlashedClassName() { return javaClass.getConstantPool().getConstantString(javaClass.getClassNameIndex(), Const.CONSTANT_Class); }
/** * Constructor. * * @param inputStream * the input stream from which to read the class file * @param fileName * filename of the class file */ public RepositoryClassParser(InputStream inputStream, String fileName) { classParser = new ClassParser(inputStream, fileName); }
public static String getExceptionSig(DismantleBytecode dbc, CodeException e) { if (e.getCatchType() == 0) { return "Ljava/lang/Throwable;"; } Constant c = dbc.getConstantPool().getConstant(e.getCatchType()); if (c instanceof ConstantClass) { return "L" + ((ConstantClass) c).getBytes(dbc.getConstantPool()) + ";"; } return "Ljava/lang/Throwable;"; }
private static int getLineNumber(Method method, InstructionHandle handle) { LineNumberTable table = method.getCode().getLineNumberTable(); if (table == null) { return -1; } return table.getSourceLine(handle.getPosition()); } }
protected String getStringFromIndex(int i) { ConstantUtf8 name = (ConstantUtf8) constantPool.getConstant(i); return name.getBytes(); }
@Override public void visit(JavaClass obj) { classIsFinal = obj.isFinal(); reportedForThisClass = false; classIsVisibleToOtherPackages = obj.isPublic() || obj.isProtected(); }
public static boolean isSynthetic(JavaClass j) { if (j.isSynthetic()) { return true; } for(Attribute a : j.getAttributes()) { if (a instanceof Synthetic) { return true; } } return false; } public static boolean isSynthetic(FieldGenOrMethodGen m) {
@Override public void visit(Method obj) { methodIsStatic = obj.isStatic(); state = 0; sawGetClass = -100; }
@Override public void visit(Method obj) { int flags = obj.getAccessFlags(); synchronizedMethod = (flags & Const.ACC_SYNCHRONIZED) != 0; }
@Override public boolean shouldVisit(JavaClass obj) { boolean isFinal = (obj.getAccessFlags() & Const.ACC_FINAL) != 0 || (obj.getAccessFlags() & Const.ACC_PUBLIC) == 0; return !isFinal; }
private static boolean internalIsSynthetic(final FieldOrMethod m) { if (m.isSynthetic()) { return true; } for (final Attribute a : m.getAttributes()) { if (a instanceof Synthetic) { return true; } } return false; }
boolean isSynthetic(FieldOrMethod obj) { Attribute[] a = obj.getAttributes(); for (Attribute aA : a) { if (aA instanceof Synthetic) { return true; } } return false; }
/** * Constructor. * * @param fileName * name of the class file */ public RepositoryClassParser(String fileName) { classParser = new ClassParser(fileName); }