Clone
Andrew Dinn
committed
on 19 May 16
Disable compilation when injecting into inner classes -- part-fix for BYTEMAN-288
References to inner classes from compiled rule code cause … Show more
Disable compilation when injecting into inner classes -- part-fix for BYTEMAN-288

References to inner classes from compiled rule code cause verify

errors. However, these errors can be avoided if instead the ruel code

is interpreted. This fix disables compilation of rule code for any

INTERFACE rule or overriding CLASS (with a ^) rule whose trigger class

is found to be an inner class. Note that these two cases are treated

specially because there are legitimate cases where compilation might

be appropriate for some trigger classes which match the rule but will

cause problems with other matches. If compilation is specified using a

normal (non-overriding) CLASS rule and the target class is an inner

class then that is a spec error so Byteman generates bytecode and an

error results.

This is merely a limited heuristic which has both false positives and

negatives. It can interpret rules whcih might legitimately compile

(e.g. they don't use $0) and pass rules which will still fail to

compile (e.g. $1 is an inner class). It also doesn't detect cases

where the inner class is non-static (guaranteed to fail if we try to

use the inner instance with no handle on the enclosing wrapper

instance). A better fix requires upgarding the type check methods of

Expression classes to detect uses of inner classes and either disable

compilation or throw a type exception.

Show less

3.X + 2 more