"Can't process class" for empty .class files

Hello, one of our dependency vendors occasionally provides dependency updates that contain empty .class files for some reason (i.e. there are .class files with file size of 0). They don’t seem willing or able to stop doing this.

Proguard doesn’t seem to be able to process these. We are building with proguard-maven-plugin:2.3.1 which I believe uses Proguard 7.0.0:

[proguard] Error: Can't read [/../.m2/repository/com/xxx/patches/9.0.20221014-SOR/patches-9.0.20221014-SOR.jar] (Can't process class [com/xxx/eventsrvc/ESDefaultAdminEventListener$2.class] (null))

The file com/xxx/eventsrvc/ESDefaultAdminEventListener$2.class exists in the dependency JAR with size 0.

Not sure if it’s always empty inner .class files (“x$1.class”) or not.

Is there a way to tell Proguard to simply ignore these, instead of fail? The only workaround I’ve found so far is to remove these empty files from the JAR and rebuild.

Dear @ollierob,

First of all, I want to welcome you to our community! Thanks for reaching out to us for the first time.

This type of error can be circumvented by using an inputfilter. Please find an example below:

-injars patches-9.0.20221014-SOR.jar(!com.xxx.eventsrvc/ESDefaultAdminEventListener$2.class)

(make sure to provide the correct paths)
Kind regards,

Ewout

Thanks, not sure that’s a good solution if using the Maven plugin as this auto-determines injars but I will see what I can figure out.

Rather than a workaround here, can you please advise if there’s a flag to tell Proguard to ignore empty class files, or can you please enhance the product to add one?

Dear @ollierob ,

Since you are using the Maven plugin, you might want to take a look at:
https://wvengen.github.io/proguard-maven-plugin/
This will allow you to configure the filters with inFilter .

There currently is no specific option to tell PG to ignore empty class files. If this request would be made more often in the future, we might add it as a feature.

Kind regards,

Ewout