Zelix KlassMaster - Documentation
 

The ignoreMissingReferences Statement

The ZKM Script ignoreMissingReferences statement specifies classes, fields and methods which can be ignored if they cannot be found by Zelix KlassMaster™ when executing a open, trim or obfuscate statement. Successive ignoreMissingReferences statements have a cumulative effect. Once a specification has been set its effect can be removed entirely by a following resetIgnoreMissingReferences statement.

Note that the ignoreMissingReferences statement must precede your ZKM Script open statement. Missing classes, fields and methods are often first detected at that stage.

Also note that if you use this statement then Zelix KlassMaster™ may not be able to process your classes correctly. You should only use the statement if you are sure that the missing classes, fields and methods are really irrelevant to your classes.

In any case, there are some scenarios where Zelix KlassMaster™ cannot ignore a missing class, field or method. For example, Zelix KlassMaster™ cannot ignore a missing class if it is extended by a class that has been opened for obfuscation.

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

Examples and Explanation

ignoreMissingReferences statement parameters may be loosely categorized into the following groups

No parameters specified

If the ignoreMissingReferences statement appears with no parameters at all then it is the same as specifying that all missing classes, fields and methods should be ignored.

Class specification parameters

Put informally (with mandatory components in bold), the syntax is:
<packageQualifiers>.<className>;

Note that because the specification is for a class which cannot be found, only limited specifications are possible. For a class to be specified, all of the following must be true:
  • Its package qualifiers must match any specified package parameter component. If there is no package parameter component then the class must be in the default package.
  • Its unqualified name must match the specified class name specification.

If a class specification parameter's class name specification is followed by a "+" tag then the parameter also causes references to any missing fields and methods of the class to be ignored.
ignoreMissingReferences *        and //Ignore all missing classes in the default package
                        *.Class1 and //Ignore all missing classes with the unqualified class name "Class1"
                        pack0.*.*;   //Ignore all missing classes in a sub-package of "pack0"
 

Field specification parameters

Put informally (with mandatory components in bold), the syntax is:
<classAnnotations> <classModifiers> "<archiveQualifier>"!<packageQualifiers>.<className> <extendsClause> <implementsClause>
    <fieldName>;

Note that because the specification is for a field which cannot be found, only limited field specific specifications are possible. For a field to be specified, all of the following must be true:
ignoreMissingReferences *.* *       and //Ignore all missing fields
                        *.Class1 f* and //Ignore all missing fields matching "f*" in classes with the unqualified name "Class1"
                        @*.* public *.* *; //Ignore all missing fields in public classes with an annotation.

Method specification parameters

Put informally (with mandatory components in bold), the syntax is:
<classAnnotations> <classModifiers> "<archiveQualifier>"!<packageQualifiers>.<className> <extendsClause> <implementsClause>
    <methodName>(<argumentTypes>);

Note that because the specification is for a method which cannot be found, only limited method specific specifications are possible. For a method to be specified, all of the following must be true:
  • Its containing class must match any class parameter component (see Class specification parameters).
  • 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.

The ignoreMissingReferences statement supports the special method name <init> which represents a constructor.
ignoreMissingReferences *.* *(*)     and  //Ignore all missing methods
                        *.* <init>() and  //Ignore all missing no argument constructors
                        //Ignore all missing the methods of any class implementing "Serializable" in a package that matches "pack1.*"
                        pack1.* implements java.io.Serializable *(*);

Syntax

"ignoreMissingReferences" specificationParameter ("and" specificationParameter)* ";"

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

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

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

classSpecificationParameter ::=
   [annotationSpecifier] [["!"] "public" | "package"]
   [["!"] "abstract"] [["!"] "final"] [["!"] "interface"] [["!"] "synthetic"] [["!"] "enum"] [["!"] "annotation"]
   ["\"" archiveQualifier "\"" "!"] [packageSpecificationParameter] nameSpecifier ["^"] ["+"] [containingClause]
   [extendsClause] [implementsClause]

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

specificationParameter ::= classSpecificationParameter |
fieldSpecificationParameter |
methodSpecificationParameter

extendsClause ::= "extends" [annotationSpecifier] wildcardClassName

fieldSpecificationParameter ::=    classSpecificationParameter    nameSpecifier

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

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

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

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

memberSpecifier ::= fieldSpecificationParameter | methodSpecificationParameter

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

methodSpecificationParameter ::=    classSpecificationParameter    nameSpecifier "(" [ "*" | (parameter ("," parameter))] ")"

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

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

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

nameSpecifier ::= wildcardName | nameAndList

packageSpecificationParameter ::= packageName | packageNameAndList

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

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

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

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, field or method name) with the "*" wildcard allowed
Where archiveQualifier is a relative or absolute archive path name with the "*" wildcard allowed. E.g. "/lib/*.jar" or "myJar0.jar"
 
ZKM Script classpath statement The ZKM Script Language ZKM Script resetIgnoreMissingReferences statement