找不到符号:抽象类中的静态方法(BCEL)

时间:2013-12-07 19:43:33

标签: java jar .class-file bcel

我有点坚持这个。我无法编译,因为java声称没有找到方法setRepository(),它是在以下代码中为抽象类Repository定义的:

    public abstract class Repository {

        private static org.apache.bcel.util.Repository _repository = SyntheticRepository.getInstance();


        /** Set repository instance to be used for class loading
         */
        public static void setRepository( org.apache.bcel.util.Repository rep ) {
            _repository = rep;
        }

         /** Clear the repository.
         */
         public static void clearCache() {
             _repository.clear();
         }
}

请注意,clearCache函数链接得很好......

以下是尝试使用此功能的代码

 public static void run(List<String> allClasses) {
        Config config = Config.g();
        ClassPath classpath = new ClassPath(config.outJar + File.pathSeparator + config.libJars);
        SyntheticRepository repo = SyntheticRepository.getInstance(classpath);
        org.apache.bcel.Repository.clearCache();
        org.apache.bcel.Repository.setRepository((org.apache.bcel.util.Repository)repo);

请注意,在BCEL中存在一个令人讨厌的复杂问题,它既有抽象类Repository,也有接口Repository(org.apache.bcel.util.Repository)。我不知道这是否与这个问题有关。

完成错误输出:

[javac] Compiling 1 source file to /Users/gestalt/code/stamp/droidrecord/droidrecord/instrumentor/classes
[javac] /Users/gestalt/code/stamp/droidrecord/droidrecord/instrumentor/src/edu/stanford/droidrecord/instrumentor/util/OutputVerifier.java:31: cannot find symbol
[javac] symbol  : method setRepository(org.apache.bcel.util.Repository)
[javac] location: class org.apache.bcel.Repository
[javac]         org.apache.bcel.Repository.setRepository(repo);
[javac]                                   ^
[javac] 1 error

感谢大家!

0 个答案:

没有答案