symbol not found: static method in abstract class (BCEL)

217 views Asked by At

I'm a bit stuck on this. I can't compile because java claims not to find the method setRepository(), which is defined for the abstract class Repository in the follow code:

    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();
         }
}

Note that the clearCache function links just fine...

Here's the code that attempt to use this function

 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);

Note that there's an annoying complication that in BCEL there is both an abstract class Repository, and an interface Repository (org.apache.bcel.util.Repository). I don't know if this is related to the issue.

Complete error output:

[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

Thank folks!

0

There are 0 answers