Search code examples
javaobfuscationallatori

obfuscating with allatori obfuscates too much


I have the following config.xml file

<config>
  <input>
    <jar in="FVCellsPlugin-3.3.1-jcg.jar" out="obf-FVCellsPlugin-3.3.1-jcg.jar"/>
  </input>
  <keep-names>
    <class template="class io.github.freakyville.fvcells.main.Main"/>
    <class template="class regex:(?!io\.github\.freakyville).*\..*">
        <field template="*"/>
        <field template="static *"/>
        <field template="public static *"/>
        <method template="private+ *(**)"/>
        <method template="private+ static *(**)"/>
    </class>
    <class template="private+ class regex:io\.github\.freakyville\.utilsupdated\..*"/>
  </keep-names>
  <property name="log-file" value="log.xml"/>
  <property name="line-numbers" value="keep"/>
</config>

So I tried a few things without it working, all my code that i want obfuscated is in the package(or sub packages) io.github.freakyville(except io.github.freakyville.utilsupdated). when the plugin is enabled I get an error java.lang.NoSuchMethodError: com.mongodb.client.model.geojson.c.iiiiiI(Ljava/lang/String;)Ljava/lang/String; which shows that it is obfuscating the class inside com.mongodb.client.model.geojson, When looking inside the jar I can see that it has obfuscated the geojson.c class https://gyazo.com/45c17157d5d7a213f14a9ecc2c12b4f6 which to me doesn't make sence as my regex (?!io\.github\.freakyville).*\..* should match that package/class path and then keep the package/class right?


Solution

  • Ah I figured it out, I missed the tag in the documentation(which ignores the classes matched in the obfuscating process). Adding my class templates to that and now it works