Skip to content

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

@mernst

Description

@mernst

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 [].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions