无法解析thisJointPoint.getArgs()

时间:2016-06-09 09:22:19

标签: intellij-idea aspectj

我在我的项目中运行了这个AspectJ代码,但IDE(IntelliJ)告诉它"无法解析getArgs()"在thisJoinPoint。为什么会出现这种错误?我应该将任何aspectJ库导入我的项目吗?

package org.apache.hadoop.mapred.aspects;

import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.mylib;

public aspect MapReduceCalls {
    Mylib mylib;

    before(): execution(* run(..)) {
        mylib = new Mylib();
    }

    before(): call(* org.apache.hadoop.mapreduce.Mapper.cleanup(..)) || call(* org.apache.hadoop.mapreduce.Reducer.cleanup(..)) {
        Object obj = thisJoinPoint.getArgs()[0];

        try {
            mylib.cleanup(obj);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

谢谢,

1 个答案:

答案 0 :(得分:0)

是的,您需要在类路径上使用AspectJ运行时库 aspectjrt.jar