[DROOLS-549] Queries in the default package are built twice
(cherry picked from commit ebf7f1dcc85a0a98e41f6bd5ea43cf6e17e80fb7)
[DROOLS-547] Queries should check the type of input arguments
(cherry picked from commit 0eb43be028e455ccc175fd739abc554f7c96fa67)
[DROOLS-555] Support both static and dynamic trait interfaces on the same object
(cherry picked from commit a475dfd09e05528c6ee9dbf845cce780f268dfc5)
[DROOLS-549] Move helper methods to ClassUtils
(cherry picked from commit dd59435b623cc5dfdbb3ba9b0ff18b187fc3bc79)