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.

Notbad
  • 5,936
  • 12
  • 54
  • 100

1 Answers1

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.
Sean Bright
  • 118,630
  • 17
  • 138
  • 146
  • I missed that part. Thanks. – Notbad Feb 12 '14 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 '17 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 '17 at 11:17
  • 2
    so without {*;} you don't keep members and methods, so what would you be keeping exactly? – hmac Oct 22 '18 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 '20 at 03:06