siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
712 stars 107 forks source link

`--ignore-missing-classes` and updating CLASSPATH #260

Open mkr-plse opened 4 years ago

mkr-plse commented 4 years ago

When japicmp is run as follows java -jar japicmp/target/japicmp-0.14.3-jar-with-dependencies.jar -n ~/Downloads/jmh-core-1.23.jar -o ~/Downloads/jmh-core-1.21.jar, the following error shows up:

E: Could not load 'Class not found: org.apache.commons.math3.stat.descriptive.StatisticalSummary': org.apache.commons.math3.stat.descriptive.StatisticalSummary. Please make sure that all libraries have been added to the classpath (CLASSPATH=) or try the option '--ignore-missing-classes'

Updating the CLASSPATH with commons-math3-3.6.1.jar doesn't fix the issue. Ignoring the missing classes however fixes the issue. Will ignoring the missing classes (from other jars) likely affect the result of comparison between the input old and new jars, if I am just looking for any changes to the method signatures in the classes in the input jars?

siom79 commented 4 years ago

Adding the jar to the normal Classpath won't help. Try adding it with the --new-classpath or --old-classpath option of the tool.

If you leave out dependencies, japicmp cannot detect changes related to interfaces or superclasses that stem from the libary.

mkr-plse commented 4 years ago

Adding the jar to the normal Classpath won't help. Try adding it with the --new-classpath or --old-classpath option of the tool.

Thanks. This addresses the problem. Can this issue track updating the error message Please make sure that all libraries have been added to the classpath (CLASSPATH=) to suggest updating --old-classpath and --new-classpath appropriately?

If you leave out dependencies, japicmp cannot detect changes related to interfaces or superclasses that stem from the libary.

If I am just interested in comparing the method signatures for just the input old (O) and new (N) jars, I am not sure how the absence of dependent jars (D1 and D2) will cause a problem. Consider the following cases:

Of course, comparison of classes in D1 and D2 will be ignored, and any semantic changes that affect the input classes in O and N will also be ignored. But, is there any case where the syntactic changes in the input jars be ignored by using the --ignore-missing-classes?

jrenaat commented 3 years ago

Adding the jar to the normal Classpath won't help. Try adding it with the --new-classpath or --old-classpath option of the tool.

If you leave out dependencies, japicmp cannot detect changes related to interfaces or superclasses that stem from the libary.

I might point out that if you use the default ClassPathMode.ONE_COMMON_CLASSPATH, and you just specify one of the two classpath options, as you suggested above, this will result in the following error: "E: Please provide both options: --old-classpath and --new-classpath". In other words, both options have to be set, even if you want to use one common classpath, which is a bit counterintuitive.