-
Notifications
You must be signed in to change notification settings - Fork 349
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
Problem with dataflow inside a lambda during type argument inference #6629
Comments
Before version 3.43.0, type argument inference errors were suppressed by default. We greatly improved the handling of type argument inference in 3.43.0, so they are no longer suppressed by default. That's why this error is new. It looks like the problem is that an argument to |
Thanks for the reply @smillst. But I'm still at a loss, and can't make sense of this error.
What am I missing here? Where can I read up on type argument inference? |
The problem is an argument to the constructor, not its formal parameters. Try this assigning the constructor to a local variable to see it's type and you should get an error for one or more of the arguments.
Here's an example that is similar to your error:
Here's are the errors I get:
|
Thanks for you attention on this @smillst. Apologies if the misunderstanding is my own. I'm trying the following sample code:
Produces the error:
Adding P.S.
But this seems like a separate issue related to default bounds settings. |
Thanks for the test case. This is a bug. Here's a smaller test case that reproduces the problem:
|
FWIW @smillst I have encountered a similar error that I can file a new bug if you like and or maybe there is a way to annotate the "sneak throw" technique. /**
* An error friendly {@link Function} for converting properties.
*
* @param <T> input type.
* @param <R> output type.
* @param <E> error type.
*/
public interface PropertyFunction<T extends @Nullable Object, R extends @Nullable Object, E extends Exception>
extends Function<T, R> {
@Override
default R apply(T t) {
try {
return _apply(t);
}
catch (Exception e) {
// the error happens below here.
sneakyThrow(e);
throw new RuntimeException(e);
}
}
/**
* Apply that throws error.
* @param t input
* @return output
* @throws E if an error happened in function.
*/
public R _apply(T t) throws E;
@SuppressWarnings("unchecked")
private static <E extends Throwable> void sneakyThrow(final Throwable x) throws E {
throw (E) x;
}
}
I'm not really sure how to properly annotate or EDIT when I suppress the warning I get:
|
Trying to bump our Checkerframework version to from 3.42.0 to 3.43.0 and am seeing the following issue which is not clear to me:
NotNull is applied in the
package-info.java
:The following code has started producing the following error:
Is this expected?
What has changed since 3.42.0 which is causing this issue?
The text was updated successfully, but these errors were encountered: