typetools / checker-framework

Pluggable type-checking for Java
http://checkerframework.org/
Other
994 stars 350 forks source link

AnnotatedTypeMirrors of binary trees are recomputed too often #498

Open smillst opened 8 years ago

smillst commented 8 years ago

Types of binary trees are recomputed each time getAnnotatedType is called. The type of a binary tree is the LUB of the left and right side of the trees, so getAnnotatedType is called on the left and right trees. Data flow calls getAnnotatedType on every node in a binary tree.

Possible fixes:

  1. Cache the types. (Caches haven't worked well in the past)
  2. Compute the LUB in dataflow which will store the types. (Any checker that wants the type to be something other than the LUB will have to override CFTransfer.)
smillst commented 8 years ago

(Probably Adding caches is the right way to fix this.)