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

The following examples show how to use org.objectweb.asm.Opcodes#ACC_VOLATILE . 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: ClassInfo.java    From ModTheSpire with MIT License 6 votes vote down vote up
/**
 * Convert an ASM access mask to a reflection Modifier mask.
 *
 * @param asmAccessMask the ASM access mask
 *
 * @return the Modifier mask
 */
private int convertAccessMaskToModifierMask(int asmAccessMask)
{
    int modifier = 0;

    // Convert the ASM access info into Reflection API modifiers.

    if ((asmAccessMask & Opcodes.ACC_FINAL) != 0)
        modifier |= Modifier.FINAL;

    if ((asmAccessMask & Opcodes.ACC_NATIVE) != 0)
        modifier |= Modifier.NATIVE;

    if ((asmAccessMask & Opcodes.ACC_INTERFACE) != 0)
        modifier |= Modifier.INTERFACE;

    if ((asmAccessMask & Opcodes.ACC_ABSTRACT) != 0)
        modifier |= Modifier.ABSTRACT;

    if ((asmAccessMask & Opcodes.ACC_PRIVATE) != 0)
        modifier |= Modifier.PRIVATE;

    if ((asmAccessMask & Opcodes.ACC_PROTECTED) != 0)
        modifier |= Modifier.PROTECTED;

    if ((asmAccessMask & Opcodes.ACC_PUBLIC) != 0)
        modifier |= Modifier.PUBLIC;

    if ((asmAccessMask & Opcodes.ACC_STATIC) != 0)
        modifier |= Modifier.STATIC;

    if ((asmAccessMask & Opcodes.ACC_STRICT) != 0)
        modifier |= Modifier.STRICT;

    if ((asmAccessMask & Opcodes.ACC_SYNCHRONIZED) != 0)
        modifier |= Modifier.SYNCHRONIZED;

    if ((asmAccessMask & Opcodes.ACC_TRANSIENT) != 0)
        modifier |= Modifier.TRANSIENT;

    if ((asmAccessMask & Opcodes.ACC_VOLATILE) != 0)
        modifier |= Modifier.VOLATILE;

    return modifier;
}
 
Example 2
Source File: JClassPatcher.java    From rscplus with GNU General Public License v3.0 6 votes vote down vote up
private String decodeAccess(int access) {
  String res = "";

  if ((access & Opcodes.ACC_PUBLIC) == Opcodes.ACC_PUBLIC) res += "public ";
  if ((access & Opcodes.ACC_PRIVATE) == Opcodes.ACC_PRIVATE) res += "private ";
  if ((access & Opcodes.ACC_PROTECTED) == Opcodes.ACC_PROTECTED) res += "protected ";

  if ((access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC) res += "static ";
  if ((access & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL) res += "final ";
  if ((access & Opcodes.ACC_VOLATILE) == Opcodes.ACC_VOLATILE) res += "protected ";
  if ((access & Opcodes.ACC_SYNCHRONIZED) == Opcodes.ACC_SYNCHRONIZED) res += "synchronized ";
  if ((access & Opcodes.ACC_ABSTRACT) == Opcodes.ACC_ABSTRACT) res += "abstract ";
  if ((access & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE) res += "interface ";

  return res;
}
 
Example 3
Source File: SerialVersionUIDAdder.java    From Concurnas with MIT License 5 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value) {
  // Get the class field information for step 4 of the algorithm. Also determine if the class
  // already has a SVUID.
  if (computeSvuid) {
    if ("serialVersionUID".equals(name)) {
      // Since the class already has SVUID, we won't be computing it.
      computeSvuid = false;
      hasSvuid = true;
    }
    // Collect the non private fields. Only the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED,
    // ACC_STATIC, ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when computing
    // serialVersionUID values.
    if ((access & Opcodes.ACC_PRIVATE) == 0
        || (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
      int mods =
          access
              & (Opcodes.ACC_PUBLIC
                  | Opcodes.ACC_PRIVATE
                  | Opcodes.ACC_PROTECTED
                  | Opcodes.ACC_STATIC
                  | Opcodes.ACC_FINAL
                  | Opcodes.ACC_VOLATILE
                  | Opcodes.ACC_TRANSIENT);
      svuidFields.add(new Item(name, mods, desc));
    }
  }

  return super.visitField(access, name, desc, signature, value);
}
 
Example 4
Source File: FieldNodeDecompiler.java    From bytecode-viewer with GNU General Public License v3.0 5 votes vote down vote up
private 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_SYNTHETIC) != 0)
        tokens.add("synthetic");
    if ((access & Opcodes.ACC_STATIC) != 0)
        tokens.add("static");
    if ((access & Opcodes.ACC_FINAL) != 0)
        tokens.add("final");
    if ((access & Opcodes.ACC_TRANSIENT) != 0)
        tokens.add("transient");
    if ((access & Opcodes.ACC_VOLATILE) != 0)
        tokens.add("volatile");
    if (tokens.size() == 0)
        return "";
    // 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 5
Source File: SerialVersionUIDAdder.java    From JReFrameworker with MIT License 5 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value) {
  // Get the class field information for step 4 of the algorithm. Also determine if the class
  // already has a SVUID.
  if (computeSvuid) {
    if ("serialVersionUID".equals(name)) {
      // Since the class already has SVUID, we won't be computing it.
      computeSvuid = false;
      hasSvuid = true;
    }
    // Collect the non private fields. Only the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED,
    // ACC_STATIC, ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when computing
    // serialVersionUID values.
    if ((access & Opcodes.ACC_PRIVATE) == 0
        || (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
      int mods =
          access
              & (Opcodes.ACC_PUBLIC
                  | Opcodes.ACC_PRIVATE
                  | Opcodes.ACC_PROTECTED
                  | Opcodes.ACC_STATIC
                  | Opcodes.ACC_FINAL
                  | Opcodes.ACC_VOLATILE
                  | Opcodes.ACC_TRANSIENT);
      svuidFields.add(new Item(name, mods, desc));
    }
  }

  return super.visitField(access, name, desc, signature, value);
}
 
Example 6
Source File: SerialVersionUIDAdder.java    From JReFrameworker with MIT License 5 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value) {
  // Get the class field information for step 4 of the algorithm. Also determine if the class
  // already has a SVUID.
  if (computeSvuid) {
    if ("serialVersionUID".equals(name)) {
      // Since the class already has SVUID, we won't be computing it.
      computeSvuid = false;
      hasSvuid = true;
    }
    // Collect the non private fields. Only the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED,
    // ACC_STATIC, ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when computing
    // serialVersionUID values.
    if ((access & Opcodes.ACC_PRIVATE) == 0
        || (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
      int mods =
          access
              & (Opcodes.ACC_PUBLIC
                  | Opcodes.ACC_PRIVATE
                  | Opcodes.ACC_PROTECTED
                  | Opcodes.ACC_STATIC
                  | Opcodes.ACC_FINAL
                  | Opcodes.ACC_VOLATILE
                  | Opcodes.ACC_TRANSIENT);
      svuidFields.add(new Item(name, mods, desc));
    }
  }

  return super.visitField(access, name, desc, signature, value);
}
 
Example 7
Source File: AccessFlags.java    From buck with Apache License 2.0 5 votes vote down vote up
/** Gets the access flag (see JVMS8 4.1, 4.5, 4.6) corresponding to the given modifier. */
private static int modifierToAccessFlag(Modifier modifier) {
  switch (modifier) {
    case PUBLIC:
      return Opcodes.ACC_PUBLIC;
    case PROTECTED:
      return Opcodes.ACC_PROTECTED;
    case PRIVATE:
      return Opcodes.ACC_PRIVATE;
    case ABSTRACT:
      return Opcodes.ACC_ABSTRACT;
    case DEFAULT:
      return 0;
    case STATIC:
      return Opcodes.ACC_STATIC;
    case FINAL:
      return Opcodes.ACC_FINAL;
    case TRANSIENT:
      return Opcodes.ACC_TRANSIENT;
    case VOLATILE:
      return Opcodes.ACC_VOLATILE;
    case SYNCHRONIZED:
      return Opcodes.ACC_SYNCHRONIZED;
    case NATIVE:
      return Opcodes.ACC_NATIVE;
    case STRICTFP:
      return Opcodes.ACC_STRICT;
    default:
      throw new IllegalArgumentException(String.format("Unexpected modifier: %s", modifier));
  }
}
 
Example 8
Source File: FieldNodeDecompiler.java    From java-disassembler with GNU General Public License v3.0 5 votes vote down vote up
private static String getAccessString(int access) {
    List<String> tokens = new ArrayList<>();
    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_SYNTHETIC) != 0)
        tokens.add("synthetic");
    if ((access & Opcodes.ACC_STATIC) != 0)
        tokens.add("static");
    if ((access & Opcodes.ACC_FINAL) != 0)
        tokens.add("final");
    if ((access & Opcodes.ACC_TRANSIENT) != 0)
        tokens.add("transient");
    if ((access & Opcodes.ACC_VOLATILE) != 0)
        tokens.add("volatile");
    if (tokens.size() == 0)
        return "";
    // 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 9
Source File: IncrementalSupportVisitor.java    From AnoleFix with MIT License 5 votes vote down vote up
/**
 * Ensures that the class contains a $change field used for referencing the
 * IncrementalChange dispatcher.
 * <p/>
 * Also updates package_private visiblity to public so we can call into this class from
 * outside the package.
 */
@Override
public void visit(int version, int access, String name, String signature, String superName,
                  String[] interfaces) {
    visitedClassName = name;
    visitedSuperName = superName;

    super.visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC
                    | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC,
            "$change", getRuntimeTypeName(CHANGE_TYPE), null, null);
    access = transformClassAccessForInstantRun(access);
    super.visit(version, access, name, signature, superName, interfaces);
}
 
Example 10
Source File: SerialVersionUIDAdder.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value) {
  // Get the class field information for step 4 of the algorithm. Also determine if the class
  // already has a SVUID.
  if (computeSVUID) {
    if ("serialVersionUID".equals(name)) {
      // Since the class already has SVUID, we won't be computing it.
      computeSVUID = false;
      hasSVUID = true;
    }
    // Collect the non private fields. Only the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED,
    // ACC_STATIC, ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when computing
    // serialVersionUID values.
    if ((access & Opcodes.ACC_PRIVATE) == 0
        || (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
      int mods =
          access
              & (Opcodes.ACC_PUBLIC
                  | Opcodes.ACC_PRIVATE
                  | Opcodes.ACC_PROTECTED
                  | Opcodes.ACC_STATIC
                  | Opcodes.ACC_FINAL
                  | Opcodes.ACC_VOLATILE
                  | Opcodes.ACC_TRANSIENT);
      svuidFields.add(new Item(name, mods, desc));
    }
  }

  return super.visitField(access, name, desc, signature, value);
}
 
Example 11
Source File: RedirectionVisitor.java    From Stark with Apache License 2.0 5 votes vote down vote up
/**
 * Ensures that the class contains a $starkChange field used for referencing the IncrementalChange
 * dispatcher.
 * <p>
 * <p>Also updates package_private visibility to public so we can call into this class from
 * outside the package.
 */
@Override
public void visit(int version, int access, String name, String signature, String superName,
                  String[] interfaces) {
    visitedClassName = name;
    visitedSuperName = superName;
    isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
    int fieldAccess =
            isInterface
                    ? Opcodes.ACC_PUBLIC
                    | Opcodes.ACC_STATIC
                    | Opcodes.ACC_SYNTHETIC
                    | Opcodes.ACC_FINAL
                    : Opcodes.ACC_PUBLIC
                    | Opcodes.ACC_STATIC
                    | Opcodes.ACC_VOLATILE
                    | Opcodes.ACC_SYNTHETIC
                    | Opcodes.ACC_TRANSIENT;
    // when dealing with interfaces, the $starkChange field is an AtomicReference to the CHANGE_TYPE
    // since fields in interface must be final. For classes, it's the CHANGE_TYPE directly.
    if (isInterface) {
        super.visitField(
                fieldAccess,
                "$starkChange",
                getRuntimeTypeName(Type.getType(AtomicReference.class)),
                null,
                null);
    } else {
        super.visitField(fieldAccess, "$starkChange", getRuntimeTypeName(CHANGE_TYPE), null, null);
    }
    access = transformClassAccessForStark(access);
    super.visit(version, access, name, signature, superName, interfaces);
}
 
Example 12
Source File: ModifierReviewable.java    From byte-buddy with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public FieldManifestation getFieldManifestation() {
    int modifiers = getModifiers();
    switch (modifiers & (Opcodes.ACC_VOLATILE | Opcodes.ACC_FINAL)) {
        case Opcodes.ACC_FINAL:
            return FieldManifestation.FINAL;
        case Opcodes.ACC_VOLATILE:
            return FieldManifestation.VOLATILE;
        case EMPTY_MASK:
            return FieldManifestation.PLAIN;
        default:
            throw new IllegalStateException("Unexpected modifiers: " + modifiers);
    }
}
 
Example 13
Source File: Textifier.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends a string representation of the given access modifiers to
 * {@link #buf buf}.
 *
 * @param access
 *          some access modifiers.
 */
private void appendAccess(final int access) {
  if ((access & Opcodes.ACC_PUBLIC) != 0) {
    buf.append("public ");
  }
  if ((access & Opcodes.ACC_PRIVATE) != 0) {
    buf.append("private ");
  }
  if ((access & Opcodes.ACC_PROTECTED) != 0) {
    buf.append("protected ");
  }
  if ((access & Opcodes.ACC_FINAL) != 0) {
    buf.append("final ");
  }
  if ((access & Opcodes.ACC_STATIC) != 0) {
    buf.append("static ");
  }
  if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
    buf.append("synchronized ");
  }
  if ((access & Opcodes.ACC_VOLATILE) != 0) {
    buf.append("volatile ");
  }
  if ((access & Opcodes.ACC_TRANSIENT) != 0) {
    buf.append("transient ");
  }
  if ((access & Opcodes.ACC_ABSTRACT) != 0) {
    buf.append("abstract ");
  }
  if ((access & Opcodes.ACC_STRICT) != 0) {
    buf.append("strictfp ");
  }
  if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
    buf.append("synthetic ");
  }
  if ((access & Opcodes.ACC_MANDATED) != 0) {
    buf.append("mandated ");
  }
  if ((access & Opcodes.ACC_ENUM) != 0) {
    buf.append("enum ");
  }
}
 
Example 14
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 15
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 16
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 17
Source File: Textifier.java    From JReFrameworker with MIT License 4 votes vote down vote up
/**
 * Appends a string representation of the given access flags to {@link #stringBuilder}.
 *
 * @param accessFlags some access flags.
 */
private void appendAccess(final int accessFlags) {
  if ((accessFlags & Opcodes.ACC_PUBLIC) != 0) {
    stringBuilder.append("public ");
  }
  if ((accessFlags & Opcodes.ACC_PRIVATE) != 0) {
    stringBuilder.append("private ");
  }
  if ((accessFlags & Opcodes.ACC_PROTECTED) != 0) {
    stringBuilder.append("protected ");
  }
  if ((accessFlags & Opcodes.ACC_FINAL) != 0) {
    stringBuilder.append("final ");
  }
  if ((accessFlags & Opcodes.ACC_STATIC) != 0) {
    stringBuilder.append("static ");
  }
  if ((accessFlags & Opcodes.ACC_SYNCHRONIZED) != 0) {
    stringBuilder.append("synchronized ");
  }
  if ((accessFlags & Opcodes.ACC_VOLATILE) != 0) {
    stringBuilder.append("volatile ");
  }
  if ((accessFlags & Opcodes.ACC_TRANSIENT) != 0) {
    stringBuilder.append("transient ");
  }
  if ((accessFlags & Opcodes.ACC_ABSTRACT) != 0) {
    stringBuilder.append("abstract ");
  }
  if ((accessFlags & Opcodes.ACC_STRICT) != 0) {
    stringBuilder.append("strictfp ");
  }
  if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0) {
    stringBuilder.append("synthetic ");
  }
  if ((accessFlags & Opcodes.ACC_MANDATED) != 0) {
    stringBuilder.append("mandated ");
  }
  if ((accessFlags & Opcodes.ACC_ENUM) != 0) {
    stringBuilder.append("enum ");
  }
}
 
Example 18
Source File: Textifier.java    From JReFrameworker with MIT License 4 votes vote down vote up
/**
 * Appends a string representation of the given access flags to {@link #stringBuilder}.
 *
 * @param accessFlags some access flags.
 */
private void appendAccess(final int accessFlags) {
  if ((accessFlags & Opcodes.ACC_PUBLIC) != 0) {
    stringBuilder.append("public ");
  }
  if ((accessFlags & Opcodes.ACC_PRIVATE) != 0) {
    stringBuilder.append("private ");
  }
  if ((accessFlags & Opcodes.ACC_PROTECTED) != 0) {
    stringBuilder.append("protected ");
  }
  if ((accessFlags & Opcodes.ACC_FINAL) != 0) {
    stringBuilder.append("final ");
  }
  if ((accessFlags & Opcodes.ACC_STATIC) != 0) {
    stringBuilder.append("static ");
  }
  if ((accessFlags & Opcodes.ACC_SYNCHRONIZED) != 0) {
    stringBuilder.append("synchronized ");
  }
  if ((accessFlags & Opcodes.ACC_VOLATILE) != 0) {
    stringBuilder.append("volatile ");
  }
  if ((accessFlags & Opcodes.ACC_TRANSIENT) != 0) {
    stringBuilder.append("transient ");
  }
  if ((accessFlags & Opcodes.ACC_ABSTRACT) != 0) {
    stringBuilder.append("abstract ");
  }
  if ((accessFlags & Opcodes.ACC_STRICT) != 0) {
    stringBuilder.append("strictfp ");
  }
  if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0) {
    stringBuilder.append("synthetic ");
  }
  if ((accessFlags & Opcodes.ACC_MANDATED) != 0) {
    stringBuilder.append("mandated ");
  }
  if ((accessFlags & Opcodes.ACC_ENUM) != 0) {
    stringBuilder.append("enum ");
  }
}
 
Example 19
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 20
Source File: GizmoClassVisitor.java    From gizmo with Apache License 2.0 4 votes vote down vote up
public FieldVisitor visitField(final int access, final String name, final String descriptor, final String signature, final Object value) {
    //     int ACC_PUBLIC = 0x0001; // class, field, method
    //    int ACC_PRIVATE = 0x0002; // class, field, method
    //    int ACC_PROTECTED = 0x0004; // class, field, method
    //    int ACC_STATIC = 0x0008; // field, method
    //    int ACC_FINAL = 0x0010; // class, field, method, parameter
    //    int ACC_SUPER = 0x0020; // class
    //    int ACC_SYNCHRONIZED = 0x0020; // method
    //    int ACC_OPEN = 0x0020; // module
    //    int ACC_TRANSITIVE = 0x0020; // module requires
    //    int ACC_VOLATILE = 0x0040; // field
    //    int ACC_BRIDGE = 0x0040; // method
    //    int ACC_STATIC_PHASE = 0x0040; // module requires
    //    int ACC_VARARGS = 0x0080; // method
    //    int ACC_TRANSIENT = 0x0080; // field
    //    int ACC_NATIVE = 0x0100; // method
    //    int ACC_INTERFACE = 0x0200; // class
    //    int ACC_ABSTRACT = 0x0400; // class, method
    //    int ACC_STRICT = 0x0800; // method
    //    int ACC_SYNTHETIC = 0x1000; // class, field, method, parameter, module *
    //    int ACC_ANNOTATION = 0x2000; // class
    //    int ACC_ENUM = 0x4000; // class(?) field inner
    //    int ACC_MANDATED = 0x8000; // parameter, module, module *
    //    int ACC_MODULE = 0x8000; // class
    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_VOLATILE: {
                append(" volatile");
                break;
            }
            case Opcodes.ACC_TRANSIENT: {
                append(" transient");
                break;
            }
            case Opcodes.ACC_SYNTHETIC: {
                append(" synthetic");
                break;
            }
            case Opcodes.ACC_ENUM: {
                append(" enum");
                break;
            }
        }
        mods ^= mod;
    }
    newLine();
    append("Field ").append(name).append(" : ").append(Type.getType(descriptor)).newLine().newLine();
    return super.visitField(access, name, descriptor, signature, value);
}