Package objot.bytecode

Examples of objot.bytecode.Bytecode


  protected abstract Object forWeave(Class<? extends Aspect> ac, Method m) throws Exception;

  private byte[] make(Class<?> target, Bytes ab, String name, Class<?> sup,
    ArrayList<Constructor<?>> ts, ArrayList<Method> ms)
  {
    Bytecode y = new Bytecode(ab);
    Constants cs = y.cons;
    y.head.setModifier(Mod2.PUBLIC | Mod2.SYNTHETIC);
    int classCi = cs.addClass(name);
    y.head.setSuperCi(cs.addClass(sup));

    Bytes n = cs.getUtf(cs.getClass(y.head.getClassCi()));
    for (int i = 1; i < cs.getConN(); i++)
      if (cs.getTag(i) == Constants.TAG_CLASS && cs.equalsUtf(cs.getClass(i), n))
        cs.setClass(i, cs.getClass(classCi));

    Field f = new Field(cs);
    f.setModifier(Mod2.PUBLIC | Mod2.STATIC);
    f.setNameCi(cs.addUcs(DATAS_NAME));
    f.setDescCi(cs.addUcs(Class2.descript(Object[].class)));
    y.getFields().addField(f);
    int datasCi = cs.addField(y.head.getClassCi(), cs.addNameDesc(f.getNameCi(),
      f.getDescCi()));

    Code ato = y.getProcs().removeProc(y.getProcs().searchProc(CTOR_NAME, null)).getCode();
    for (Constructor<?> t: ts)
      new WeaveProc(target, y, ato).ctor(t);
    Code ao = y.getProcs().removeProc( //
      y.getProcs().searchProc(Aspect.NAME_aspect, null)).getCode();
    for (int i = 0; i < ms.size(); i++)
      new WeaveProc(target, y, ao).method(ms.get(i), i, datasCi);
    y.removeInnerClasses();
    return y.normalize();
  }
View Full Code Here


    for (int i = 1; i < csn; i++)
      oss[i] = cs[i].os;
    lazy = lazy_;

    String name = Container.class.getName() + "$$" + hashCode();
    y = new Bytecode();
    cons = y.cons;
    int superCi = cons.addClass(Container.class);
    y.head.setModifier(Mod2.FINAL | Mod2.SYNTHETIC);
    y.head.setClassCi(cons.addClass(name));
    y.head.setSuperCi(superCi);
View Full Code Here

        + (cd.hashCode() ^ Thread.currentThread().hashCode()) + '$' //
        + c.getName().replace('.', '$') //
      : c.getName() + "$$" //
        + (cd.hashCode() ^ Thread.currentThread().hashCode()) + '$' //
        + cd.getClass().getName().replace('.', '$');
    Bytecode y = new Bytecode();
    y.head.setModifier(Mod2.PUBLIC | Mod2.FINAL | Mod2.SYNTHETIC);
    y.head.setClassCi(y.cons.addClass(y.cons.addUcs(Class2.pathName(name))));
    y.head.setSuperCi(y.cons.addClass(Clazz.class));
    y.getProcs().addProc(Procedure.addCtor0(y.cons, y.head.getSuperCi(), Mod2.PUBLIC));

    int classCi = y.cons.addClass(c);
    if (es.length > 0)
    {
      int encsCi = y.cons.addField(F_encs);
      int ableCi = y.cons.addProc(Property.M_encodable);
      int nameCi = y.cons.addField(Property.F_name);
      makeEncode(y, es, classCi, encsCi, ableCi, nameCi);
      makeEncodeRefs(y, es, classCi, encsCi, ableCi);
    }
    try
    {
      c.getDeclaredConstructor(Array2.CLASSES0);
      makeObject(y, classCi);
    }
    catch (NoSuchMethodException e)
    {
    }
    if (ds.length > 0)
    {
      makeDecode(y, ds, classCi, 0);
      makeDecode(y, ds, classCi, 1);
      makeDecode(y, ds, classCi, 2);
    }

    Clazz z = Class2.<Clazz>load(Clazz.class.getClassLoader(), name, y.normalize()) //
    .newInstance();
    z.encs = es;
    z.decs = dNames;
    return z;
  }
View Full Code Here

TOP

Related Classes of objot.bytecode.Bytecode

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.