{"id":10008294,"date":"2023-09-20T20:35:35","date_gmt":"2023-09-20T12:35:35","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008294"},"modified":"2023-09-20T20:35:35","modified_gmt":"2023-09-20T12:35:35","slug":"java21%e7%9a%84%e6%96%b0%e7%89%b9%e6%80%a7","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008294","title":{"rendered":"Java21\u7684\u65b0\u7279\u6027"},"content":{"rendered":"<blockquote><p>Java\u8bed\u8a00\u7279\u6027\u7cfb\u5217<\/p><\/blockquote>\n<ul>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000004417288\" rel=\"noopener noreferrer\">Java5\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000004417536\" rel=\"noopener noreferrer\">Java6\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000004417830\" rel=\"noopener noreferrer\">Java7\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000004419611\" rel=\"noopener noreferrer\">Java8\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000013620826\" rel=\"noopener noreferrer\">Java9\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000014076481\" rel=\"noopener noreferrer\">Java10\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000016527932\" rel=\"noopener noreferrer\">Java11\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000018588495\" rel=\"noopener noreferrer\">Java12\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000020426123\" rel=\"noopener noreferrer\">Java13\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000022064656\" rel=\"noopener noreferrer\">Java14\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000024485709\" rel=\"noopener noreferrer\">Java15\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000039660464\" rel=\"noopener noreferrer\">Java16\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000040691717\" rel=\"noopener noreferrer\">Java17\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000041598372\" rel=\"noopener noreferrer\">Java18\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000042529334\" rel=\"noopener noreferrer\">Java19\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000043584234\" rel=\"noopener noreferrer\">Java20\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/1190000044238496\" rel=\"noopener noreferrer\">Java21\u7684\u65b0\u7279\u6027<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/957c4dbee25aabd6659b58d874ff77bd17\" rel=\"noopener noreferrer\">Java22\u7684\u65b0\u7279\u6027<\/a><\/li>\n<\/ul>\n<h2>\u5e8f<\/h2>\n<p>\u672c\u6587\u4e3b\u8981\u8bb2\u8ff0\u4e00\u4e0bJava21\u7684\u65b0\u7279\u6027<\/p>\n<h2>\u7248\u672c\u53f7<\/h2>\n<pre><code>java -version\nopenjdk version &quot;21&quot; 2023-09-19\nOpenJDK Runtime Environment (build 21+35-2513)\nOpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)<\/code><\/pre>\n<blockquote><p>\u4eceversion\u4fe1\u606f\u53ef\u4ee5\u770b\u51fa\u662fbuild 21+35<\/p><\/blockquote>\n<h2>\u7279\u6027\u5217\u8868<\/h2>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=aylAxrsKho2KmpHDM1ze2g%3D%3D.%2B%2Bdqo9uVOTjcGoKq6uFjn78iK6ntzKSASx5LbA6k0a0%3D\" rel=\"noopener noreferrer\">JEP 430: String Templates (Preview)<\/a><\/h3>\n<p>\u5728java21\u4e4b\u524d\uff0c\u5b57\u7b26\u4e32\u62fc\u63a5\u6216\u8005\u5b57\u7b26\u4e32\u4e0e\u8868\u8fbe\u5f0f\u7ec4\u5408\u4e3b\u8981\u662f\u7528StringBuilder\u3001String::format\u3001java.text.MessageFormat\uff0c\u4e0d\u8fc7\u53ef\u8bfb\u6027\u90fd\u4e0d\u662f\u592a\u597d\uff0cjava21\u5f15\u5165\u4e86StringTemplate(<code>java.lang.StringTemplate<\/code>)\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<pre><code>@PreviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES)\npublic interface StringTemplate {\n    List&lt;String&gt; fragments();\n    List&lt;Object&gt; values();\n    default String interpolate() {\n        return StringTemplate.interpolate(fragments(), values());\n    }\n    default &lt;R, E extends Throwable&gt; R\n    process(Processor&lt;? extends R, ? extends E&gt; processor) throws E {\n        Objects.requireNonNull(processor, &quot;processor should not be null&quot;);\n\n        return processor.process(this);\n    }\n\n    static String interpolate(List&lt;String&gt; fragments, List&lt;?&gt; values) {\n        Objects.requireNonNull(fragments, &quot;fragments must not be null&quot;);\n        Objects.requireNonNull(values, &quot;values must not be null&quot;);\n        int fragmentsSize = fragments.size();\n        int valuesSize = values.size();\n        if (fragmentsSize != valuesSize + 1) {\n            throw new IllegalArgumentException(&quot;fragments must have one more element than values&quot;);\n        }\n        JavaTemplateAccess JTA = SharedSecrets.getJavaTemplateAccess();\n        return JTA.interpolate(fragments, values);\n    }\n\n    Processor&lt;String, RuntimeException&gt; STR = StringTemplate::interpolate;\n    Processor&lt;StringTemplate, RuntimeException&gt; RAW = st -&gt; st;\n\n    @PreviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES)\n    @FunctionalInterface\n    public interface Processor&lt;R, E extends Throwable&gt; {\n        R process(StringTemplate stringTemplate) throws E;\n        static &lt;T&gt; Processor&lt;T, RuntimeException&gt; of(Function&lt;? super StringTemplate, ? extends T&gt; process) {\n            return process::apply;\n        }\n\n        @PreviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES)\n        public sealed interface Linkage permits FormatProcessor {\n            MethodHandle linkage(List&lt;String&gt; fragments, MethodType type);\n        }\n    }\n}<\/code><\/pre>\n<blockquote>\n<p>StringTemplate\u662f\u4e2a\u63a5\u53e3\uff0c\u5b83\u5b9a\u4e49\u4e86fragments\u3001values\u3001interpolate\u3001process\u65b9\u6cd5\uff0c\u540c\u65f6\u63d0\u4f9b\u4e86interpolate\u3001process\u65b9\u6cd5\u7684\u9ed8\u8ba4\u5b9e\u73b0\uff1b\u540c\u65f6\u5185\u7f6e\u4e86\u4e24\u4e2aprocessor\uff0c\u5206\u522b\u662fSTR\u548cRAW\uff0c\u4ed6\u4eec\u7684\u533a\u522b\u5728\u4e8eRAW\u53ef\u4ee5\u83b7\u53d6\u5230StringTemplate\u7c7b\u578b\uff0cSTR\u5219\u662fStringTemplate\u6267\u884c\u4e86interpolate\u65b9\u6cd5\u4e4b\u540e\u7684\u7ed3\u679c\uff0c\u83b7\u5f97\u5230\u7684\u662f\u6700\u7ec8\u7ed3\u679cString\uff1b\u5176\u57fa\u672c\u8bed\u6cd5\u5c31\u662f\u7528<code>\/{}<\/code>\u6765\u5305\u542b\u53d8\u91cf\u6216\u8005\u8868\u8fbe\u5f0f<\/p>\n<p>RAW\u793a\u4f8b<\/p>\n<\/blockquote>\n<pre><code>    @Test\n    public void testRaw() {\n        int x = 10;\n        int y = 20;\n        StringTemplate st = RAW.&quot;\/{x} + \/{y} = \/{x + y}&quot;;\n        List&lt;String&gt; fragments = st.fragments();\n        List&lt;Object&gt; values = st.values();\n        log.info(&quot;fragments:{}, values:{}, st:{}&quot;, fragments, values, st.interpolate());\n    }<\/code><\/pre>\n<blockquote><p>\u8f93\u51fafragments:[,  + ,  = , ], values:[10, 20, 30], st:10 + 20 = 30<\/p><\/blockquote>\n<blockquote><p>STR\u793a\u4f8b<\/p><\/blockquote>\n<pre><code>    @Test\n    public void testStr() {\n        String name = &quot;Joan&quot;;\n        String info = STR.&quot;My name is \/{name}&quot;;\n        System.out.println(info);\n    }<\/code><\/pre>\n<blockquote>\n<p>\u8f93\u51faMy name is Joan<\/p>\n<p>\u4e5f\u652f\u6301\u65b9\u6cd5\u8c03\u7528\u548c\u8868\u8fbe\u5f0f<\/p>\n<\/blockquote>\n<pre><code>    @Test\n    public void testStrExpression() {\n        String filePath = &quot;tmp.dat&quot;;\n        File file = new File(filePath);\n        String msg = STR. &quot;The file \/{ filePath } \/{ file.exists() ? &quot;does&quot; : &quot;does not&quot; } exist&quot; ;\n        System.out.println(msg);\n    }<\/code><\/pre>\n<blockquote><p>\u6700\u540e\u8f93\u51faThe file tmp.dat does not exist<\/p><\/blockquote>\n<p>\u5bf9\u4e8e\u8fd8\u6709\u683c\u5f0f\u5316\u9700\u6c42\u7684\uff0c\u63d0\u4f9b\u4e86java.util.FMT<\/p>\n<pre><code>    @Test\n    public void testFmt() {\n        record Rectangle(String name, double width, double height) {\n            double area() {\n                return width * height;\n            }\n        }\n        Rectangle[] zone = new Rectangle[] {\n                new Rectangle(&quot;Alfa&quot;, 17.8, 31.4),\n                new Rectangle(&quot;Bravo&quot;, 9.6, 12.4),\n                new Rectangle(&quot;Charlie&quot;, 7.1, 11.23),\n        };\n        String table = FMT.&quot;&quot;&quot;\n    Description     Width    Height     Area\n    %-12s\/{zone[0].name}  %7.2f\/{zone[0].width}  %7.2f\/{zone[0].height}     %7.2f\/{zone[0].area()}\n    %-12s\/{zone[1].name}  %7.2f\/{zone[1].width}  %7.2f\/{zone[1].height}     %7.2f\/{zone[1].area()}\n    %-12s\/{zone[2].name}  %7.2f\/{zone[2].width}  %7.2f\/{zone[2].height}     %7.2f\/{zone[2].area()}\n    \/{&quot; &quot;.repeat(28)} Total %7.2f\/{zone[0].area() + zone[1].area() + zone[2].area()}\n    &quot;&quot;&quot;;\n        System.out.println(table);\n    }<\/code><\/pre>\n<p>\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49processor<\/p>\n<pre><code>@Test\n    public void testCustomProcessor() {\n        var MYJSON = StringTemplate.Processor.of(\n                (StringTemplate st) -&gt; com.alibaba.fastjson.JSON.parseObject(st.interpolate())\n        );\n\n        String name    = &quot;Joan Smith&quot;;\n        String phone   = &quot;555-123-4567&quot;;\n        String address = &quot;1 Maple Drive, Anytown&quot;;\n        JSONObject doc = MYJSON.&quot;&quot;&quot;\n    {\n        &quot;name&quot;:    &quot;\/{name}&quot;,\n        &quot;phone&quot;:   &quot;\/{phone}&quot;,\n        &quot;address&quot;: &quot;\/{address}&quot;\n    }\n    &quot;&quot;&quot;;\n        System.out.println(doc);\n    }<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=aucyiDfWDzeeU5%2B2ZrPw0Q%3D%3D.I7Fv2FlQB%2FGyhMqGLBK2FtUH4SZCM9q6b8LrYjSR3cA%3D\" rel=\"noopener noreferrer\">JEP 431: Sequenced Collections<\/a><\/h3>\n<p>java21\u5f15\u5165\u4e86java.util.SequencedCollection\u3001java.util.SequencedMap\u6765\u7edf\u4e00\u5404\u7c7b\u96c6\u5408\u7684\u987a\u5e8f\u65b9\u6cd5\u65b9\u6cd5<\/p>\n<pre><code>public interface SequencedCollection&lt;E&gt; extends Collection&lt;E&gt; {\n    SequencedCollection&lt;E&gt; reversed();\n    default void addFirst(E e) {\n        throw new UnsupportedOperationException();\n    }\n    default void addLast(E e) {\n        throw new UnsupportedOperationException();\n    }\n    default E getFirst() {\n        return this.iterator().next();\n    }\n    default E getLast() {\n        return this.reversed().iterator().next();\n    }\n    default E removeFirst() {\n        var it = this.iterator();\n        E e = it.next();\n        it.remove();\n        return e;\n    }\n    default E removeLast() {\n        var it = this.reversed().iterator();\n        E e = it.next();\n        it.remove();\n        return e;\n    }\n}<\/code><\/pre>\n<blockquote><p>SequencedCollection\u7ee7\u627f\u4e86Collection\u63a5\u53e3\uff0c\u540c\u65f6\u5b9a\u4e49\u4e86reversed\uff0c\u63d0\u4f9b\u4e86addFirst\u3001addLast\u3001getFirst\u3001getLast\u3001removeFirst\u3001removeLast\u7684default\u5b9e\u73b0\uff1bList\u3001SequencedSet\u63a5\u53e3\u90fd\u7ee7\u627f\u4e86SequencedCollection\u63a5\u53e3<\/p><\/blockquote>\n<pre><code>public interface SequencedMap&lt;K, V&gt; extends Map&lt;K, V&gt; {\n    SequencedMap&lt;K, V&gt; reversed();\n    default Map.Entry&lt;K,V&gt; firstEntry() {\n        var it = entrySet().iterator();\n        return it.hasNext() ? new NullableKeyValueHolder&lt;&gt;(it.next()) : null;\n    }\n    default Map.Entry&lt;K,V&gt; lastEntry() {\n        var it = reversed().entrySet().iterator();\n        return it.hasNext() ? new NullableKeyValueHolder&lt;&gt;(it.next()) : null;\n    }\n    default Map.Entry&lt;K,V&gt; pollFirstEntry() {\n        var it = entrySet().iterator();\n        if (it.hasNext()) {\n            var entry = new NullableKeyValueHolder&lt;&gt;(it.next());\n            it.remove();\n            return entry;\n        } else {\n            return null;\n        }\n    }\n    default Map.Entry&lt;K,V&gt; pollLastEntry() {\n        var it = reversed().entrySet().iterator();\n        if (it.hasNext()) {\n            var entry = new NullableKeyValueHolder&lt;&gt;(it.next());\n            it.remove();\n            return entry;\n        } else {\n            return null;\n        }\n    }\n    default V putFirst(K k, V v) {\n        throw new UnsupportedOperationException();\n    }\n    default V putLast(K k, V v) {\n        throw new UnsupportedOperationException();\n    }\n    default SequencedSet&lt;K&gt; sequencedKeySet() {\n        class SeqKeySet extends AbstractMap.ViewCollection&lt;K&gt; implements SequencedSet&lt;K&gt; {\n            Collection&lt;K&gt; view() {\n                return SequencedMap.this.keySet();\n            }\n            public SequencedSet&lt;K&gt; reversed() {\n                return SequencedMap.this.reversed().sequencedKeySet();\n            }\n            public boolean equals(Object other) {\n                return view().equals(other);\n            }\n            public int hashCode() {\n                return view().hashCode();\n            }\n        }\n        return new SeqKeySet();\n    }\n    default SequencedCollection&lt;V&gt; sequencedValues() {\n        class SeqValues extends AbstractMap.ViewCollection&lt;V&gt; implements SequencedCollection&lt;V&gt; {\n            Collection&lt;V&gt; view() {\n                return SequencedMap.this.values();\n            }\n            public SequencedCollection&lt;V&gt; reversed() {\n                return SequencedMap.this.reversed().sequencedValues();\n            }\n        }\n        return new SeqValues();\n    }\n    default SequencedSet&lt;Map.Entry&lt;K, V&gt;&gt; sequencedEntrySet() {\n        class SeqEntrySet extends AbstractMap.ViewCollection&lt;Map.Entry&lt;K, V&gt;&gt;\n                implements SequencedSet&lt;Map.Entry&lt;K, V&gt;&gt; {\n            Collection&lt;Map.Entry&lt;K, V&gt;&gt; view() {\n                return SequencedMap.this.entrySet();\n            }\n            public SequencedSet&lt;Map.Entry&lt;K, V&gt;&gt; reversed() {\n                return SequencedMap.this.reversed().sequencedEntrySet();\n            }\n            public boolean equals(Object other) {\n                return view().equals(other);\n            }\n            public int hashCode() {\n                return view().hashCode();\n            }\n        }\n        return new SeqEntrySet();\n    }              \n}<\/code><\/pre>\n<blockquote><p>SequencedMap\u63a5\u53e3\u7ee7\u627f\u4e86Map\u63a5\u53e3\uff0c\u5b83\u5b9a\u4e49\u4e86reversed\u65b9\u6cd5\uff0c\u540c\u65f6\u63d0\u4f9b\u4e86firstEntry\u3001lastEntry\u3001pollFirstEntry\u3001pollLastEntry\u3001putFirst\u3001putLast\u3001sequencedKeySet\u3001sequencedValues\u3001sequencedEntrySet\u65b9\u6cd5\u7684\u9ed8\u8ba4\u5b9e\u73b0<\/p><\/blockquote>\n<p>\u6b64\u6b21\u7248\u672c\u7684\u53d8\u52a8\uff1a<br \/><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044238508\" alt=\"SequencedCollection\" title=\"SequencedCollection\"><\/p>\n<ul>\n<li>List\u73b0\u5728\u6709\u4f5c\u4e3a\u5176\u76f4\u63a5\u7684\u8d85\u7ea7\u63a5\u53e3\uff0cSequencedCollection<\/li>\n<li>Deque\u73b0\u5728\u6709\u4f5c\u4e3a\u5176\u76f4\u63a5\u7684\u8d85\u7ea7\u63a5\u53e3\uff0cSequencedCollection<\/li>\n<li>LinkedHashSet\u53e6\u5916\u5b9e\u73b0SequencedSet\u63a5\u53e3<\/li>\n<li>SortedSet\u73b0\u5728\u6709\u4f5c\u4e3a\u5176\u76f4\u63a5\u7684\u8d85\u7ea7\u63a5\u53e3\uff0cSequencedSet<\/li>\n<li>LinkedHashMap\u53e6\u5916\u5b9e\u73b0SequencedMap\u63a5\u53e3<\/li>\n<li>SortedMap\u73b0\u5728\u6709\u4f5c\u4e3a\u5b83\u7684\u76f4\u63a5\u8d85\u7ea7\u63a5\u53e3\uff0cSequencedMap<\/li>\n<\/ul>\n<p>\u53e6\u5916Collections\u8fd8\u63d0\u4f9b\u4e86\u5de5\u5382\u65b9\u6cd5\u7528\u4e8e\u8fd4\u56de\u4e0d\u53ef\u53d8\u7c7b\u578b<\/p>\n<pre><code>Collections.unmodifiableSequencedCollection(sequencedCollection)\nCollections.unmodifiableSequencedSet(sequencedSet)\nCollections.unmodifiableSequencedMap(sequencedMap)<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=MJR6Ij69GXDnCmLkZI7SCQ%3D%3D.9caNold%2FHmDaRoVVooUPAksOtbf8OGIgYvNmRWIkD0M%3D\" rel=\"noopener noreferrer\">JEP 439: Generational ZGC<\/a><\/h3>\n<p>ZGC\u5206\u4ee3\u56de\u6536\u65e0\u7591\u662f\u4e00\u4e2a\u91cd\u78c5\u7684GC\u7279\u6027\uff0cZGC\u4e4b\u524d\u7684\u7248\u672c\u4e0d\u652f\u6301\u5206\u4ee3\u56de\u6536\uff0c\u6b64\u6b21\u652f\u6301\u5206\u4ee3\u56de\u6536\u7684\u8bdd\uff0c\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5bf9\u5e74\u8f7b\u4ee3\u8fdb\u884c\u6536\u96c6\uff0c\u63d0\u9ad8GC\u6027\u80fd\u3002\u76ee\u524d\u662f\u5206\u4ee3\u4e0e\u975e\u5206\u4ee3\u90fd\u652f\u6301\uff0c\u4f7f\u7528\u5206\u4ee3\u5219\u901a\u8fc7<code>-XX:+UseZGC-XX:+ZGenerational<\/code>\u5f00\u542f\uff0c\u540e\u7eed\u7248\u672c\u5c06\u4f1a\u628a\u5206\u4ee3\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u7684\uff0c\u800c<code>-XX:-ZGenerational<\/code>\u7528\u4e8e\u5f00\u542f\u975e\u5206\u4ee3\uff0c\u6700\u540e\u5c06\u4f1a\u5e9f\u9664\u975e\u5206\u4ee3\u7684\u652f\u6301\uff0c\u5c4a\u65f6ZGenerational\u53c2\u6570\u4e5f\u5c31\u6ca1\u6709\u4f5c\u7528\u4e86\u3002<\/p>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=flKhJXvaxO30dblKJghwqQ%3D%3D.igCgdAY0sWEpMej4KjZvTD%2Be2JqDHSjJbqK0w%2FtE9JQ%3D\" rel=\"noopener noreferrer\">JEP 440: Record Patterns<\/a><\/h3>\n<blockquote><p>JDK19\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=cSkYi5%2FMtMQQBVX%2B6cXZ8A%3D%3D.KjD1kksKZk5h%2B6jbrJHxn9cvZHYcckkeS2OuecGo2a0%3D\" rel=\"noopener noreferrer\">JEP 405: Record Patterns (Preview)<\/a>\u5c06Record\u7684\u6a21\u5f0f\u5339\u914d\u4f5c\u4e3a\u7b2c\u4e00\u6b21preview<br \/>JDK20\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=dNoZ2%2FHnVcBToTsdaKPiVg%3D%3D.v7BstLjbIaW%2F750tDYPBeW3iDxCKBs7k1ePWUNm1LC8%3D\" rel=\"noopener noreferrer\">JEP 432: Record Patterns (Second Preview)<\/a>\u4f5c\u4e3a\u7b2c\u4e8c\u6b21preview<br \/>\u6b64\u6b21\u5728JDK21\u5219\u4f5c\u4e3a\u6b63\u5f0f\u7248\u672c\u53d1\u5e03\uff0c\u4f7f\u7528\u793a\u4f8b\u5982\u4e0b<\/p><\/blockquote>\n<pre><code>record Point(int x, int y) {}\n\n\/\/ As of Java 21\nstatic void printSum(Object obj) {\n    if (obj instanceof Point(int x, int y)) {\n        System.out.println(x+y);\n    }\n}\n\nenum Color { RED, GREEN, BLUE }\nrecord ColoredPoint(Point p, Color c) {}\nrecord Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}\n\/\/ As of Java 21\nstatic void printUpperLeftColoredPoint(Rectangle r) {\n    if (r instanceof Rectangle(ColoredPoint ul, ColoredPoint lr)) {\n         System.out.println(ul.c());\n    }\n}\n\nstatic void printColorOfUpperLeftPoint(Rectangle r) {\n    if (r instanceof Rectangle(ColoredPoint(Point p, Color c),\n                               ColoredPoint lr)) {\n        System.out.println(c);\n    }\n}<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Kti8o6Dna7rSP2a5DPApkQ%3D%3D.RvlA0FQYXX1Xwdwhu%2F2hz7Z6KP0h9Mexdt0UaEFyCt0%3D\" rel=\"noopener noreferrer\">JEP 441: Pattern Matching for switch<\/a><\/h3>\n<blockquote><p>\u5728JDK14<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=y9UW%2BE8yhDnP1A%2B2pIKEMQ%3D%3D.1nTeXsNYx912trKQu1L1TnaYeOnXnXZoPR7q%2BWFdQFo%3D\" rel=\"noopener noreferrer\">JEP 305: Pattern Matching for instanceof (Preview)<\/a>\u4f5c\u4e3apreview<br \/>\u5728JDK15<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=dhxdKa1hOsmj9NapMxRpxg%3D%3D.c5W9STM6mnAXFFDWztrLh03TCnHVacrrzYzK0WxYhQw%3D\" rel=\"noopener noreferrer\">JEP 375: Pattern Matching for instanceof (Second Preview)<\/a>\u4f5c\u4e3a\u7b2c\u4e8c\u8f6e\u7684preview<br \/>\u5728JDK16<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=EXNMRCAF5zc8yAevVuussQ%3D%3D.SW2LcM4R5AcxV%2FrRZ7ucrmMisIWN7zR55oUUgvt2tBk%3D\" rel=\"noopener noreferrer\">JEP 394: Pattern Matching for instanceof<\/a>\u8f6c\u6b63<br \/>JDK17\u5f15\u5165<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=N%2Bm08GZEutXHbbYnkA9xqA%3D%3D.oV8F0dMbxNqt%2FW8Eu%2FIDPnrFqXz4sR45HkvaXzkqhj%2BjCBzgjIekhk8oN124dsOO\" rel=\"noopener noreferrer\">JEP 406: Pattern Matching for switch (Preview)<\/a><br \/>JDK18\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Uy%2FNlE3qRuXKEd%2Fn%2F9rCow%3D%3D.B7sb7oBlil72XF9kgqauKPMPaVn%2FgCmkyqvUC%2F37de0%3D\" rel=\"noopener noreferrer\">JEP 420: Pattern Matching for switch (Second Preview)<\/a>\u5219\u4f5c\u4e3a\u7b2c\u4e8c\u8f6epreview<br \/>JDK19\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=AotW%2FtMaVYb1CBd3aIIE5Q%3D%3D.DZs6ED19IVMz7txUaypuCveiwJdnpoqVkPiZGjN6G9Y%3D\" rel=\"noopener noreferrer\">JEP 427: Pattern Matching for switch (Third Preview)<\/a>\u4f5c\u4e3a\u7b2c\u4e09\u8f6epreview<br \/>JDK20\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Ud44eJ0ZUaD6YF37NdeF6g%3D%3D.hqsyO8vaWhF1XdYx0hZiUa537t0N7KVSa5YVI%2FoYHq8%3D\" rel=\"noopener noreferrer\">JEP 433: Pattern Matching for switch (Fourth Preview)<\/a>\u4f5c\u4e3a\u7b2c\u56db\u8f6epreview<br \/>\u800c\u6b64\u6b21JDK21\u5c06Pattern Matching for switch\u4f5c\u4e3a\u6b63\u5f0f\u7248\u672c\u53d1\u5e03\uff0c\u793a\u4f8b\u5982\u4e0b<\/p><\/blockquote>\n<pre><code>\/\/ Prior to Java 21\nstatic String formatter(Object obj) {\n    String formatted = &quot;unknown&quot;;\n    if (obj instanceof Integer i) {\n        formatted = String.format(&quot;int %d&quot;, i);\n    } else if (obj instanceof Long l) {\n        formatted = String.format(&quot;long %d&quot;, l);\n    } else if (obj instanceof Double d) {\n        formatted = String.format(&quot;double %f&quot;, d);\n    } else if (obj instanceof String s) {\n        formatted = String.format(&quot;String %s&quot;, s);\n    }\n    return formatted;\n}\n\n\/\/ As of Java 21\nstatic String formatterPatternSwitch(Object obj) {\n    return switch (obj) {\n        case Integer i -&gt; String.format(&quot;int %d&quot;, i);\n        case Long l    -&gt; String.format(&quot;long %d&quot;, l);\n        case Double d  -&gt; String.format(&quot;double %f&quot;, d);\n        case String s  -&gt; String.format(&quot;String %s&quot;, s);\n        default        -&gt; obj.toString();\n    };\n}\n\n\/\/ As of Java 21\nstatic void testFooBarNew(String s) {\n    switch (s) {\n        case null         -&gt; System.out.println(&quot;Oops&quot;);\n        case &quot;Foo&quot;, &quot;Bar&quot; -&gt; System.out.println(&quot;Great&quot;);\n        default           -&gt; System.out.println(&quot;Ok&quot;);\n    }\n}\n\n\/\/ As of Java 21\nstatic void testStringEnhanced(String response) {\n    switch (response) {\n        case null -&gt; { }\n        case &quot;y&quot;, &quot;Y&quot; -&gt; {\n            System.out.println(&quot;You got it&quot;);\n        }\n        case &quot;n&quot;, &quot;N&quot; -&gt; {\n            System.out.println(&quot;Shame&quot;);\n        }\n        case String s\n        when s.equalsIgnoreCase(&quot;YES&quot;) -&gt; {\n            System.out.println(&quot;You got it&quot;);\n        }\n        case String s\n        when s.equalsIgnoreCase(&quot;NO&quot;) -&gt; {\n            System.out.println(&quot;Shame&quot;);\n        }\n        case String s -&gt; {\n            System.out.println(&quot;Sorry?&quot;);\n        }\n    }\n}\n\n\/\/ As of Java 21\nstatic void exhaustiveSwitchWithBetterEnumSupport(CardClassification c) {\n    switch (c) {\n        case Suit.CLUBS -&gt; {\n            System.out.println(&quot;It's clubs&quot;);\n        }\n        case Suit.DIAMONDS -&gt; {\n            System.out.println(&quot;It's diamonds&quot;);\n        }\n        case Suit.HEARTS -&gt; {\n            System.out.println(&quot;It's hearts&quot;);\n        }\n        case Suit.SPADES -&gt; {\n            System.out.println(&quot;It's spades&quot;);\n        }\n        case Tarot t -&gt; {\n            System.out.println(&quot;It's a tarot&quot;);\n        }\n    }\n}\n\n\/\/ As of Java 21\nsealed interface Currency permits Coin {}\nenum Coin implements Currency { HEADS, TAILS } \n\nstatic void goodEnumSwitch1(Currency c) {\n    switch (c) {\n        case Coin.HEADS -&gt; {    \/\/ Qualified name of enum constant as a label\n            System.out.println(&quot;Heads&quot;);\n        }\n        case Coin.TAILS -&gt; {\n            System.out.println(&quot;Tails&quot;);\n        }\n    }\n}\n\nstatic void goodEnumSwitch2(Coin c) {\n    switch (c) {\n        case HEADS -&gt; {\n            System.out.println(&quot;Heads&quot;);\n        }\n        case Coin.TAILS -&gt; {    \/\/ Unnecessary qualification but allowed\n            System.out.println(&quot;Tails&quot;);\n        }\n    }\n}\n\n\/\/ As of Java 21\nstatic void testNew(Object obj) {\n    switch (obj) {\n        case String s when s.length() == 1 -&gt; ...\n        case String s                      -&gt; ...\n        ...\n    }\n}<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=dywytc5hisjECVSxc9vsjw%3D%3D.ep%2BWvCrivBAgJOlQigGJr%2Fy8jYngjrtCafs2Ddo9GhM%3D\" rel=\"noopener noreferrer\">JEP 442: Foreign Function &#038; Memory API (Third Preview)<\/a><\/h3>\n<blockquote><p>Foreign Function &#038; Memory (FFM) API\u5305\u542b\u4e86\u4e24\u4e2aincubating API<br \/>JDK14\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=KAwiIHiesZCeBm1c3lL3sg%3D%3D.RVbOPY846wyQayd%2FQH%2FDl8gq5GtBNM6ggK%2BhGp6p%2FjJRv12A2cool5FsfUfYcGTA\" rel=\"noopener noreferrer\">JEP 370: Foreign-Memory Access API (Incubator)<\/a>\u5f15\u5165\u4e86Foreign-Memory Access API\u4f5c\u4e3aincubator<br \/>JDK15\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=cf1HrA3kfP%2FgRl3LUjHBcA%3D%3D.foOqn%2F%2B2lAmJ0C484iuvUDH29j1h39n2deRqFtA%2BkKPTNcicDLBWlYgHjYmX5dEP\" rel=\"noopener noreferrer\">JEP 383: Foreign-Memory Access API (Second Incubator)<\/a>Foreign-Memory Access API\u4f5c\u4e3a\u7b2c\u4e8c\u8f6eincubator<br \/>JDK16\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=3gAJSobkDf7XoJMZdjxXdw%3D%3D.%2BjbphdRF2rC2I5xawgsMgrkFDmt5PaAoCHQdBP1yNQmfUbI5K972kgt5%2FoOEUse3\" rel=\"noopener noreferrer\">JEP 393: Foreign-Memory Access API (Third Incubator)<\/a>\u4f5c\u4e3a\u7b2c\u4e09\u8f6e\uff0c\u5b83\u5f15\u5165\u4e86Foreign Linker API (JEP <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=v3qFzOg5COgZmNGP6n0gng%3D%3D.XpYuQ2nbF2CRNgUkbttqouLLVfoyQW66zSf%2BJgK7f%2FWp%2BSkREx6v2rc4nOkwee67\" rel=\"noopener noreferrer\">389<\/a>)<br \/>FFM API\u5728JDK 17\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=3FsBSz9vLmpJI0k8%2FCc84Q%3D%3D.FuqkOw2jmxhTozpAzAE9pOI1V3OKHHn7A2XDi4UK8s8%3D\" rel=\"noopener noreferrer\">JEP 412: Foreign Function &#038; Memory API (Incubator)<\/a>\u4f5c\u4e3aincubator\u5f15\u5165<br \/>FFM API\u5728JDK 18\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=y9v7pe0ryF45e5CFGTf2Lw%3D%3D.9x5VVFzd5zZ%2Bo6bDHKavUQzCGRty9iglGc7Rlz9GmCg%3D\" rel=\"noopener noreferrer\">JEP 419: Foreign Function &#038; Memory API (Second Incubator)<\/a>\u4f5c\u4e3a\u7b2c\u4e8c\u8f6eincubator<br \/>JDK19\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=cZeNQXg1PvepfR2tVzkl0A%3D%3D.c72pWA%2BeSgUmlDkbj5eVgb%2FDR2kc4AAqHgW%2Bwz4op34%3D\" rel=\"noopener noreferrer\">JEP 424: Foreign Function &#038; Memory API (Preview)<\/a>\u5219\u5c06FFM API\u4f5c\u4e3apreview API<br \/>JDK20\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=HZ4YSCuttd3tM5HhKGPlSg%3D%3D.MgHlW8mY0n9iF2KhrB8XTqRUuFuBMrpohKiCeqZCXPs%3D\" rel=\"noopener noreferrer\">JEP 434: Foreign Function &#038; Memory API (Second Preview)<\/a>\u4f5c\u4e3a\u7b2c\u4e8c\u8f6epreview<br \/>JDK21\u5219\u4f5c\u4e3a\u7b2c\u4e09\u8f6e\u7684preview\uff0c\u4f7f\u7528\u793a\u4f8b<\/p><\/blockquote>\n<pre><code>.javac --release 21 --enable-preview ...java --enable-preview ...\n\n\/\/ 1. Find foreign function on the C library path\nLinker linker          = Linker.nativeLinker();\nSymbolLookup stdlib    = linker.defaultLookup();\nMethodHandle radixsort = linker.downcallHandle(stdlib.find(&quot;radixsort&quot;), ...);\n\/\/ 2. Allocate on-heap memory to store four strings\nString[] javaStrings = { &quot;mouse&quot;, &quot;cat&quot;, &quot;dog&quot;, &quot;car&quot; };\n\/\/ 3. Use try-with-resources to manage the lifetime of off-heap memory\ntry (Arena offHeap = Arena.ofConfined()) {\n    \/\/ 4. Allocate a region of off-heap memory to store four pointers\n    MemorySegment pointers\n        = offHeap.allocateArray(ValueLayout.ADDRESS, javaStrings.length);\n    \/\/ 5. Copy the strings from on-heap to off-heap\n    for (int i = 0; i &lt; javaStrings.length; i++) {\n        MemorySegment cString = offHeap.allocateUtf8String(javaStrings[i]);\n        pointers.setAtIndex(ValueLayout.ADDRESS, i, cString);\n    }\n    \/\/ 6. Sort the off-heap data by calling the foreign function\n    radixsort.invoke(pointers, javaStrings.length, MemorySegment.NULL, '\/0');\n    \/\/ 7. Copy the (reordered) strings from off-heap to on-heap\n    for (int i = 0; i &lt; javaStrings.length; i++) {\n        MemorySegment cString = pointers.getAtIndex(ValueLayout.ADDRESS, i);\n        javaStrings[i] = cString.getUtf8String(0);\n    }\n} \/\/ 8. All off-heap memory is deallocated here\nassert Arrays.equals(javaStrings,\n                     new String[] {&quot;car&quot;, &quot;cat&quot;, &quot;dog&quot;, &quot;mouse&quot;});  \/\/ true<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=l45tAqfAo9N2tRw2WOvWeA%3D%3D.%2BOKNBpFIKavfons5PdtGtpuB4IkzqfKgwz1T8rw0OgY%3D\" rel=\"noopener noreferrer\">JEP 443: Unnamed Patterns and Variables (Preview)<\/a><\/h3>\n<p>Unnamed Patterns and Variables\u652f\u6301\u7528<code>_<\/code>\u6765\u66ff\u4ee3\u6ca1\u6709\u4f7f\u7528\u7684\u53d8\u91cf\u58f0\u660e\uff0c\u6bd4\u5982<\/p>\n<pre><code>r instanceof Point _\nr instanceof ColoredPoint(Point(int x, int _), Color _)\nif (r instanceof ColoredPoint(_, Color c)) { ... c ... }\nswitch (b) {\n    case Box(RedBall _), Box(BlueBall _) -&gt; processBox(b);\n    case Box(GreenBall _)                -&gt; stopProcessing();\n    case Box(_)                          -&gt; pickAnotherBox();\n}\nint acc = 0;\nfor (Order _ : orders) {\n    if (acc &lt; LIMIT) { \n        ... acc++ ...\n    }\n}\nwhile (q.size() &gt;= 3) {\n    var x = q.remove();\n    var _ = q.remove();\n    var _ = q.remove(); \n    ... new Point(x, 0) ...\n}<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=d0PoP4MFrPm6m2ig102K%2Bg%3D%3D.XyKH6TjsUzUMZvzsDjtIjJtYgTZn5FimiUO8ZM9brcI%3D\" rel=\"noopener noreferrer\">JEP 444: Virtual Threads<\/a><\/h3>\n<blockquote><p>\u5728JDK19<a target=\"_blank\" href=\"https:\/\/segmentfault.com\/a\/JEP\" rel=\"noopener noreferrer\">https:\/\/openjdk.org\/jeps\/425<\/a>)\u4f5c\u4e3a\u7b2c\u4e00\u6b21preview<br \/>\u5728JDK20<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=l8Zg2PYtc3NjoxuiwwYvZw%3D%3D.K2QcvHM4GKGtZpU5XXyScCr4ETWEIP229Zf5fNmKfOs%3D\" rel=\"noopener noreferrer\">JEP 436: Virtual Threads (Second Preview)<\/a>\u4f5c\u4e3a\u7b2c\u4e8c\u6b21preview\uff0c\u6b64\u7248\u672cjava.lang.ThreadGroup\u88ab\u6c38\u4e45\u5e9f\u5f03<br \/>\u5728JDK21\u7248\u672c\uff0cVirtual Threads\u6b63\u5f0f\u53d1\u5e03\uff0c\u4e0e\u4e4b\u524d\u7248\u672c\u76f8\u6bd4\uff0c\u8fd9\u6b21\u652f\u6301\u4e86threadlocal\uff0c\u7136\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7Thread.Builder\u6765\u521b\u5efa\uff0c\u800c\u4e14\u4e5f\u652f\u6301threaddump(<code>jcmd &lt;pid&gt; Thread.dump_to_file -format=json &lt;file&gt;<\/code>)<\/p><\/blockquote>\n<p>\u4f7f\u7528\u793a\u4f8b<\/p>\n<pre><code>void handle(Request request, Response response) {\n    var url1 = ...\n    var url2 = ...\n \n    try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {\n        var future1 = executor.submit(() -&gt; fetchURL(url1));\n        var future2 = executor.submit(() -&gt; fetchURL(url2));\n        response.send(future1.get() + future2.get());\n    } catch (ExecutionException | InterruptedException e) {\n        response.fail(e);\n    }\n}\n \nString fetchURL(URL url) throws IOException {\n    try (var in = url.openStream()) {\n        return new String(in.readAllBytes(), StandardCharsets.UTF_8);\n    }\n}<\/code><\/pre>\n<blockquote><p>\u4e00\u822c\u7528Executors.newVirtualThreadPerTaskExecutor()\u662f\u60f3\u901a\u8fc7\u6c60\u5316\u6280\u672f\u6765\u51cf\u5c11\u5bf9\u8c61\u521b\u5efa\u5f00\u9500\uff0c\u4e0d\u8fc7\u7531\u4e8e\u865a\u62df\u7ebf\u7a0b\u76f8\u6bd4\u5e73\u53f0\u7ebf\u7a0b\u66f4\u4e3a&#8221;\u5ec9\u4ef7&#8221;\uff0c\u56e0\u800c\u4e0d\u518d\u9700\u8981\u6c60\u5316\uff0c\u5982\u679c\u9700\u8981\u63a7\u5236\u865a\u62df\u7ebf\u7a0b\u6570\u5219\u53ef\u4ee5\u4f7f\u7528\u4fe1\u53f7\u91cf\u7684\u65b9\u5f0f\uff0c\u56e0\u800c\u63d0\u4f9b\u4e86Thread.Builder\u6765\u76f4\u63a5\u521b\u5efa\u865a\u62df\u7ebf\u7a0b\uff0c\u793a\u4f8b\u5982\u4e0b\uff1a<\/p><\/blockquote>\n<pre><code>Thread thread = Thread.ofVirtual().name(&quot;duke&quot;).unstarted(runnable);\nThread.startVirtualThread\uff08Runnable\uff09 <\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Cx%2FQ%2B9HSL%2FEt5vulLa9fCw%3D%3D.dIXMYZR6Gm9nq0ZTkhaMwKi4g1s294hhRLVI3SiH0jU%3D\" rel=\"noopener noreferrer\">JEP 445: Unnamed Classes and Instance Main Methods (Preview)<\/a><\/h3>\n<p>\u672a\u547d\u540d\u7684\u7c7b\u548c\u5b9e\u4f8bmain\u65b9\u6cd5\u8fd9\u4e2a\u7279\u6027\u53ef\u4ee5\u7b80\u5316hello world\u793a\u4f8b\uff0c\u65b9\u4fbfjava\u65b0\u624b\u5165\u95e8\uff0c\u793a\u4f8b\u5982\u4e0b<\/p>\n<pre><code>        static void main(String[] args) {\n            System.out.println(&quot;static main with args&quot;);\n        }\n\n        static void main() {\n            System.out.println(&quot;static main without args&quot;);\n        }\n\n        void main(String[] args) {\n            System.out.println(&quot;main with args&quot;);\n        }\n\n        void main() {\n            System.out.println(&quot;main with without args&quot;);\n        }<\/code><\/pre>\n<blockquote><p>javac &#8211;release 21 &#8211;enable-preview Main.javajava &#8211;enable-preview Main<br \/>\u5176\u4e2dmain\u65b9\u6cd5\u9009\u62e9\u7684\u4f18\u5148\u987a\u5e8f\u662fstatic\u7684\u4f18\u4e8e\u975estatic\u7684\uff0c\u7136\u540e\u6709args\u7684\u4f18\u4e8e\u6ca1\u6709args\u7684<\/p><\/blockquote>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=0xiM9fPZwK8C4zslUO6FIA%3D%3D.iDQ1tz5cZNPJhjWYE86vUrN%2FOEKVPrOLX6W3wTDJYKw%3D\" rel=\"noopener noreferrer\">JEP 446: Scoped Values (Preview)<\/a><\/h3>\n<blockquote><p>Scoped Values\u5728JDK20\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=xyg94qSu%2FIpH8khlhGwlCQ%3D%3D.XuZXyzdLY1tcPQ4Vbnkhe6PxKaV%2BAk5%2Fi%2Bt8tS6kG3Q%3D\" rel=\"noopener noreferrer\">JEP 429: Scoped Values (Incubator)<\/a>\u4f5c\u4e3aIncubator<br \/>\u6b64\u6b21\u5728JDK21\u4f5c\u4e3apreview\u7248\u672c<br \/>ScopedValue\u662f\u4e00\u79cd\u7c7b\u4f3cThreadLocal\u7684\u7ebf\u7a0b\u5185\/\u7236\u5b50\u7ebf\u7a0b\u4f20\u9012\u53d8\u91cf\u7684\u66f4\u4f18\u65b9\u6848\u3002ThreadLocal\u63d0\u4f9b\u4e86\u4e00\u79cd\u65e0\u9700\u5728\u65b9\u6cd5\u53c2\u6570\u4e0a\u4f20\u9012\u901a\u7528\u53d8\u91cf\u7684\u65b9\u6cd5\uff0cInheritableThreadLocal\u4f7f\u5f97\u5b50\u7ebf\u7a0b\u53ef\u4ee5\u62f7\u8d1d\u7ee7\u627f\u7236\u7ebf\u7a0b\u7684\u53d8\u91cf\u3002\u4f46\u662fThreadLocal\u63d0\u4f9b\u4e86set\u65b9\u6cd5\uff0c\u53d8\u91cf\u662f\u53ef\u53d8\u7684\uff0c\u53e6\u5916remove\u65b9\u6cd5\u5f88\u5bb9\u6613\u88ab\u5ffd\u7565\uff0c\u5bfc\u81f4\u5728\u7ebf\u7a0b\u6c60\u573a\u666f\u4e0b\u5f88\u5bb9\u6613\u9020\u6210\u5185\u5b58\u6cc4\u9732\u3002ScopedValue\u5219\u63d0\u4f9b\u4e86\u4e00\u79cd\u4e0d\u53ef\u53d8\u3001\u4e0d\u62f7\u8d1d\u7684\u65b9\u6848\uff0c\u5373\u4e0d\u63d0\u4f9bset\u65b9\u6cd5\uff0c\u5b50\u7ebf\u7a0b\u4e0d\u9700\u8981\u62f7\u8d1d\u5c31\u53ef\u4ee5\u8bbf\u95ee\u7236\u7ebf\u7a0b\u7684\u53d8\u91cf\u3002\u5177\u4f53\u4f7f\u7528\u5982\u4e0b\uff1a<\/p><\/blockquote>\n<pre><code>class Server {\n  public final static ScopedValue&lt;User&gt; LOGGED_IN_USER = ScopedValue.newInstance();\n \n  private void serve(Request request) {\n    \/\/ ...\n    User loggedInUser = authenticateUser(request);\n    ScopedValue.where(LOGGED_IN_USER, loggedInUser)\n               .run(() -&gt; restAdapter.processRequest(request));\n    \/\/ ...\n  }\n}<\/code><\/pre>\n<blockquote><p>\u901a\u8fc7ScopedValue.where\u53ef\u4ee5\u7ed1\u5b9aScopedValue\u7684\u503c\uff0c\u7136\u540e\u5728run\u65b9\u6cd5\u91cc\u53ef\u4ee5\u4f7f\u7528\uff0c\u65b9\u6cd5\u6267\u884c\u5b8c\u6bd5\u81ea\u884c\u91ca\u653e\uff0c\u53ef\u4ee5\u88ab\u5783\u573e\u6536\u96c6\u5668\u56de\u6536<\/p><\/blockquote>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=et76LZ1k1HBJp4akN5xjXA%3D%3D.1FBqfldfxd%2BxOFBKURe4d03yMHJBF5AccrJYIu5AZtM%3D\" rel=\"noopener noreferrer\">JEP 448: Vector API (Sixth Incubator)<\/a><\/h3>\n<blockquote><p>JDK16\u5f15\u5165\u4e86<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=SLy0YlQvBRagvdwCpKytQw%3D%3D.BzDEZxnWTEhrAI5fTmBQxroMm6MvFyAMArpzZwpWgPvW6rGI9KMXqVOlASxFyPpD\" rel=\"noopener noreferrer\">JEP 338: Vector API (Incubator)<\/a>\u63d0\u4f9b\u4e86jdk.incubator.vector\u6765\u7528\u4e8e\u77e2\u91cf\u8ba1\u7b97<br \/>JDK17\u8fdb\u884c\u6539\u8fdb\u5e76\u4f5c\u4e3a\u7b2c\u4e8c\u8f6e\u7684incubator<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=WprGX2uHbklCIN4mi0RNVA%3D%3D.LUg9PwBXtDE9QaxoZbkMp4j6htILyQKW%2BxM4%2FlaiANqNoKz51TBEtmSRHScJcX%2FY\" rel=\"noopener noreferrer\">JEP 414: Vector API (Second Incubator)<\/a><br \/>JDK18\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=mfD3giCu7Hkj52yKJxiV9w%3D%3D.j6Sz1q2HkoMS7LhTGyaEjmNQDv%2BXiD3pU8TFhWoiIrA%3D\" rel=\"noopener noreferrer\">JEP 417: Vector API (Third Incubator)<\/a>\u8fdb\u884c\u6539\u8fdb\u5e76\u4f5c\u4e3a\u7b2c\u4e09\u8f6e\u7684incubator<br \/>JDK19\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=ao3AlcS2Ru3bxC0HWjt82w%3D%3D.%2FSo7ErBL7rtQvLtKPDzy8eWPUvwhjV1E%2BOU7y%2BuD%2FGc%3D\" rel=\"noopener noreferrer\">JEP 426:Vector API (Fourth Incubator)<\/a>\u4f5c\u4e3a\u7b2c\u56db\u8f6e\u7684incubator<br \/>JDK20\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=N0dk4ha0cx4Adzol8q2EKQ%3D%3D.jB9RTFrU7jj2pDONSqzqjoBQYSe07unjsyBl2E7Emxw%3D\" rel=\"noopener noreferrer\">JEP 438: Vector API (Fifth Incubator)<\/a>\u4f5c\u4e3a\u7b2c\u4e94\u8f6e\u7684incubator<br \/>\u800cJDK21\u5219\u4f5c\u4e3a\u7b2c\u516d\u8f6e\u7684incubator\uff0c\u4f7f\u7528\u793a\u4f8b\u5982\u4e0b<\/p><\/blockquote>\n<pre><code>static final VectorSpecies&lt;Float&gt; SPECIES = FloatVector.SPECIES_PREFERRED;\n\nvoid vectorComputation(float[] a, float[] b, float[] c) {\n    int i = 0;\n    int upperBound = SPECIES.loopBound(a.length);\n    for (; i &lt; upperBound; i += SPECIES.length()) {\n        \/\/ FloatVector va, vb, vc;\n        var va = FloatVector.fromArray(SPECIES, a, i);\n        var vb = FloatVector.fromArray(SPECIES, b, i);\n        var vc = va.mul(va)\n                   .add(vb.mul(vb))\n                   .neg();\n        vc.intoArray(c, i);\n    }\n    for (; i &lt; a.length; i++) {\n        c[i] = (a[i] * a[i] + b[i] * b[i]) * -1.0f;\n    }\n}<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=PRlQ2r0WblZmO5lGNa1fvw%3D%3D.4BLunx5ZHa3YVC8QV463Zjax0IwxTrQg8Tp8PlWsYHM%3D\" rel=\"noopener noreferrer\">JEP 449: Deprecate the Windows 32-bit x86 Port for Removal<\/a><\/h3>\n<p>\u5e9f\u5f03\u4e86\u5bf9Windows 32-bit x86 (x86-32)\u7684\u79fb\u690d\uff0c\u4ee5\u4fbf\u540e\u7eed\u7248\u672c\u5220\u9664<\/p>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=cR8c2uvjStbI%2FE4KKrpZ9g%3D%3D.CYIMzfhokBsM9r%2F%2BxH0lenzbHESIfWrC1%2F9uLCb1o%2FQ%3D\" rel=\"noopener noreferrer\">JEP 451: Prepare to Disallow the Dynamic Loading of Agents<\/a><\/h3>\n<p>\u5bf9\u5c06\u4ee3\u7406\u52a8\u6001\u52a0\u8f7d\u5230\u6b63\u5728\u8fd0\u884c\u7684 JVM \u4e2d\u65f6\u53d1\u51fa\u8b66\u544a\uff0c\u540e\u7eed\u7248\u672c\u5c06\u4e0d\u5141\u8bb8\u52a8\u6001\u52a0\u8f7dagent\u3002<\/p>\n<blockquote><p>\u5728 JDK 9 \u53ca\u66f4\u9ad8\u7248\u672c\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7<code>-XX:-EnableDynamicAgentLoading<\/code>\u7981\u6b62\u52a8\u6001\u52a0\u8f7dagent\u3002<br \/>\u5728 JDK 21 \u4e2d\uff0c\u5141\u8bb8\u52a8\u6001\u52a0\u8f7dagent\uff0c\u4f46 JVM \u4f1a\u5728\u53d1\u751f\u65f6\u53d1\u51fa\u8b66\u544a\u3002\u4f8b\u5982\uff1a<\/p><\/blockquote>\n<pre><code>WARNING: A {Java,JVM TI} agent has been loaded dynamically (file:\/u\/bob\/agent.jar)\nWARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning\nWARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information\nWARNING: Dynamic loading of agents will be disallowed by default in a future release<\/code><\/pre>\n<p>\u82e5\u8981\u5141\u8bb8\u5de5\u5177\u52a8\u6001\u52a0\u8f7dagent\u800c\u4e0d\u53d1\u51fa\u8b66\u544a\uff0c\u7528\u6237\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u4f7f\u7528<code>-XX:+EnableDynamicAgentLoading<\/code><\/p>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=9Tuy57yHI%2F7lC4nEpXn6BQ%3D%3D.2c7XJ7hgup3fK5gS2v0nGEaCx2JnVzZOh2Xm4EGKZIE%3D\" rel=\"noopener noreferrer\">JEP 452: Key Encapsulation Mechanism API<\/a><\/h3>\n<p>Key Encapsulation Mechanism(KEM)\u662f\u4e00\u79cd\u73b0\u4ee3\u52a0\u5bc6\u6280\u672f\uff0c\u5b83\u4f7f\u7528\u975e\u5bf9\u79f0\u6216\u516c\u94a5\u52a0\u5bc6\u6765\u4fdd\u62a4\u5bf9\u79f0\u5bc6\u94a5\u3002\u4f20\u7edf\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u516c\u94a5\u52a0\u5bc6\u4e00\u4e2a\u968f\u673a\u751f\u6210\u7684\u5bf9\u79f0\u5bc6\u94a5\uff0c\u4f46\u8fd9\u9700\u8981\u586b\u5145\uff0c\u5e76\u4e14\u53ef\u80fd\u96be\u4ee5\u8bc1\u660e\u5b89\u5168\u3002\u76f8\u53cd\uff0cKEM\u5229\u7528\u516c\u94a5\u7684\u5c5e\u6027\u6d3e\u751f\u4e00\u4e2a\u76f8\u5173\u7684\u5bf9\u79f0\u5bc6\u94a5\uff0c\u8fd9\u4e0d\u9700\u8981\u586b\u5145\u3002<\/p>\n<blockquote><p>\u6b64\u6b21\u65b0\u589e\u4e86javax.crypto.KEM\u3001javax.crypto.KEMSpi<\/p><\/blockquote>\n<pre><code>package javax.crypto;\n\npublic class DecapsulateException extends GeneralSecurityException;\n\npublic final class KEM {\n\n    public static KEM getInstance(String alg)\n        throws NoSuchAlgorithmException;\n    public static KEM getInstance(String alg, Provider p)\n        throws NoSuchAlgorithmException;\n    public static KEM getInstance(String alg, String p)\n        throws NoSuchAlgorithmException, NoSuchProviderException;\n\n    public static final class Encapsulated {\n        public Encapsulated(SecretKey key, byte[] encapsulation, byte[] params);\n        public SecretKey key();\n        public byte[] encapsulation();\n        public byte[] params();\n    }\n\n    public static final class Encapsulator {\n        String providerName();\n        int secretSize();           \/\/ Size of the shared secret\n        int encapsulationSize();    \/\/ Size of the key encapsulation message\n        Encapsulated encapsulate();\n        Encapsulated encapsulate(int from, int to, String algorithm);\n    }\n\n    public Encapsulator newEncapsulator(PublicKey pk)\n            throws InvalidKeyException;\n    public Encapsulator newEncapsulator(PublicKey pk, SecureRandom sr)\n            throws InvalidKeyException;\n    public Encapsulator newEncapsulator(PublicKey pk, AlgorithmParameterSpec spec,\n                                        SecureRandom sr)\n            throws InvalidAlgorithmParameterException, InvalidKeyException;\n\n    public static final class Decapsulator {\n        String providerName();\n        int secretSize();           \/\/ Size of the shared secret\n        int encapsulationSize();    \/\/ Size of the key encapsulation message\n        SecretKey decapsulate(byte[] encapsulation) throws DecapsulateException;\n        SecretKey decapsulate(byte[] encapsulation, int from, int to,\n                              String algorithm)\n                throws DecapsulateException;\n    }\n\n    public Decapsulator newDecapsulator(PrivateKey sk)\n            throws InvalidKeyException;\n    public Decapsulator newDecapsulator(PrivateKey sk, AlgorithmParameterSpec spec)\n            throws InvalidAlgorithmParameterException, InvalidKeyException;\n\n}<\/code><\/pre>\n<blockquote><p>\u5b83\u4e3b\u8981\u662f\u63d0\u4f9b\u4e86newEncapsulator\u3001newDecapsulator\u65b9\u6cd5\uff0c\u4f7f\u7528\u793a\u4f8b\u5982\u4e0b<\/p><\/blockquote>\n<pre><code>\/\/ Receiver side\nKeyPairGenerator g = KeyPairGenerator.getInstance(&quot;ABC&quot;);\nKeyPair kp = g.generateKeyPair();\npublishKey(kp.getPublic());\n\n\/\/ Sender side\nKEM kemS = KEM.getInstance(&quot;ABC-KEM&quot;);\nPublicKey pkR = retrieveKey();\nABCKEMParameterSpec specS = new ABCKEMParameterSpec(...);\nKEM.Encapsulator e = kemS.newEncapsulator(pkR, specS, null);\nKEM.Encapsulated enc = e.encapsulate();\nSecretKey secS = enc.key();\nsendBytes(enc.encapsulation());\nsendBytes(enc.params());\n\n\/\/ Receiver side\nbyte[] em = receiveBytes();\nbyte[] params = receiveBytes();\nKEM kemR = KEM.getInstance(&quot;ABC-KEM&quot;);\nAlgorithmParameters algParams = AlgorithmParameters.getInstance(&quot;ABC-KEM&quot;);\nalgParams.init(params);\nABCKEMParameterSpec specR = algParams.getParameterSpec(ABCKEMParameterSpec.class);\nKEM.Decapsulator d = kemR.newDecapsulator(kp.getPrivate(), specR);\nSecretKey secR = d.decapsulate(em);\n\n\/\/ secS and secR will be identical<\/code><\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=SXevHP1ZD%2B4RpNnfiBZZrw%3D%3D.fYwpPXJboZSkG4LUJNQ2r62zlmkMMwyM0QQT0AONMGE%3D\" rel=\"noopener noreferrer\">JEP 453: Structured Concurrency (Preview)<\/a><\/h3>\n<blockquote><p>\u5728JDK19\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=6cH4hdt5aHUAfgIN7cACSg%3D%3D.mHuKzy%2FKnqaJ78DvhqtT8CNWwW0fBlxAUpzV5o6mGHA%3D\" rel=\"noopener noreferrer\">JEP 428: Structured Concurrency (Incubator)<\/a>\u4f5c\u4e3a\u7b2c\u4e00\u6b21incubator<br \/>\u5728JDK20\u7684<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=fmhstqAUbe2D88MMF9ErfA%3D%3D.GIPeUoOh1HZyPCZKKCk%2Fm4gHr4xYQyRsbcVJbekfOk0%3D\" rel=\"noopener noreferrer\">JEP 437: Structured Concurrency (Second Incubator)<\/a>\u4f5c\u4e3a\u7b2c\u4e8c\u6b21incubator<br \/>\u6b64\u6b21\u5728JDK21\u5219\u4f5c\u4e3apreview\uff0c\u4f7f\u7528\u793a\u4f8b\u5982\u4e0b<\/p><\/blockquote>\n<pre><code>Response handle() throws ExecutionException, InterruptedException {\n    try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {\n        Supplier&lt;String&gt;  user  = scope.fork(() -&gt; findUser());\n        Supplier&lt;Integer&gt; order = scope.fork(() -&gt; fetchOrder());\n\n        scope.join()            \/\/ Join both subtasks\n             .throwIfFailed();  \/\/ ... and propagate errors\n\n        \/\/ Here, both subtasks have succeeded, so compose their results\n        return new Response(user.get(), order.get());\n    }\n}<\/code><\/pre>\n<h2>\u7ec6\u9879\u89e3\u8bfb<\/h2>\n<p>\u4e0a\u9762\u5217\u51fa\u7684\u662f\u5927\u65b9\u9762\u7684\u7279\u6027\uff0c\u9664\u6b64\u4e4b\u5916\u8fd8\u6709\u4e00\u4e9bapi\u7684\u66f4\u65b0\u53ca\u5e9f\u5f03\uff0c\u4e3b\u8981\u89c1<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=sS6eJGJC8Ggxg195CHLvDA%3D%3D.K38kQZG9A3qP2WqB5chqW%2B6WQmcfWxdqrmY%2BB6kyqemaji%2F%2BJn%2F2fKpkkxe7BLFj\" rel=\"noopener noreferrer\">JDK 21 Release Notes<\/a>\uff0c\u8fd9\u91cc\u4e3e\u51e0\u4e2a\u4f8b\u5b50\u3002<\/p>\n<h3>\u6dfb\u52a0\u9879<\/h3>\n<ul>\n<li>Math.clamp() and StrictMath.clamp() Methods (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=ssRBnSjHQHsvaSzhCMdrkA%3D%3D.Qvdz7hht%2BJazwGjA9E%2F%2FYFG7QZ2OdVUHLmAnKeP5TB328Q84p252j7ywHRrTqtz1\" rel=\"noopener noreferrer\">JDK-8301226<\/a>)<\/li>\n<li>New String indexOf(int,int,int) and indexOf(String,int,int) Methods to Support a Range of Indices (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=mkE1FEfR21BTCFgJVR5fRA%3D%3D.3ddK4rU0B7gzkaYLm5jNf46aUA%2BIDWi26c0ki0rHmfCyp%2BboZMW1CN9d2d6OOHOm\" rel=\"noopener noreferrer\">JDK-8302590<\/a>)<\/li>\n<li>New splitWithDelimiters() Methods Added to String and java.util.regex.Pattern (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=dfaS9sT9Nd%2BWsBs%2B7bmCdA%3D%3D.PEIDIIYeqbhAnTuKh1k3Rw4RA9QZX%2BRFSMc8PPUbwZ0Qe%2BtHyu7MA%2F62lWD1l1w4\" rel=\"noopener noreferrer\">JDK-8305486<\/a>)<\/li>\n<li>System.exit() and Runtime.exit() Logging (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=LeUpQndFNppOERZTvAvkbg%3D%3D.DNGkXDVnKPD5wkI4jyjkEMsaHVX%2BMSZOUz8P27E24cAbFuhSkkA9ZAg%2BqwfaZtXi\" rel=\"noopener noreferrer\">JDK-8301627<\/a>)<\/li>\n<li>The java.net.http.HttpClient Is Now AutoCloseable (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=rXP5RBaVx4LFHkYVAbv6hA%3D%3D.jc%2FlqxruE5j8nEjRFcfoHz%2B7rUvWu5p2dNisDSSBCCKGUUrUi0rAEHKBUJz1N4hc\" rel=\"noopener noreferrer\">JDK-8267140<\/a>)<\/li>\n<li>New StringBuilder and StringBuffer repeat Methods (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=1TprkufU5rVr6tacn8cTzQ%3D%3D.Cx6TVhzKTNPnVTfJbdC3mHcry97Sao4ibP2oqtQ2QUTpBCg%2Ftw5brAJ1Oc1nJmMW\" rel=\"noopener noreferrer\">JDK-8302323<\/a>)<\/li>\n<li>Last Resort G1 Full GC Moves Humongous Objects (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=74xiZhPMyZOU4R8CHU3zAA%3D%3D.GFT76tprc5nuspjXVlgbOr80ha2MoFkZGJFRmqgkdzPcac1z%2BxvOSx%2Fd0EMIfuQm\" rel=\"noopener noreferrer\">JDK-8191565<\/a>)<\/li>\n<\/ul>\n<h3>\u79fb\u9664\u9879<\/h3>\n<ul>\n<li>Removed SECOM Trust System&#8217;s RootCA1 Root Certificate (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=hykPZDFq%2F%2B5vBoDWx3bk2A%3D%3D.AyvOepJPBn59Ne0N58dx%2FuzyCUf0BVAITg6cRP1lm3clmz6zrBtShHzhmC1uDA9t\" rel=\"noopener noreferrer\">JDK-8295894<\/a>)<\/li>\n<li>java.io.File&#8217;s Canonical Path Cache Is Removed (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Nkca970aINUC%2FvJNeg9SzA%3D%3D.swmcyUP4O2GN3xqlFtmpPBC08zi3GbUw%2FZqeFNMbJs0T8Q5wNPDR310mY1H54tOs\" rel=\"noopener noreferrer\">JDK-8300977<\/a>)<\/li>\n<li>Removal of the java.compiler System Property (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=fekwlaFRE1%2BD1VFyRA953A%3D%3D.6jkO%2FP791UdKVYkr8aAnC09cPziBJZtt3RXOLIsXJs7G51CqraNvLSONzz8s1sp4\" rel=\"noopener noreferrer\">JDK-8041676<\/a>)<\/li>\n<li>The java.lang.Compiler Class Has Been Removed (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=QYtkLPjkw%2FB67NbXfAM%2Beg%3D%3D.7HdKBGPv3%2BAb0YaZHwX06iWSH2JRTs36Ntl6%2FrOk4sQB3bP2Z%2FmZuO1xP62P%2FrnX\" rel=\"noopener noreferrer\">JDK-8205129<\/a>)<\/li>\n<li>Remove the JAR Index Feature (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=OSYhObwGdpcZCURsVlWkvA%3D%3D.1GxEOVtaBWl4kTSg6U%2FMAzU9K0AP0dHC72tRpCs%2Bk6TL3oY9MMkHVE6WdUEXNPIr\" rel=\"noopener noreferrer\">JDK-8302819<\/a>)<\/li>\n<li>Removal of G1 Hot Card Cache (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Ygznb2N1wNBw%2F4C1mQPOQw%3D%3D.z3eaTWMoHqnIrMLcC0RjkJNR1ZO%2B714G1guOfrkiY9XNuRRLluFuz2GkzwpX3Fri\" rel=\"noopener noreferrer\">JDK-8225409<\/a>)<\/li>\n<li>Obsolete Legacy HotSpot Parallel Class Loading Workaround Option -XX:+EnableWaitForParallelLoad Is Removed (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=H0%2BRFDpRgagBRhV2SiT%2B2g%3D%3D.m769aRFVDITo2tCb%2BCQZxA%2B2SA08yXHi6SWYu4lOMUYLJ3eNkmSpBjI7n0cJUbcB\" rel=\"noopener noreferrer\">JDK-8298469<\/a>)<\/li>\n<li>The MetaspaceReclaimPolicy Flag has Been Obsoleted (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=MYZXeYoOt%2BK4R7ikaEVGJQ%3D%3D.rvxWDPSf1Kz4jRHJtuLfaGZlQs91uF3ofewx2LoI4JX4rmMDz5x1zBsQzRCJWf7F\" rel=\"noopener noreferrer\">JDK-8302385<\/a>)<\/li>\n<\/ul>\n<h3>\u5e9f\u5f03\u9879<\/h3>\n<ul>\n<li>Deprecate GTK2 for Removal (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Z%2FmnytEZRdfXSPF9Ygi8tw%3D%3D.dj8iE7jNdKNQMECHUJKZ9hrvPG2llYZmEg2BAA3O6RoyWmq0DI9OUVFO43qYXmuc\" rel=\"noopener noreferrer\">JDK-8280031<\/a>)<\/li>\n<li>Deprecate JMX Subject Delegation and the JMXConnector.getMBeanServerConnection(Subject) Method for Removal (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=cLJnVhp5qCyZKPOkbBEYZg%3D%3D.s707mQHMGrD9ufImaG9vcaPfBJ1NqXfMaktlRMKJRV1ApW3sC4hiQyYP5VOUM013\" rel=\"noopener noreferrer\">JDK-8298966<\/a>)<\/li>\n<\/ul>\n<h3>\u91cd\u8981bug\u4fee\u590d<\/h3>\n<ul>\n<li>Error Computing the Amount of Milli- and Microseconds between java.time.Instants (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=y0P8WJfEggvOAfASu4IKKQ%3D%3D.47%2FNCbK7l85LSE2Uucy9lHyWLj99ZzgjVO%2Bpkho08DtLVQPpMF8%2BadqEftG2WxlH\" rel=\"noopener noreferrer\">JDK-8307466<\/a>)<\/li>\n<li>Disallow Extra Semicolons Between &#8220;import&#8221; Statements (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=06btxVWNIco5o%2Feauggoyw%3D%3D.GyshhH1BAvTX9foBMHw1nihRPPGPAEzEyBwAMOkSTFQHFXQaF5uBo4Ry2MjxJrAv\" rel=\"noopener noreferrer\">JDK-8027682<\/a>)<\/li>\n<\/ul>\n<h3>\u5df2\u77e5\u95ee\u9898<\/h3>\n<ul>\n<li>JVM May Crash or Malfunction When Using ZGC and Non-Default ObjectAlignmentInBytes (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=hcZlZpADBKryLE8rJ84cJw%3D%3D.cT36ZDEWWwpmQ9L0%2FdSCbIvu14nOC0kEAdta2NLCl4V%2F9sLMNKDVqRYVpzGln%2BXy\" rel=\"noopener noreferrer\">JDK-8312749<\/a>)<\/li>\n<li>Validations on ZIP64 Extra Fields (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Zm9H2bNkdxi3tgjmgyPAjQ%3D%3D.AmMN%2FfE3UkhVHJknUk0OIMNO5sLnN9jxIfl8GMUhTKkrf4G%2BZaKVSOL4WwqaSVI3\" rel=\"noopener noreferrer\">JDK-8313765<\/a>)<\/li>\n<li>java.util.regex.MatchResult Might Throw StringIndexOutOfBoundsException on Regex Patterns Containing Lookaheads and Lookbehinds (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=iUYWzeP5yXHX7m9Qh74TGA%3D%3D.1nlKG1C6Ca6PWw69HVju4r2Hw%2BqYANJSGqCRFO41SkHbLEz5X%2FRZneFK7Gt0Ag4D\" rel=\"noopener noreferrer\">JDK-8132995<\/a>)<\/li>\n<li>JVM May Hang When Using Generational ZGC if a VM Handshake Stalls on Memory (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=zUDlfEw1oGkETnf11AyA0g%3D%3D.loKkHsd4kt4a5upMEx4yoD%2B7QUnoYAqJvSPRaO7tz7e2X3u8144J%2Fm%2FaQ0KLZrzf\" rel=\"noopener noreferrer\">JDK-8311981<\/a>)<\/li>\n<\/ul>\n<h3>\u5176\u4ed6\u4e8b\u9879<\/h3>\n<ul>\n<li>ObjectInputStream::readObject() Should Handle Negative Array Sizes without Throwing NegativeArraySizeExceptions (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=YrfsY5zA35STED7EZeCizQ%3D%3D.Ev4k12dIzkZBmg1CZ%2Bw5pCyq3C73wYZDiFsqUEkG9SQG3zYoSoPE1HC6R4trmydu\" rel=\"noopener noreferrer\">JDK-8306461<\/a>)<\/li>\n<li>File::listRoots Changed to Return All Available Drives on Windows (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=OC1kTyMpNgXgKFGhFnTXyw%3D%3D.EFz%2Bz2gw3MYof5WpTHeHfZGmhlczhzD%2BRnhv%2BJeumAg%2BtjcU7CPGoZ3dnMjNa1NQ\" rel=\"noopener noreferrer\">JDK-8208077<\/a>)<\/li>\n<li>Thread.sleep(millis, nanos) Is Now Able to Perform Sub-Millisecond Sleeps (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Pf0Y8UPk3L5VuMkOI4Jbyg%3D%3D.mEbINli%2BWMcbAroUw3jTSDjtg0gMfjOP%2FvoYbFMlEGNOAI7gfhF%2FZavdayFMRA5Y\" rel=\"noopener noreferrer\">JDK-8305092<\/a>)<\/li>\n<li>FileChannel.transferFrom Extends File if Called to Transfer Bytes to the File (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=RClORHpzZxugoK7P%2FjIvIA%3D%3D.PHYwkpeYaSoBWvQDTLoxQ3ZMSKDYcoF5MGvj3fhr7p6OWP43rs4Eh%2FbU1aaVZ3wl\" rel=\"noopener noreferrer\">JDK-8303260<\/a>)<\/li>\n<li>Clarification of the Default Charset Initialization with file.encoding (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=j%2BI2YpZIew440RV7g2dxhQ%3D%3D.gVKTZ%2Bni%2BmczrLW4UwCUBJHO8SfpSqjxLmS3Fw5gC0swDETOMw30jvcfmwvrqYjW\" rel=\"noopener noreferrer\">JDK-8300916<\/a>)<\/li>\n<li>java.util.Formatter May Return Slightly Different Results on double and float (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=tnGxiWIVhM0jLtKB5yRVdg%3D%3D.MmLdTSBMF0ChQOIZAifzglu8Rr8B664tksYYchMbS%2F5iNEmhmTngFKKZFfGTdPm4\" rel=\"noopener noreferrer\">JDK-8300869<\/a>)<\/li>\n<li>JVM TI ThreadStart and ThreadEnd Events Not Sent for Virtual Threads (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=K4RKknfEzNDAGYMI%2BTxFAA%3D%3D.4obCQZPJIaqGjdCsR1fznEX4sqi7Dc0n4QsdYmd50w3AseH4xHh6b7F3Gao1h0el\" rel=\"noopener noreferrer\">JDK-8307399<\/a>)<\/li>\n<li>Add final Keyword to Some Static Methods (<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=OjdUjGx0cAbYI%2Bv57AboYA%3D%3D.X5th2iiIQXQQ7jpwSMB2QpS7DfpgCJpUp028iyO5zcy%2Fo%2FCstKsZeNQf9HAd1Kuv\" rel=\"noopener noreferrer\">JDK-8302696<\/a>)<\/li>\n<\/ul>\n<h2>\u5c0f\u7ed3<\/h2>\n<p>Java21\u4e3b\u8981\u6709\u5982\u4e0b\u51e0\u4e2a\u7279\u6027<\/p>\n<ul>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=E8AyklYNHU5hymnS41VnRA%3D%3D.5rlGM4uE7NiaNZZtO8qt5aM094aD0YZZ6k7wG3toQSk%3D\" rel=\"noopener noreferrer\">JEP 430: String Templates (Preview)<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=%2F9h1PXnKIuVHw3X45gjNqg%3D%3D.hPrQJbK6qabwVvUjaohCS4NRPM%2F2cIBpb9zj0V%2FpYlo%3D\" rel=\"noopener noreferrer\">JEP 431: Sequenced Collections<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=QWKMXqT0fZingwYhDDaC4Q%3D%3D.PhP3%2FjbdgRoBL8EFTfreYbww62PFsk4Hr4noaHx6dro%3D\" rel=\"noopener noreferrer\">JEP 439: Generational ZGC<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=N0zZAII2efiWxOWVaoFgUQ%3D%3D.w0PyRc8uqUQZU%2FAtKgdIY4cPDIGNPkkDgAPM%2BX%2BYoQw%3D\" rel=\"noopener noreferrer\">JEP 440: Record Patterns<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=BIpB8ZssXTg77D0LfSnj%2Fw%3D%3D.a9SJ49jizRkFruB%2BOdF2pmbK5Q19%2FepiFlHd3NRaHSo%3D\" rel=\"noopener noreferrer\">JEP 441: Pattern Matching for switch<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=KHgtyiLOxl2o2glQ32gdrg%3D%3D.q7DPdcV92853DdVre%2FXFc0HrYEjL7bHRCtZX0jIjwb8%3D\" rel=\"noopener noreferrer\">JEP 442: Foreign Function &#038; Memory API (Third Preview)<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=QHMtzLVldHgaRnv1o6u9BQ%3D%3D.rQr0R9jrW593mykEIMsPji7JWDUXgqpw2tmKBj7Q5MU%3D\" rel=\"noopener noreferrer\">JEP 443: Unnamed Patterns and Variables (Preview)<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=5HD2ZmTDO0Z7me1pUr5RvA%3D%3D.sfTTxaGg%2F4eL5CI3o1FEDLoLrfxv%2FsDv%2FVZ2mHIfvZI%3D\" rel=\"noopener noreferrer\">JEP 444: Virtual Threads<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=Nd14pqHTzY5dzdzhLXdq9w%3D%3D.o6AxEX1p3r%2B8s9kydeg68QKsrgy9QTa7mnSCCOsAA9M%3D\" rel=\"noopener noreferrer\">JEP 445: Unnamed Classes and Instance Main Methods (Preview)<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=rQ%2FQ%2F5m7uU%2Bah7D%2FUc6mvA%3D%3D.7GQqCYObmRkSnHXPy8rHJ3I0YxiG%2BnTa%2B50ECCKeSAI%3D\" rel=\"noopener noreferrer\">JEP 446: Scoped Values (Preview)<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=2%2FjJTD5t0RJ4eCWtLSmung%3D%3D.dsKW7EmOuhIoW%2FuiJgSareqMfjZ5BHb6sAoMkNfEXH8%3D\" rel=\"noopener noreferrer\">JEP 448: Vector API (Sixth Incubator)<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=dhE4A0LeOtGRNnabBSyOlg%3D%3D.u4dACGWIhWQnmmpQQcWo7m0wf10m83oJQtNevQ62eAU%3D\" rel=\"noopener noreferrer\">JEP 449: Deprecate the Windows 32-bit x86 Port for Removal<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=oXgG8I%2FOvjJq3tpLz5jIUQ%3D%3D.SbbkOQZ9J9zQQaiDFT2dCSNZNpUCoW%2FaoUNGSbk1Jes%3D\" rel=\"noopener noreferrer\">JEP 451: Prepare to Disallow the Dynamic Loading of Agents<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=K02hhAweKw00ABW2Ncc%2Fqg%3D%3D.w%2B4iKQ6odJ7KA5Kcl%2BoTaIoii0OVPZgoiDxduUPgWms%3D\" rel=\"noopener noreferrer\">JEP 452: Key Encapsulation Mechanism API<\/a><\/li>\n<li>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=CUh6OgsTvLjMUkGRw4F4HA%3D%3D.Kbst%2B%2Bz0DzvcKKx%2F34Sq6CDPm5cQdELOAN5ySv0%2FGDY%3D\" rel=\"noopener noreferrer\">JEP 453: Structured Concurrency (Preview)<\/a><\/p>\n<blockquote><p>\u5176\u4e2d<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=%2FoGvPGi9AXUiCwViKnm7zg%3D%3D.wb59Amn3SPZokU9eUu%2BxyTdYhspePz7%2FMkaMYShkN98%3D\" rel=\"noopener noreferrer\">JEP 439: Generational ZGC<\/a>\u53ca<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=3cNNoKnuiqL08%2BVxwEnuTg%3D%3D.kHowge0gvYwOGHdp49cWhARK59YjzBoZJVN%2FNq7qRTo%3D\" rel=\"noopener noreferrer\">JEP 444: Virtual Threads<\/a>\u5e94\u5c5e\u4e8e\u91cd\u78c5\u7ea7\u7684\u7279\u6027\uff0c\u800c<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=vRMi1HWRldgL7fDJJ2Jtmg%3D%3D.%2FnzfuDBwevu9XQS%2FytdpFCL77LUTJFy1Ievn57woJcQ%3D\" rel=\"noopener noreferrer\">JEP 430: String Templates (Preview)<\/a>\u3001<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=buIVepLl%2BHrqesAo%2F3ZxKw%3D%3D.QuhtKCIih5iKDSEwwmMKgzsz8MaUMhc%2B4saNot4kV7w%3D\" rel=\"noopener noreferrer\">JEP 431: Sequenced Collections<\/a>\u3001<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=xelmL1juEibU0PyTU6%2Bx3g%3D%3D.bpn1Xj43iDeMCQa2lLVG78cwiajDutx%2FzVJreZOoRfI%3D\" rel=\"noopener noreferrer\">JEP 440: Record Patterns<\/a>\u53ca<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=W17O8kb2BeaUIcj2btUULw%3D%3D.7svONbgdGyBRzQJic5Qn9FQzn4IC1IsiZ0wdnYEv5EE%3D\" rel=\"noopener noreferrer\">JEP 441: Pattern Matching for switch<\/a>\u5219\u5728\u8bed\u8a00\u8868\u8fbe\u529b\u5c42\u9762\u4e0a\u6709\u4e86\u589e\u5f3a<br \/>\u53e6\u5916java21\u662f\u7ee7JDK 17\u4e4b\u540e\u6700\u65b0\u7684\u957f\u671f\u652f\u6301(LTS)\u7248\u672c\uff0c\u5c06\u83b7\u5f97\u81f3\u5c118\u5e74\u7684\u652f\u6301\u3002<\/p><\/blockquote>\n<\/li>\n<\/ul>\n<h2>doc<\/h2>\n<ul>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=ORYue6Ol%2FhttbEiudRwbdw%3D%3D.b6glQPzItWdkBbj%2F765QTG9%2Fq4zE%2B0oZc61UeBos5wtX754rjRieMdB68Qz4IBYQ\" rel=\"noopener noreferrer\">JDK 21 Features<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=jbK7bHEs5PAadt5b6pzI5g%3D%3D.hLxlE6EWA9v8Nyg7q46lEJ9U5KfSpmU4qMaQUXXHTormQTX8HHXKJ6bbCW3iRxKU\" rel=\"noopener noreferrer\">JDK 21 Release Notes<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=mKAnw7NiYSWuna%2FVGgwDLQ%3D%3D.YDO0P5CKFxLG1IcchUr7Y9vzPEHWNMNtXVLZ2oGjEll6s%2BZcnxhVIiD%2Fhvbpio2SznbEdPVtdJNAChFav%2B%2B3Nxp8okLaFyYebeD0wGQxfj0%3D\" rel=\"noopener noreferrer\">Consolidated JDK 21 Release Notes<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=SjDHkj8DW3MIkfQ9cV53uQ%3D%3D.VIv6lRnsxiig%2FgsSGp6urNYUIwd%2Fc2wnxg003x%2F1kYDFIJCV9CBhcKMWFUS4Tpp0kagdPQsMnhLT1FTGiNCUb7hcASpUwwUX01Ka3Ascjso%3D\" rel=\"noopener noreferrer\">Java SE 21 deprecated-list<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=quWzC4GKSeFqs7vqvpgU1Q%3D%3D.1t7S2W34v3NEMY%2FFsm5oOuOiiyq5%2BoGgRDpttH41bX3hE2W0QlwX41lGBKTHu8RGa968KgflvVyaRMsUB4ciAQ%3D%3D\" rel=\"noopener noreferrer\">The Arrival of Java 21<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=eVc2aPQdQepO%2FDRFkMHmkQ%3D%3D.pS%2FEdiI0krJ2NEOczaWcv28%2FQH8OzjmeqKCkbufM0A%2FWSsvYjOuTuL9%2FW2SsolRHZB0sPYrtgtCOt7fAkxLI6uKUDB1pGE24LuxlJ1vHGMc%3D\" rel=\"noopener noreferrer\">JDK 21 G1\/Parallel\/Serial GC changes<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=CB7ep0rKbnm%2BK5EjP9HOGg%3D%3D.FQphkmQm6eHlQwf6QbmkbXDK%2Bt2QY2DJYcBBHB3g0rmgG0LkfAFBNTTVcajdq4ZVXIdON1B9NLniEFk9HUnMkg%3D%3D\" rel=\"noopener noreferrer\">Java 21, the Next LTS Release, Delivers Virtual Threads, Record Patterns and Pattern Matching<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=8to5ILsVZZYk1YUlcKpD3w%3D%3D.MlLDOy4P78dA9gPEMigY9sgoq%2Fzlg5U1k7KciV3E7iKW88w4NcdZMH%2B13sTTYHwP13YNqUI2u32MX5K2U9q8Lg%3D%3D\" rel=\"noopener noreferrer\">JDK 21 and JDK 22: What We Know So Far<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=2hOTrNeP6yMhbNzIBtf7tQ%3D%3D.YVHgDJjPTxR47kC%2F8s57Xx7PEtUxRCjGIaeacFofUezwT6mrGoMUJ4Vd0H4ncMZS\" rel=\"noopener noreferrer\">Java 21 New Features: \u201cThe ZGC is generational and will further improve performance for suitable applications\u201d<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=oIQr1FLngMFZzgtE6qOc5g%3D%3D.TtadXpoce1eYM%2BWz33kRwc3XZH3SQwqWxJ77Del9by6u1w%2BvISNfHxEYNTUSZSQqclw1lvd9XchFsREnAZ2wjFwwXUES%2FSxb5RjsT6t7KxI%3D\" rel=\"noopener noreferrer\">Java 21 is Available Today, And It\u2019s Quite the Update<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044238496\">https:\/\/segmentfault.com\/a\/1190000044238496<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java\u8bed\u8a00\u7279\u6027\u7cfb\u5217 Java5\u7684\u65b0\u7279\u6027 Java6\u7684\u65b0\u7279\u6027 Java7\u7684\u65b0\u7279\u6027 Java8\u7684\u65b0\u7279\u6027 Java [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008294","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008294"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008294\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}