0

After keep for public api, I can't include classes belonging to a sub package, see com.example.protocol.* below

<keep>
   <class classes="protected"
       methods="protected"
       fields="protected">
      </class>

     <!------------------- this part doesn't work ----------------------------->
      <class>
          <patternset>
              <include name="com.example.protocol.*"/>
          </patternset>
      </class>
</keep>

Tried above pom.xml but resulting class is still obfuscated

1 Answers1

0

From the yGuard documentation:

If [...] the class element contains no nested patternset, a class element matches all class names.

This means the classes that match the patternset from the second class element also match the first class element. And that means your configuration contains contradictory directives. In such a case, there is no defined behavior for yGuard's keep element.

You need to exclude the classes you want to match in the second class element from the set that is matched in the first class element:

<keep>
  <class classes="protected" methods="protected" fields="protected">
    <patternset>
      <include name="**"/>
      <exclude name="com.example.protocol.*"/>
    </patternset>
  </class>
  <class>
    <patternset>
      <include name="com.example.protocol.*"/>
    </patternset>
  </class>
</keep>
Thomas Behr
  • 761
  • 4
  • 10