imagej / ImageJ

Public domain software for processing and analyzing scientific images
http://imagej.org
Other
513 stars 218 forks source link

Deleting duplicate plugins (ij.plugin.ClassChecker) #156

Closed imagingbook closed 2 years ago

imagingbook commented 2 years ago

ClassChecker "checks for duplicate class and JAR files in the plugins folders and deletes older duplicates": I am not sure about the original purpose of this, since duplicate .class and .jar files cannot exist unless they reside in different packages. That is, plugins with the same names but in different packages should be allowed in general. If duplicate "command names" are a problem, the package names could be included.

Apart from this, there appear to be 2 issues with ClassChecker as it is now:

  1. Deletion does not work properly. Assume there are 3 plugins with the same name My_Inverter.class in three packages A, B, C, with identical modification dates. In this case, only A.My_Inverter.class is deleted, but 3 times in a row:

    Deleting duplicate plugin: D:...\ImageJ\plugins\A\My_Inverter.class
    Deleting duplicate plugin: D:...\ImageJ\plugins\A\My_Inverter.class
    Deleting duplicate plugin: D:...\ImageJ\plugins\A\My_Inverter.class
    
  2. Compiled package-info.class files should be ignored, since they cannot contain plugin code. They should be allowed to exist, there is no reason to delete them at all:

    Deleting duplicate plugin: D:...\ImageJ\plugins\A\package-info.class
    Deleting duplicate plugin: D:...\ImageJ\plugins\A\package-info.class
    

One more issue: The deleted .class files get nevertheless listed in the Plugins menu, so when a user selects any of these a "class-not-found" error occurs!

rasband commented 2 years ago

Hi Wilhelm,

Do you any suggestions for how the ClassChecker can be modified to fix these issues?

imagingbook commented 2 years ago

Sure, I'd be happy to fix it but I am still unclear about its intent. Apparently ClassChecker is supposed to find plugins with identical names in (evidently) different packages and delete all but the most recent .class file.

I tried to run ImageJ with ClassChecker completely deactivated and it seems to be doing just fine. So perhaps it could be removed all together, or I have overlooked something?

rasband commented 2 years ago

The ImageJ 1.53s6 daily build deactivates ClassChecker except when the Compile and Run command is used.

rasband commented 2 years ago

The ClassChecker in the ImageJ 1.53s7 daily build displays warning messages but no longer deletes files. It only runs when you use the Compile and Run command, which typically creates class files that are not in a package.

imagingbook commented 2 years ago

I cannot see this change in this repo. Has the 1.53s7 build been pushed?

rasband commented 2 years ago

The new 1.53s10 commit has all the ClassChecker changes.