45 Star 88 Fork 43

Small Warm / asmsupport

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README_EN.md

asmsupport

Build Status Coverage Status Maven central openhub Codacy Badge License (LGPL version 3.0)

中文README

Class byte code manipulate library

The asmsupport is a java class byte code manipulate library, it make easier to write or modify a class at runtime. This framework is base on asm framework, but different from asm that avoid use original jvm instruction and avoid maintain stack and local variables.

Modules

Module Description
asmsupport-thrid This modules is a set of third open source code, the benefit is to avoid third library confilict when you use asmsupport.
asmsupport-standard This module is a standard apid definition of asmsupport, you can implement a new framework of asmsupport will be following this standard api.
asmsupport-core This module is the core implement of asmsupport-standard.
asmsupport-client This module is the wrapper of asmsupport-core, and it's also implement the asmsupport-standard api
asmsupport-grammar This module is support to java grammar.
asmsupport-issues This module is all of the test code for each issue test, the benefit of this modules is make the issue never reproduce again when you run 'mvn test'
asmsupport-sample Some simple sample use asmsupport, such as dynamic proxy, json serialize and so on.
asmsupport-lesson This module contains some asmsupport tutorials codes.

Maven Dependency

<dependency>
    <groupId>cn.wensiqun</groupId>
    <artifactId>asmsupport-client</artifactId>
    <version>x.x.x</version>
</dependency>

Features

Different

ASM

BECL

javassist

First Case

The source will using ASMSupport to generate the following code.

public class FirstCase {
    
    public static void main(String[] args) {
        System.out.println("Hello ASMSupport.");
    }
    
}

Class Generate Flow Diagram

Class Generate Flow Diagram

Advanced Sample

Json serialization base on byte code

The JSON sample under the package cn.wensiqun.asmsupport.sample.client.json, run the "cn.wensiqun.asmsupport.sample.client.json.demo.Runner" main method, and you can get the generated class in folder "target/asmsupport-test-generated".

Dynamic Proxy base on byte code

The Proxy sample under the package cn.wensiqun.asmsupport.sample.client.proxy, run the cn.wensiqun.asmsupport.sample.client.proxy.demo.Runner main method, and you can get the generated class in folder "target/asmsupport-test-generated".

License

Asmsupport is licensed under the GNU Lesser General Public License (LGPL)

Comments ( 1 )

Sign in for post a comment

About

当使用ASM编写的时候 很多情况下需要了解JVM底层的指令的, 并且需要对栈和本地变量显式的进行操作, 如果直接用ASM进行开发势必会付出更多的学习成本和时间成本,并且不易后期的维护。 此框架正好缓解了上述问题。使程序员编写字节码的时候更易于理解和开发,屏蔽了JVM指令以及栈和本地变量的操作,开发的时候更趋近于直接编写java程序。 spread retract
Java
Cancel

Releases

No release

Gitee Metrics

Contributors

All

Activities

load more
can not load any more
Java
1
https://git.oschina.net/wensiqun/asmsupport.git
git@git.oschina.net:wensiqun/asmsupport.git
wensiqun
asmsupport
asmsupport
master

Search

152606 8668e384 1899542 133635 2cd7d36e 1899542