Zelix KlassMaster - Documentation
 

The methodParameterObfuscationExclude Statement

The ZKM Script methodParameterObfuscationExclude statement allows you to specify which methods should NOT be considered as being available for parameter list obfuscation. Method parameters may be changed by following a obfuscate statement which has its obfuscateParameters parameter set to normal. Successive methodParameterObfuscationExclude statements have a cumulative effect. Once a specification has been set its effect can be removed entirely by a following resetMethodParameterObfuscationExclusions statement.

If there is a methodParameterObfuscationExclude statement without a methodParameterObfuscationInclude statement then the methodParameterObfuscationExclude statement will be applied against the set of all methods to reduce the available set. If there is a methodParameterObfuscationExclude statement and a methodParameterObfuscationInclude statement then the methodParameterObfuscationInclude statement will be applied first against the set of all methods and then the methodParameterObfuscationExclude statement will be applied against the set of methods specified by the methodParameterObfuscationInclude statement.

Note that if there is neither a methodParameterObfuscationExclude statement or a methodParameterObfuscationExclude 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

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

"methodParameterObfuscationExclude" 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 methodParameterObfuscationInclude statement The ZKM Script Language ZKM Script resetMethodParameterObfuscationExclusions statement
Zelix KlassMaster - Java Obfuscator