-
Notifications
You must be signed in to change notification settings - Fork 273
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
cast
warning with -Xlint
enabled (becomes error with -Werror
)
#1491
Comments
There is a workaround: Apply |
same or related, and overshadow didn't help
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
@Value.Style(typeBuilder = "*TestDataBuilder", newBuilder = "create", jakarta = true, overshadowImplementation = true)
final class UserTestDataBuilders {
private UserTestDataBuilders() {}
@Builder.Factory
static User user(@Nonnull Optional<String> name perhaps the simplest upfront way would simply be to add a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a minimalistic interface that will repro the issue.
Here's the warning(/error with
-Werror
enabled):You need both the JSON annotations and the
Builder
class to trigger this warning.Here's the offending generated snippet:
builder.build()
actually returns anImmutableExample
, not anExample
. Hence, the cast is redundant.If you remove the
Builder
class fromExample
, the snippet looks like this instead:See also #672;
@SuppressWarnings({"all"})
does not suppress-Xlint
warnings for some reason.In this case, it should be fairly easy to fix this, and the
cast
warning is probably not one you want to disable. (Whereas theprocessing
warning in #672 is often one that gets disabled anyway.)The text was updated successfully, but these errors were encountered: