Package org.codehaus.aspectwerkz.reflect

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


    }

    protected static final int someField = 32;

    public void testSerialVerUid() throws Throwable {
        ClassInfo classInfo = AsmClassInfo.getClassInfo("test.SerialVerUidTest", ContextClassLoader.getLoader());
        long UID = AddSerialVersionUidVisitor.calculateSerialVersionUID(classInfo);
        assertEquals(-6289975506796941698L, UID);
    }
View Full Code Here


        if (isSystemMixin(mixinClass)) {
            mixinClass = defineSystemMixin(mixinClass.getClassLoader());
        } else {
            List allInterfaces = ClassInfoHelper.collectInterfaces(mixinClass);
            for (Iterator iterator = allInterfaces.iterator(); iterator.hasNext();) {
                ClassInfo interfaceInfo = (ClassInfo) iterator.next();
                m_interfaceClassNames.add(interfaceInfo.getName());
            }

            List interfaceDeclaredMethods = ClassInfoHelper.collectMethodsFromInterfacesImplementedBy(mixinClass);
            List sortedMethodList = ClassInfoHelper.createInterfaceDefinedMethodList(
                    mixinClass, interfaceDeclaredMethods
View Full Code Here

     * @param loader
     * @return
     */
    private ClassInfo defineSystemMixin(final ClassLoader loader) {
        // if advisable impl mixin get the class info from the AsmClassInfo to keep the methods starting with aw$
        ClassInfo mixinClass = AsmClassInfo.getClassInfo(AdvisableImpl.class.getName(), loader);
        MethodInfo[] methods = mixinClass.getMethods();
        for (int i = 0; i < methods.length; i++) {
            MethodInfo method = methods[i];
            if (method.getName().startsWith(TransformationConstants.SYNTHETIC_MEMBER_PREFIX)) {
                m_methodsToIntroduce.add(method);
            }
View Full Code Here

        ExpressionContext context = (ExpressionContext) data;

        // we are matching on the CALLER info
        // for execution() pointcut, this is equals to CALLEE info
        ReflectionInfo info = context.getWithinReflectionInfo();
        ClassInfo classInfo = (info instanceof MemberInfo) ?
                              ((MemberInfo) info).getDeclaringType() : (ClassInfo) info;

        Node childNode = node.jjtGetChild(0);
        MethodInfo[] methodInfos = classInfo.getMethods();
        for (int i = 0; i < methodInfos.length; i++) {
            if (Boolean.TRUE.equals(childNode.jjtAccept(this, methodInfos[i]))) {
                return Boolean.TRUE;
            }
        }

        ConstructorInfo[] constructorInfos = classInfo.getConstructors();
        for (int i = 0; i < constructorInfos.length; i++) {
            if (Boolean.TRUE.equals(childNode.jjtAccept(this, constructorInfos[i]))) {
                return Boolean.TRUE;
            }
        }
View Full Code Here

        ExpressionContext context = (ExpressionContext) data;

        // we are matching on the CALLER info
        // for execution() pointcut, this is equals to CALLEE info
        ReflectionInfo info = context.getWithinReflectionInfo();
        ClassInfo classInfo = (info instanceof MemberInfo) ?
                              ((MemberInfo) info).getDeclaringType() : (ClassInfo) info;

        Node childNode = node.jjtGetChild(0);
        FieldInfo[] fieldInfos = classInfo.getFields();
        for (int i = 0; i < fieldInfos.length; i++) {
            if (Boolean.TRUE.equals(childNode.jjtAccept(this, fieldInfos[i]))) {
                return Boolean.TRUE;
            }
        }
View Full Code Here

     * @return the class info
     */
    public static ClassInfo getClassInfo(final String className, final ClassLoader loader) {
        final String javaClassName = getJavaClassName(className);
        AsmClassInfoRepository repository = AsmClassInfoRepository.getRepository(loader);
        ClassInfo classInfo = repository.getClassInfo(javaClassName);
        if (classInfo == null) {
            classInfo = createClassInfoFromStream(javaClassName, loader, true);
        }
        return classInfo;
    }
View Full Code Here

     * @return the class info
     */
    public static ClassInfo getClassInfo(final byte[] bytecode, final ClassLoader loader) {
        final String className = AsmClassInfo.retrieveClassNameFromBytecode(bytecode);
        AsmClassInfoRepository repository = AsmClassInfoRepository.getRepository(loader);
        ClassInfo classInfo = repository.getClassInfo(className);
        if (classInfo == null) {
            classInfo = new AsmClassInfo(bytecode, loader, true);
        }
        return classInfo;
    }
View Full Code Here

            byte[] bytes = cr.b;
            ClassNameRetrievalClassAdapter visitor = new ClassNameRetrievalClassAdapter();
            cr.accept(visitor, NO_ATTRIBUTES, true);
            final String className = visitor.getClassName();
            AsmClassInfoRepository repository = AsmClassInfoRepository.getRepository(loader);
            ClassInfo classInfo = repository.getClassInfo(className);
            if (classInfo == null) {
                classInfo = new AsmClassInfo(bytes, loader, true);
            }
            return classInfo;
        } catch (IOException e) {
View Full Code Here

            byte[] bytes = cr.b;
            ClassNameRetrievalClassAdapter visitor = new ClassNameRetrievalClassAdapter();
            cr.accept(visitor, NO_ATTRIBUTES, true);
            String className = visitor.getClassName();
            AsmClassInfoRepository repository = AsmClassInfoRepository.getRepository(loader);
            ClassInfo classInfo = repository.getClassInfo(className);
            if (classInfo == null) {
                classInfo = new AsmClassInfo(bytes, loader, lazyAttributes);
            }
            return classInfo;
        } catch (IOException e) {
View Full Code Here

//        //TODO - seems to be the case for AJ - not intuitive
//        if (info instanceof ConstructorInfo) {
//            // target(..) does not match for constructors
//            return Boolean.FALSE;
//        }
        ClassInfo declaringType = null;
        if (info instanceof MemberInfo) {
            // if method/field is static, target(..) is evaluated to false
            if (Modifier.isStatic(((MemberInfo) info).getModifiers())) {
                return Boolean.FALSE;
            }

            declaringType = ((MemberInfo) info).getDeclaringType();
        } else if (info instanceof ClassInfo) {
            declaringType = (ClassInfo) info;
        }

        String boundedTypeName = node.getBoundedType(m_expressionInfo);
        // check if the context we match is an interface call, while the bounded type of target(..) is not an
        // interface. In such a case we will need a runtime check
        if (declaringType.isInterface()) {
            // if we are a instanceof (subinterface) of the bounded type, then we don't need a runtime check
            if (ClassInfoHelper.instanceOf(declaringType, boundedTypeName)) {
                return Boolean.TRUE;
            } else {
                //System.out.println("*** RT check for "  + boundedTypeName + " when I am " + declaringType.getName());
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.