Skip to content

Commit bfcf638

Browse files
zzzyxwvutchrisbra
authored andcommitted
runtime(java): Make changes for JDK 25
- 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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 85fd7f8 commit bfcf638

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

runtime/doc/syntax.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*syntax.txt* For Vim version 9.1. Last change: 2025 Sep 28
1+
*syntax.txt* For Vim version 9.1. Last change: 2025 Oct 04
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2272,11 +2272,11 @@ cycles for such a feature to become either integrated into the platform or
22722272
withdrawn from this effort. To cater for early adopters, there is optional
22732273
support in Vim for syntax related preview features that are implemented. You
22742274
can request it by specifying a list of preview feature numbers as follows: >
2275-
:let g:java_syntax_previews = [488]
2275+
:let g:java_syntax_previews = [507]
22762276
22772277
The supported JEP numbers are to be drawn from this table:
22782278
`430`: String Templates [JDK 21]
2279-
`488`: Primitive types in Patterns, instanceof, and switch
2279+
`507`: Primitive types in Patterns, instanceof, and switch
22802280

22812281
Note that as soon as the particular preview feature will have been integrated
22822282
into the Java platform, its entry will be removed from the table and related

runtime/syntax/java.vim

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
44
" Former Maintainer: Claudio Fleiner <[email protected]>
55
" Repository: https://github.com/zzzyxwvut/java-vim.git
6-
" Last Change: 2025 Sep 28
6+
" Last Change: 2025 Oct 04
77

88
" Please check ":help java.vim" for comments on some of the options
99
" available.
@@ -46,11 +46,18 @@ function! s:ff.RightConstant(x, y) abort
4646
return a:y
4747
endfunction
4848

49-
function! s:ff.IsAnyRequestedPreviewFeatureOf(ns) abort
50-
return exists("g:java_syntax_previews") &&
51-
\ !empty(filter(a:ns, printf('index(%s, v:val) + 1',
52-
\ string(g:java_syntax_previews))))
53-
endfunction
49+
if !empty(get(g:, 'java_syntax_previews', []))
50+
" Fold the value of "g:java_syntax_previews" in this function.
51+
exec printf("%s\n%s\n%s",
52+
\ 'function! s:ff.IsAnyRequestedPreviewFeatureOf(ns) abort',
53+
\ printf('return !empty(filter(a:ns, "index(%s, v:val) + 1"))',
54+
\ string(g:java_syntax_previews)),
55+
\ 'endfunction')
56+
else
57+
function! s:ff.IsAnyRequestedPreviewFeatureOf(dummy) abort
58+
return 0
59+
endfunction
60+
endif
5461

5562
if !exists("*s:ReportOnce")
5663
function s:ReportOnce(message) abort
@@ -233,7 +240,7 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
233240
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
234241
syn cluster javaClasses add=javaR_JavaLang
235242
hi def link javaR_JavaLang javaR_Java
236-
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
243+
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
237244
syn match javaC_JavaLang "\<System\>" " See javaDebug.
238245
" Generic non-interfaces:
239246
syn match javaC_JavaLang "\<Class\>"
@@ -242,13 +249,15 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
242249
syn match javaC_JavaLang "\<Enum\>"
243250
syn match javaC_JavaLang "\<ClassValue\>"
244251
exec 'syn match javaC_JavaLang "\%(\<Enum\.\)\@' . s:ff.Peek('5', '') . '<=\<EnumDesc\>"'
252+
syn match javaC_JavaLang "\<ScopedValue\>"
245253
" Member classes:
246254
exec 'syn match javaC_JavaLang "\%(\<Character\.\)\@' . s:ff.Peek('10', '') . '<=\<Subset\>"'
247255
exec 'syn match javaC_JavaLang "\%(\<Character\.\)\@' . s:ff.Peek('10', '') . '<=\<UnicodeBlock\>"'
248256
exec 'syn match javaC_JavaLang "\%(\<ProcessBuilder\.\)\@' . s:ff.Peek('15', '') . '<=\<Redirect\>"'
249257
exec 'syn match javaC_JavaLang "\%(\<ModuleLayer\.\)\@' . s:ff.Peek('12', '') . '<=\<Controller\>"'
250258
exec 'syn match javaC_JavaLang "\%(\<Runtime\.\)\@' . s:ff.Peek('8', '') . '<=\<Version\>"'
251259
exec 'syn match javaC_JavaLang "\%(\<System\.\)\@' . s:ff.Peek('7', '') . '<=\<LoggerFinder\>"'
260+
exec 'syn match javaC_JavaLang "\%(\<ScopedValue\.\)\@' . s:ff.Peek('12', '') . '<=\<Carrier\>"'
252261
" Member enumerations:
253262
exec 'syn match javaC_JavaLang "\%(\<Thread\.\)\@' . s:ff.Peek('7', '') . '<=\<State\>"'
254263
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("
275284
exec 'syn match javaI_JavaLang "\%(\<Thread\.\)\@' . s:ff.Peek('7', '') . '<=\<Builder\>"'
276285
exec 'syn match javaI_JavaLang "\%(\<Thread\.Builder\.\)\@' . s:ff.Peek('15', '') . '<=\<OfPlatform\>"'
277286
exec 'syn match javaI_JavaLang "\%(\<Thread\.Builder\.\)\@' . s:ff.Peek('15', '') . '<=\<OfVirtual\>"'
287+
exec 'syn match javaI_JavaLang "\%(\<ScopedValue\.\)\@' . s:ff.Peek('12', '') . '<=\<CallableOp\>"'
278288
syn cluster javaClasses add=javaI_JavaLang
279289
hi def link javaI_JavaLang javaI_Java
280290

@@ -302,12 +312,13 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
302312
syn match javaLangObject "\<toString\>"
303313
hi def link javaLangObject javaConstant
304314

315+
" As of JDK 25, RuntimePermission is deprecated for removal
316+
" (JDK-8353641).
317+
" (Note that SecurityException is still not deprecated.)
305318
" As of JDK 24, SecurityManager is rendered non-functional
306319
" (JDK-8338625).
307-
" (Note that SecurityException and RuntimePermission are still
308-
" not deprecated.)
309320
" As of JDK 21, Compiler is no more (JDK-8205129).
310-
syn keyword javaLangDeprecated Compiler SecurityManager
321+
syn keyword javaLangDeprecated Compiler SecurityManager RuntimePermission
311322
endif
312323

313324
runtime syntax/javaid.vim
@@ -350,7 +361,7 @@ endif
350361

351362
exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*::\@!"he=e-1'
352363

353-
if s:ff.IsAnyRequestedPreviewFeatureOf([455, 488])
364+
if s:ff.IsAnyRequestedPreviewFeatureOf([455, 488, 507])
354365
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaBoolean,javaNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaType,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
355366
else
356367
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaLabelDefault,javaLabelVarType,javaLabelWhenClause

runtime/syntax/testdir/dumps/java_previews_455_00.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
>/+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
1+
>/+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
22
@75
33
@75
44
@75

runtime/syntax/testdir/input/java_previews_455.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// VIM_TEST_SETUP let g:java_syntax_previews = [455, 488]
1+
// VIM_TEST_SETUP let g:java_syntax_previews = [455, 488, 507]
22

33

44

0 commit comments

Comments
 (0)