@Override
  public void buildToBytecode(ClassWriter parent) {
    int access = 0;
    access = BitUtil.set(access, Opcodes.ACC_STATIC, myModifiers.contains(PsiModifier.STATIC));
    access = BitUtil.set(access, Opcodes.ACC_PUBLIC, myModifiers.contains(PsiModifier.PUBLIC));

    StringBuilder descBuilder = new StringBuilder();
    descBuilder.append("(");
    for (JavaParameterStubBuilder parameter : myParameters) {
      appendType(parameter.getType(), descBuilder);
    }
    descBuilder.append(")");
    appendType(myReturnType, descBuilder);

    try {
      parent.visitMethod(access, myName, descBuilder.toString(), null, null).visitEnd();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 2
0
 private void setFlag(@FlagConstant byte mask, boolean value) {
   myFlags = BitUtil.set(myFlags, mask, value);
 }