24

What does this rule mean in proguard for example:

-keep class myjava.** {*;}

I understand {*;} part would mean all members and methods in the class. But what does the 2 asterisk mean in the package name?.

Thanks in advance.

1 Answer 1

26

From the manual:

Types in classname, annotationtype, returntype, and argumenttype can contain
wildcards: '?' for a single character, '*' for any number of characters (but
not the package separator), '**' for any number of (any) characters, '%' for
any primitive type, '***' for any type, and '...' for any number of arguments.
5
  • I missed that part. Thanks.
    – Notbad
    Feb 12, 2014 at 12:08
  • I still dont get it. So whats the different between -keep @@annotation.Singleton public class * and -keep @@annotation.Singleton public class **
    – Basil Musa
    Mar 24, 2017 at 21:28
  • 6
    @BasilMusa if I understand correctly, a single asterix doesn't include the package separater, so, for example: com.google.* would keep com.google.test or com.google.anothertest but not com.google.test.one. A double asterisk would keep all potential subpackages ad infinitum
    – Jon
    Jun 13, 2017 at 11:17
  • 2
    so without {*;} you don't keep members and methods, so what would you be keeping exactly?
    – hmac
    Oct 22, 2018 at 20:41
  • For me using the double asterisk requires inserting #noinspection ShrinkerUnresolvedReference above the line, guess it depends on your environment setup
    – lasec0203
    Sep 26, 2020 at 3:06

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.