Zelix KlassMaster - Documentation

The methodParameterChangesInclude Statement

The ZKM Script methodParameterChangesInclude statement allows you to specify which methods should be considered as being available for parameter list changes. Method parameters may be changed by a following obfuscate statement which has:
  • Its allowMethodParameterChanges parameter set to true and
    • Its encryptStringLiterals parameter set to enhanced and/or
    • Its obfuscateReferences parameter set to normal.
Successive methodParameterChangesInclude statements have a cumulative effect. Once a specification has been set its effect can be If there is a methodParameterChangesInclude statement without a methodParameterChangesExclude statement then only the methods specified by the methodParameterChangesInclude statement will be considered as candidates for parameter changes. If there is a methodParameterChangesInclude statement and a methodParameterChangesExclude statement then the methodParameterChangesInclude statement will be applied first against the set of all methods and then the methodParameterChangesExclude statement will be applied against the set of methods specified by the methodParameterChangesInclude statement.

Note that if there is neither a methodParameterChangesInclude statement or a methodParameterChangesExclude statement active then the obfuscate statement will default to treating all methods as candidates.

The remainder of this page is organized into the following sections.

Examples and Explanation

methodParameterChangesInclude statement parameters must specify methods. Put informally (with mandatory components in bold), the syntax is:
<classAnnotations> <classModifiers> <packageQualifiers>.<className> <extendsClause> <implementsClause>
    <methodAnnotations> <methodModifiers> <methodName>(<argumentTypes>) <throwsClause> +signatureClasses;

For a method to be matched by the statement, all of the following must be true:
  • Its containing class must match any class include parameter component.
  • Its annotations must match any specified method or method parameter level annotations.
  • Its modifiers (e.g. public native) must match all parameter method modifiers. So if the parameters are public static !synchronized then the method must be public, static and NOT synchronized to be matched.
  • Its name must match the parameter method name.
  • Its argument types (e.g. int[], java.lang.String) must match the parameter argument types if they exist. (A single parameter argument type of "*" matches any method argument types including no arguments.) If the parameter has no argument type then the method must take no arguments.
  • Its throws clause must contain all the classes specified in the include parameter's throw clause. So, if the include parameter's throws clause is throws java.io.IOException then the method must throw java.io.IOException or one of its subclasses to be matched.
methodParameterChangesInclude *.* *(*)          and  //Match references to all methods
                              *.* !static m*()  and  //Match references to all non-static methods taking no parameters with names matching "m*"
                              //Match references to all "native" methods. Also match the containing class.
                              *.*^ native *(*)  and  
                              *.* *(*) throws java.io.IOException and  //Match references to all methods that throw "java.io.IOException". 
                              //Match references to all "abstract" methods that  take a single String.
                              *.* abstract *(java.lang.String) and 
                              //Match references to all the methods of any class implementing "Serializable" in a package that matches "pack1.*"
                              pack1.* implements java.io.Serializable *(*) and
                              //Match references to all methods annotated with a class matching "*.MyAnnotation0".
                              *.* @*.MyAnnotation0 *(*); and


"methodParameterChangesInclude" methodIncludeParameter ("and" methodIncludeParameter)* ";"

annotationSpecifier ::= ("@" [packageIncludeParameter] nameSpecifier) | annotationSpecifierAndList

annotationSpecifierAndList ::= ["!"] "(" annotationSpecifierOrList ("&&" annotationSpecifierOrList)* ")"

annotationSpecifierOrList ::= annotationSpecifier ("||" annotationSpecifier)*

classIncludeParameter ::=
   [annotationSpecifier] [["!"] "public" | "package"]
   [["!"] "abstract"] [["!"] "final"] [["!"] "interface"] [["!"] "synthetic"] [["!"] "enum"] [["!"] "annotation"]
   [packageIncludeParameter] nameSpecifier ["^"] ["+"] [extendsClause] [implementsClause]

containingClause ::= "containing" "{" "memberAndList" "}"

extendsClause ::= "extends" [annotationSpecifier] wildcardClassName

fullyQualifiedClassName ::= name ("." name)*

implementsClause ::= "implements" [annotationSpecifier] wildcardClassName ("," [annotationSpecifier] wildcardClassName)*

memberAndList ::= ["!"] "(" memberOrList ("&&" memberOrList)* ")"

memberOrList ::= memberSpecifier ("||" memberSpecifier)*

memberSpecifier ::= methodIncludeParameter

nameAndList ::= ["!"] "(" nameOrList ("&&" nameOrList)* ")"

methodIncludeParameter ::=
   classIncludeParameter [annotationSpecifier] [["!"] "public" | "protected"| "package"| "private"]
   [["!"] "abstract"] [["!"] "static"] [["!"] "final"] [["!"] "native"] [["!"] "synchronized"] [["!"] "synthetic"] [["!"] "bridge"]
   nameSpecifier "(" [ "*" | (parameter ("," parameter)*)] ")" ["throws" wildcardClassName]

name ::= (["0"-"9","a"-"z","A"-"Z","$","_"])+
   i.e. a Java identifer (e.g. a package, class or method name) with no wildcards allowed

nameAndList ::= ["!"] "(" nameOrList ("&&" nameOrList)* ")"

nameOrList ::= nameSpecifier ("||" nameSpecifier)*

nameSpecifier ::= wildcardName | nameAndList

packageIncludeParameter ::= packageName | packageNameAndList

packageName ::= wildcardName ("." wildcardName)* "."
   NB: the final "." is part of the package name

packageNameAndList ::= ["!"] "(" packageNameOrList ("&&" packageNameOrList)* ")"

packageNameOrList ::= packageIncludeParameter ("||" packageIncludeParameter)*

parameter ::= [annotationSpecifier] ("*" | "?" | type)

type ::=
   ("byte" | "short" | "char" | "int" | "long" | "float" | "double"| "boolean" |
   fullyQualifiedClassName) ("[]")*

wildcardClassName ::= wildcardName ("." wildcardName)*

wildcardName ::= (["*","0"-"9","a"-"z","A"-"Z","$","_"])+
   i.e. a Java identifer (e.g. a package, class or method name) with the "*" wildcard allowed
ZKM Script resetObfuscateReferenceExclusions statement The ZKM Script Language ZKM Script methodParameterChangesExclude statement
Zelix KlassMaster - Java Obfuscator