Skip to content

Build fails when using picocli-codegen #1137

@xligrd

Description

@xligrd

I set up picocli-codegen as an annotation processor and from that point on build always fails with:

error: FATAL ERROR: java.lang.ClassCastException: class com.sun.tools.javac.code.Attribute$Class cannot be cast to class javax.lang.model.type.TypeMirror (com.sun.tools.javac.code.Attribute$Class is in module jdk.compiler of loader 'app'; javax.lang.model.type.TypeMirror is in module java.compiler of loader 'platform')
at picocli.codegen.annotation.processing.CompletionCandidatesMetaData.extract(CompletionCandidatesMetaData.java:44)
at picocli.codegen.annotation.processing.AbstractCommandSpecProcessor.buildOption(AbstractCommandSpecProcessor.java:499).

Where the related code looks like:

public static class LevelCompletion extends ArrayList<String> {
        public LevelCompletion() {
            super(Arrays.asList("OFF", "INFO", "WARN", ));
        }
    }

    @CommandLine.Option(names = "--level",
                        description = "Level.",
                        defaultValue = "OFF", 
                        showDefaultValue = CommandLine.Help.Visibility.ALWAYS,
                        completionCandidates = LevelCompletion.class)
    private Level level;

Am I doing something wrong or is it bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    theme: codegenAn issue or change related to the picocli-codegen moduletype: bug 🐛

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions