Package org.codehaus.aspectwerkz.reflect

Examples of org.codehaus.aspectwerkz.reflect.ClassInfo$NullClassInfo


    private static boolean isSpecialArgument(final String adviceArgName, final ExpressionInfo expressionInfo) {
        return adviceArgName.equals(expressionInfo.getSpecialArgumentName());
    }

    private static boolean isCustomJointPoint(final Type type, final ClassLoader loader) {
        ClassInfo classInfo = AsmClassInfo.getClassInfo(type.getClassName(), loader);
        return ClassInfoHelper.implementsInterface(classInfo, ExpressionInfo.JOINPOINT_CLASS_NAME) ||
               ClassInfoHelper.implementsInterface(classInfo, ExpressionInfo.STATIC_JOINPOINT_CLASS_NAME);
    }
View Full Code Here


     *
     * @param buf   the string buffer to which the descriptor must be appended.
     * @param klass the class whose descriptor must be computed.
     */
    private static void getClassDescriptor(final StringBuffer buf, final ClassInfo klass) {
        ClassInfo d = klass;
        while (true) {
            if (d.isPrimitive()) {
                char car;
                if (d.equals(INTEGER)) {
                    car = 'I';
                } else if (d.equals(VOID)) {
                    car = 'V';
                } else if (d.equals(BOOLEAN)) {
                    car = 'Z';
                } else if (d.equals(BYTE)) {
                    car = 'B';
                } else if (d.equals(CHARACTER)) {
                    car = 'C';
                } else if (d.equals(SHORT)) {
                    car = 'S';
                } else if (d.equals(DOUBLE)) {
                    car = 'D';
                } else if (d.equals(FLOAT)) {
                    car = 'F';
                } else if (d.equals(LONG)) {
                    car = 'J';
                } else {
                    throw new Error("should not happen");
                }
                buf.append(car);
                return;
            } else if (d.isArray()) {
                buf.append('[');
                d = d.getComponentType();
            } else {
                buf.append('L');
                String name = d.getName();
                int len = name.length();
                for (int i = 0; i < len; ++i) {
                    char car = name.charAt(i);
                    buf.append(car == '.' ? '/' : car);
                }
View Full Code Here

        final String methodDesc,
        final byte[] bytecode,
        final ClassLoader loader) {
        String className = AsmClassInfo.retrieveClassNameFromBytecode(bytecode);
        AsmClassInfoRepository repository = AsmClassInfoRepository.getRepository(loader);
        ClassInfo classInfo = repository.getClassInfo(className);
        if (classInfo == null) {
            classInfo = AsmClassInfo.getClassInfo(bytecode, loader);
        }
        return classInfo.getMethod(AsmHelper.calculateMethodHash(methodName, methodDesc));
    }
View Full Code Here

    public static ClassInfo getClassInfo(final CtClass clazz, final ClassLoader loader) {

        JavassistClassInfoRepository repository = JavassistClassInfoRepository.getRepository(loader);

        ClassInfo classInfo = repository.getClassInfo(clazz.getName());

        if (classInfo == null) {

            classInfo = new JavassistClassInfo(clazz, loader);
View Full Code Here

                for (int i = 0; i < interfaces.length; i++) {

                    CtClass anInterface = interfaces[i];

                    ClassInfo classInfo = JavassistClassInfo.getClassInfo(anInterface, (ClassLoader) m_loaderRef.get());

                    m_interfaces[i] = classInfo;

                    if (!m_classInfoRepository.hasClassInfo(anInterface.getName())) {
View Full Code Here

            return false;

        }

        ClassInfo classInfo = (ClassInfo) o;

        return m_class.getName().toString().equals(classInfo.getName().toString());

    }
View Full Code Here

        final String fieldDesc,
        final byte[] bytecode,
        final ClassLoader loader) {
        String className = AsmClassInfo.retrieveClassNameFromBytecode(bytecode);
        AsmClassInfoRepository repository = AsmClassInfoRepository.getRepository(loader);
        ClassInfo classInfo = repository.getClassInfo(className);
        if (classInfo == null) {
            classInfo = AsmClassInfo.getClassInfo(bytecode, loader);
        }
        return classInfo.getField(AsmHelper.calculateFieldHash(fieldName, fieldDesc));
    }
View Full Code Here

        final String constructorDesc,
        final byte[] bytecode,
        final ClassLoader loader) {
        String className = AsmClassInfo.retrieveClassNameFromBytecode(bytecode);
        AsmClassInfoRepository repository = AsmClassInfoRepository.getRepository(loader);
        ClassInfo classInfo = repository.getClassInfo(className);
        if (classInfo == null) {
            classInfo = AsmClassInfo.getClassInfo(bytecode, loader);
        }
        return classInfo.getMethod(AsmHelper.calculateConstructorHash(constructorDesc));
    }
View Full Code Here

        // TransformationUtil.getJoinPointIndex(klass.getCtClass()); //TODO
        // thread safe reentrant
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            final SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(definition, new ExpressionContext(PointcutType.CALL, classInfo, classInfo), ctClass)) {
                continue;
            }
            ctClass.instrument(new ExprEditor() {
                public void edit(MethodCall methodCall) throws CannotCompileException {
                    try {
                        CtBehavior where;
                        try {
                            where = methodCall.where();
                        } catch (RuntimeException e) {
                            // <clinit> access leads to a bug in Javassist
                            where = ctClass.getClassInitializer();
                        }

                        // filter caller methods
                        if (methodFilterCaller(where)) {
                            return;
                        }

                        // get the callee method name, signature and class name
                        CtMethod calleeMethod = methodCall.getMethod();
                        String calleeClassName = methodCall.getClassName();

                        // filter callee classes
                        if (!definition.inIncludePackage(calleeClassName)) {
                            return;
                        }

                        // filter callee methods
                        if (methodFilterCallee(calleeMethod)) {
                            return;
                        }
                        JavassistClassInfoRepository classInfoRepository = JavassistClassInfoRepository
                                .getRepository(context.getLoader());

                        // TODO: callee side class info is NOT used, make use of
                        // it
                        ClassInfo calleeSideClassInfo = classInfoRepository.getClassInfo(calleeClassName);
                        if (calleeSideClassInfo == null) {
                            calleeSideClassInfo = JavassistClassInfo.getClassInfo(ctClass.getClassPool().get(
                                calleeClassName), context.getLoader());
                        }
View Full Code Here

                    methodTuple.getDeclaringClass(),
                    methodTuple);
                tuple.signature = methodSignature;
                tuple.rtti = new MethodRttiImpl(methodSignature, thisInstance, targetInstance);
                MethodInfo methodInfo = JavaMethodInfo.getMethodInfo(methodTuple.getWrapperMethod());
                ClassInfo withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ExpressionContext ctx = new ExpressionContext(PointcutType.EXECUTION, methodInfo, methodInfo);//AVAJ
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
                        if (pointcut.getExpressionInfo().hasCflowPointcut()) {
                            cflowExpressionList.add(pointcut.getExpressionInfo().getCflowExpressionRuntime());
                        }
                    }
                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.METHOD_CALL:
                methodTuple = AspectRegistry.getMethodTuple(declaringClass, joinPointHash);
                methodSignature = new MethodSignatureImpl(methodTuple.getDeclaringClass(), methodTuple);
                tuple.signature = methodSignature;
                tuple.rtti = new MethodRttiImpl(methodSignature, thisInstance, targetInstance);
                methodInfo = JavaMethodInfo.getMethodInfo(methodTuple.getWrapperMethod());
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.CALL, methodInfo, withinInfo);
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
                        if (pointcut.getExpressionInfo().hasCflowPointcut()) {
                            cflowExpressionList.add(pointcut.getExpressionInfo().getCflowExpressionRuntime());
                        }
                    }
                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.CONSTRUCTOR_EXECUTION:
                ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
                ConstructorSignatureImpl constructorSignature = new ConstructorSignatureImpl(constructorTuple
                        .getDeclaringClass(), constructorTuple);
                tuple.signature = constructorSignature;
                tuple.rtti = new ConstructorRttiImpl(constructorSignature, thisInstance, targetInstance);
                ConstructorInfo constructorInfo = JavaConstructorInfo.getConstructorInfo(constructorTuple
                        .getWrapperConstructor());
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.EXECUTION, constructorInfo, constructorInfo);//AVAJ
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
                        if (pointcut.getExpressionInfo().hasCflowPointcut()) {
                            cflowExpressionList.add(pointcut.getExpressionInfo().getCflowExpressionRuntime());
                        }
                    }
                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.CONSTRUCTOR_CALL:
                constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
                constructorSignature = new ConstructorSignatureImpl(
                    constructorTuple.getDeclaringClass(),
                    constructorTuple);
                tuple.signature = constructorSignature;
                tuple.rtti = new ConstructorRttiImpl(constructorSignature, thisInstance, targetInstance);
                constructorInfo = JavaConstructorInfo.getConstructorInfo(constructorTuple.getWrapperConstructor());
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.CALL, constructorInfo, withinInfo);
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
                        if (pointcut.getExpressionInfo().hasCflowPointcut()) {
                            cflowExpressionList.add(pointcut.getExpressionInfo().getCflowExpressionRuntime());
                        }
                    }
                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.FIELD_SET:
                Field field = AspectRegistry.getField(declaringClass, joinPointHash);
                FieldSignatureImpl fieldSignature = new FieldSignatureImpl(field.getDeclaringClass(), field);
                tuple.signature = fieldSignature;
                tuple.rtti = new FieldRttiImpl(fieldSignature, thisInstance, targetInstance);
                FieldInfo fieldInfo = JavaFieldInfo.getFieldInfo(field);
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.SET, fieldInfo, withinInfo);//AVAJ
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
                        if (pointcut.getExpressionInfo().hasCflowPointcut()) {
                            cflowExpressionList.add(pointcut.getExpressionInfo().getCflowExpressionRuntime());
                        }
                    }
                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.FIELD_GET:
                field = AspectRegistry.getField(declaringClass, joinPointHash);
                fieldSignature = new FieldSignatureImpl(field.getDeclaringClass(), field);
                tuple.signature = fieldSignature;
                tuple.rtti = new FieldRttiImpl(fieldSignature, thisInstance, targetInstance);
                fieldInfo = JavaFieldInfo.getFieldInfo(field);
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.GET, fieldInfo, withinInfo);//AVAJ
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
                        if (pointcut.getExpressionInfo().hasCflowPointcut()) {
                            cflowExpressionList.add(pointcut.getExpressionInfo().getCflowExpressionRuntime());
                        }
                    }
                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.HANDLER:
                CatchClauseSignatureImpl catchClauseSignature = new CatchClauseSignatureImpl(
                    declaringClass,
                    declaringClass,
                    "");
                tuple.signature = catchClauseSignature;
                tuple.rtti = new CatchClauseRttiImpl(catchClauseSignature, thisInstance, targetInstance);
                ClassInfo exceptionClassInfo = JavaClassInfo.getClassInfo(declaringClass);
                withinInfo = JavaClassInfo.getClassInfo(targetClass);//AVAJ within/withincode support ?
                ctx = new ExpressionContext(PointcutType.HANDLER, exceptionClassInfo, withinInfo);
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.reflect.ClassInfo$NullClassInfo

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.