-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
"Not a parameterized type!" when indexing a record with a compact constructor and an annotated parameterized types #218
Comments
The error occurs when parsing a type annotation on the record constructor. If the constructor is removed, the class file is parsed just fine. This is how
It seems to me that the Jandex should be able to ignore that. I'll try to figure something out. |
Also, it seems the problem only appears with a compact constructor. As a workaround, you can use a normal constructor instead of a compact one: public record MyRecord(List<@NotEmpty String> list) {
public MyRecord(List<@NotEmpty String> list) {
this.list = list;
}
} |
The merit goes to you :) Are you sure it should be |
Actually a compact constructor has implicitly declared parameters, per the JLS (8.10.4.2. Compact Canonical Constructors). In this case, there's just one parameter, and its type contains a type annotation. The record also implicitly declares a component field (8.10.3. Record Members). That field's type also contains a type annotation, and it seems to me that javac simply takes the type of the field it generated and pushes it into the constructor parameter list. Which is fine, until there are type annotations :-) EDIT: the record also implicitly declares an accessor method, but type annotations on its return type seem to be correct. |
In any case, I have a workaround for Jandex that will just drop the invalid type annotation. |
Done in #219. Thanks for the report! |
Hello,
Considering this java record with a compact constructor:
When indexing the record
Jandex throws a
java.lang.IllegalArgumentException: Not a parameterized type!
The text was updated successfully, but these errors were encountered: