git/t/t4018
Andrei Rybak 93d52ed050 userdiff: support Java sealed classes
A new kind of class was added in Java 17 -- sealed classes.[1]  This
feature includes several new keywords that may appear in a declaration
of a class.  New modifiers before name of the class: "sealed" and
"non-sealed", and a clause after name of the class marked by keyword
"permits".

The current set of regular expressions in userdiff.c already allows the
modifier "sealed" and the "permits" clause, but not the modifier
"non-sealed", which is the first hyphenated keyword in Java.[2]  Allow
hyphen in the words that precede the name of type to match the
"non-sealed" modifier.

In new input file "java-sealed" for the test t4018-diff-funcname.sh, use
a Java code comment for the marker "RIGHT".  This workaround is needed,
because the name of the sealed class appears on the line of code that
has the "ChangeMe" marker.

[1] Detailed description in "JEP 409: Sealed Classes"
    https://openjdk.org/jeps/409
[2] "JEP draft: Keyword Management for the Java Language"
    https://openjdk.org/jeps/8223002

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-02-08 12:57:13 -08:00
..
README
bash-arithmetic-function
bash-bashism-style-compact
bash-bashism-style-function
bash-bashism-style-whitespace
bash-conditional-function
bash-missing-parentheses
bash-mixed-style-compact
bash-mixed-style-function
bash-nested-functions
bash-other-characters
bash-posix-style-compact
bash-posix-style-function
bash-posix-style-whitespace
bash-subshell-function
bash-trailing-comment
cpp-c++-function
cpp-class-constructor
cpp-class-constructor-mem-init
cpp-class-definition
cpp-class-definition-derived
cpp-class-destructor
cpp-function-returning-global-type
cpp-function-returning-nested
cpp-function-returning-pointer
cpp-function-returning-reference
cpp-gnu-style-function
cpp-namespace-definition
cpp-operator-definition
cpp-skip-access-specifiers
cpp-skip-comment-block
cpp-skip-labels
cpp-struct-definition
cpp-struct-single-line
cpp-template-function-definition
cpp-union-definition
cpp-void-c-function
css-attribute-value-selector
css-block-level-@-statements
css-brace-in-col-1
css-class-selector
css-colon-eol
css-colon-selector
css-common
css-id-selector
css-long-selector-list
css-prop-sans-indent
css-root-selector
css-short-selector-list
css-trailing-space
custom1-pattern
custom2-match-to-end-of-line
custom3-alternation-in-pattern
dts-labels
dts-node-unitless
dts-nodes
dts-nodes-boolean-prop
dts-nodes-comment1
dts-nodes-comment2
dts-nodes-multiline-prop
dts-reference
dts-root
dts-root-comment
elixir-do-not-pick-end
elixir-ex-unit-test
elixir-function
elixir-macro
elixir-module
elixir-module-func
elixir-nested-module
elixir-private-function
elixir-protocol
elixir-protocol-implementation
fortran-block-data
fortran-comment
fortran-comment-keyword
fortran-comment-legacy
fortran-comment-legacy-star
fortran-external-function
fortran-external-subroutine
fortran-module
fortran-module-procedure
fortran-program
fountain-scene
golang-complex-function
golang-func
golang-interface
golang-long-func
golang-struct
java-class-brace-on-separate-line
java-class-member-function
java-class-space-before-type-parameters
java-class-type-parameters
java-class-type-parameters-implements
java-enum-constant
java-interface-type-parameters
java-interface-type-parameters-extends
java-method-return-generic-bounded
java-method-return-generic-wildcard
java-nested-field
java-non-sealed userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-record userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-record-space-before-components userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-record-type-parameters userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-sealed userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters-implements-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
kotlin-class
kotlin-enum-class
kotlin-fun
kotlin-inheritace-class
kotlin-inline-class
kotlin-interface
kotlin-nested-fun
kotlin-public-class
kotlin-sealed-class
markdown-heading-indented
markdown-heading-non-headings
matlab-class-definition
matlab-function
matlab-octave-section-1
matlab-octave-section-2
matlab-section
perl-skip-end-of-heredoc
perl-skip-forward-decl
perl-skip-sub-in-pod
perl-sub-definition
perl-sub-definition-kr-brace
php-abstract-class
php-abstract-method
php-class
php-enum
php-final-class
php-final-method
php-function
php-interface
php-method
php-trait
python-async-def
python-class
python-def
python-indented-async-def
python-indented-class
python-indented-def
rust-fn
rust-impl
rust-macro-rules
rust-struct
rust-trait
scheme-class
scheme-def
scheme-def-variant
scheme-define-slash-public
scheme-define-syntax
scheme-define-variant
scheme-library
scheme-local-define
scheme-module
scheme-top-level-define
scheme-user-defined-define

README

How to write RIGHT test cases
=============================

Insert the word "ChangeMe" (exactly this form) at a distance of
at least two lines from the line that must appear in the hunk header.

The text that must appear in the hunk header must contain the word
"right", but in all upper-case, like in the title above.

This text is a bit twisted and out of order, but it is itself a
test case for the default hunk header pattern. Know what you are doing
if you change it.

BTW, this tests that the head line goes to the hunk header, not the line
of equal signs.