Search in sources :

Example 1 with BootstrapMethods

use of org.apache.bcel.classfile.BootstrapMethods in project fb-contrib by mebigfatguy.

the class OverlyPermissiveMethod method getBootstrapMethod.

@Nullable
private BootstrapMethod getBootstrapMethod(int bootstrapIndex) {
    for (Attribute a : cls.getAttributes()) {
        if ("BootstrapMethods".equals(a.getName())) {
            if (a instanceof BootstrapMethods) {
                BootstrapMethods bma = (BootstrapMethods) a;
                BootstrapMethod[] methods = bma.getBootstrapMethods();
                if (bootstrapIndex >= methods.length) {
                    return null;
                }
                return methods[bootstrapIndex];
            }
            throw new RuntimeException("Incompatible bcel version, the bcel that is in use, is too old and doesn't have attribute 'BootstrapMethods'");
        }
    }
    return null;
}
Also used : BootstrapMethod(org.apache.bcel.classfile.BootstrapMethod) Attribute(org.apache.bcel.classfile.Attribute) BootstrapMethods(org.apache.bcel.classfile.BootstrapMethods) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 Attribute (org.apache.bcel.classfile.Attribute)1 BootstrapMethod (org.apache.bcel.classfile.BootstrapMethod)1 BootstrapMethods (org.apache.bcel.classfile.BootstrapMethods)1