[DROOLS-363] make incremental compilation to work with declared types
(cherry picked from commit b88dab15355640fb6eaa5842e0e9cc0027335769)