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

Negatable Optional<Boolean> not recognized when annotation processor is enabled. #1713

Closed
nineinchnick opened this issue Jun 20, 2022 · 3 comments · Fixed by #1714
Closed
Labels
theme: annotation-proc An issue or change related to the annotation processor type: enhancement ✨

Comments

@nineinchnick
Copy link
Contributor

I have an option like this:

    @Option(names = "--progress", paramLabel = "<progress>", description = "Show query progress", negatable = true)
    public Optional<Boolean> progress;

and I'm getting this error when building the project with Maven:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/jwas/src/trino/client/trino-cli/src/main/java/io/trino/cli/ClientOptions.java:[144,30] progress must be a boolean: only boolean options can be negatable.

when I enable the annotation processor in the pom.xml file:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>info.picocli</groupId>
                            <artifactId>picocli-codegen</artifactId>
                            <version>4.6.3</version>
                        </path>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

It works without the annotation processor.
I can't really avoid using the Optional and I'm trying to build a static binary using GraalVM.

@remkop
Copy link
Owner

remkop commented Jun 20, 2022

Hi @nineinchnick thank you for raising this!

For now, I suspect that the only way around the annotation processor's compilation error is to replace Optional<Boolean> with Boolean... 😓

It is a good idea to try to improve the annotation processor to deal with this.
Will you be able to create a pull request for this?

@remkop remkop added type: enhancement ✨ theme: annotation-proc An issue or change related to the annotation processor labels Jun 20, 2022
@nineinchnick
Copy link
Contributor Author

I'd love to try! Any pointers?

@nineinchnick
Copy link
Contributor Author

I've been looking at the annotation processor tests but there's a lot of different kinds of tests and I can't find a basic one that'd cover most data types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: annotation-proc An issue or change related to the annotation processor type: enhancement ✨
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants