File: Issue1809.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; perl: 26
file content (40 lines) | stat: -rw-r--r-- 1,149 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * @test
 * @summary Test for Issue 1809: caching issue.
 *     https://github.com/typetools/checker-framework/issues/1809
 *     Also see framework/tests/all-systems/Issue1809.java
 *
 * @compile -XDrawDiagnostics -processor org.checkerframework.checker.nullness.NullnessChecker -AatfCacheSize=4 Issue1809.java
 * @compile -XDrawDiagnostics -processor org.checkerframework.checker.nullness.NullnessChecker -AatfDoNotCache Issue1809.java
 * @compile -XDrawDiagnostics -processor org.checkerframework.checker.nullness.NullnessChecker Issue1809.java
 */

import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

@SuppressWarnings("unchecked")
abstract class Issue1809 {

    abstract <T> Stream<T> concat(Stream<? extends T>... streams);

    abstract Optional<A> f();

    private static class A {}

    interface B {
        List<C> g();
    }

    interface C {
        List<S> h();
    }

    interface S {}

    private Stream<A> xrefsFor(B b) {
        return concat(b.g().stream().flatMap(a -> a.h().stream().map(c -> f())))
                .filter(Optional::isPresent)
                .map(Optional::get);
    }
}