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

Static metamodel generation produces uncompilable code under JDK 21 #257

Closed
ledsoft opened this issue Jul 16, 2024 · 0 comments · Fixed by #258
Closed

Static metamodel generation produces uncompilable code under JDK 21 #257

ledsoft opened this issue Jul 16, 2024 · 0 comments · Fixed by #258
Labels
Milestone

Comments

@ledsoft
Copy link
Contributor

ledsoft commented Jul 16, 2024

When I have a JOPA entity class with fields annotated with annotation with target ElementType.TYPE_USE (for example, Java validation API annotations @NotNull etc.), the static metamodel generator produces uncompilable output, because it attempts to insert the annotation text into the type field definition in the generated static metamodel.

For example, for the following attribute definition:

@NotBlank
@ParticipationConstraints(nonEmpty = true)
@OWLDataProperty(iri = cz.cvut.kbss.termit.util.Vocabulary.s_p_ma_krestni_jmeno)
String firstName;

it produces

public static volatile SingularAttribute<UserAccount, NotBlank String> firstName;

and messes up the imports, adding import String;.

This happens under JDK 21, JDK 17 output is fine. Other annotation targets do not cause this issue, only ElementType.TYPE_USE.

@ledsoft ledsoft added the bug label Jul 16, 2024
@ledsoft ledsoft added this to the 2.0.3 milestone Jul 16, 2024
ledsoft added a commit that referenced this issue Jul 17, 2024
…ons in element type declaration.

In JDK 17 and before, annotations were added before type ("@annotation java.util.Set"), now, they are inserted into the type ("java.util@Annotation Set"), so we cannot rely on TypeMirror.toString when determining type.
@ledsoft ledsoft linked a pull request Jul 17, 2024 that will close this issue
ledsoft added a commit that referenced this issue Jul 17, 2024
…ons in element type declaration.

In JDK 17 and before, annotations were added before type ("@annotation java.util.Set"), now, they are inserted into the type ("java.util@Annotation Set"), so we cannot rely on TypeMirror.toString when determining type.
@ledsoft ledsoft closed this as completed Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant