@@ -103,7 +103,7 @@ public void staticFieldB64Test() throws Exception {
103103 @ Test
104104 public void maxCommentLengthOptionTest () throws Exception {
105105 // maxCommentLength=10 should truncate the 650-char decoded string to 10 chars + "..."
106- String code = decompileSmali ("b64/long_b64.smali" , Map .of ("b64-deobfuscate. maxCommentLength" , "10" ));
106+ String code = decompileSmali ("b64/long_b64.smali" , Map .of (opt ( " maxCommentLength") , "10" ));
107107 System .out .println (code );
108108 assertThat (code ).contains ("b64: " + "A" .repeat (10 ) + "..." );
109109 assertThat (code ).doesNotContain ("A" .repeat (11 ));
@@ -112,7 +112,7 @@ public void maxCommentLengthOptionTest() throws Exception {
112112 @ Test
113113 public void unlimitedCommentLengthOptionTest () throws Exception {
114114 // maxCommentLength=0 should produce a comment with all 650 decoded chars, no truncation
115- String code = decompileSmali ("b64/long_b64.smali" , Map .of ("b64-deobfuscate. maxCommentLength" , "0" ));
115+ String code = decompileSmali ("b64/long_b64.smali" , Map .of (opt ( " maxCommentLength") , "0" ));
116116 System .out .println (code );
117117 assertThat (code ).contains ("b64: " + "A" .repeat (650 ));
118118 assertThat (code ).doesNotContain ("..." );
@@ -131,7 +131,7 @@ public void identifierLikeB64NotFlaggedTest() throws Exception {
131131 public void lowPrintableThresholdOptionTest () throws Exception {
132132 // Lowering minPrintablePercent to 75 (old default) causes "fillItem" to be flagged again
133133 String code = decompileSmali ("b64/identifier_like_b64.smali" ,
134- Map .of ("b64-deobfuscate. minPrintablePercent" , "75" ));
134+ Map .of (opt ( " minPrintablePercent") , "75" ));
135135 System .out .println (code );
136136 assertThat (code ).contains ("b64:" );
137137 }
@@ -140,7 +140,7 @@ public void lowPrintableThresholdOptionTest() throws Exception {
140140 public void requirePaddingFiltersNoPaddingTest () throws Exception {
141141 // "fillItem" has no '=' padding; with requirePadding=true it must not be flagged
142142 String code = decompileSmali ("b64/identifier_like_b64.smali" ,
143- Map .of ("b64-deobfuscate. requirePadding" , "yes" , "b64-deobfuscate. minPrintablePercent" , "75" ));
143+ Map .of (opt ( " requirePadding") , "yes" , opt ( " minPrintablePercent") , "75" ));
144144 System .out .println (code );
145145 assertThat (code ).doesNotContain ("b64:" );
146146 }
@@ -149,7 +149,7 @@ public void requirePaddingFiltersNoPaddingTest() throws Exception {
149149 public void requirePaddingAllowsPaddedStringTest () throws Exception {
150150 // "aGVsbG8=" ends with '='; it must still be flagged when requirePadding=true
151151 String code = decompileSmali ("b64/b64_decodable.smali" ,
152- Map .of ("b64-deobfuscate. requirePadding" , "yes" ));
152+ Map .of (opt ( " requirePadding") , "yes" ));
153153 System .out .println (code );
154154 assertThat (code ).contains ("b64: hello" );
155155 }
@@ -158,7 +158,7 @@ public void requirePaddingAllowsPaddedStringTest() throws Exception {
158158 public void minInputLengthOptionTest () throws Exception {
159159 // Raising minInputLength to 24 should suppress the 8-char "aGVsbG8=" string
160160 String code = decompileSmali ("b64/b64_decodable.smali" ,
161- Map .of ("b64-deobfuscate. minInputLength" , "24" ));
161+ Map .of (opt ( " minInputLength") , "24" ));
162162 System .out .println (code );
163163 assertThat (code ).doesNotContain ("b64:" );
164164 }
@@ -168,8 +168,8 @@ public void minAlphanumericPercentOptionTest() throws Exception {
168168 // "fillItem" decodes to ~40% alphanumeric; setting minAlphanumericPercent=50 must suppress it
169169 // (set printable threshold low enough to isolate the alnum check)
170170 String code = decompileSmali ("b64/identifier_like_b64.smali" ,
171- Map .of ("b64-deobfuscate. minPrintablePercent" , "75" ,
172- "b64-deobfuscate. minAlphanumericPercent" , "50" ));
171+ Map .of (opt ( " minPrintablePercent") , "75" ,
172+ opt ( " minAlphanumericPercent") , "50" ));
173173 System .out .println (code );
174174 assertThat (code ).doesNotContain ("b64:" );
175175 }
@@ -188,7 +188,7 @@ public void skipIdentifiersFiltersIdentifierLikeTest() throws Exception {
188188 // "fillItem" looks like a Java identifier; with skipIdentifiers=true it must not be flagged
189189 // (printable threshold lowered so only the identifier check is responsible for filtering)
190190 String code = decompileSmali ("b64/identifier_like_b64.smali" ,
191- Map .of ("b64-deobfuscate. skipIdentifiers" , "yes" , "b64-deobfuscate. minPrintablePercent" , "75" ));
191+ Map .of (opt ( " skipIdentifiers") , "yes" , opt ( " minPrintablePercent") , "75" ));
192192 System .out .println (code );
193193 assertThat (code ).doesNotContain ("b64:" );
194194 }
@@ -197,7 +197,7 @@ public void skipIdentifiersFiltersIdentifierLikeTest() throws Exception {
197197 public void skipIdentifiersAllowsPaddedStringTest () throws Exception {
198198 // "aGVsbG8=" contains '=' so it is NOT identifier-like; skipIdentifiers=true must not suppress it
199199 String code = decompileSmali ("b64/b64_decodable.smali" ,
200- Map .of ("b64-deobfuscate. skipIdentifiers" , "yes" ));
200+ Map .of (opt ( " skipIdentifiers") , "yes" ));
201201 System .out .println (code );
202202 assertThat (code ).contains ("b64: hello" );
203203 }
@@ -206,7 +206,7 @@ public void skipIdentifiersAllowsPaddedStringTest() throws Exception {
206206 public void minDecodedLengthFiltersShortDecodeTest () throws Exception {
207207 // "aGVsbG8=" decodes to "hello" (5 chars); minDecodedLength=10 must suppress it
208208 String code = decompileSmali ("b64/b64_decodable.smali" ,
209- Map .of ("b64-deobfuscate. minDecodedLength" , "10" ));
209+ Map .of (opt ( " minDecodedLength") , "10" ));
210210 System .out .println (code );
211211 assertThat (code ).doesNotContain ("b64:" );
212212 }
@@ -215,7 +215,7 @@ public void minDecodedLengthFiltersShortDecodeTest() throws Exception {
215215 public void minDecodedLengthAllowsLongDecodeTest () throws Exception {
216216 // "SGVsbG8sIFdvcmxkIQ==" decodes to "Hello, World!" (13 chars); minDecodedLength=10 must allow it
217217 String code = decompileSmali ("b64/hello.smali" ,
218- Map .of ("b64-deobfuscate. minDecodedLength" , "10" ));
218+ Map .of (opt ( " minDecodedLength") , "10" ));
219219 System .out .println (code );
220220 assertThat (code ).contains ("b64: Hello, World!" );
221221 }
@@ -232,6 +232,10 @@ private String decompileSmali(String fileName) throws Exception {
232232 return decompileSmali (fileName , Map .of ());
233233 }
234234
235+ private static String opt (String key ) {
236+ return JadxStringDecoderPlugin .PLUGIN_ID + "." + key ;
237+ }
238+
235239 private String decompileSmali (String fileName , Map <String , String > pluginOptions ) throws Exception {
236240 JadxArgs args = new JadxArgs ();
237241 args .getInputFiles ().add (getSampleFile (fileName ));
0 commit comments