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

Confusing invalid.array.component.type error message #213

Open
mernst opened this issue Nov 21, 2020 · 0 comments
Open

Confusing invalid.array.component.type error message #213

mernst opened this issue Nov 21, 2020 · 0 comments

Comments

@mernst
Copy link
Collaborator

mernst commented Nov 21, 2020

For this code:

import org.checkerframework.checker.determinism.qual.*;

public class InvalidArrayComponentType {

    public static void methodForName(String method) {
        @PolyDet String @PolyDet [] bnArgnames = method.split(" *, *");
        @PolyDet String @PolyDet [] argnames = bnArgnames;
    }
}

the Determinism Checker produces the following error message:

InvalidArrayComponentType.java:13: error: [invalid.array.component.type] component type (@PolyDet String @Det []) cannot be used with array type (@PolyDet)
        @PolyDet String @PolyDet [] argnames = bnArgnames;
                                                      ^
  1. The component and array types seem to be switched in the error message.

  2. It is confusing that the message is issued at the use of bnArgnames. I think it would be clearer for users (and possibly more efficient in the implementation) to issue the error message at the declaration, which is where the illegal type appears in the source code.

  3. The program contains @PolyDet String @PolyDet [] but the message names a different type, @PolyDet String @Det [].

t-rasmud added a commit that referenced this issue Jan 5, 2021
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