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
Eclipse 2024-03 reports unclosed closeable for whitelisted StreamEx #2199
Eclipse 2024-03 reports unclosed closeable for whitelisted StreamEx #2199
Conversation
Mmmhhh,
@szarnekow do you see any difference between my test and your use case? |
@stephan-herrmann, thank you for investigating. The error reproduces for me with this stub:
The test case can subsequently be simplified to import one.util.streamex.StreamEx;
class Issue2191 {
void whoot(Object obj) {
// Potential resource leak: '<unassigned Closeable value>' may not be closed
StreamEx.of(obj).toString();
} and package one.util.streamex;
import java.util.Spliterator;
import java.util.function.Function;
import java.util.stream.Stream;
public abstract class StreamEx<T> extends Base<T> {
public static <T> StreamEx<T> of(T element) {
return null;
}
}
abstract class Base<T> implements Stream<T> {
} If we make the case a tiny bit more interesting: package one.util.streamex;
import java.util.Spliterator;
import java.util.function.Function;
import java.util.stream.Stream;
public abstract class StreamEx<T> extends Base<T> {
public static <T> StreamEx<T> of(T element) {
return null;
}
public static <T> StreamEx<T> of(Spliterator<? extends T> spliterator) {
return null;
}
@Override
public <R> StreamEx<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) {
return null;
}
public StreamEx<T> append(Stream<? extends T> other) {
return null;
}
}
abstract class Base<T> implements Stream<T> {
} another warning pops up
The compiler settings I used: |
- public abstract class StreamEx<T> implements Stream<T> {
+ public abstract class StreamEx<T> extends AbstractStreamEx<T, StreamEx<T>> { Guess what: this innocent diff revealed a real blooper in our existing whitelist detection:
For source types the solution is simple: invoke the appropriate variant during For binary types and parameterized types I didn't (yet) change the wiring into |
Test failure is #2187 |
@stephan-herrmann I installed the Eclipse batch compiler for Java from this update site: https://download.eclipse.org/eclipse/updates/4.32-I-builds/I20240403-0940/plugins/ I still see the same errors for usages of StreamEx. Should that build contain the fix? |
Ah, it seems I've to install the Eclipse Java Development Tools instead. |
How can you use a plugins directory as an update site? For me that shows "No software site found at ..."
Did that help? |
@stephan-herrmann Yes, this helped. Note that I used the wrong link (plugins subdir), I tried installing the batch compiler alone from the update site, but had to choose the correct feature. My bad. Everything's gucci now. |
tests #2191