Skip to content

Inconsistency with both typeAnnotationQuantifyCapability and superclassQuantifyCapability #275

@Dimibe

Description

@Dimibe

When using the two capabilities typeAnnotationQuantifyCapability and superclassQuantifyCapability combined, the covered reflectable classes are not as expected.

Type annotations from super classes are reflectable, but super classes of type annotations are not. According to the code documentation, my expectation is, that in both cases all classes must be reflectable.

Consider the following Reflector:

class Reflector extends Reflectable {
  const Reflector()
      : super(instanceInvokeCapability, reflectedTypeCapability,
            typeAnnotationQuantifyCapability, superclassQuantifyCapability);
}
const reflector = Reflector();

In the following case, the annotated class A extends a class B which has a class member of type C. In this case, all classes A, B and C are reflectable, which is what I expect.

@reflector
class A extends B { }

class B {
  C? c;
}

class C {}

The second case is the other way around, the annotated class A has a member of type B which extends class C. In this case, only class A and B are reflectable.

@reflector
class A {
 B? b;
}

class B extends C {}

class C {}

My expectation is that class C must be reflectable as well, since the doc of superclassQuantifyCapability is:

Gives support for reflection on all superclasses of covered classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions