Java Code Examples for javassist.bytecode.MethodInfo#getLineNumber()

The following examples show how to use javassist.bytecode.MethodInfo#getLineNumber() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SourceTargetTransformer.java    From DroidAssist with Apache License 2.0 5 votes vote down vote up
protected String getReplaceStatement(
        CtConstructor constructor,
        boolean initializer,
        String statement) {
    if (!initializer) {
        statement = replaceAnnotationStatement(constructor, statement);
    }
    MethodInfo methodInfo = constructor.getMethodInfo();
    int line = methodInfo.getLineNumber(0);
    String name = initializer ? "<clinit>" : "<init>";
    String className = constructor.getDeclaringClass().getName();
    ClassFile classFile2 = constructor.getDeclaringClass().getClassFile2();
    String fileName = classFile2 == null ? null : classFile2.getSourceFile();
    return getReplaceStatement(statement, line, name, className, fileName);
}
 
Example 2
Source File: SourceTargetTransformer.java    From DroidAssist with Apache License 2.0 5 votes vote down vote up
protected String getReplaceStatement(CtMethod method, String statement) {
    statement = replaceAnnotationStatement(method, statement);
    MethodInfo methodInfo = method.getMethodInfo();
    int line = methodInfo.getLineNumber(0);
    String name = method.getName();
    String className = method.getDeclaringClass().getName();
    ClassFile classFile2 = method.getDeclaringClass().getClassFile2();
    String fileName = classFile2 == null ? null : classFile2.getSourceFile();
    return getReplaceStatement(statement, line, name, className, fileName);
}