You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nullness of generics is lost for "new Foo<@Nullable Object>().bar()"Β #1155
Foo.java:12: warning: [NullAway] Cannot assign from type Inner<Object> to type Inner<@Nullable Object> due to mismatched nullability of type parameters
Inner<@Nullable Object> mThing = new Inner<@Nullable Object>().identity();
^
(see http://t.uber.com/nullaway )
If I change the assignment to two lines, it compiles without warning:
We have some workarounds for missing annotations in types of new expressions, but we don't handle this case yet. I think openjdk/jdk#23946 might eventually solve this problem for us, assuming it lands and once it makes it into a released javac version. Otherwise, we'll have to add another workaround.
It seems that in the latest JDK 25 early access build this bug is fixed, probably due to openjdk/jdk#23946 landing. We may hold off a bit on rolling our own fix for this, to see how this plays out and whether the JDK fix might get backported.
Foo.java:16: warning: [NullAway] Cannot assign from type Foo. to type Callback<@Nullable Integer> due to mismatched nullability of type parameters
Callback<@Nullable Integer> self = this;
The wrong name I filed as #1202, but the warning is triggered because it thinks "this" is Callback<Integer> rather than Callback<@Nullable Integer> (which is why I'm guessing it's due to this javac bug)
Activity
msridhar commentedon Mar 16, 2025
We have some workarounds for missing annotations in types of
newexpressions, but we don't handle this case yet. I think openjdk/jdk#23946 might eventually solve this problem for us, assuming it lands and once it makes it into a releasedjavacversion. Otherwise, we'll have to add another workaround.msridhar commentedon Apr 20, 2025
It seems that in the latest JDK 25 early access build this bug is fixed, probably due to openjdk/jdk#23946 landing. We may hold off a bit on rolling our own fix for this, to see how this plays out and whether the JDK fix might get backported.
agrieve commentedon Apr 22, 2025
Progress!
Just ran into another bug that I think is an instance of this:
The wrong name I filed as #1202, but the warning is triggered because it thinks "this" is
Callback<Integer>rather thanCallback<@Nullable Integer>(which is why I'm guessing it's due to this javac bug)Enable the test for a call on a new expression with a @nullable type β¦