Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@HasQualifierParameter doesn't apply to anonymous classes #3831

Closed
t-rasmud opened this issue Oct 25, 2020 · 0 comments
Closed

@HasQualifierParameter doesn't apply to anonymous classes #3831

t-rasmud opened this issue Oct 25, 2020 · 0 comments

Comments

@t-rasmud
Copy link
Contributor

Consider the following test case:

import org.checkerframework.checker.tainting.qual.Tainted;
import org.checkerframework.framework.qual.HasQualifierParameter;

@HasQualifierParameter(Tainted.class)
public class InnerHasQualifierParameter {

    @HasQualifierParameter(Tainted.class)
    interface TestInterface {
        public void testMethod();
    }

    public void test() {
        TestInterface test =
                new TestInterface() {
                    public void testMethod() {}
                };
    }
}

Running the tainting checker with the command javac -processor tainting checker/tests/tainting/InnerHasQualifierParameter.java results in the following error:

checker/tests/tainting/InnerHasQualifierParameter.java:14: error: [missing.has.qual.param] Missing @HasQualifierParameter for hierarchy @Tainted.
                new TestInterface() {
                                    ^
  Class extends or implements a type that has a qualifier parameter.
1 error

While this is an expected output, there is no way to explicitly annotate the anonymous class with @HasQualifierParameter.
Proposed solution: Make @HasQualifierParameter an inherited annotation type.

t-rasmud added a commit to t-rasmud/checker-framework that referenced this issue Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant