typetools / typetools/checker-framework

GUIEffect: Issue with transitive @UI inheritance

Open
#2,049 2 comments 0 reactions 1 assignee View on GitHub

@csgordon is already working on this.

Since Jun 22, 2018.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

We have observed some strange behavior for the GUIEffect checker when dealing with long (>2 classes deep) inheritance hierarchies.

Consider the following example code:

class MyTestCase {

    @PolyUIType
    static class PolyUIBaseClass {
        @PolyUIEffect
        public void foo() {};
    }

    static class TransitiveUISubclass extends @UI PolyUIBaseClass { }

    static class UISubclass extends TransitiveUISubclass {
        @UIEffect
        public void bar() {}
        @Override
        public void foo() {
            bar();
        }
    }

}

Unless I am mistaken, I would expect the guieffect checker on this code to compile without error (which is what happens if UISubclass is made to extend @UI PolyUIBaseClass directly, except for a effects.redundant.uitype warning), or else to give an override error, where it complains that foo should be @UIEffect, as it overrides @UIEffect TransitiveUISubclass.foo().

However, instead, this code fails with error: (call.invalid.ui) on the callsite for bar(); inside foo, showing that it considers the declaration of UISubclass.foo to be both valid and @SafeEffect.

Is this expected behavior or an error in the checker?

cc: @msridhar @csgordon

p.s. This is not a high urgency issue for us right now, but it seems very unintuitive and did mean that in the past we weren't checking some things that we thought we were.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.