aserg-ufmg / RefDiff

A tool to mine refactorings in the commit history of git repositories.
MIT License
148 stars 44 forks source link

No such method #5

Closed CharleyBrown99 closed 4 years ago

CharleyBrown99 commented 5 years ago

I've been trying to do the example but it doesn't work, i get an internal error. Here is the log : 0 [main] INFO refdiff.core.util.GitServiceImpl - Checking out A:\Ecole\Session11\LOG530\jersey d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606 ... 2887 [main] INFO refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer - Analyzing code after (d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606) ... 3628 [main] INFO refdiff.core.util.GitServiceImpl - Checking out A:\Ecole\Session11\LOG530\jersey 526599a8e2110f3ffb50c12294f5b7e4cd13b0b6 ... 5916 [main] INFO refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer - Analyzing code before (526599a8e2110f3ffb50c12294f5b7e4cd13b0b6) ... Exception in thread "main" java.lang.NoSuchMethodError: org.eclipse.jgit.revwalk.RevWalk.close()V at refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer.detectAtCommit(GitHistoryStructuralDiffAnalyzer.java:106) at refdiff.core.RefDiff.detectAtCommit(RefDiff.java:64) at application.Analyser.analyseRepo(Analyser.java:17) at application.Application.main(Application.java:10)

And here is the code : `public class Analyser {

public static List<SDRefactoring> analyseRepo(String repoURL,String localRepoLocation) throws Exception{
    RefDiff refDiff = new RefDiff();
    GitService gitService = new GitServiceImpl();
    Repository repository = gitService.cloneIfNotExists(localRepoLocation,repoURL);
    List<SDRefactoring> refactorings = refDiff.detectAtCommit(repository, "d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606");
    return refactorings;
}

}` But the code doesn't even get to the return. Is there an error in my code or the problem resides in the RefDiff ?

danilofes commented 5 years ago

I'm not able to replicate this problem. Which version of Java are you using?

CharleyBrown99 commented 5 years ago

i use JDK 1.8 or more precisely, java version 1.8.0_60. I also use IntlliJ has the IDE.

Thank you for answering

CharleyBrown99 commented 5 years ago

I found the problem. In the version 0.1.1, RevWalk does not implement AutoCloseable. Is there a newer version on the maven ? Here is my maven right now `

com.github.aserg-ufmg
   <artifactId>refdiff-core</artifactId>
   <version>0.1.1</version>

`

danilofes commented 5 years ago

RevWalk is a class from the library org.eclipse.jgit. Note that refdiff-core 0.1.1 depends on jgit version 4.7.0.201704051617-r and it does implement AutoCloseable in this version. Can you check which version of jgit is in your classpath? Maybe your pom.xml is forcing a different version for some reason.

danilofes commented 4 years ago

I'm closing this issue as I'm not sure it is still relevant.