runtime(java): Optionally highlight parameterised types
In the presence of parameterised types whose names begin
with a capital letter and end with a less-than sign "<" that
introduces a type argument or a list of comma-separated type
arguments, followed by a greater-than sign ">", a variable
"g:java_highlight_generics" can be defined to have some
components of such types uniformly coloured (by picking
highlight groups for javaGenericsC{1,2}, javaWildcardBound).
For example,
------------------------------------------------------------
java.io.InputStream stream = java.io.InputStream.nullInputStream();
java.util.function.Function<String,
java.util.function.BiFunction<String, String, String>> updater =
property -> (oldValue, newValue) -> oldValue;
java.util.logging.LogManager.getLogManager()
.updateConfiguration(stream, updater);
------------------------------------------------------------
Note that the diamond form and explicit type arguments do
not qualify for this kind of recognition.
For example,
------------------------------------------------------------
new java.util.HashSet<>().<String>toArray(new String[0]);
------------------------------------------------------------
References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.5
https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.9
https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.12.2.1
closes: #15050
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-20 21:00:53 +02:00
|
|
|
| +0#00e0e07#ffffff0@7|E| |p|e@1|k|(|)|;+0#0000000&| @57
|
|
|
|
| +0#00e0e07&@7|E| |p|o|p|(|)|;+0#0000000&| @58
|
|
|
|
| +0#00e0e07&@7|S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|E+0#0000000#ffffff0|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|p|o|p|A|l@1|(|S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|?+0#0000000#ffffff0| +0#00e0e07&|s+0#00e0003&|u|p|e|r| +0#00e0e07&|E+0#0000000&|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|e|l|e|m|e|n|t|s|)|;+0#0000000&| @15
|
|
|
|
| +0#00e0e07&@7|S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|E+0#0000000#ffffff0|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|p|o|p|S|o|m|e|(|S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|?+0#0000000#ffffff0| +0#00e0e07&|s+0#00e0003&|u|p|e|r| +0#00e0e07&|E+0#0000000&|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|e|l|e|m|e|n|t|s|,| +0#0000000&@15
|
|
|
|
| +0#00e0e07&@19|P+0#0000001#ffff4012|r|e|d|i|c|a|t|e|<|?+0#0000000#ffffff0| +0#00e0e07&|s+0#00e0003&|u|p|e|r| +0#00e0e07&|E+0#0000000&|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|f|i|l|t|e|r|)|;+0#0000000&| @25
|
|
|
|
| +0#00e0e07&@7>S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|E+0#0000000#ffffff0|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|p|u|s|h|(|E| |e|l|e|m|e|n|t|)|;+0#0000000&| @37
|
|
|
|
| +0#00e0e07&@7|S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|E+0#0000000#ffffff0|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|p|u|s|h|A|l@1|(|I+0#0000001#ffff4012|t|e|r|a|b|l|e|<|?+0#0000000#ffffff0| +0#00e0e07&|e+0#00e0003&|x|t|e|n|d|s| +0#00e0e07&|E+0#0000000&|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|e|l|e|m|e|n|t|s|)|;+0#0000000&| @13
|
|
|
|
| +0#00e0e07&@7|S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|E+0#0000000#ffffff0|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|p|u|s|h|S|o|m|e|(|I+0#0000001#ffff4012|t|e|r|a|b|l|e|<|?+0#0000000#ffffff0| +0#00e0e07&|e+0#00e0003&|x|t|e|n|d|s| +0#00e0e07&|E+0#0000000&|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|e|l|e|m|e|n|t|s|,| +0#0000000&@13
|
|
|
|
| +0#00e0e07&@19|P+0#0000001#ffff4012|r|e|d|i|c|a|t|e|<|?+0#0000000#ffffff0| +0#00e0e07&|s+0#00e0003&|u|p|e|r| +0#00e0e07&|E+0#0000000&|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|f|i|l|t|e|r|)|;+0#0000000&| @25
|
|
|
|
| +0#00e0e07&@7|S+0#0000001#ffff4012|t|a|c|k|a|b|l|e|<|E+0#0000000#ffffff0|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|w|i|n|d|(|C+0#0000001#ffff4012|o|n|s|u|m|e|r|<|?+0#0000000#ffffff0| +0#00e0e07&|s+0#00e0003&|u|p|e|r| +0#00e0e07&|S+0#ffffff16#ff404010|t|a|c|k|a|b|l|e|<|E+0#0000000#ffffff0|>+0#ffffff16#ff404010|>+0#0000001#ffff4012| +0#00e0e07#ffffff0|a|c|t|i|o|n|)|;+0#0000000&| @9
|
|
|
|
@4|}| @69
|
|
|
|
@75
|
2024-09-15 19:53:50 +02:00
|
|
|
@4|s+0#00e0003&|e|a|l|e|d| +0#0000000&|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|N+0#0000001#ffff4012|u|m|<|N+0#0000000#ffffff0| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|N|u|m|b|e|r|>+0#0000001#ffff4012| +0#0000000#ffffff0@32
|
runtime(java): Optionally highlight parameterised types
In the presence of parameterised types whose names begin
with a capital letter and end with a less-than sign "<" that
introduces a type argument or a list of comma-separated type
arguments, followed by a greater-than sign ">", a variable
"g:java_highlight_generics" can be defined to have some
components of such types uniformly coloured (by picking
highlight groups for javaGenericsC{1,2}, javaWildcardBound).
For example,
------------------------------------------------------------
java.io.InputStream stream = java.io.InputStream.nullInputStream();
java.util.function.Function<String,
java.util.function.BiFunction<String, String, String>> updater =
property -> (oldValue, newValue) -> oldValue;
java.util.logging.LogManager.getLogManager()
.updateConfiguration(stream, updater);
------------------------------------------------------------
Note that the diamond form and explicit type arguments do
not qualify for this kind of recognition.
For example,
------------------------------------------------------------
new java.util.HashSet<>().<String>toArray(new String[0]);
------------------------------------------------------------
References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.5
https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.9
https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.12.2.1
closes: #15050
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-20 21:00:53 +02:00
|
|
|
@4|{| @69
|
|
|
|
| +0#00e0e07&@7|i+0#00e0003&|n|t| +0#00e0e07&|r|a|d|i|x|(|)|;+0#0000000&| @54
|
|
|
|
| +0#00e0e07&@7|N| |v|a|l|u|e|(|)|;+0#0000000&| @56
|
|
|
|
@4|}| @69
|
|
|
|
@75
|
|
|
|
@4|r+0#00e0003&|e|c|o|r|d| +0#0000000&|B+0#0000001#ffff4012|i|n|<|N+0#0000000#ffffff0| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|N|u|m|b|e|r|>+0#0000001#ffff4012|(+0#0000000#ffffff0|N| |v|a|l|u|e|)| |i+0#00e0003&|m|p|l|e|m|e|n|t|s| +0#0000000&|N+0#0000001#ffff4012|u|m|<|N+0#0000000#ffffff0|>+0#0000001#ffff4012| +0#0000000#ffffff0@15
|
|
|
|
@57|5@1|,|3|-|9| @7|4|0|%|
|