We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
WildcardTypeName ignores its annotations when emitting. For example, consider the following code:
WildcardTypeName wildcard = WildcardTypeName.subtypeOf(com.squareup.javapoet.TypeName.LONG.box()) .annotated(List.of(AnnotationSpec.builder(Safe.class).build())); ParameterizedTypeName paramTypeName = ParameterizedTypeName.get(ClassName.get(Optional.class), wildcard); TypeSpec testTypeSpec = TypeSpec.classBuilder("PoetTestClass") .addField(paramTypeName, "testWildcardField", Modifier.PRIVATE) .build(); JavaFile file = JavaFile.builder("com.poet.test", testTypeSpec) .skipJavaLangImports(true) .indent(" ") .build(); file.writeTo(tempDir.toPath(), StandardCharsets.UTF_8);
We expect this to output:
package com.poet.test; import java.util.Optional; class PoetTestClass { private Optional<@Safe ? extends Long> testWildcardField; }
But instead it outputs:
package com.poet.test; import java.util.Optional; class PoetTestClass { private Optional<? extends Long> testWildcardField; }
The text was updated successfully, but these errors were encountered:
Hi, I would like to work on this issue. Since I am new to open source world it would be great if you can guide me.
Sorry, something went wrong.
No branches or pull requests
WildcardTypeName ignores its annotations when emitting. For example, consider the following code:
We expect this to output:
But instead it outputs:
The text was updated successfully, but these errors were encountered: