Java Code Examples for org.objectweb.asm.Opcodes#ACC_MODULE

The following examples show how to use org.objectweb.asm.Opcodes#ACC_MODULE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Textifier.java    From Concurnas with MIT License 4 votes vote down vote up
@Override
public void visit(
    final int version,
    final int access,
    final String name,
    final String signature,
    final String superName,
    final String[] interfaces) {
  if ((access & Opcodes.ACC_MODULE) != 0) {
    // Modules are printed in visitModule.
    return;
  }
  this.access = access;
  int majorVersion = version & 0xFFFF;
  int minorVersion = version >>> 16;
  stringBuilder.setLength(0);
  stringBuilder
      .append("// class version ")
      .append(majorVersion)
      .append('.')
      .append(minorVersion)
      .append(" (")
      .append(version)
      .append(")\n");
  if ((access & Opcodes.ACC_DEPRECATED) != 0) {
    stringBuilder.append(DEPRECATED);
  }
  appendRawAccess(access);

  appendDescriptor(CLASS_SIGNATURE, signature);
  if (signature != null) {
    appendJavaDeclaration(name, signature);
  }

  appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE));
  if ((access & Opcodes.ACC_ANNOTATION) != 0) {
    stringBuilder.append("@interface ");
  } else if ((access & Opcodes.ACC_INTERFACE) != 0) {
    stringBuilder.append("interface ");
  } else if ((access & Opcodes.ACC_ENUM) == 0) {
    stringBuilder.append("class ");
  }
  appendDescriptor(INTERNAL_NAME, name);

  if (superName != null && !"java/lang/Object".equals(superName)) {
    stringBuilder.append(" extends ");
    appendDescriptor(INTERNAL_NAME, superName);
  }
  if (interfaces != null && interfaces.length > 0) {
    stringBuilder.append(" implements ");
    for (int i = 0; i < interfaces.length; ++i) {
      appendDescriptor(INTERNAL_NAME, interfaces[i]);
      if (i != interfaces.length - 1) {
        stringBuilder.append(' ');
      }
    }
  }
  stringBuilder.append(" {\n\n");

  text.add(stringBuilder.toString());
}
 
Example 2
Source File: Textifier.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName,
    final String[] interfaces) {
  if ((access & Opcodes.ACC_MODULE) != 0) {
    // visitModule will print the module
    return;
  }
  this.access = access;
  int major = version & 0xFFFF;
  int minor = version >>> 16;
  buf.setLength(0);
  buf.append("// class version ").append(major).append('.').append(minor).append(" (").append(version).append(")\n");
  if ((access & Opcodes.ACC_DEPRECATED) != 0) {
    buf.append("// DEPRECATED\n");
  }
  buf.append("// access flags 0x").append(Integer.toHexString(access).toUpperCase()).append('\n');

  appendDescriptor(CLASS_SIGNATURE, signature);
  if (signature != null) {
    TraceSignatureVisitor sv = new TraceSignatureVisitor(access);
    SignatureReader r = new SignatureReader(signature);
    r.accept(sv);
    buf.append("// declaration: ").append(name).append(sv.getDeclaration()).append('\n');
  }

  appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE));
  if ((access & Opcodes.ACC_ANNOTATION) != 0) {
    buf.append("@interface ");
  } else if ((access & Opcodes.ACC_INTERFACE) != 0) {
    buf.append("interface ");
  } else if ((access & Opcodes.ACC_ENUM) == 0) {
    buf.append("class ");
  }
  appendDescriptor(INTERNAL_NAME, name);

  if (superName != null && !"java/lang/Object".equals(superName)) {
    buf.append(" extends ");
    appendDescriptor(INTERNAL_NAME, superName);
    buf.append(' ');
  }
  if (interfaces != null && interfaces.length > 0) {
    buf.append(" implements ");
    for (int i = 0; i < interfaces.length; ++i) {
      appendDescriptor(INTERNAL_NAME, interfaces[i]);
      buf.append(' ');
    }
  }
  buf.append(" {\n\n");

  text.add(buf.toString());
}
 
Example 3
Source File: Textifier.java    From JReFrameworker with MIT License 4 votes vote down vote up
@Override
public void visit(
    final int version,
    final int access,
    final String name,
    final String signature,
    final String superName,
    final String[] interfaces) {
  if ((access & Opcodes.ACC_MODULE) != 0) {
    // Modules are printed in visitModule.
    return;
  }
  this.access = access;
  int majorVersion = version & 0xFFFF;
  int minorVersion = version >>> 16;
  stringBuilder.setLength(0);
  stringBuilder
      .append("// class version ")
      .append(majorVersion)
      .append('.')
      .append(minorVersion)
      .append(" (")
      .append(version)
      .append(")\n");
  if ((access & Opcodes.ACC_DEPRECATED) != 0) {
    stringBuilder.append(DEPRECATED);
  }
  appendRawAccess(access);

  appendDescriptor(CLASS_SIGNATURE, signature);
  if (signature != null) {
    appendJavaDeclaration(name, signature);
  }

  appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE));
  if ((access & Opcodes.ACC_ANNOTATION) != 0) {
    stringBuilder.append("@interface ");
  } else if ((access & Opcodes.ACC_INTERFACE) != 0) {
    stringBuilder.append("interface ");
  } else if ((access & Opcodes.ACC_ENUM) == 0) {
    stringBuilder.append("class ");
  }
  appendDescriptor(INTERNAL_NAME, name);

  if (superName != null && !"java/lang/Object".equals(superName)) {
    stringBuilder.append(" extends ");
    appendDescriptor(INTERNAL_NAME, superName);
  }
  if (interfaces != null && interfaces.length > 0) {
    stringBuilder.append(" implements ");
    for (int i = 0; i < interfaces.length; ++i) {
      appendDescriptor(INTERNAL_NAME, interfaces[i]);
      if (i != interfaces.length - 1) {
        stringBuilder.append(' ');
      }
    }
  }
  stringBuilder.append(" {\n\n");

  text.add(stringBuilder.toString());
}
 
Example 4
Source File: Textifier.java    From JReFrameworker with MIT License 4 votes vote down vote up
@Override
public void visit(
    final int version,
    final int access,
    final String name,
    final String signature,
    final String superName,
    final String[] interfaces) {
  if ((access & Opcodes.ACC_MODULE) != 0) {
    // Modules are printed in visitModule.
    return;
  }
  this.access = access;
  int majorVersion = version & 0xFFFF;
  int minorVersion = version >>> 16;
  stringBuilder.setLength(0);
  stringBuilder
      .append("// class version ")
      .append(majorVersion)
      .append('.')
      .append(minorVersion)
      .append(" (")
      .append(version)
      .append(")\n");
  if ((access & Opcodes.ACC_DEPRECATED) != 0) {
    stringBuilder.append(DEPRECATED);
  }
  appendRawAccess(access);

  appendDescriptor(CLASS_SIGNATURE, signature);
  if (signature != null) {
    appendJavaDeclaration(name, signature);
  }

  appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE));
  if ((access & Opcodes.ACC_ANNOTATION) != 0) {
    stringBuilder.append("@interface ");
  } else if ((access & Opcodes.ACC_INTERFACE) != 0) {
    stringBuilder.append("interface ");
  } else if ((access & Opcodes.ACC_ENUM) == 0) {
    stringBuilder.append("class ");
  }
  appendDescriptor(INTERNAL_NAME, name);

  if (superName != null && !"java/lang/Object".equals(superName)) {
    stringBuilder.append(" extends ");
    appendDescriptor(INTERNAL_NAME, superName);
  }
  if (interfaces != null && interfaces.length > 0) {
    stringBuilder.append(" implements ");
    for (int i = 0; i < interfaces.length; ++i) {
      appendDescriptor(INTERNAL_NAME, interfaces[i]);
      if (i != interfaces.length - 1) {
        stringBuilder.append(' ');
      }
    }
  }
  stringBuilder.append(" {\n\n");

  text.add(stringBuilder.toString());
}