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

CodeAction for generate @TemplateData #532

Open
angelozerr opened this issue Jan 12, 2022 · 3 comments
Open

CodeAction for generate @TemplateData #532

angelozerr opened this issue Jan 12, 2022 · 3 comments

Comments

@angelozerr
Copy link
Contributor

angelozerr commented Jan 12, 2022

Today completion validation etc provide fields methods from java type by using java reflection.

I wonder if we should have à settings like reflectionValueResolver set to true by default.

When this settings will be set to false completion validation will provide only fields and methods annotated with @templatedata.

We could provide a quickfix for the methods and fields which are used in the template but not annotated, to insert in the java file the proper TemplateData annotation.

@mkouba what do you think about this idea?

@mkouba
Copy link
Collaborator

mkouba commented Jan 13, 2022

Today completion validation etc provide fields methods from java type by using java reflection.

Note that reflection resolver does not work for native images unless the relevant java type is registered for reflection (e.g. via @RegisterForReflection).

When this settings will be set to false completion validation will provide only fields and methods annotated with @templatedata.

We should not forget about template extension methods...

We could provide a quickfix for the methods and fields which are used in the template but not annotated, to insert in the java file the proper TemplateData annotation.

Sounds reasonable... but we'll need to make sure all value resolvers are counted, i.e. reflection + existing @TemplateData + @TemplateExtension and also @TemplateEnum and @TemplateGlobal from quarkus 2.7+.

@angelozerr
Copy link
Contributor Author

Thanks for your relevant information @mkouba

IMHO I think it's important to have a settings liek reflectionValueResolver = true or perhaps a better name should be nativeImagesMode = false to understand why Quarkus application in runtime can work but not in native images.

The Qute validator can be a perfect feature to understand what the user must to fix to run a Quarkus application in native images.

Do you like this idea @mkouba ? Do you think it's an important feature?

@mkouba
Copy link
Collaborator

mkouba commented Jan 14, 2022

Do you like this idea? Do you think it's an important feature?

Hm, the problem is that a quarkus app can target multiple runtimes (JVM, native image). OTOH if an app runs ok in native mode then it should be safe to run the app in JVM. So an option like this probably makes sense. In other words, if nativeImages=true then just ignore the reflection value resolver...

@angelozerr angelozerr changed the title Support for @TemplateData CodeAction for generate @TemplateData Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants