Skip to content

int3/java2asm

Repository files navigation

java2asm

Simple tool to make generation of ASM API calls easier.

Basically, it parses javac's classfile output and creates a ClassFileTransformer that appends and / or replaces method calls.

Dependencies

python-javatools version >= 1.4.0. Currently PyPI only has 1.3.0, so install it from GitHub.

asm-4.1.jar. Put this in the source directory.

Limitations

No branching / exception handling opcodes have been implemented. But you can insert method calls to external functions and do all your control flow there, so this shouldn't be a real issue.

Example

Example.java:

@interface prepend {}
@interface replace {}

public class Example {
    
    @prepend
    public void foo() {
        System.out.println("Hello world");
    }

    @replace
    public void bar() {
        System.out.println("Hello world");
    }
}

javac Example.java && PATCHES=Example.class make

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published