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

The following examples show how to use org.objectweb.asm.Opcodes#ACC_ANNOTATION . 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: ModifierReviewable.java    From byte-buddy with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public TypeManifestation getTypeManifestation() {
    int modifiers = getModifiers();
    switch (modifiers & (Opcodes.ACC_ANNOTATION | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_FINAL)) {
        case Opcodes.ACC_FINAL:
            return TypeManifestation.FINAL;
        case Opcodes.ACC_ABSTRACT:
            return TypeManifestation.ABSTRACT;
        case Opcodes.ACC_ABSTRACT | Opcodes.ACC_INTERFACE:
            return TypeManifestation.INTERFACE;
        case Opcodes.ACC_ABSTRACT | Opcodes.ACC_INTERFACE | Opcodes.ACC_ANNOTATION:
            return TypeManifestation.ANNOTATION;
        case EMPTY_MASK:
            return TypeManifestation.PLAIN;
        default:
            throw new IllegalStateException("Unexpected modifiers: " + modifiers);
    }
}
 
Example 2
Source File: ClassNodeDecompiler.java    From bytecode-viewer with GNU General Public License v3.0 5 votes vote down vote up
public static String getAccessString(int access) {
    List<String> tokens = new ArrayList<String>();
    if ((access & Opcodes.ACC_PUBLIC) != 0)
        tokens.add("public");
    if ((access & Opcodes.ACC_PRIVATE) != 0)
        tokens.add("private");
    if ((access & Opcodes.ACC_PROTECTED) != 0)
        tokens.add("protected");
    if ((access & Opcodes.ACC_FINAL) != 0)
        tokens.add("final");
    if ((access & Opcodes.ACC_SYNTHETIC) != 0)
        tokens.add("synthetic");
    // if ((access & Opcodes.ACC_SUPER) != 0)
    // tokens.add("super"); implied by invokespecial insn
    if ((access & Opcodes.ACC_ABSTRACT) != 0)
        tokens.add("abstract");
    if ((access & Opcodes.ACC_INTERFACE) != 0)
        tokens.add("interface");
    if ((access & Opcodes.ACC_ENUM) != 0)
        tokens.add("enum");
    if ((access & Opcodes.ACC_ANNOTATION) != 0)
        tokens.add("annotation");
    if (!tokens.contains("interface") && !tokens.contains("enum")
            && !tokens.contains("annotation"))
        tokens.add("class");
    if (tokens.size() == 0)
        return "[Error parsing]";

    // hackery delimeters
    StringBuilder sb = new StringBuilder(tokens.get(0));
    for (int i = 1; i < tokens.size(); i++) {
        sb.append(" ");
        sb.append(tokens.get(i));
    }
    return sb.toString();
}
 
Example 3
Source File: MaybeContinuableClassVisitor.java    From tascalate-javaflow with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
    isAnnotation = (access & Opcodes.ACC_ANNOTATION) > 0;
    selfclass = name;
    superclass = superName;
    superinterfaces = interfaces;
}
 
Example 4
Source File: MaybeContinuableClassVisitor.java    From tascalate-javaflow with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
    isAnnotation = (access & Opcodes.ACC_ANNOTATION) > 0;
    selfclass = name;
    superclass = superName;
    superinterfaces = interfaces;
}
 
Example 5
Source File: ASMReflector.java    From meghanada-server with GNU General Public License v3.0 5 votes vote down vote up
private static void readClassIndex(
    Map<ClassIndex, File> indexes, InputStream in, File file, boolean allowSuper)
    throws IOException {

  ClassReader classReader = new ClassReader(in);
  String className = ClassNameUtils.replaceSlash(classReader.getClassName());

  boolean projectOutput = file.isDirectory();

  int access = classReader.getAccess();

  boolean isPublic = (Opcodes.ACC_PUBLIC & access) == Opcodes.ACC_PUBLIC;
  boolean isProtected = (Opcodes.ACC_PROTECTED & access) == Opcodes.ACC_PROTECTED;

  boolean isInterface = (Opcodes.ACC_INTERFACE & access) == Opcodes.ACC_INTERFACE;
  boolean isAnnotation = (Opcodes.ACC_ANNOTATION & access) == Opcodes.ACC_ANNOTATION;

  boolean isSuper = false;

  if (allowSuper) {
    isSuper = (Opcodes.ACC_SUPER & access) == Opcodes.ACC_SUPER;
  }
  if (projectOutput || (isPublic || isProtected || isSuper)) {
    String pkg = ClassNameUtils.getPackage(className);
    boolean onlyClassName = !preloadClassPackages.contains(pkg);
    ClassAnalyzeVisitor classAnalyzeVisitor =
        new ClassAnalyzeVisitor(className, onlyClassName, false);
    classReader.accept(classAnalyzeVisitor, 0);
    ClassIndex classIndex = classAnalyzeVisitor.getClassIndex();
    if (!classIndex.isAnonymous) {
      classIndex.setInterface(isInterface);
      classIndex.setAnnotation(isAnnotation);
      indexes.put(classIndex, file);
      if (!onlyClassName) {
        innerCache.putIfAbsent(className, classAnalyzeVisitor.getMembers());
      }
    }
  }
}
 
Example 6
Source File: ClassInfo.java    From java-almanac with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
@Override
public ElementType getType() {
	if ((access & Opcodes.ACC_ANNOTATION) != 0) {
		return ElementType.ANNOTATION;
	}
	if ((access & Opcodes.ACC_INTERFACE) != 0) {
		return ElementType.INTERFACE;
	}
	if ((access & Opcodes.ACC_ENUM) != 0) {
		return ElementType.ENUM;
	}
	return ElementType.CLASS;
}
 
Example 7
Source File: SAXClassAdapter.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
static void appendAccess(final int access, final StringBuilder sb) {
  if ((access & Opcodes.ACC_PUBLIC) != 0) {
    sb.append("public ");
  }
  if ((access & Opcodes.ACC_PRIVATE) != 0) {
    sb.append("private ");
  }
  if ((access & Opcodes.ACC_PROTECTED) != 0) {
    sb.append("protected ");
  }
  if ((access & Opcodes.ACC_FINAL) != 0) {
    if ((access & ACCESS_MODULE) == 0) {
      sb.append("final ");
    } else {
      sb.append("transitive ");
    }
  }
  if ((access & Opcodes.ACC_STATIC) != 0) {
    sb.append("static ");
  }
  if ((access & Opcodes.ACC_SUPER) != 0) {
    if ((access & ACCESS_CLASS) == 0) {
      if ((access & ACCESS_MODULE_REQUIRES) != 0) {
        sb.append("transitive ");
      } else {
        if ((access & ACCESS_MODULE) == 0) {
          sb.append("synchronized ");
        } else {
          sb.append("open ");
        }
      }
    } else {
      sb.append("super ");
    }
  }
  if ((access & Opcodes.ACC_VOLATILE) != 0) {
    if ((access & ACCESS_FIELD) == 0) {
      sb.append("bridge ");
    } else {
      if ((access & ACCESS_MODULE_REQUIRES) == 0) {
        sb.append("volatile ");
      } else {
        sb.append("static ");
      }
    }
  }
  if ((access & Opcodes.ACC_TRANSIENT) != 0) {
    if ((access & ACCESS_FIELD) == 0) {
      sb.append("varargs ");
    } else {
      sb.append("transient ");
    }
  }
  if ((access & Opcodes.ACC_NATIVE) != 0) {
    sb.append("native ");
  }
  if ((access & Opcodes.ACC_STRICT) != 0) {
    sb.append("strict ");
  }
  if ((access & Opcodes.ACC_INTERFACE) != 0) {
    sb.append("interface ");
  }
  if ((access & Opcodes.ACC_ABSTRACT) != 0) {
    sb.append("abstract ");
  }
  if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
    sb.append("synthetic ");
  }
  if ((access & Opcodes.ACC_ANNOTATION) != 0) {
    sb.append("annotation ");
  }
  if ((access & Opcodes.ACC_ENUM) != 0) {
    sb.append("enum ");
  }
  if ((access & Opcodes.ACC_DEPRECATED) != 0) {
    sb.append("deprecated ");
  }
  if ((access & Opcodes.ACC_MANDATED) != 0) {
    if ((access & ACCESS_CLASS) == 0) {
      sb.append("module ");
    } else {
      sb.append("mandated ");
    }
  }
}
 
Example 8
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 9
Source File: AbiFilteringClassVisitor.java    From buck with Apache License 2.0 4 votes vote down vote up
private boolean isAnnotation(int access) {
  return (access & Opcodes.ACC_ANNOTATION) > 0;
}
 
Example 10
Source File: AbstractASMBackend.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Utility method to get the access modifiers of a Host
 * @param modVal The bitset representation of the Host's modifiers
 * @param host The Host (SootClass, SootField or SootMethod) the modifiers are to be retrieved from
 * @return A bitset representation of the Host's modifiers in ASM's internal representation
 */
protected static int getModifiers(int modVal, Host host) {
	int modifier = 0;
	// Retrieve visibility-modifier
	if (Modifier.isPublic(modVal)) {
		modifier |= Opcodes.ACC_PUBLIC;
	} else if (Modifier.isPrivate(modVal)) {
		modifier |= Opcodes.ACC_PRIVATE;
	} else if (Modifier.isProtected(modVal)) {
		modifier |= Opcodes.ACC_PROTECTED;
	}
	// Retrieve static-modifier
	if (Modifier.isStatic(modVal)
			&& ((host instanceof SootField) || (host instanceof SootMethod))) {
		modifier |= Opcodes.ACC_STATIC;
	}
	// Retrieve final-modifier
	if (Modifier.isFinal(modVal)) {
		modifier |= Opcodes.ACC_FINAL;
	}
	// Retrieve synchronized-modifier
	if (Modifier.isSynchronized(modVal) && host instanceof SootMethod) {
		modifier |= Opcodes.ACC_SYNCHRONIZED;
	}
	// Retrieve volatile/bridge-modifier
	if (Modifier.isVolatile(modVal) && !(host instanceof SootClass)) {
		modifier |= Opcodes.ACC_VOLATILE;
	}
	// Retrieve transient/varargs-modifier
	if (Modifier.isTransient(modVal) && !(host instanceof SootClass)) {
		modifier |= Opcodes.ACC_TRANSIENT;
	}
	// Retrieve native-modifier
	if (Modifier.isNative(modVal) && host instanceof SootMethod) {
		modifier |= Opcodes.ACC_NATIVE;
	}
	// Retrieve interface-modifier
	if (Modifier.isInterface(modVal) && host instanceof SootClass) {
		modifier |= Opcodes.ACC_INTERFACE;
	} else if (host instanceof SootClass) {
		/*
		 * For all classes except for interfaces the super-flag should be
		 * set. See JVM 8-Specification section 4.1, page 72.
		 */
		modifier |= Opcodes.ACC_SUPER;
	}
	// Retrieve abstract-modifier
	if (Modifier.isAbstract(modVal) && !(host instanceof SootField)) {
		modifier |= Opcodes.ACC_ABSTRACT;
	}
	// Retrieve strictFP-modifier
	if (Modifier.isStrictFP(modVal) && host instanceof SootMethod) {
		modifier |= Opcodes.ACC_STRICT;
	}
	/*
	 * Retrieve synthetic-modifier. Class not present in source-code but
	 * generated by e.g. compiler TODO Do we need both checks?
	 */
	if (Modifier.isSynthetic(modVal) || host.hasTag("SyntheticTag")) {
		modifier |= Opcodes.ACC_SYNTHETIC;
	}
	// Retrieve annotation-modifier
	if (Modifier.isAnnotation(modVal) && host instanceof SootClass) {
		modifier |= Opcodes.ACC_ANNOTATION;
	}
	// Retrieve enum-modifier
	if (Modifier.isEnum(modVal) && !(host instanceof SootMethod)) {
		modifier |= Opcodes.ACC_ENUM;
	}
	return modifier;
}
 
Example 11
Source File: AccessFlags.java    From buck with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the class access flags (see JVMS8 4.1) for the given type element, augmented by the
 * special ASM pseudo-access flag for @Deprecated types.
 */
public int getAccessFlags(TypeElement typeElement) {
  ElementKind kind;
  try {
    kind = typeElement.getKind();
  } catch (CannotInferException e) {
    Preconditions.checkState(typeElement.getNestingKind().isNested());

    // We cannot know the access flags of an inferred type element. However, the only
    // flag that matters in the InnerClasses table is ACC_STATIC. When reading the
    // InnerClasses table, the compiler may create ClassSymbols for types it hasn't
    // seen before, and the absence of ACC_STATIC will cause it to mark those
    // ClassSymbols as inner classes, and it will not correct that when later loading
    // the class from its definitive class file. However, it is safe to mark
    // everything with ACC_STATIC, because the compiler *will* properly update
    // non-static classes when loading their definitive class files.
    // (http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/file/9986bf97a48d/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java#l2272)
    return Opcodes.ACC_STATIC;
  }

  int result = getCommonAccessFlags(typeElement);
  switch (kind) {
    case ANNOTATION_TYPE:
      // No ACC_SUPER here per JVMS 4.1
      result = result | Opcodes.ACC_ANNOTATION;
      result = result | Opcodes.ACC_INTERFACE;
      result = result | Opcodes.ACC_ABSTRACT;
      break;
    case ENUM:
      result = result | Opcodes.ACC_SUPER; // JVMS 4.1
      result = result | Opcodes.ACC_ENUM;

      if (isAbstractEnum(typeElement)) {
        result = result & ~Opcodes.ACC_FINAL | Opcodes.ACC_ABSTRACT;
      }
      break;
    case INTERFACE:
      // No ACC_SUPER here per JVMS 4.1
      result = result | Opcodes.ACC_ABSTRACT;
      result = result | Opcodes.ACC_INTERFACE;
      break;
      // $CASES-OMITTED$
    default:
      result = result | Opcodes.ACC_SUPER; // JVMS 4.1
      break;
  }

  return result;
}
 
Example 12
Source File: Engine.java    From JReFrameworker with MIT License 4 votes vote down vote up
@SuppressWarnings("unused")
private static String getAccessModifiers(int access){
	LinkedList<String> modifiers = new LinkedList<String>();
	if((Opcodes.ACC_ABSTRACT & access) == Opcodes.ACC_ABSTRACT){
		modifiers.add("abstract");
	}
	if((Opcodes.ACC_ANNOTATION & access) == Opcodes.ACC_ANNOTATION){
		modifiers.add("annotation");
	}
	if((Opcodes.ACC_BRIDGE & access) == Opcodes.ACC_BRIDGE){
		modifiers.add("bridge");
	}
	if((Opcodes.ACC_DEPRECATED & access) == Opcodes.ACC_DEPRECATED){
		modifiers.add("deprecated");
	}
	if((Opcodes.ACC_ENUM & access) == Opcodes.ACC_ENUM){
		modifiers.add("enum");
	}
	if((Opcodes.ACC_FINAL & access) == Opcodes.ACC_FINAL){
		modifiers.add("final");
	}
	if((Opcodes.ACC_INTERFACE & access) == Opcodes.ACC_INTERFACE){
		modifiers.add("interface");
	}
	if((Opcodes.ACC_MANDATED & access) == Opcodes.ACC_MANDATED){
		modifiers.add("mandated");
	}
	if((Opcodes.ACC_NATIVE & access) == Opcodes.ACC_NATIVE){
		modifiers.add("native");
	}
	if((Opcodes.ACC_PRIVATE & access) == Opcodes.ACC_PRIVATE){
		modifiers.add("private");
	}
	if((Opcodes.ACC_PROTECTED & access) == Opcodes.ACC_PROTECTED){
		modifiers.add("protected");
	}
	if((Opcodes.ACC_PUBLIC & access) == Opcodes.ACC_PUBLIC){
		modifiers.add("public");
	}
	if((Opcodes.ACC_STATIC & access) == Opcodes.ACC_STATIC){
		modifiers.add("static");
	}
	if((Opcodes.ACC_STRICT & access) == Opcodes.ACC_STRICT){
		modifiers.add("strict");
	}
	if((Opcodes.ACC_SUPER & access) == Opcodes.ACC_SUPER){
		modifiers.add("super");
	}
	if((Opcodes.ACC_SYNCHRONIZED & access) == Opcodes.ACC_SYNCHRONIZED){
		modifiers.add("synchronized");
	}
	if((Opcodes.ACC_SYNTHETIC & access) == Opcodes.ACC_SYNTHETIC){
		modifiers.add("synthetic");
	}
	if((Opcodes.ACC_TRANSIENT & access) == Opcodes.ACC_TRANSIENT){
		modifiers.add("transient");
	}
	if((Opcodes.ACC_VARARGS & access) == Opcodes.ACC_VARARGS){
		modifiers.add("varargs");
	}
	if((Opcodes.ACC_VOLATILE & access) == Opcodes.ACC_VOLATILE){
		modifiers.add("volatile");
	}
	return modifiers.toString();
}
 
Example 13
Source File: MaybeContinuableAnnotationVisitor.java    From tascalate-javaflow with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
    isAnnotation = (access & Opcodes.ACC_ANNOTATION) > 0;
}
 
Example 14
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 15
Source File: ClassReaderWrapper.java    From pinpoint with Apache License 2.0 4 votes vote down vote up
public boolean isAnnotation() {
    return (this.classReader.getAccess() & Opcodes.ACC_ANNOTATION) != 0;
}
 
Example 16
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 17
Source File: MaybeContinuableAnnotationVisitor.java    From tascalate-javaflow with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
    isAnnotation = (access & Opcodes.ACC_ANNOTATION) > 0;
}
 
Example 18
Source File: GizmoClassVisitor.java    From gizmo with Apache License 2.0 4 votes vote down vote up
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
    super.visit(version, access, name, signature, superName, interfaces);
    this.name = name;
    append("// Class: ").append(name).newLine();
    append("//     Access = ");
    for (int mods = access; mods != 0;) {
        int mod = Integer.lowestOneBit(mods);
        switch (mod) {
            case Opcodes.ACC_PUBLIC: {
                append(" public");
                break;
            }
            case Opcodes.ACC_PRIVATE: {
                append(" private");
                break;
            }
            case Opcodes.ACC_PROTECTED: {
                append(" protected");
                break;
            }
            case Opcodes.ACC_STATIC: {
                append(" static");
                break;
            }
            case Opcodes.ACC_FINAL: {
                append(" final");
                break;
            }
            case Opcodes.ACC_INTERFACE: {
                append(" interface");
                break;
            }
            case Opcodes.ACC_ABSTRACT: {
                append(" abstract");
                break;
            }
            case Opcodes.ACC_SYNTHETIC: {
                append(" synthetic");
                break;
            }
            case Opcodes.ACC_ANNOTATION: {
                append(" annotation");
                break;
            }
            case Opcodes.ACC_ENUM: {
                append(" enum");
                break;
            }
        }
        mods ^= mod;
    }
    newLine();
    if (superName != null) append("//     Extends: ").append(superName).newLine();
    if (interfaces != null && interfaces.length > 0) {
        append("//     Implements:").newLine();
        for (String iName : interfaces) {
            append("//         ").append(iName).newLine();
        }
    }
    newLine();
    append("// DO NOT MODIFY.  This is not actually a source file; it is a textual representation of generated code.");
    newLine();
    append("// Use only for debugging purposes.");
    newLine().newLine();
}
 
Example 19
Source File: MaybeContinuableAnnotationVisitor.java    From tascalate-javaflow with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
    isAnnotation = (access & Opcodes.ACC_ANNOTATION) > 0;
}
 
Example 20
Source File: Type.java    From spring-graalvm-native with Apache License 2.0 4 votes vote down vote up
public boolean isAnnotation() {
	if (dimensions > 0)
		return false;
	return (node.access & Opcodes.ACC_ANNOTATION) != 0;
}