Package org.codehaus.aspectwerkz.reflect

Examples of org.codehaus.aspectwerkz.reflect.MethodInfo


                return;
            }

            int joinPointHash = AsmHelper.calculateMethodHash(calleeMethodName, calleeMethodDesc);
            ClassInfo classInfo = AsmClassInfo.getClassInfo(calleeClassName.replace('/', '.'), m_loader);
            MethodInfo calleeMethodInfo = classInfo.getMethod(joinPointHash);
            if (calleeMethodInfo == null) {
                // lookup in the class hierarchy
                ClassInfo superClassInfo = classInfo.getSuperClass();
                while (superClassInfo != null) {
                    calleeMethodInfo = superClassInfo.getMethod(joinPointHash);
                    if (calleeMethodInfo == null) {
                        // go up in the hierarchy
                        superClassInfo = superClassInfo.getSuperClass();
                    } else {
                        break;
                    }
                }
                if (calleeMethodInfo == null) {
                    throw new Error(
                            "callee method info metadata structure could not be build for method: "
                            + calleeClassName
                            + '.'
                            + calleeMethodName
                            + ':'
                            + calleeMethodDesc
                    );
                }
            }

            ExpressionContext ctx = new ExpressionContext(PointcutType.CALL, calleeMethodInfo, m_callerMethodInfo);

            if (methodFilter(m_ctx.getDefinitions(), ctx, calleeMethodInfo)) {
                super.visitMethodInsn(opcode, calleeClassName, calleeMethodName, calleeMethodDesc);
            } else {
                m_ctx.markAsAdvised();
                m_sequence++; // single place of incrementation, is used in multiple places

                // TODO is caller class sufficient in the name or do we need callee classname?
                String joinPointClassName = JoinPointCompiler.getJoinPointClassName(
                        m_callerClassName,
                        JoinPointType.METHOD_CALL,
                        joinPointHash
                );

                // load the caller instance (this), or null if in a static context
                // note that callee instance [optional] and args are already on the stack
                if (Modifier.isStatic(m_callerMethodInfo.getModifiers())) {
                    visitInsn(ACONST_NULL);
                } else {
                    visitVarInsn(ALOAD, 0);
                }

                // add the call to the join point
                super.visitMethodInsn(
                        INVOKESTATIC,
                        joinPointClassName,
                        INVOKE_METHOD_NAME,
                        TransformationUtil.getInvokeSignatureForCodeJoinPoints(
                                calleeMethodInfo.getModifiers(), calleeMethodDesc, m_callerClassName, calleeClassName
                        )
                );

                // emit the joinpoint
                m_ctx.addEmittedInlinedJoinPoint(
                        new ContextImpl.EmittedInlinedJoinPoint(
                                JoinPointType.METHOD_CALL,
                                m_callerClassName,
                                m_callerMethodName,
                                m_callerMethodDesc,
                                m_callerMethodInfo.getModifiers(),
                                calleeClassName,
                                calleeMethodName,
                                calleeMethodDesc,
                                calleeMethodInfo.getModifiers(),
                                m_sequence,
                                joinPointHash,
                                joinPointClassName
                        )
                );
View Full Code Here


     * @param fieldInfo
     * @param mixinDef
     */
    private void addMixinMethods(final MixinFieldInfo fieldInfo, final MixinDefinition mixinDef) {
        for (Iterator it3 = mixinDef.getMethodsToIntroduce().iterator(); it3.hasNext();) {
            MethodInfo methodInfo = (MethodInfo) it3.next();
            final String methodName = methodInfo.getName();
            final String methodSignature = methodInfo.getSignature();

            if (m_addedMethods.contains(AlreadyAddedMethodVisitor.getMethodKey(methodName, methodSignature))) {
                continue;
            }

View Full Code Here

            }

            int joinPointHash = AsmHelper.calculateMethodHash(calleeMethodName, calleeMethodDesc);

            ClassInfo classInfo = AsmClassInfo.getClassInfo(calleeClassName, m_loader);
            MethodInfo calleeMethodInfo = classInfo.getMethod(joinPointHash);

            if (calleeMethodInfo == null) {
                System.err.println(
                        "AW::WARNING " +
                        "metadata structure could not be build for method ["
                        + classInfo.getName().replace('/', '.')
                        + '.' + calleeMethodName + ':' + calleeMethodDesc
                        + "] when parsing method ["
                        + m_callerClassInfo.getName() + '.' + m_callerMethodName + "(..)]"
                );
                // bail out
                super.visitMethodInsn(opcode, calleeClassName, calleeMethodName, calleeMethodDesc);
                return;
            }

            ExpressionContext ctx = new ExpressionContext(PointcutType.CALL, calleeMethodInfo, m_callerMemberInfo);

            if (methodFilter(m_ctx.getDefinitions(), ctx, calleeMethodInfo)) {
                super.visitMethodInsn(opcode, calleeClassName, calleeMethodName, calleeMethodDesc);
            } else {
                m_ctx.markAsAdvised();

                String joinPointClassName = TransformationUtil.getJoinPointClassName(
                        m_callerClassName,
                        m_callerMethodName,
                        m_callerMethodDesc,
                        calleeClassName,
                        JoinPointType.METHOD_CALL_INT,
                        joinPointHash
                );

                // load the caller instance (this), or null if in a static context
                // note that callee instance [optional] and args are already on the stack
                if (Modifier.isStatic(m_callerMemberInfo.getModifiers())) {
                    visitInsn(ACONST_NULL);
                } else {
                    visitVarInsn(ALOAD, 0);
                }

                // add the call to the join point
                super.visitMethodInsn(
                        INVOKESTATIC,
                        joinPointClassName,
                        INVOKE_METHOD_NAME,
                        TransformationUtil.getInvokeSignatureForCodeJoinPoints(
                                calleeMethodInfo.getModifiers(), calleeMethodDesc,
                                m_callerClassName, calleeClassName
                        )
                );

                // emit the joinpoint
                //See AW-253 - we remember if we had an INVOKE INTERFACE opcode
                int modifiers = calleeMethodInfo.getModifiers();
                if (opcode == INVOKEINTERFACE) {
                    modifiers = modifiers | MODIFIER_INVOKEINTERFACE;
                }
                m_ctx.addEmittedJoinPoint(
                        new EmittedJoinPoint(
View Full Code Here

            name.startsWith(WRAPPER_METHOD_PREFIX)) {
            return cv.visitMethod(access, name, desc, exceptions, attrs);
        }

        int hash = AsmHelper.calculateMethodHash(name, desc);
        MethodInfo methodInfo = m_classInfo.getMethod(hash);
        if (methodInfo == null) {
            System.err.println(
                    "AW::WARNING " +
                    "metadata structure could not be build for method ["
                    + m_classInfo.getName().replace('/', '.')
View Full Code Here

                    MethodInfo[] methods = classInfo.getMethods();

                    for (int j = 0; j < methods.length; j++) {

                        MethodInfo method = methods[j];

                        if (method.getName().equals(PROCEED_METHOD_NAME)) {

                            // we inherit the binding from the advice that actually use us

                            // for now the first advice sets the rule
View Full Code Here

        // get the custom join point interfaces

        for (Iterator it = m_customProceedMethodStructs.iterator(); it.hasNext();) {

            MethodInfo methodInfo = ((CustomProceedMethodStruct) it.next()).customProceed;

            interfaces.add(methodInfo.getDeclaringType().getName().replace('.', '/'));

        }


View Full Code Here

        for (Iterator it = m_customProceedMethodStructs.iterator(); it.hasNext();) {

            CustomProceedMethodStruct customProceedStruct = (CustomProceedMethodStruct) it.next();

            MethodInfo methodInfo = customProceedStruct.customProceed;

            final String desc = methodInfo.getSignature();



            if (addedMethodSignatures.contains(desc)) {
View Full Code Here

            final ClassInfo calleeClassInfo = AsmClassInfo.getClassInfo(joinPoint.getCalleeClassName(), loader);

            final ClassInfo callerClassInfo = AsmClassInfo.getClassInfo(joinPoint.getCallerClassName(), loader);

            final MethodInfo callerMethodInfo = getCallerMethodInfo(callerClassInfo, joinPoint);



            ExpressionContext ctx = null;
View Full Code Here

    private static MethodInfo getCallerMethodInfo(final ClassInfo callerClassInfo,

                                                  final EmittedJoinPoint emittedJoinPoint) {

        MethodInfo callerMethodInfo = null;

        MethodInfo[] callerMethods = callerClassInfo.getMethods();

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

            MethodInfo method = callerMethods[i];

            if (method.getName().equals(emittedJoinPoint.getCallerMethodName()) &&

                method.getSignature().equals(emittedJoinPoint.getCallerMethodDesc())) {

                callerMethodInfo = method;

                break;
View Full Code Here

     */

    public MethodInfo getMethod(final int hash) {

        MethodInfo method = (MethodInfo) m_methods.get(hash);

        if (method == null) {

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

View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.reflect.MethodInfo

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.