Zelix KlassMaster - Documentation
 

The methodParameterChangesExclude Statement

The ZKM Script methodParameterChangesExclude statement allows you to specify which methods should NOT be considered as being available for parameter list changes. Method parameters may be changed by following a 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 methodParameterChangesExclude statements have a cumulative effect. Once a specification has been set its effect can be removed entirely by a following resetMethodParameterChangesExclusions statement.

If there is a methodParameterChangesExclude statement without a methodParameterChangesInclude statement then the methodParameterChangesExclude statement will be applied against the set of all methods to reduce the available set. If there is a methodParameterChangesExclude statement and a methodParameterChangesInclude 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 methodParameterChangesExclude 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

methodParameterChangesExclude 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.
methodParameterChangesExclude *.* *(*)          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

Syntax

"methodParameterChangesExclude" methodExcludeParameter ("and" methodExcludeParameter)* ";"

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

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

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

classExcludeParameter ::=
   [annotationSpecifier] [["!"] "public" | "package"]
   [["!"] "abstract"] [["!"] "final"] [["!"] "interface"] [["!"] "synthetic"] [["!"] "enum"] [["!"] "annotation"]
   [packageExcludeParameter ["."]] 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 ::= methodExcludeParameter

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

methodExcludeParameter ::=
   classExcludeParameter [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

packageExcludeParameter ::= packageName | packageNameAndList

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

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

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

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 methodParameterChangesInclude statement The ZKM Script Language ZKM Script resetMethodParameterChangesExclusions statement
Zelix KlassMaster - Java Obfuscator