- edited description
ClassHierarchy.isASubtypeOf sometimes returns Unknown even though the supertype is final
I encountered a problem with the subtype checker in ClassHierarchy.
Assume we have a project with some final class C {}
, and the JDK is not part of the project. Then, classHierarchy.isASubtypeOf(ObjectType("java/util/ArrayList"), ObjectType("myproject/C")) == No
. This is as expected. Even though ArrayList is an unknown type, we know that it can not be a subtype of C since C is final.
However, if we add a class MyList extends ArrayList {}
to the project, the same check now returns Unknown.
It seems like this is because ArrayList is now “known” to the ClassHierarchy (because it appears in the MyList class definition?), and whether or not the supertype is final is only checked when the subtype is unknown. This looks wrong to me.
Comments (4)
-
reporter -
reporter - edited description
-
repo owner It is definitively an unwanted imprecision which I will fix. Thanks for the very helpful description!
-
repo owner - changed status to resolved
fixes issue
#182Signed-off-by: Michael Eichberg mail@michael-eichberg.de
f
Signed-off-by: Michael Eichberg mail@michael-eichberg.de
formatting
Signed-off-by: Michael Eichberg mail@michael-eichberg.de
→ <<cset d913029c1179>>
- Log in to comment