Skip to content

I20180425-0250

@trancexpress trancexpress tagged this 24 Apr 13:31
Refactor rename on methods with common names, e.g. getName() can take
very long. The rename is done mainly in two parts. A workspace search
for methods with matching signatures, and a check to find out which of
those methods are actually to be renamed.

A large portion of the computations is done in the latter part. I.e. to
determine the search-matching methods that are affected by the rename.
Specifically, the rename will look for cases such as:

interface I { void a() }
interface J { void a() }
class A implements I, J

Renaming I.a must also affect J.a due to A. Type J is considered a
married alien type, as A implements both I and J.

The check for married alien types can be very expensive, as in worst
case it involves a type hierarchy computation for each search match (for
common names, there can be thousands of matches).

This change improves simple cases, where its not necessary to
look for alien types. This is done by examining the hierarchy of the
method under rename, and checking whether any subtype has a super type
which is not in this hierarchy. If not, the expensive alien types
computation is omitted, since no alien types can exist.

With this change, we observe roughly 4x performance gain for common,
simple cases of renaming methods.

Change-Id: I5aea126f715e8b98ef7c9bb6123535b3d1b5a668
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Assets 2
Loading