GumTreeDiff / gumtree

An awesome code differencing tool
https://github.com/GumTreeDiff/gumtree/wiki
GNU Lesser General Public License v3.0
893 stars 170 forks source link

ClassNotFound `org/simmetrics/StringMetrics` #344

Closed BlackHart98 closed 1 month ago

BlackHart98 commented 3 months ago

I am trying to use GumTree for an AST diff in my DSL, I use Rascal MPL to generate the XML (GumTreeNode), But I get this error when I try to call the matcher:

Screenshot 2024-04-07 at 02 34 24

If needed I will provide the GitHub repository so you could look at it, thanks. Your input will be appreciated

[!Note] I am Using the GumTree API but it doesn't seem to be sufficient, my guess is I am probably doing something wrong.

BlackHart98 commented 3 months ago

Here is the link to the repository: ast_diff

jrfaller commented 3 months ago

Hello! Strange bug since normally Simmetrics is in the dependency list. You are using GumTree using maven? Cheers

jrfaller commented 3 months ago

Try a dependency to gumtree-core and bump version to 4.0.0-beta1

BlackHart98 commented 3 months ago

Ok, I will do that right away

BlackHart98 commented 3 months ago

Like so?

<dependency>
      <groupId>com.github.gumtreediff</groupId>
      <artifactId>gumtree-core</artifactId>
      <version>4.0.0-beta1</version>
    </dependency>

Did that and got Missing artifact com.github.gumtreediff:gumtree-core:jar:4.0.0-beta1

jrfaller commented 3 months ago

https://central.sonatype.com/artifact/com.github.gumtreediff/core

BlackHart98 commented 3 months ago

Done, this version doesn't seem to be compatible with my Java Version, correct me if I am wrong but it works for java 17+, right?

Java("UnsupportedClassVersionError","com/github/gumtreediff/io/TreeIoUtils has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0")

Rascal works well for Java 11

jrfaller commented 3 months ago

Ow right. Ok try to downgrade the core version it should work: https://central.sonatype.com/artifact/com.github.gumtreediff/core/3.0.0 (however it would be great to be able to use 4.0.0)

BlackHart98 commented 3 months ago

That was the version I had before, it complains about dependencies:

Screenshot 2024-04-08 at 11 22 48
BlackHart98 commented 3 months ago

Is there a way I could use the GumTree jar together with some commands and parse my generated XML (GumTree): Like so; java -jar gumtreediff.jar -diff <t1> <t2>

The command above is made up just to illustrate what I have in mind t1 and t2 are GumTrees (XML files)

BlackHart98 commented 3 months ago

So, I was able to get Rascal to work with Java 17, but I hit a new wall, the error:

Cannot invoke "com.github.gumtreediff.utils.Registry$Factory.instantiate(Object[])" because "this.defaultMatcherFactory" is null

any idea why this is the case?

jrfaller commented 3 months ago

ok and this is with GumTree 4.0.0-beta1 right ?

jrfaller commented 1 month ago

Hi!

Did you manage to get it working?

BlackHart98 commented 1 month ago

I was able to get the 4.0.0-beta1 to work via a workaround but a version that works with Java 8 would have been more suitable/convenient

jrfaller commented 1 month ago

Nice! Sorry but our policy is to maintain Java last LTS 😢

Cheers.