Package org.allspice.bytecode

Examples of org.allspice.bytecode.ClassDef


    assertEquals(m.invoke(obj,7L,6L),true) ;
    assertEquals(m.invoke(obj,7L,7L),false) ;
  }
  public void test3() throws Exception {
   
    ClassDef cd = defadd("float",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",float.class,float.class) ;
    assertEquals(m.invoke(obj,7.0F,6.0F),true) ;
    assertEquals(m.invoke(obj,7.0F,7.0F),false) ;
  }
View Full Code Here


    assertEquals(m.invoke(obj,7.0F,6.0F),true) ;
    assertEquals(m.invoke(obj,7.0F,7.0F),false) ;
  }
  public void test4() throws Exception {
   
    ClassDef cd = defadd("int",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",int.class,int.class) ;
    assertEquals(m.invoke(obj,7,6),true) ;
    assertEquals(m.invoke(obj,7,7),false) ;
View Full Code Here

    assertEquals(m.invoke(obj,7,7),false) ;

  }
  public void test5() throws Exception {
   
    ClassDef cd = defadd("short",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",short.class,short.class) ;
    assertEquals(m.invoke(obj,(short)7,(short)6),true) ;
    assertEquals(m.invoke(obj,(short)7,(short)7),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,(short)7,(short)6),true) ;
    assertEquals(m.invoke(obj,(short)7,(short)7),false) ;
  }
  public void test6() throws Exception {
   
    ClassDef cd = defadd("byte",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",byte.class,byte.class) ;
    assertEquals(m.invoke(obj,(byte)7,(byte)6),true) ;
    assertEquals(m.invoke(obj,(byte)7,(byte)7),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,(byte)7,(byte)6),true) ;
    assertEquals(m.invoke(obj,(byte)7,(byte)7),false) ;
  }
  public void test7() throws Exception {
   
    ClassDef cd = defadd("char",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",char.class,char.class) ;
    assertEquals(m.invoke(obj,(char)7,(char)6),true) ;
    assertEquals(m.invoke(obj,(char)7,(char)7),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,(char)7,(char)6),true) ;
    assertEquals(m.invoke(obj,(char)7,(char)7),false) ;
  }
  public void test8() throws Exception {
   
    ClassDef cd = defadd("boolean",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",boolean.class,boolean.class) ;
    assertEquals(m.invoke(obj,true,false),true) ;
    assertEquals(m.invoke(obj,true,true),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,true,false),true) ;
    assertEquals(m.invoke(obj,true,true),false) ;
  }
  public void test9() throws Exception {
   
    ClassDef cd = defadd("java.lang.String",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",String.class,String.class) ;
    assertEquals(m.invoke(obj,"abc","abc"),false) ;
    assertEquals(m.invoke(obj,"abc","ABC"),true) ;
  }
View Full Code Here

import org.allspice.bytecode.instructions.Subtract;
import org.allspice.bytecode.instructions.Swap;

public class TestSwap extends MyTestCase {
  public ClassDef defadd01() {
    ClassDef cd = makeClassDef() ;
    {
      Var x = new Var(0,TypeName.INT) ;
      Var y = new Var(1,TypeName.INT) ;
      MethodDef md = new MethodDef(TypeName.INT,"getFoo",x,y) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Load(y),
          new Swap(),
          new Subtract(TypeCode.INT),
          new Return(TypeCode.INT)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

import org.allspice.bytecode.instructions.Load;
import org.allspice.bytecode.instructions.Return;

public class TestChkCast extends MyTestCase {
  public ClassDef defadd(String type) {
    ClassDef cd = makeClassDef() ;
    {
      Var x = new Var(0,TypeName.OBJECT) ;
      MethodDef md = new MethodDef(new TypeName(type),"getFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Convert(TypeCode.getType(x.getType()),new TypeName(type)),
          new Return(TypeCode.getType(type))
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

import org.allspice.bytecode.instructions.Load;
import org.allspice.bytecode.instructions.Return;

public class TestDup extends MyTestCase {
  public ClassDef defadd01() {
    ClassDef cd = makeClassDef() ;
    {
      Var x = new Var(0,TypeName.INT) ;
      MethodDef md = new MethodDef(TypeName.INT,"getFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Dup(TypeCode.VOID,TypeCode.INT),
          new Add(TypeCode.INT),
          new Return(TypeCode.INT)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.ClassDef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.