Skip to content

Misleading Warning for -keepclasseswithmembernames With Empty Member Block #511

@anandbabu-r

Description

@anandbabu-r

When using the rule:

-keepclasseswithmembernames class * { }

ProGuard prints a warning suggesting that the rule has no effect:

Note: this option doesn't specify which class members to keep...
This way, the option simply won't have any effect.

However, this is not true for -keepclasseswithmembernames.
With an empty block, the rule still matches all classes, effectively preserving all class names and preventing class-name obfuscation.

This behavior contradicts the warning message, which implies the rule is harmless.

A minimal reproducible example and explanation is here

Expected Behavior

ProGuard should warn that:

An empty block in -keepclasseswithmembernames does preserve class names,

And therefore affects obfuscation.

It could be useful if it said something like

 Warning: empty member block in '-keepclasseswithmembernames' will preserve
         class names for all matching classes.

Why This Matters

The current warning is misleading and can cause developers to unknowingly disable class-name obfuscation across their entire project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions