-
Notifications
You must be signed in to change notification settings - Fork 446
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
After version 1.38, putting a ternary as a generic parameter in a function call gives an incorrect error #3899
Comments
I've seen something similar with 1.38 with incorrect compilation errors that don't appear when compiled through javac. A generic type could not be worked out and a default record constructor could not be found. Reverting to 1.37 appears to have fixed the problem. |
i faced same problem with 1.38 and reverting to 1.37 fixed the problem |
Confirmed both in 1.38.0 (current release) and 1.39.2025011008 (current pre-release): Reproducible with: import java.util.function.Supplier;
public class CompileError {
<T> void foo(Supplier<T> p, int foo) {
}
void bar(Integer i) {
foo(null, i != null ? i : 100);
}
} |
json.put("id", id == null ? null : id.longValue());
(json and id are both objects of our own types)
error over .put:
The method put(String, T) in the type Json is not applicable for the arguments (String, Long)Java(67108979)
lines without a ternary conditional operator, such as below, do not give an error
json.put("id", id.longValue());
The text was updated successfully, but these errors were encountered: