Examples of BCClass


Examples of serp.bytecode.BCClass

                continue;
            }
           
            meth = (Method) fmds[i].getBackingMember();
            // ##### this will fail if we override and don't call super.
            BCClass declaringType = _managedType.getProject()
                .loadClass(fmds[i].getDeclaringType());
            getter = declaringType.getDeclaredMethod(meth.getName(),
                meth.getParameterTypes());
            if (getter == null) {
                addViolation("property-no-getter", new Object[]{ fmds[i] },
                    true);
                continue;
            }
            returned = getReturnedField(getter);
            if (returned != null)
                registerBackingFieldInfo(fmds[i], getter, returned);

            setter = declaringType.getDeclaredMethod(getSetterName(fmds[i]),
                new Class[]{ fmds[i].getDeclaredType() });
            if (setter == null) {
                if (returned == null) {
                    addViolation("property-no-setter",
                        new Object[]{ fmds[i] }, true);
View Full Code Here

Examples of serp.bytecode.BCClass

            for (int i = 0; i < args.length; i++)
                classes.addAll(Arrays.asList(cap.parseTypes(args[i])));
        }

        Project project = new Project();
        BCClass bc;
        PCEnhancer enhancer;
        int status;
        for (Iterator itr = classes.iterator(); itr.hasNext();) {
            Object o = itr.next();
            if (log.isTraceEnabled())
View Full Code Here

Examples of serp.bytecode.BCClass

    /**
     * Generate a new class with the given name. If a non-null parent class
     * is given, it will be set as the superclass.
     */
    public Class generateClass(String name, Class parent) {
        BCClass bc = _project.loadClass(name, null);
        if (parent != null)
            bc.setSuperclass(parent);
        bc.addDefaultConstructor();

        try {
            return Class.forName(name, false, _loader);
        } catch (ClassNotFoundException cnfe) {
            throw new InternalException(cnfe.toString(), cnfe);
View Full Code Here

Examples of serp.bytecode.BCClass

            return field;
        }
    }

    private BCMethod getBCMethod(Method meth) {
        BCClass bc = pc.getProject().loadClass(meth.getDeclaringClass());
        return bc.getDeclaredMethod(meth.getName(), meth.getParameterTypes());
    }
View Full Code Here

Examples of serp.bytecode.BCClass

            enhancer.setEnforcePropertyRestrictions
                (_flags.enforcePropertyRestrictions);

            if (enhancer.run() == PCEnhancer.ENHANCE_NONE)
                return null;
            BCClass pcb = enhancer.getPCBytecode();
            returnBytes = AsmAdaptor.toByteArray(pcb, pcb.toByteArray());
            return returnBytes;
        } catch (Throwable t) {
            _log.warn(_loc.get("cft-exception-thrown", className), t);
            if (t instanceof RuntimeException)
                throw (RuntimeException) t;
View Full Code Here

Examples of serp.bytecode.BCClass

                continue;
            }
           
            meth = (Method) fmds[i].getBackingMember();
            // ##### this will fail if we override and don't call super.
            BCClass declaringType = _managedType.getProject()
                .loadClass(fmds[i].getDeclaringType());
            getter = declaringType.getDeclaredMethod(meth.getName(),
                meth.getParameterTypes());
            if (getter == null) {
                addViolation("property-no-getter", new Object[]{ fmds[i] },
                    true);
                continue;
            }
            returned = getReturnedField(getter);
            if (returned != null)
                registerBackingFieldInfo(fmds[i], getter, returned);

            setter = declaringType.getDeclaredMethod(getSetterName(fmds[i]),
                new Class[]{ fmds[i].getDeclaredType() });
            if (setter == null) {
                if (returned == null) {
                    addViolation("property-no-setter",
                        new Object[]{ fmds[i] }, true);
View Full Code Here

Examples of serp.bytecode.BCClass

            for (int i = 0; i < args.length; i++)
                classes.addAll(Arrays.asList(cap.parseTypes(args[i])));
        }

        Project project = new Project();
        BCClass bc;
        PCEnhancer enhancer;
        Collection persAwareClasses = new HashSet();
       
        int status;
        for (Iterator itr = classes.iterator(); itr.hasNext();) {
View Full Code Here

Examples of serp.bytecode.BCClass

     * is not found, returns null.
    */
    private int[] getIdClassConstructorParmOrder(Class<?> oidType, ArrayList<Integer> pkfields,
            FieldMetaData[] fmds) {
        Project project = new Project();
        BCClass bc = project.loadClass(oidType);
        BCMethod[] methods = bc.getDeclaredMethods("<init>");
        if (methods == null || methods.length == 0) {
            return null;
        }
       
        int parmOrder[] = new int[pkfields.size()];
View Full Code Here

Examples of serp.bytecode.BCClass

            return Class.forName(name, false, loader);
        } catch (Throwable t) {
        }

        // create class
        BCClass oid = bc.getProject().loadClass(name, null);
        oid.addDefaultConstructor();
        return Class.forName(name, false, bc);
    }
View Full Code Here

Examples of serp.bytecode.BCClass

        throws IOException {
        Project project = new Project();
       
        InputStream in = WASManagedRuntime.class.getClassLoader()
            .getResourceAsStream(CLASS.replace('.', '/') + ".class");
        BCClass bcClass = project.loadClass(in);
       
        String [] interfaces = bcClass.getInterfaceNames();
       
        if(interfaces != null) {
          for(int i = 0; i < interfaces.length; i++) {
            if(interfaces[i].equals(INTERFACE)) {
              return;
            }
          }
        }
        bcClass.declareInterface(INTERFACE);
        AsmAdaptor.write(bcClass);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.