Disable compilation when injecting into inner classes -- part-fix for BYTEMAN-288 References to inner classes from compiled rule code cause …
Disable compilation when injecting into inner classes -- part-fix for BYTEMAN-288References to inner classes from compiled rule code cause verifyerrors. However, these errors can be avoided if instead the ruel codeis interpreted. This fix disables compilation of rule code for anyINTERFACE rule or overriding CLASS (with a ^) rule whose trigger classis found to be an inner class. Note that these two cases are treatedspecially because there are legitimate cases where compilation mightbe appropriate for some trigger classes which match the rule but willcause problems with other matches. If compilation is specified using anormal (non-overriding) CLASS rule and the target class is an innerclass then that is a spec error so Byteman generates bytecode and anerror results.This is merely a limited heuristic which has both false positives andnegatives. It can interpret rules whcih might legitimately compile(e.g. they don't use $0) and pass rules which will still fail tocompile (e.g. $1 is an inner class). It also doesn't detect caseswhere the inner class is non-static (guaranteed to fail if we try touse the inner instance with no handle on the enclosing wrapperinstance). A better fix requires upgarding the type check methods ofExpression classes to detect uses of inner classes and either disablecompilation or throw a type exception.