Package org.apache.jdo.impl.enhancer.classfile

Examples of org.apache.jdo.impl.enhancer.classfile.ClassMethod


                               Set found,
                               Set missing,
                               boolean annotatable)
    {
        final String key = methodKey(methodName, expectedSig);
        final ClassMethod method = (ClassMethod)jdoLikeMethods.get(key);
        if (method == null) {
            missing.add(key);
            return;
        }
        found.add(key);

        final String foundSig = method.signature().asString();
        final int foundMods = method.access();
        if (!expectedSig.equals(foundSig) || expectedMods != foundMods) {
            env.error(
                getI18N("enhancer.class_has_illegally_declared_jdo_member",
                        new Object[]{ userClassName,
                                      methodName,
View Full Code Here


                new SyntheticAttribute(
                    pool.addUtf8(SyntheticAttribute.expectedAttrName)));
        }
       
        // create and add the method
        final ClassMethod method
            = new ClassMethod(accessFlags,
                              pool.addUtf8(methodName),
                              pool.addUtf8(methodSig),
                              methodAttrs);
        affirm(classFile.findMethod(methodName, methodSig) == null,
               "Attempt to add a repeated method.");
View Full Code Here

                    + Descriptor.userMethodResult(methodSig)
                    + " " + methodName
                    + Descriptor.userMethodArgs(methodSig));

        // get method
        final ClassMethod method = classFile.findMethod(methodName, methodSig);
        affirm(method != null,
               "Attempt to add code to a non-existing method.");

        // check the found method
        affirm(!method.isAbstract(),
               "Attempt to add code to an abstract method.");
        affirm(!method.isNative(),
               "Attempt to add code to a native method.");
        final CodeAttribute foundCodeAttr = method.codeAttribute();
        affirm(foundCodeAttr != null)// by JVM spec

        // prepend the new code to the current one
        final Insn firstInsn = codeAttr.theCode();
        affirm(firstInsn != null);
        final Insn foundFirstInsn = foundCodeAttr.theCode();
        affirm(foundFirstInsn != null);
        final Insn lastInsn = firstInsn.append(foundFirstInsn);
        affirm(lastInsn != null);
        foundCodeAttr.setTheCode(firstInsn);

        // ajust the method's stack and locals demand
        foundCodeAttr.setStackUsed(max(foundCodeAttr.stackUsed(),
                                       codeAttr.stackUsed()));
        foundCodeAttr.setLocalsUsed(max(foundCodeAttr.localsUsed(),
                                        codeAttr.localsUsed()));

        // add the exception attribute or its exceptions
        if (exceptAttr != null) {
            affirm((exceptAttr.getExceptions().size()
                    == new HashSet(exceptAttr.getExceptions()).size()),
                   "Exception attribute contains duplicate exceptions.");
           
            final ExceptionsAttribute foundExceptAttr
                = method.exceptionsAttribute();
            if (foundExceptAttr == null) {
                // add the exception attribute
                final AttributeVector methodAttrs = method.attributes();
                affirm(methodAttrs != null);
                methodAttrs.addElement(exceptAttr);
            } else {
                // add those exceptions not already present
                final List foundEx = foundExceptAttr.getExceptions();
View Full Code Here

        env.message("annotating class " + userClassName);

        boolean annotated = false;
        for (final Iterator i = analyzer.getAnnotatableMethods().iterator();
             i.hasNext();) {
            final ClassMethod method = (ClassMethod)i.next();
            annotated |= annotated(method);
        }
       
        // notify controller if class changed
        if (annotated) {
View Full Code Here

TOP

Related Classes of org.apache.jdo.impl.enhancer.classfile.ClassMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.