Skip to content

New java keywords

Hello. I guess very few people use GtkSourceView for Java, but I do use gedit for Java. Actually I hate Java and heavy editors, I prefer simple and classic (but yet with quite modern features) text editors, and Java is used in my studies.

Studying the keywords listed here: https://docs.oracle.com/javase/specs/jls/se19/html/jls-3.html#jls-3.9
your java.lang file included all the ‘reserved keywords’ but the underscore, and none of the ‘contextual keywords’. I hope my change is okay — well, the doc says that these new keywords may be interpreted as identifiers in some contexts (for backward compatibility of course), but I think it is at least an improvement to include them in java.lang. I use much the var keyword (like I use auto in C++), and sometimes record.

Also, I added a matcher for Java annotations (like @Override or @SuppressWarnings("something")).

I’ve tested the file (I edited directly /usr/share/gtksourceview-4/language-specs/java.lang on my system).

I also noticed that the regexps for numeric constants had to be swapped to work correctly — that’s strange, is it intended?

(I don’t know if it’s best practice to ‘squash’ my commits.)

Thank you for providing good free software.

Merge request reports