Basics, failure semantics on 26 vs 27, lazy collections, API across 25/26/27, preview-flag traps and a JMH read-path benchmark (jars fetched and sha1-checked, not committed). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
119 lines
5.1 KiB
Plaintext
119 lines
5.1 KiB
Plaintext
$ javap java.lang.StableValue (25.0.4.1+1-LTS)
|
|
Compiled from "StableValue.java"
|
|
public interface java.lang.StableValue<T> {
|
|
public abstract boolean trySet(T);
|
|
public abstract T orElse(T);
|
|
public abstract T orElseThrow();
|
|
public abstract boolean isSet();
|
|
public abstract T orElseSet(java.util.function.Supplier<? extends T>);
|
|
public abstract void setOrThrow(T);
|
|
public abstract boolean equals(java.lang.Object);
|
|
public abstract int hashCode();
|
|
public static <T> java.lang.StableValue<T> of();
|
|
public static <T> java.lang.StableValue<T> of(T);
|
|
public static <T> java.util.function.Supplier<T> supplier(java.util.function.Supplier<? extends T>);
|
|
public static <R> java.util.function.IntFunction<R> intFunction(int, java.util.function.IntFunction<? extends R>);
|
|
public static <T, R> java.util.function.Function<T, R> function(java.util.Set<? extends T>, java.util.function.Function<? super T, ? extends R>);
|
|
public static <E> java.util.List<E> list(int, java.util.function.IntFunction<? extends E>);
|
|
public static <K, V> java.util.Map<K, V> map(java.util.Set<K>, java.util.function.Function<? super K, ? extends V>);
|
|
}
|
|
|
|
$ javap java.lang.LazyConstant (26.0.2.1+1)
|
|
Compiled from "LazyConstant.java"
|
|
public interface java.lang.LazyConstant<T> extends java.util.function.Supplier<T> {
|
|
public abstract T orElse(T);
|
|
public abstract T get();
|
|
public abstract boolean isInitialized();
|
|
public abstract boolean equals(java.lang.Object);
|
|
public abstract int hashCode();
|
|
public abstract java.lang.String toString();
|
|
public static <T> java.lang.LazyConstant<T> of(java.util.function.Supplier<? extends T>);
|
|
}
|
|
|
|
$ javap java.lang.LazyConstant (27+35)
|
|
Compiled from "LazyConstant.java"
|
|
public interface java.lang.LazyConstant<T> extends java.util.function.Supplier<T> {
|
|
public abstract T get();
|
|
public abstract boolean equals(java.lang.Object);
|
|
public abstract int hashCode();
|
|
public abstract java.lang.String toString();
|
|
public static <T> java.lang.LazyConstant<T> of(java.util.function.Supplier<? extends T>);
|
|
}
|
|
|
|
$ javap java.util.List | grep ofLazy (26.0.2.1+1)
|
|
public static <E> java.util.List<E> ofLazy(int, java.util.function.IntFunction<? extends E>);
|
|
$ javap java.util.Map | grep ofLazy (26.0.2.1+1)
|
|
public static <K, V> java.util.Map<K, V> ofLazy(java.util.Set<? extends K>, java.util.function.Function<? super K, ? extends V>);
|
|
$ javap java.util.Set | grep ofLazy (26.0.2.1+1)
|
|
|
|
$ javap java.util.List | grep ofLazy (27+35)
|
|
public static <E> java.util.List<E> ofLazy(int, java.util.function.IntFunction<? extends E>);
|
|
$ javap java.util.Map | grep ofLazy (27+35)
|
|
public static <K, V> java.util.Map<K, V> ofLazy(java.util.Set<? extends K>, java.util.function.Function<? super K, ? extends V>);
|
|
$ javap java.util.Set | grep ofLazy (27+35)
|
|
public static <E> java.util.Set<E> ofLazy(java.util.Set<? extends E>, java.util.function.Predicate<? super E>);
|
|
|
|
$ javac --enable-preview --release 25 src/StableValue25.java && java --enable-preview StableValue25 (25.0.4.1+1-LTS)
|
|
[load] configuration
|
|
CONFIG.get(): loaded
|
|
CONFIG.get(): loaded
|
|
[compute] orElseSet
|
|
lazy(): computed
|
|
lazy(): computed
|
|
[element] 2
|
|
LIST.get(2): v2
|
|
|
|
$ javac --enable-preview --release 26 broken/StillStable.java (26.0.2.1+1)
|
|
broken/StillStable.java:3: error: cannot find symbol
|
|
static final StableValue<String> CONFIG = StableValue.of();
|
|
^
|
|
symbol: class StableValue
|
|
location: class StillStable
|
|
broken/StillStable.java:3: error: cannot find symbol
|
|
static final StableValue<String> CONFIG = StableValue.of();
|
|
^
|
|
symbol: variable StableValue
|
|
location: class StillStable
|
|
2 errors
|
|
exit=1
|
|
|
|
$ javac --enable-preview --release 27 broken/StillStable.java (27+35)
|
|
broken/StillStable.java:3: error: cannot find symbol
|
|
static final StableValue<String> CONFIG = StableValue.of();
|
|
^
|
|
symbol: class StableValue
|
|
location: class StillStable
|
|
broken/StillStable.java:3: error: cannot find symbol
|
|
static final StableValue<String> CONFIG = StableValue.of();
|
|
^
|
|
symbol: variable StableValue
|
|
location: class StillStable
|
|
2 errors
|
|
exit=1
|
|
|
|
$ javac --enable-preview --release 26 broken/RemovedApi.java (26.0.2.1+1)
|
|
exit=0
|
|
|
|
$ javac --enable-preview --release 27 broken/RemovedApi.java (27+35)
|
|
broken/RemovedApi.java:4: error: cannot find symbol
|
|
System.out.println(c.isInitialized()); // exists on JDK 26, removed in 27
|
|
^
|
|
symbol: method isInitialized()
|
|
location: variable c of type LazyConstant<String>
|
|
broken/RemovedApi.java:5: error: cannot find symbol
|
|
System.out.println(c.orElse("fallback")); // exists on JDK 26, removed in 27
|
|
^
|
|
symbol: method orElse(String)
|
|
location: variable c of type LazyConstant<String>
|
|
2 errors
|
|
exit=1
|
|
|
|
$ javac --enable-preview --release 27 broken/ReassignInSupplier.java (27+35)
|
|
broken/ReassignInSupplier.java:5: error: cannot find symbol
|
|
c.set("y");
|
|
^
|
|
symbol: method set(String)
|
|
location: variable c of type LazyConstant<String>
|
|
1 error
|
|
exit=1
|