JDK 28 javac:when 抛受检异常,27 编过却接不住
JDK-8390759:switch 的 when 守卫抛 IOException 时,JDK 27.0.1.0.3 能编过、try-catch 反而报 never thrown,运行时仍炸;28-ea+21-1707 要求 catch/throws,catch 能接到 boom。Spring Boot 4.1.2 + release 21 同结果。
在这个技术方向,积累扎实的知识与实践。
共 573 篇文章JDK-8390759:switch 的 when 守卫抛 IOException 时,JDK 27.0.1.0.3 能编过、try-catch 反而报 never thrown,运行时仍炸;28-ea+21-1707 要求 catch/throws,catch 能接到 boom。Spring Boot 4.1.2 + release 21 同结果。
JDK-8385925:standalone 三元/switch 混 raw 与参数化时,旧 javac 按操作数顺序可能放过;JDK 28 起两端都定成 raw。Spring Boot 4.1.2 实测 27.0.1.0.3 过、28-ea+21 报 Object cannot be converted to Integer。
JDK-8377561:Parallel GC 在 JDK 26 遇连续大对象分配时堆不扩,Spring Boot 4.1.2 实测 committed 卡在 23M、2000 次 Full GC;JDK 27.0.1.0.3 扩到 1370M、0 次 Full GC。
JDK 27 起 G1 将 MinHeapFreeRatio/MaxHeapFreeRatio 默认改为 0/100,Full GC 后不再按空闲比例缩堆。Spring Boot 4.1.2 实测:清掉约 350M 后 JDK 21.0.12.1 默认 committed 从 512M 回到 64M,JDK 27.0.1.0.3 默认仍 512M;显式恢复 40/70 又可缩回 64M。
业务用 IdentityHashMap 按身份缓存 LocalDate:JDK 28 EA 28-ea+21-1707 默认 size=2,开 --enable-preview 后 isValue=true、size=1 且后写入覆盖;同步与 WeakHashMap 抛 IdentityException;反射改 Integer.value 预览下 IllegalAccessException。Spring Boot 4.1.2。
升到 HttpClient 5.7-beta1 后 evictIdleConnections 弃用;只改 evictExpiredConnections 时,Tomcat Keep-Alive=timeout=60 盖住 RequestConfig,2.5 秒后 available 仍为 1。ConnectionConfig.timeToLive(1s) 再 closeExpired 可清到 0。Spring Boot 4.1.2 / Java 21.0.12.1。
JBS JDK-8394468(2026-10-26 仍 Unresolved)。(true ? null : "abc").length() 在 21.0.12.1、27.0.1.0.3、28-ea+21 均 AssertionError: Invalid pool entry(exit 4);对调或条件非常量可编译。10-25 已有 openjdk/jdk#33555(rfr)。Spring Boot 3.5.6 下 mvn compile 报 An unknown compilation problem occurred。
对照 27.0.1+9:cacerts 110→106,emsign 三张与 comodoaaaca 全部消失;tzdata 2026c→2026e,America/Winnipeg 在 2026-11-01 02:00 后不再回拨到 -06。
官方 JDK 28 EA Build 21(28-ea+21-1707)已含 JDK-8394607。同一套 ofInputStream 晚读复现:b21 读满 8000 字节,对照 28-ea+20-1588 仍 IOException: closed。
JDK-8394607:HttpClient HTTP/2 用 ofInputStream 晚读时丢掉已收齐的 body。JDK 21.0.12.1、27+35、28-ea+20 复现失败;ofByteArray 与立刻读流正常;主线 5c1c7c1(b21)已修,本地 bf83d326 构建读满 8000 字节。