mirror of
https://github.com/git/git
synced 2024-08-28 12:09:19 +00:00
Merge branch 'ar/userdiff-java-update'
Userdiff regexp update for Java language. * ar/userdiff-java-update: userdiff: support Java sealed classes userdiff: support Java record types userdiff: support Java type parameters
This commit is contained in:
commit
4a6e6b0d5b
6
t/t4018/java-class-brace-on-separate-line
Normal file
6
t/t4018/java-class-brace-on-separate-line
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class RIGHT
|
||||||
|
{
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-class-space-before-type-parameters
Normal file
6
t/t4018/java-class-space-before-type-parameters
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class RIGHT <TYPE, PARAMS, AFTER, SPACE> {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private A ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-class-type-parameters
Normal file
6
t/t4018/java-class-type-parameters
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class RIGHT<A, B> {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private A ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-class-type-parameters-implements
Normal file
6
t/t4018/java-class-type-parameters-implements
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class RIGHT<A, B> implements List<A> {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private A ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-interface-type-parameters
Normal file
6
t/t4018/java-interface-type-parameters
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
interface RIGHT<A, B> {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
public B foo(A ChangeMe);
|
||||||
|
}
|
6
t/t4018/java-interface-type-parameters-extends
Normal file
6
t/t4018/java-interface-type-parameters-extends
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
interface RIGHT<A, B> extends Function<A, B> {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
public B foo(A ChangeMe);
|
||||||
|
}
|
8
t/t4018/java-non-sealed
Normal file
8
t/t4018/java-non-sealed
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
public abstract sealed class SealedClass {
|
||||||
|
public static non-sealed class RIGHT extends SealedClass {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private int ChangeMe;
|
||||||
|
}
|
||||||
|
}
|
6
t/t4018/java-record
Normal file
6
t/t4018/java-record
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public record RIGHT(int comp1, double comp2, String comp3) {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
static int ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-record-space-before-components
Normal file
6
t/t4018/java-record-space-before-components
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public record RIGHT (String components, String after, String space) {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
static int ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-record-type-parameters
Normal file
6
t/t4018/java-record-type-parameters
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public record RIGHT<A, N extends Number>(A comp1, N comp2, int comp3) {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
static int ChangeMe;
|
||||||
|
}
|
7
t/t4018/java-sealed
Normal file
7
t/t4018/java-sealed
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
public abstract sealed class Sealed { // RIGHT
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
public final class ChangeMe extends Sealed {
|
||||||
|
}
|
||||||
|
}
|
6
t/t4018/java-sealed-permits
Normal file
6
t/t4018/java-sealed-permits
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public abstract sealed class RIGHT permits PermittedA, PermittedB {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private int ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-sealed-type-parameters
Normal file
6
t/t4018/java-sealed-type-parameters
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public abstract sealed class RIGHT<A, B> {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private int ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-sealed-type-parameters-implements-permits
Normal file
6
t/t4018/java-sealed-type-parameters-implements-permits
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public abstract sealed class RIGHT<A, B> implements List<A> permits PermittedA, PermittedB {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private int ChangeMe;
|
||||||
|
}
|
6
t/t4018/java-sealed-type-parameters-permits
Normal file
6
t/t4018/java-sealed-type-parameters-permits
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public abstract sealed class RIGHT<A, B> permits PermittedA, PermittedB {
|
||||||
|
static int ONE;
|
||||||
|
static int TWO;
|
||||||
|
static int THREE;
|
||||||
|
private int ChangeMe;
|
||||||
|
}
|
|
@ -170,8 +170,8 @@ PATTERNS("html",
|
||||||
"[^<>= \t]+"),
|
"[^<>= \t]+"),
|
||||||
PATTERNS("java",
|
PATTERNS("java",
|
||||||
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
|
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
|
||||||
/* Class, enum, and interface declarations */
|
/* Class, enum, interface, and record declarations */
|
||||||
"^[ \t]*(([a-z]+[ \t]+)*(class|enum|interface)[ \t]+[A-Za-z][A-Za-z0-9_$]*[ \t]+.*)$\n"
|
"^[ \t]*(([a-z-]+[ \t]+)*(class|enum|interface|record)[ \t]+.*)$\n"
|
||||||
/* Method definitions; note that constructor signatures are not */
|
/* Method definitions; note that constructor signatures are not */
|
||||||
/* matched because they are indistinguishable from method calls. */
|
/* matched because they are indistinguishable from method calls. */
|
||||||
"^[ \t]*(([A-Za-z_<>&][][?&<>.,A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$",
|
"^[ \t]*(([A-Za-z_<>&][][?&<>.,A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$",
|
||||||
|
|
Loading…
Reference in a new issue