proguard icon indicating copy to clipboard operation
proguard copied to clipboard

Proguard 6.2.2: shrink dont work with some interfaces

Open caraiz opened this issue 4 years ago • 4 comments

Hello, shrink dont work completly with the library fastutil (http://fastutil.di.unimi.it), leaving in the output jar unused classes.

Im using openjdk 13.0.2 and proguard 6.2.2.

After some tests, the problem seems be when an interface method is overrided.

public interface BooleanSetOk extends java.util.Set<Boolean>
{
	boolean add2(Boolean aBoolean);
}

public interface BooleanSetFail extends java.util.Set<Boolean>
{
	@Override
	boolean add(Boolean aBoolean);
}

The first class is removed, but the second don't.

caraiz avatar Apr 24 '20 17:04 caraiz

Some code is probably calling BooleanSetFail # add(Boolean). ProGuard's shrinking step then won't remove the interface.

In both cases, optimization passes might remove the interface, but this depends on the implementations and invocations,

EricLafortune avatar Apr 24 '20 18:04 EricLafortune

I send you a simple example to test what happens.

proguard-test.zip

caraiz avatar Apr 25 '20 10:04 caraiz

Still not working with version 7.1.0

caraiz avatar Jul 25 '21 15:07 caraiz

Hi, i tested again with version 7.4.1

The class is never used but its not shrinked. Seems the problem occurs when overriding a method of a generic interface.

proguard-test.zip

caraiz avatar Jan 13 '24 15:01 caraiz