]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(java): Make changes for JDK 25
authorAliaksei Budavei <0x000c70@gmail.com>
Sat, 4 Oct 2025 10:09:58 +0000 (10:09 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 4 Oct 2025 10:09:58 +0000 (10:09 +0000)
- Add to the list of java.lang classes three new types: IO,
  ScopedValue, and ScopedValue.Carrier.
- Add to the list of java.lang interfaces a new type:
  ScopedValue.CallableOp.
- "Demote" RuntimePermission from the list of java.lang
  class types to javaLangDeprecated.
- Reintroduce supported syntax-preview-feature numbers 455
  and 488 as _a new number_ 507.

References:
https://bugs.openjdk.org/browse/JDK-8353641
https://openjdk.org/jeps/506 (Scoped Values)
https://openjdk.org/jeps/507 (Primitive Types in Patterns etc.)
https://openjdk.org/jeps/512 (Compact Source Files etc.)

closes: #18479

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/syntax.txt
runtime/syntax/java.vim
runtime/syntax/testdir/dumps/java_previews_455_00.dump
runtime/syntax/testdir/input/java_previews_455.java

index 8f10398c273d90f978a1565f6f70ae0d7a4ad122..8e2e0c6105aa00cdde13e40ce9dc10b3d92ef8f6 100644 (file)
@@ -1,4 +1,4 @@
-*syntax.txt*   For Vim version 9.1.  Last change: 2025 Sep 28
+*syntax.txt*   For Vim version 9.1.  Last change: 2025 Oct 04
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -2272,11 +2272,11 @@ cycles for such a feature to become either integrated into the platform or
 withdrawn from this effort.  To cater for early adopters, there is optional
 support in Vim for syntax related preview features that are implemented.  You
 can request it by specifying a list of preview feature numbers as follows: >
-       :let g:java_syntax_previews = [488]
+       :let g:java_syntax_previews = [507]
 
 The supported JEP numbers are to be drawn from this table:
        `430`: String Templates [JDK 21]
-       `488`: Primitive types in Patterns, instanceof, and switch
+       `507`: Primitive types in Patterns, instanceof, and switch
 
 Note that as soon as the particular preview feature will have been integrated
 into the Java platform, its entry will be removed from the table and related
index 5458b048e9c81fe0e5e3799f75195d3f7f344d12..a715331f826a00283e4a254c20f0b925448e1353 100644 (file)
@@ -3,7 +3,7 @@
 " Maintainer:          Aliaksei Budavei <0x000c70 AT gmail DOT com>
 " Former Maintainer:   Claudio Fleiner <claudio@fleiner.com>
 " Repository:          https://github.com/zzzyxwvut/java-vim.git
-" Last Change:         2025 Sep 28
+" Last Change:         2025 Oct 04
 
 " Please check ":help java.vim" for comments on some of the options
 " available.
@@ -46,11 +46,18 @@ function! s:ff.RightConstant(x, y) abort
   return a:y
 endfunction
 
-function! s:ff.IsAnyRequestedPreviewFeatureOf(ns) abort
-  return exists("g:java_syntax_previews") &&
-    \ !empty(filter(a:ns, printf('index(%s, v:val) + 1',
-                           \ string(g:java_syntax_previews))))
-endfunction
+if !empty(get(g:, 'java_syntax_previews', []))
+  " Fold the value of "g:java_syntax_previews" in this function.
+  exec printf("%s\n%s\n%s",
+    \ 'function! s:ff.IsAnyRequestedPreviewFeatureOf(ns) abort',
+    \ printf('return !empty(filter(a:ns, "index(%s, v:val) + 1"))',
+                       \ string(g:java_syntax_previews)),
+    \ 'endfunction')
+else
+  function! s:ff.IsAnyRequestedPreviewFeatureOf(dummy) abort
+    return 0
+  endfunction
+endif
 
 if !exists("*s:ReportOnce")
   function s:ReportOnce(message) abort
@@ -233,7 +240,7 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
   syn keyword javaR_JavaLang ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException ClassCastException IllegalArgumentException IllegalMonitorStateException IllegalThreadStateException IndexOutOfBoundsException NegativeArraySizeException NullPointerException NumberFormatException RuntimeException SecurityException StringIndexOutOfBoundsException IllegalStateException UnsupportedOperationException EnumConstantNotPresentException TypeNotPresentException IllegalCallerException LayerInstantiationException WrongThreadException MatchException
   syn cluster javaClasses add=javaR_JavaLang
   hi def link javaR_JavaLang javaR_Java
-  syn keyword javaC_JavaLang Boolean Character ClassLoader Compiler Double Float Integer Long Math Number Object Process Runtime SecurityManager String StringBuffer Thread ThreadGroup Byte Short Void Package RuntimePermission StrictMath StackTraceElement ProcessBuilder StringBuilder Module ModuleLayer StackWalker Record
+  syn keyword javaC_JavaLang Boolean Character ClassLoader Compiler Double Float Integer Long Math Number Object Process Runtime SecurityManager String StringBuffer Thread ThreadGroup Byte Short Void Package RuntimePermission StrictMath StackTraceElement ProcessBuilder StringBuilder Module ModuleLayer StackWalker Record IO
   syn match   javaC_JavaLang "\<System\>"      " See javaDebug.
   " Generic non-interfaces:
   syn match   javaC_JavaLang "\<Class\>"
@@ -242,6 +249,7 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
   syn match   javaC_JavaLang "\<Enum\>"
   syn match   javaC_JavaLang "\<ClassValue\>"
   exec 'syn match javaC_JavaLang "\%(\<Enum\.\)\@' . s:ff.Peek('5', '') . '<=\<EnumDesc\>"'
+  syn match   javaC_JavaLang "\<ScopedValue\>"
   " Member classes:
   exec 'syn match javaC_JavaLang "\%(\<Character\.\)\@' . s:ff.Peek('10', '') . '<=\<Subset\>"'
   exec 'syn match javaC_JavaLang "\%(\<Character\.\)\@' . s:ff.Peek('10', '') . '<=\<UnicodeBlock\>"'
@@ -249,6 +257,7 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
   exec 'syn match javaC_JavaLang "\%(\<ModuleLayer\.\)\@' . s:ff.Peek('12', '') . '<=\<Controller\>"'
   exec 'syn match javaC_JavaLang "\%(\<Runtime\.\)\@' . s:ff.Peek('8', '') . '<=\<Version\>"'
   exec 'syn match javaC_JavaLang "\%(\<System\.\)\@' . s:ff.Peek('7', '') . '<=\<LoggerFinder\>"'
+  exec 'syn match javaC_JavaLang "\%(\<ScopedValue\.\)\@' . s:ff.Peek('12', '') . '<=\<Carrier\>"'
   " Member enumerations:
   exec 'syn match javaC_JavaLang "\%(\<Thread\.\)\@' . s:ff.Peek('7', '') . '<=\<State\>"'
   exec 'syn match javaC_JavaLang "\%(\<Character\.\)\@' . s:ff.Peek('10', '') . '<=\<UnicodeScript\>"'
@@ -275,6 +284,7 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
   exec 'syn match javaI_JavaLang "\%(\<Thread\.\)\@' . s:ff.Peek('7', '') . '<=\<Builder\>"'
   exec 'syn match javaI_JavaLang "\%(\<Thread\.Builder\.\)\@' . s:ff.Peek('15', '') . '<=\<OfPlatform\>"'
   exec 'syn match javaI_JavaLang "\%(\<Thread\.Builder\.\)\@' . s:ff.Peek('15', '') . '<=\<OfVirtual\>"'
+  exec 'syn match javaI_JavaLang "\%(\<ScopedValue\.\)\@' . s:ff.Peek('12', '') . '<=\<CallableOp\>"'
   syn cluster javaClasses add=javaI_JavaLang
   hi def link javaI_JavaLang javaI_Java
 
@@ -302,12 +312,13 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
   syn match javaLangObject "\<toString\>"
   hi def link javaLangObject javaConstant
 
+  " As of JDK 25, RuntimePermission is deprecated for removal
+  "    (JDK-8353641).
+  "    (Note that SecurityException is still not deprecated.)
   " As of JDK 24, SecurityManager is rendered non-functional
   "    (JDK-8338625).
-  "    (Note that SecurityException and RuntimePermission are still
-  "    not deprecated.)
   " As of JDK 21, Compiler is no more (JDK-8205129).
-  syn keyword javaLangDeprecated Compiler SecurityManager
+  syn keyword javaLangDeprecated Compiler SecurityManager RuntimePermission
 endif
 
 runtime syntax/javaid.vim
@@ -350,7 +361,7 @@ endif
 
 exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*::\@!"he=e-1'
 
-if s:ff.IsAnyRequestedPreviewFeatureOf([455, 488])
+if s:ff.IsAnyRequestedPreviewFeatureOf([455, 488, 507])
   syn region  javaLabelRegion  transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaBoolean,javaNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaType,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
 else
   syn region  javaLabelRegion  transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
index 1a446bc6932cd40056c72ebab5696db31c04286a..3a61cf84c328544b35188b236fa325c622c63577 100644 (file)
@@ -1,4 +1,4 @@
->/+0#0000e05#ffffff0@1| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|j|a|v|a|_|s|y|n|t|a|x|_|p|r|e|v|i|e|w|s| |=| |[|4|5@1|,| |4|8@1|]| +0#0000000&@17
+>/+0#0000e05#ffffff0@1| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|j|a|v|a|_|s|y|n|t|a|x|_|p|r|e|v|i|e|w|s| |=| |[|4|5@1|,| |4|8@1|,| |5|0|7|]| +0#0000000&@12
 @75
 @75
 @75
index ed6430f573ae4994170f78c48e587f60034e551f..bdffa23f74eab589da4f353f78e91eb368413e73 100644 (file)
@@ -1,4 +1,4 @@
-// VIM_TEST_SETUP let g:java_syntax_previews = [455, 488]
+// VIM_TEST_SETUP let g:java_syntax_previews = [455, 488, 507]