Skip to content

andysonnenburg/BC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ABOUT BC
========

BC is a simple layer on the ASM bytecode manipulation framework.  It adds low
cost type safety to opcode usage, as well as providing a simple and readable
DSL.

USAGE
=====

Simply extend com.github.sonyandy.bc.BC and provide an implementation for
protected[this] defineClass.  For example:

object Example extends BC[AnyRef] {
  protected[this] defineClass {
    public.`final`.`class`("Example") {
      
      public.void("<init>")() {
        ALOAD(0)
        INVOKESPECIAL("java/lang/Object", "<init>", "()V")
        RETURN
      }

    }
  }
}

val exampleClass: Class[AnyRef] = Example

Note that an implicit conversion from BC[A] to Class[A] is provided, using the
ClassLoader of the current thread to load the class.

About

Scala Bytecode DSL built on ASM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages