Example usage for org.objectweb.asm Opcodes ACC_ABSTRACT

List of usage examples for org.objectweb.asm Opcodes ACC_ABSTRACT

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ACC_ABSTRACT.

Prototype

int ACC_ABSTRACT

To view the source code for org.objectweb.asm Opcodes ACC_ABSTRACT.

Click Source Link

Usage

From source file:net.sf.clirr.core.internal.asm.AsmJavaType.java

License:Open Source License

public boolean isAbstract() {
    return checkFlag(Opcodes.ACC_ABSTRACT);
}

From source file:net.sf.profiler4j.agent.BytecodeTransformer.java

License:Apache License

private static boolean canProfileMethod(Type classType, int access, String name, String desc, String signature,
        String[] exceptions, Config config, String globalName, String localName) {
    if (((access & Opcodes.ACC_ABSTRACT) | (access & Opcodes.ACC_NATIVE)
            | (access & Opcodes.ACC_SYNTHETIC)) != 0) {
        return false;
    }/*from w  w  w.j a  v a  2s  . c  om*/
    // if (name.equals("<init>") || name.equals("<clinit>")) {
    // return false;
    // }
    return true;
    /*List<Rule> rules = config.getRules();
    if (rules == null) {
       return false;
    }
    Rule selectedRule = null;
    for (Rule rule : rules) {
       if (rule.matches(globalName)) {
    selectedRule = rule;
    break;
       }
    }
    if (selectedRule == null) {
       return false;
    }
    if (selectedRule.getAction() == Rule.Action.ACCEPT) {
       if (selectedRule.isBooleanOptionSet(Rule.Option.BEANPROPS, config)
       && isGetterSetter(access, name, desc)) {
    return false;
       }
       boolean packageAccess = (access & 0x7) == 0;
       boolean protectedAccess = (access & Opcodes.ACC_PROTECTED) != 0;
       boolean publicAccess = (access & Opcodes.ACC_PUBLIC) != 0;
       String accessStr = selectedRule.getOption(Rule.Option.ACCESS, config);
       boolean acceptVisiblity = "private".equals(accessStr)
       || ("package".equals(accessStr) && (packageAccess || protectedAccess || publicAccess))
       || ("protected".equals(access) && (protectedAccess || publicAccess) || ("public"
       .equals(access) && publicAccess));
       return acceptVisiblity;
    }
            
    return false;   */
}

From source file:net.sf.profiler4j.agent.BytecodeTransformer.java

License:Apache License

private static boolean isGetterSetter(int flag, String name, String methodDescriptor) {
    if ((Opcodes.ACC_PUBLIC | flag) == 0 || ((Opcodes.ACC_STATIC | flag) | (Opcodes.ACC_NATIVE | flag)
            | (Opcodes.ACC_ABSTRACT | flag) | (Opcodes.ACC_SYNCHRONIZED | flag)) != 0) {
        return false;
    }//from  ww w . j a va2s  .c  o  m
    Type[] pTypes = Type.getArgumentTypes(methodDescriptor);
    Type rType = Type.getReturnType(methodDescriptor);
    if (getterRegex.matcher(name).matches() || getterBoolRegex.matcher(name).matches()) {
        return pTypes.length == 0 && !rType.equals(Type.VOID_TYPE);
    }
    if (setterRegex.matcher(name).matches()) {
        return pTypes.length == 1 && !rType.equals(Type.VOID_TYPE);
    }
    return false;
}

From source file:nl.hardijzer.fw.checkabstract.ClassInfo.java

License:Open Source License

public void visit(int version, int access, String name, String signature, String superName,
        String[] interfaces) {//ww  w .  ja  v a  2  s  .  co  m
    info.bIsAbstract = ((access & Opcodes.ACC_ABSTRACT) != 0);
    info.strName = name;
    info.setImplements.add(superName);
    for (String i : interfaces)
        info.setImplements.add(i);
    super.visit(version, access, name, signature, superName, interfaces);
}

From source file:nl.hardijzer.fw.checkabstract.ClassInfo.java

License:Open Source License

public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    Method m = new Method(name, desc);
    boolean bAbstract = ((access & Opcodes.ACC_ABSTRACT) != 0);
    if (bAbstract)
        info.setAbstractMethods.add(m);/*  w w  w . j  a v a 2 s. co  m*/
    else
        info.setMethods.add(m);
    info.mapMethodOwner.put(m, info.strName);
    return super.visitMethod(access, name, desc, signature, exceptions);
}

From source file:org.adjective.stout.writer.ByteCodeWriter.java

License:Apache License

private int getModifierCode(Set<ElementModifier> modifiers, Sort sort) {
    int code = (sort == Sort.INTERFACE ? Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT : 0);
    for (ElementModifier modifier : modifiers) {
        code |= modifier.getCode();//w w  w .j  av  a  2  s  .c  om
    }
    return code;
}

From source file:org.adjective.stout.writer.ByteCodeWriter.java

License:Apache License

private int getModifierCode(Set<ElementModifier> modifiers, MemberType type) {
    int code = getModifierCode(modifiers, (Sort) null);
    int illegal = Opcodes.ACC_ANNOTATION | Opcodes.ACC_BRIDGE | Opcodes.ACC_ENUM | Opcodes.ACC_INTERFACE
            | Opcodes.ACC_SUPER;// w w w  .  j a  v  a2  s .  co m
    switch (type) {
    case FIELD:
        illegal |= Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE | Opcodes.ACC_STRICT | Opcodes.ACC_SYNCHRONIZED;
        break;
    case METHOD:
        if (isBitSet(Opcodes.ACC_ABSTRACT, code)) {
            illegal |= Opcodes.ACC_NATIVE | Opcodes.ACC_STRICT | Opcodes.ACC_SYNCHRONIZED | Opcodes.ACC_STATIC
                    | Opcodes.ACC_FINAL;
        }
        break;
    }
    if (isBitSet(illegal, code)) {
        throw new IllegalStateException(
                "Illegal combination of modifier codes: " + code + " (illegal codes: " + illegal + ")");
    }
    return code;
}

From source file:org.apache.commons.javaflow.providers.asm3.ContinuableClassVisitor.java

License:Apache License

public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
    final boolean skip = skipEnchancing || null == classInfo || mv == null
            || (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE)) > 0 || "<init>".equals(name)
            || !classInfo.isContinuableMethod(access, name, desc, signature);
    if (skip) {//ww  w .ja v a 2  s .c  o  m
        return mv;
    } else {
        return new ContinuableMethodNode(access, name, desc, signature, exceptions, className, cciResolver, mv);
    }
}

From source file:org.apache.cxf.jaxws.WrapperClassGenerator.java

License:Apache License

private void generatePackageInfo(String className, String ns, Class clz) {
    ClassWriter cw = createClassWriter();
    String classFileName = periodToSlashes(className);
    cw.visit(Opcodes.V1_5, Opcodes.ACC_ABSTRACT + Opcodes.ACC_INTERFACE, classFileName, null,
            "java/lang/Object", null);

    boolean q = qualified;
    SchemaInfo si = interfaceInfo.getService().getSchema(ns);
    if (si != null) {
        q = si.isElementFormQualified();
    }// w ww .  jav a 2 s  .  c om
    AnnotationVisitor av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlSchema;", true);
    av0.visit("namespace", ns);
    av0.visitEnum("elementFormDefault", getClassCode(XmlNsForm.class), q ? "QUALIFIED" : "UNQUALIFIED");
    av0.visitEnd();
    cw.visitEnd();

    loadClass(className, clz, cw.toByteArray());
}

From source file:org.apache.felix.ipojo.manipulator.metadata.annotation.ClassMetadataCollector.java

License:Apache License

/**
 * End of the visit : compute final elements.
 *
 * @see org.objectweb.asm.ClassVisitor#visitEnd()
 *//* w ww  . j a v  a 2  s  .c  o m*/
@Override
public void visitEnd() {
    // Only process real class (no annotations, no interfaces)
    if (!(is(Opcodes.ACC_ANNOTATION) || is(Opcodes.ACC_INTERFACE) || is(Opcodes.ACC_ABSTRACT))) {
        if (workbench.getRoot() == null) {
            // No 'top-level' element has been contributed

            if (workbench.ignore()) {
                // Ignore this class.
                return;
            }

            if (!workbench.getElements().isEmpty()) {
                // There are other annotation's contribution on this type (additional handler declaration/configuration)
                // That means that there is a missing 'component type' annotation

                reporter.warn(
                        "Class %s has not been marked as a component type (no @Component, @Handler, "
                                + "...). It will be ignored by the iPOJO manipulator.",
                        workbench.getType().getClassName());
                return;
            } // else: no root and no elements
            return;
        }

        componentMetadata = workbench.build();
        instanceMetadata = workbench.getInstance();

        // If we have an instance declared and the component metadata has a name, we update the component's attribute
        // of the instance (https://issues.apache.org/jira/browse/FELIX-4052).
        if (componentMetadata != null && componentMetadata.containsAttribute("name")
                && instanceMetadata != null) {
            // Update the component attribute
            instanceMetadata.addAttribute(new Attribute("component", componentMetadata.getAttribute("name")));
        }

    }
}