0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

runtime(java): Match raw-, non-generic-, and generic-type names of "java.lang"

And only match innermost element types of parameterised
array types.

References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.8
https://docs.oracle.com/javase/specs/jls/se21/html/jls-6.html#jls-6.1
https://docs.oracle.com/javase/specs/jls/se21/html/jls-10.html

closes: #17499

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Aliaksei Budavei
2025-06-10 20:37:39 +02:00
committed by Christian Brabandt
parent 572d46035f
commit c413ac7068
27 changed files with 310 additions and 245 deletions

View File

@@ -1,8 +1,13 @@
// VIM_TEST_SETUP let g:java_highlight_functions = 'style'
// VIM_TEST_SETUP let g:java_highlight_generics = 1
// VIM_TEST_SETUP let g:java_highlight_java_lang = 1
// VIM_TEST_SETUP hi link javaGenericsC1 Todo
// VIM_TEST_SETUP hi link javaGenericsC2 Error
import java.math.BigInteger;
import java.util.function.Consumer;
import java.util.function.Function;
@@ -109,6 +114,17 @@ class GenericsTests<T extends Number & Comparable<? super T>, U>
}, x.radix());
}
static Class<?> eitherComparableOrIterable(Object o)
{
final boolean comparable;
return ((comparable = o instanceof Comparable) ^
o instanceof Iterable)
? (comparable)
? Comparable.class
: Iterable.class
: java.lang.Class.class;
}
@java.lang.annotation.Target(
java.lang.annotation.ElementType.TYPE_USE)
@interface Taggable