opal
opal copied to clipboard
Improve interface of reachable method analysis and related states to prevent misuse
During development on #1 a triggered analysis that is based on the ReachableMethodAnalysis
trait got an eager scheduler. Turns out the ReachableMethodAnalysis
trait implicitly expects to only implement triggered analyses and is not (yet) compatible with eager analyses.
It expects at least some ub
on the Callers
property on the entity (since that would be the only time it would be triggered), but with an eager analysis that might not be the case yet when the analysis values are computed at the same time as the call graph. The rest of the analysis actually returns a dependency on the callers property just fine, even if no callers are present: https://github.com/opalj/opal/blob/c6d8224f35629750092931809f6c0b9abb1ca3b3/OPAL/tac/src/main/scala/org/opalj/tac/fpcf/analyses/cg/ReachableMethodAnalysis.scala#L101
This PR updates the ReachableMethodAnalysis
to stop throwing a match exception when used with an eager analysis and adds compatibility. At the same time, some other handling of the analysis is improved to add clarity or prevent further misuse (such as throwing around null
values which are discouraged in Scala).
[!NOTE] This PR does not yet update the usages of the reachable method analysis to not use the deprecated method since they can be pretty expansive. Actually, the whole deprecation is up for discussion, so a second PR changing all the usages may not be created yet until we agree on a solution (which can also be revert the changes made to the public interface).