mirror of
https://github.com/vim/vim
synced 2025-07-16 01:01:58 +00:00
runtime(java): Make changes for JDK 24 in syntax script
- "Demote" SecurityManager from the list of java.lang class types to javaLangDeprecated. - Reintroduce supported syntax-preview-feature numbers 455 and 476 as _new numbers_ 488 and 494, respectively. References: - https://openjdk.org/jeps/486 (Permanently Disable the Security Manager) - https://openjdk.org/jeps/488 (Primitive Types in Patterns etc.) - https://openjdk.org/jeps/494 (Module Import Declarations) closes: #16977 Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
f2b16986a1
commit
1054b18291
@ -1,4 +1,4 @@
|
|||||||
*syntax.txt* For Vim version 9.1. Last change: 2025 Mar 26
|
*syntax.txt* For Vim version 9.1. Last change: 2025 Mar 27
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -2202,12 +2202,12 @@ 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
|
withdrawn from this effort. To cater for early adopters, there is optional
|
||||||
support in Vim for syntax related preview features that are implemented. You
|
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: >
|
can request it by specifying a list of preview feature numbers as follows: >
|
||||||
:let g:java_syntax_previews = [455, 476]
|
:let g:java_syntax_previews = [488, 494]
|
||||||
|
|
||||||
The supported JEP numbers are to be drawn from this table:
|
The supported JEP numbers are to be drawn from this table:
|
||||||
`430`: String Templates [JDK 21]
|
`430`: String Templates [JDK 21]
|
||||||
`455`: Primitive types in Patterns, instanceof, and switch
|
`488`: Primitive types in Patterns, instanceof, and switch
|
||||||
`476`: Module Import Declarations
|
`494`: Module Import Declarations
|
||||||
|
|
||||||
Note that as soon as the particular preview feature will have been integrated
|
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
|
into the Java platform, its entry will be removed from the table and related
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
|
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
|
||||||
" Former Maintainer: Claudio Fleiner <claudio@fleiner.com>
|
" Former Maintainer: Claudio Fleiner <claudio@fleiner.com>
|
||||||
" Repository: https://github.com/zzzyxwvut/java-vim.git
|
" Repository: https://github.com/zzzyxwvut/java-vim.git
|
||||||
" Last Change: 2025 Jan 02
|
" Last Change: 2025 Mar 26
|
||||||
|
|
||||||
" Please check ":help java.vim" for comments on some of the options
|
" Please check ":help java.vim" for comments on some of the options
|
||||||
" available.
|
" available.
|
||||||
@ -46,8 +46,10 @@ function! s:ff.RightConstant(x, y) abort
|
|||||||
return a:y
|
return a:y
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:ff.IsRequestedPreviewFeature(n) abort
|
function! s:ff.IsAnyRequestedPreviewFeatureOf(ns) abort
|
||||||
return exists("g:java_syntax_previews") && index(g:java_syntax_previews, a:n) + 1
|
return exists("g:java_syntax_previews") &&
|
||||||
|
\ !empty(filter(a:ns, printf('index(%s, v:val) + 1',
|
||||||
|
\ string(g:java_syntax_previews))))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if !exists("*s:ReportOnce")
|
if !exists("*s:ReportOnce")
|
||||||
@ -108,7 +110,7 @@ syn keyword javaTypedef this super
|
|||||||
syn keyword javaOperator new instanceof
|
syn keyword javaOperator new instanceof
|
||||||
syn match javaOperator "\<var\>\%(\s*(\)\@!"
|
syn match javaOperator "\<var\>\%(\s*(\)\@!"
|
||||||
|
|
||||||
if s:ff.IsRequestedPreviewFeature(476)
|
if s:ff.IsAnyRequestedPreviewFeatureOf([476, 494])
|
||||||
" Module imports can be used in any source file.
|
" Module imports can be used in any source file.
|
||||||
syn match javaExternal "\<import\s\+module\>" contains=javaModuleImport
|
syn match javaExternal "\<import\s\+module\>" contains=javaModuleImport
|
||||||
syn keyword javaModuleImport contained module
|
syn keyword javaModuleImport contained module
|
||||||
@ -262,8 +264,12 @@ if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("
|
|||||||
syn keyword javaC_JavaLang Class InheritableThreadLocal ThreadLocal Enum ClassValue
|
syn keyword javaC_JavaLang Class InheritableThreadLocal ThreadLocal Enum ClassValue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" As of JDK 21, java.lang.Compiler is no more (deprecated in JDK 9).
|
" As of JDK 24, SecurityManager is rendered non-functional
|
||||||
syn keyword javaLangDeprecated Compiler
|
" (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 cluster javaClasses add=javaC_JavaLang
|
syn cluster javaClasses add=javaC_JavaLang
|
||||||
hi def link javaC_JavaLang javaC_Java
|
hi def link javaC_JavaLang javaC_Java
|
||||||
syn keyword javaE_JavaLang AbstractMethodError ClassCircularityError ClassFormatError Error IllegalAccessError IncompatibleClassChangeError InstantiationError InternalError LinkageError NoClassDefFoundError NoSuchFieldError NoSuchMethodError OutOfMemoryError StackOverflowError ThreadDeath UnknownError UnsatisfiedLinkError VerifyError VirtualMachineError ExceptionInInitializerError UnsupportedClassVersionError AssertionError BootstrapMethodError
|
syn keyword javaE_JavaLang AbstractMethodError ClassCircularityError ClassFormatError Error IllegalAccessError IncompatibleClassChangeError InstantiationError InternalError LinkageError NoClassDefFoundError NoSuchFieldError NoSuchMethodError OutOfMemoryError StackOverflowError ThreadDeath UnknownError UnsatisfiedLinkError VerifyError VirtualMachineError ExceptionInInitializerError UnsupportedClassVersionError AssertionError BootstrapMethodError
|
||||||
@ -311,7 +317,7 @@ endif
|
|||||||
|
|
||||||
exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*::\@!"he=e-1'
|
exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*::\@!"he=e-1'
|
||||||
|
|
||||||
if s:ff.IsRequestedPreviewFeature(455)
|
if s:ff.IsAnyRequestedPreviewFeatureOf([455, 488])
|
||||||
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaBoolean,javaNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaType,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
|
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaBoolean,javaNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaType,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
|
||||||
else
|
else
|
||||||
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
|
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
|
||||||
@ -609,7 +615,7 @@ syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaS
|
|||||||
syn region javaString start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell
|
syn region javaString start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell
|
||||||
syn match javaTextBlockError +"""\s*"""+
|
syn match javaTextBlockError +"""\s*"""+
|
||||||
|
|
||||||
if s:ff.IsRequestedPreviewFeature(430)
|
if s:ff.IsAnyRequestedPreviewFeatureOf([430])
|
||||||
syn region javaStrTemplEmbExp contained matchgroup=javaStrTempl start="\\{" end="}" contains=TOP
|
syn region javaStrTemplEmbExp contained matchgroup=javaStrTempl start="\\{" end="}" contains=TOP
|
||||||
exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="+ end=+"+ contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,@Spell'
|
exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="+ end=+"+ contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,@Spell'
|
||||||
exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell'
|
exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell'
|
||||||
@ -688,7 +694,7 @@ if exists("g:java_highlight_debug")
|
|||||||
syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial
|
syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial
|
||||||
syn region javaDebugString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugSpecial,javaDebugTextBlockError
|
syn region javaDebugString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugSpecial,javaDebugTextBlockError
|
||||||
|
|
||||||
if s:ff.IsRequestedPreviewFeature(430)
|
if s:ff.IsAnyRequestedPreviewFeatureOf([430])
|
||||||
" The highlight groups of java{StrTempl,Debug{,Paren,StrTempl}}\,
|
" The highlight groups of java{StrTempl,Debug{,Paren,StrTempl}}\,
|
||||||
" share one colour by default. Do not conflate unrelated parens.
|
" share one colour by default. Do not conflate unrelated parens.
|
||||||
syn region javaDebugStrTemplEmbExp contained matchgroup=javaDebugStrTempl start="\\{" end="}" contains=javaComment,javaLineComment,javaDebug\%(Paren\)\@!.*
|
syn region javaDebugStrTemplEmbExp contained matchgroup=javaDebugStrTempl start="\\{" end="}" contains=javaComment,javaLineComment,javaDebug\%(Paren\)\@!.*
|
||||||
|
@ -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|]| +0#0000000&@22
|
>/+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
|
||||||
@75
|
@75
|
||||||
@75
|
@75
|
||||||
@75
|
@75
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// VIM_TEST_SETUP let g:java_syntax_previews = [455]
|
// VIM_TEST_SETUP let g:java_syntax_previews = [455, 488]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,4 +29,4 @@ autocmd_add([{
|
|||||||
once: true,
|
once: true,
|
||||||
}])
|
}])
|
||||||
|
|
||||||
g:java_syntax_previews = [476]
|
g:java_syntax_previews = [476, 494]
|
||||||
|
Reference in New Issue
Block a user