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

@ConfigProperty for java.util.Duration with defaultValue flagged as error in VS code #631

Open
Dougniel opened this issue Oct 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Dougniel
Copy link

Dougniel commented Oct 6, 2023

In a similar way to #612 with java.util.Duration, the following code generates an error in the VS Code UI:

    @ConfigProperty(name = "app.duration", defaultValue = "PT15M")
    Duration duration;

❌ The error message looks like that :

'PT15M' does not match the expected type of 'Duration'.microprofile-config(DEFAULT_VALUE_IS_WRONG_TYPE)
@fbricon fbricon added the bug Something isn't working label Oct 6, 2023
@fbricon
Copy link
Collaborator

fbricon commented Oct 6, 2023

Need to add something like :

case "java.time.Duration":
	return Duration.parse(value) != null;

in https://github.com/eclipse/lsp4mp/blob/aa2fb199ebbfc03ad542fd65cfed95f518703b13/microprofile.jdt/org.eclipse.lsp4mp.jdt.core/src/main/java/org/eclipse/lsp4mp/jdt/internal/config/java/MicroProfileConfigASTValidator.java#L311 and catch any exception

@Dougniel do you feel like opening a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants