From b4e83536273f228996124a33c52221ed0d0c0299 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 20 Jun 2026 11:12:31 +0100 Subject: Introduce Java identifier --- .../output/lang/java/JavaGeneratorTests.java | 17 +- .../compiler/output/lang/java/JavaWriterTests.java | 198 +++++++++++---------- .../lang/java/ast/JavaClassDeclarationMatcher.java | 2 +- .../lang/java/ast/JavaCompilationUnitMatcher.java | 2 +- .../ast/JavaConstructorDeclarationMatcher.java | 2 +- .../lang/java/ast/JavaEnumConstantMatcher.java | 2 +- .../lang/java/ast/JavaEnumDeclarationMatcher.java | 2 +- .../lang/java/ast/JavaFieldAccessMatcher.java | 2 +- .../lang/java/ast/JavaFieldDeclarationMatcher.java | 2 +- .../lang/java/ast/JavaIdentifierMatcher.java | 34 ++++ .../java/ast/JavaInterfaceDeclarationMatcher.java | 2 +- .../lang/java/ast/JavaMethodCallMatcher.java | 2 +- .../java/ast/JavaMethodDeclarationMatcher.java | 2 +- .../output/lang/java/ast/JavaMethodRefMatcher.java | 2 +- .../output/lang/java/ast/JavaParamMatcher.java | 2 +- .../lang/java/ast/JavaRecordComponentMatcher.java | 2 +- .../java/ast/JavaRecordDeclarationMatcher.java | 2 +- .../output/lang/java/ast/JavaRefMatcher.java | 2 +- .../java/ast/JavaStaticFieldAccessMatcher.java | 2 +- .../lang/java/ast/JavaStaticMethodCallMatcher.java | 2 +- 20 files changed, 164 insertions(+), 119 deletions(-) create mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaIdentifierMatcher.java (limited to 'src/test/java/org') diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java index d7c3eeb..a99995b 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test; import org.zwobble.hobgoblin.compiler.output.generators.java.JavaGenerator; import org.zwobble.hobgoblin.compiler.output.generators.java.JavaGeneratorConfig; import org.zwobble.hobgoblin.compiler.output.generators.java.JavaNamespaceConfig; +import org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier; import org.zwobble.hobgoblin.compiler.types.NamespaceName; import java.util.List; @@ -16,7 +17,7 @@ public class JavaGeneratorTests { @Test public void defaultJavaPackageIsUsedForNamespacesWithoutExplicitMapping() { var config = new JavaGeneratorConfig( - List.of("com", "example"), + List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), Map.of(), Map.of() ); @@ -24,17 +25,17 @@ public class JavaGeneratorTests { var result = generator.namespaceToJavaPackageParts(NamespaceName.of("a", "b")); - assertThat(result, equalTo(List.of("com", "example", "a", "b"))); + assertThat(result, equalTo(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example"), JavaIdentifier.of("a"), JavaIdentifier.of("b")))); } @Test public void explicitJavaPackageIsUsedForNamespaceWhenExactNamespaceHasMapping() { var config = new JavaGeneratorConfig( - List.of("com", "example"), + List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), Map.ofEntries( Map.entry( NamespaceName.of("a", "b"), - new JavaNamespaceConfig(List.of("com", "other")) + new JavaNamespaceConfig(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("other"))) ) ), Map.of() @@ -43,17 +44,17 @@ public class JavaGeneratorTests { var result = generator.namespaceToJavaPackageParts(NamespaceName.of("a", "b")); - assertThat(result, equalTo(List.of("com", "other"))); + assertThat(result, equalTo(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("other")))); } @Test public void explicitJavaPackageIsUsedForNamespaceWhenAncestorNamespaceHasMapping() { var config = new JavaGeneratorConfig( - List.of("com", "example"), + List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), Map.ofEntries( Map.entry( NamespaceName.of("a", "b"), - new JavaNamespaceConfig(List.of("com", "other")) + new JavaNamespaceConfig(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("other"))) ) ), Map.of() @@ -62,6 +63,6 @@ public class JavaGeneratorTests { var result = generator.namespaceToJavaPackageParts(NamespaceName.of("a", "b", "c", "d")); - assertThat(result, equalTo(List.of("com", "other", "c", "d"))); + assertThat(result, equalTo(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("other"), JavaIdentifier.of("c"), JavaIdentifier.of("d")))); } } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java index 78b975d..ec09b72 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java @@ -19,12 +19,12 @@ public class JavaWriterTests { @Test public void compilationUnit() throws IOException { var java = new JavaCompilationUnit( - List.of("com", "example", "shapes"), + List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example"), JavaIdentifier.of("shapes")), new JavaClassDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ) ); @@ -47,10 +47,10 @@ public class JavaWriterTests { @Test public void emptyClassDeclaration() throws IOException { var java = new JavaClassDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ); @@ -67,12 +67,15 @@ public class JavaWriterTests { @Test public void classDeclarationImplementingSingleInterface() throws IOException { var java = new JavaClassDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of( - JavaTypeRef.topLevel(List.of("com.example"), "Shape") + JavaTypeRef.topLevel( + List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), + JavaIdentifier.of("Shape") + ) ), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ); @@ -89,13 +92,13 @@ public class JavaWriterTests { @Test public void classDeclarationImplementingMultipleInterfaces() throws IOException { var java = new JavaClassDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of( - JavaTypeRef.topLevel(List.of("com.example"), "Shape"), - JavaTypeRef.topLevel(List.of("com.example"), "Drawable") + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), JavaIdentifier.of("Shape")), + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), JavaIdentifier.of("Drawable")) ), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ); @@ -112,11 +115,11 @@ public class JavaWriterTests { @Test public void classDeclarationWithMethods() throws IOException { var java = new JavaClassDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of(), List.of( new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -124,7 +127,7 @@ public class JavaWriterTests { JavaBlock.EMPTY ), new JavaMethodDeclaration( - "b", + JavaIdentifier.of("b"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -132,7 +135,7 @@ public class JavaWriterTests { JavaBlock.EMPTY ) ), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ); @@ -155,10 +158,10 @@ public class JavaWriterTests { @Test public void classDeclarationWithDocComment() throws IOException { var java = new JavaClassDeclaration( - "Point", + JavaIdentifier.of("Point"), List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Point"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Point")), "body"), new DocComment("A 2D point.") ); @@ -176,8 +179,8 @@ public class JavaWriterTests { @Test public void emptyEnumDeclaration() throws IOException { var java = JavaEnumDeclaration.arbitrary() - .withName("SmallNumber") - .withCustomArea(JavaCustomArea.forType(JavaTypeRef.topLevel(List.of(), "SmallNumber"), "body")) + .withName(JavaIdentifier.of("SmallNumber")) + .withCustomArea(JavaCustomArea.forType(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("SmallNumber")), "body")) .build(); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -193,12 +196,12 @@ public class JavaWriterTests { @Test public void enumDeclarationWithConstants() throws IOException { var java = JavaEnumDeclaration.arbitrary() - .withName("SmallNumber") - .withCustomArea(JavaCustomArea.forType(JavaTypeRef.topLevel(List.of(), "SmallNumber"), "body")) + .withName(JavaIdentifier.of("SmallNumber")) + .withCustomArea(JavaCustomArea.forType(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("SmallNumber")), "body")) .withConstants(List.of( - JavaEnumConstant.arbitrary().withName("ZERO").build(), - JavaEnumConstant.arbitrary().withName("ONE").build(), - JavaEnumConstant.arbitrary().withName("TWO").build() + JavaEnumConstant.arbitrary().withName(JavaIdentifier.of("ZERO")).build(), + JavaEnumConstant.arbitrary().withName(JavaIdentifier.of("ONE")).build(), + JavaEnumConstant.arbitrary().withName(JavaIdentifier.of("TWO")).build() )) .build(); @@ -219,9 +222,9 @@ public class JavaWriterTests { @Test public void enumDeclarationWithDocComment() throws IOException { var java = JavaEnumDeclaration.arbitrary() - .withName("SmallNumber") + .withName(JavaIdentifier.of("SmallNumber")) .withDocComment(new DocComment("A small number.")) - .withCustomArea(JavaCustomArea.forType(JavaTypeRef.topLevel(List.of(), "SmallNumber"), "body")) + .withCustomArea(JavaCustomArea.forType(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("SmallNumber")), "body")) .build(); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -238,11 +241,11 @@ public class JavaWriterTests { @Test public void openInterfaceDeclaration() throws IOException { var java = new JavaInterfaceDeclaration( - "Shape", + JavaIdentifier.of("Shape"), JavaInterfaceOpenness.OPEN, List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Shape"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Shape")), "body"), DocComment.EMPTY ); @@ -259,11 +262,11 @@ public class JavaWriterTests { @Test public void sealedInterfaceDeclaration() throws IOException { var java = new JavaInterfaceDeclaration( - "Shape", + JavaIdentifier.of("Shape"), JavaInterfaceOpenness.SEALED, List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Shape"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Shape")), "body"), DocComment.EMPTY ); @@ -280,14 +283,14 @@ public class JavaWriterTests { @Test public void sealedInterfaceDeclarationWithPermitsTypes() throws IOException { var java = new JavaInterfaceDeclaration( - "Shape", + JavaIdentifier.of("Shape"), JavaInterfaceOpenness.SEALED, List.of( - JavaTypeRef.topLevel(List.of("abc", "def"), "One"), - JavaTypeRef.topLevel(List.of("abc", "def"), "Two") + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("abc"), JavaIdentifier.of("def")), JavaIdentifier.of("One")), + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("abc"), JavaIdentifier.of("def")), JavaIdentifier.of("Two")) ), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Shape"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Shape")), "body"), DocComment.EMPTY ); @@ -304,11 +307,11 @@ public class JavaWriterTests { @Test public void interfaceDeclarationWithDocComment() throws IOException { var java = new JavaInterfaceDeclaration( - "Shape", + JavaIdentifier.of("Shape"), JavaInterfaceOpenness.OPEN, List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Shape"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Shape")), "body"), new DocComment("A 2D shape.") ); @@ -326,12 +329,12 @@ public class JavaWriterTests { @Test public void interfaceDeclarationWithBody() throws IOException { var java = new JavaInterfaceDeclaration( - "Shape", + JavaIdentifier.of("Shape"), JavaInterfaceOpenness.OPEN, List.of(), List.of( new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.STATIC, JavaTypeRef.VOID, @@ -339,7 +342,7 @@ public class JavaWriterTests { JavaBlock.EMPTY ), new JavaMethodDeclaration( - "b", + JavaIdentifier.of("b"), JavaVisibility.PUBLIC, JavaMethodKind.STATIC, JavaTypeRef.VOID, @@ -347,7 +350,7 @@ public class JavaWriterTests { JavaBlock.EMPTY ) ), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Shape"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Shape")), "body"), DocComment.EMPTY ); @@ -370,11 +373,11 @@ public class JavaWriterTests { @Test public void emptyRecordDeclaration() throws IOException { var java = new JavaRecordDeclaration( - "Point", + JavaIdentifier.of("Point"), List.of(), List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Point"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Point")), "body"), DocComment.EMPTY ); @@ -391,11 +394,11 @@ public class JavaWriterTests { @Test public void recordDeclarationWithDocComment() throws IOException { var java = new JavaRecordDeclaration( - "Point", + JavaIdentifier.of("Point"), List.of(), List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Point"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Point")), "body"), new DocComment("A 2D point.") ); @@ -413,13 +416,13 @@ public class JavaWriterTests { @Test public void recordDeclarationImplementingOneInterface() throws IOException { var java = new JavaRecordDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of(), List.of( - JavaTypeRef.topLevel(List.of("com.example"), "Shape") + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), JavaIdentifier.of("Shape")) ), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ); @@ -436,14 +439,14 @@ public class JavaWriterTests { @Test public void recordDeclarationImplementingMultipleInterfaces() throws IOException { var java = new JavaRecordDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of(), List.of( - JavaTypeRef.topLevel(List.of("com.example"), "Shape"), - JavaTypeRef.topLevel(List.of("com.example"), "Drawable") + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), JavaIdentifier.of("Shape")), + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("com"), JavaIdentifier.of("example")), JavaIdentifier.of("Drawable")) ), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ); @@ -460,12 +463,12 @@ public class JavaWriterTests { @Test public void recordDeclarationWithMethods() throws IOException { var java = new JavaRecordDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), List.of(), List.of(), List.of( new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -473,7 +476,7 @@ public class JavaWriterTests { JavaBlock.EMPTY ), new JavaMethodDeclaration( - "b", + JavaIdentifier.of("b"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -481,7 +484,7 @@ public class JavaWriterTests { JavaBlock.EMPTY ) ), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Rectangle"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Rectangle")), "body"), DocComment.EMPTY ); @@ -504,7 +507,7 @@ public class JavaWriterTests { @Test public void emptyMethodWithoutBody() throws IOException { var java = new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -522,7 +525,7 @@ public class JavaWriterTests { @Test public void emptyInstanceMethod() throws IOException { var java = new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -541,7 +544,7 @@ public class JavaWriterTests { @Test public void publicInstanceMethod() throws IOException { var java = new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -560,7 +563,7 @@ public class JavaWriterTests { @Test public void privateInstanceMethod() throws IOException { var java = new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PRIVATE, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, @@ -579,7 +582,7 @@ public class JavaWriterTests { @Test public void emptyStaticMethod() throws IOException { var java = new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.STATIC, JavaTypeRef.VOID, @@ -598,13 +601,13 @@ public class JavaWriterTests { @Test public void methodWithParams() throws IOException { var java = new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.VOID, List.of( - new JavaParam(JavaTypeRef.INT, "b"), - new JavaParam(JavaTypeRef.LONG, "c") + new JavaParam(JavaTypeRef.INT, JavaIdentifier.of("b")), + new JavaParam(JavaTypeRef.LONG, JavaIdentifier.of("c")) ), JavaBlock.EMPTY ); @@ -620,7 +623,7 @@ public class JavaWriterTests { @Test public void methodWithBody() throws IOException { var java = new JavaMethodDeclaration( - "a", + JavaIdentifier.of("a"), JavaVisibility.PUBLIC, JavaMethodKind.INSTANCE, JavaTypeRef.INT, @@ -642,7 +645,7 @@ public class JavaWriterTests { @Test public void emptyConstructor() throws IOException { var java = new JavaConstructorDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), JavaVisibility.PUBLIC, List.of(), JavaBlock.EMPTY @@ -659,7 +662,7 @@ public class JavaWriterTests { @Test public void publicConstructor() throws IOException { var java = new JavaConstructorDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), JavaVisibility.PUBLIC, List.of(), JavaBlock.EMPTY @@ -676,7 +679,7 @@ public class JavaWriterTests { @Test public void privateConstructor() throws IOException { var java = new JavaConstructorDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), JavaVisibility.PRIVATE, List.of(), JavaBlock.EMPTY @@ -693,11 +696,11 @@ public class JavaWriterTests { @Test public void constructorWithParams() throws IOException { var java = new JavaConstructorDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), JavaVisibility.PUBLIC, List.of( - new JavaParam(JavaTypeRef.INT, "b"), - new JavaParam(JavaTypeRef.LONG, "c") + new JavaParam(JavaTypeRef.INT, JavaIdentifier.of("b")), + new JavaParam(JavaTypeRef.LONG, JavaIdentifier.of("c")) ), JavaBlock.EMPTY ); @@ -713,7 +716,7 @@ public class JavaWriterTests { @Test public void constructorWithBody() throws IOException { var java = new JavaConstructorDeclaration( - "Rectangle", + JavaIdentifier.of("Rectangle"), JavaVisibility.PUBLIC, List.of(), new JavaBlock(List.of( @@ -735,7 +738,7 @@ public class JavaWriterTests { var java = new JavaFieldDeclaration( JavaVisibility.PRIVATE, JavaTypeRef.INT, - "count" + JavaIdentifier.of("count") ); var string = write(writer -> writer.writeClassBodyDeclaration(java)); @@ -803,7 +806,7 @@ public class JavaWriterTests { @Test public void assignment() throws IOException { var java = new JavaAssignment( - new JavaRef("x"), + new JavaRef(JavaIdentifier.of("x")), new JavaIntegerLiteral(42) ); @@ -815,8 +818,8 @@ public class JavaWriterTests { @Test public void fieldAccess() throws IOException { var java = new JavaFieldAccess( - new JavaRef("one"), - "two" + new JavaRef(JavaIdentifier.of("one")), + JavaIdentifier.of("two") ); var string = write(writer -> writer.writeExpression(java)); @@ -827,8 +830,8 @@ public class JavaWriterTests { @Test public void staticFieldAccess() throws IOException { var java = new JavaStaticFieldAccess( - JavaTypeRef.topLevel(List.of("one"), "Two"), - "three" + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("one")), JavaIdentifier.of("Two")), + JavaIdentifier.of("three") ); var string = write(writer -> writer.writeExpression(java)); @@ -839,8 +842,8 @@ public class JavaWriterTests { @Test public void referenceToMethodOnType() throws IOException { var java = new JavaMethodRef( - JavaTypeRef.topLevel(List.of("one"), "Two"), - "three" + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("one")), JavaIdentifier.of("Two")), + JavaIdentifier.of("three") ); var string = write(writer -> writer.writeExpression(java)); @@ -851,7 +854,7 @@ public class JavaWriterTests { @Test public void newExpression() throws IOException { var java = new JavaNewExpression( - JavaTypeRef.topLevel(List.of("one"), "Two"), + JavaTypeRef.topLevel(List.of(JavaIdentifier.of("one")), JavaIdentifier.of("Two")), List.of(new JavaIntegerLiteral(1), new JavaIntegerLiteral(2)) ); @@ -862,7 +865,7 @@ public class JavaWriterTests { @Test public void ref() throws IOException { - var java = new JavaRef("x"); + var java = new JavaRef(JavaIdentifier.of("x")); var string = write(writer -> writer.writeExpression(java)); @@ -871,7 +874,10 @@ public class JavaWriterTests { @Test public void typeRefWithoutArgsHasNoAngleBrackets() throws IOException { - var java = JavaTypeRef.topLevel(List.of("abc", "def"), "One"); + var java = JavaTypeRef.topLevel( + List.of(JavaIdentifier.of("abc"), JavaIdentifier.of("def")), + JavaIdentifier.of("One") + ); var string = write(writer -> writer.writeTypeRef(java)); @@ -881,11 +887,11 @@ public class JavaWriterTests { @Test public void typeRefWithArgsHasAngleBrackets() throws IOException { var java = JavaTypeRef.topLevelGeneric( - List.of("abc", "def"), - "One", + List.of(JavaIdentifier.of("abc"), JavaIdentifier.of("def")), + JavaIdentifier.of("One"), List.of( - JavaTypeArg.invariant(JavaTypeRef.topLevel(List.of(), "Two")), - JavaTypeArg.invariant(JavaTypeRef.topLevel(List.of(), "Three")) + JavaTypeArg.invariant(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Two"))), + JavaTypeArg.invariant(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Three"))) ) ); @@ -897,11 +903,11 @@ public class JavaWriterTests { @Test public void typeRefArgCanBeSuper() throws IOException { var java = JavaTypeRef.topLevelGeneric( - List.of("abc", "def"), - "One", + List.of(JavaIdentifier.of("abc"), JavaIdentifier.of("def")), + JavaIdentifier.of("One"), List.of( - JavaTypeArg.superType(JavaTypeRef.topLevel(List.of(), "Two")), - JavaTypeArg.superType(JavaTypeRef.topLevel(List.of(), "Three")) + JavaTypeArg.superType(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Two"))), + JavaTypeArg.superType(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Three"))) ) ); @@ -912,7 +918,11 @@ public class JavaWriterTests { @Test public void typeRefInnerTypeNameIsSeparatedByDot() throws IOException { - var java = JavaTypeRef.inner(List.of("abc", "def"), "One", "Two"); + var java = JavaTypeRef.inner( + List.of(JavaIdentifier.of("abc"), JavaIdentifier.of("def")), + JavaIdentifier.of("One"), + JavaIdentifier.of("Two") + ); var string = write(writer -> writer.writeTypeRef(java)); @@ -922,11 +932,11 @@ public class JavaWriterTests { @Test public void customAreaContentsArePreserved() throws IOException { var java = new JavaRecordDeclaration( - "Point", + JavaIdentifier.of("Point"), List.of(), List.of(), List.of(), - new JavaCustomArea(JavaTypeRef.topLevel(List.of(), "Point"), "body"), + new JavaCustomArea(JavaTypeRef.topLevel(List.of(), JavaIdentifier.of("Point")), "body"), DocComment.EMPTY ); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaClassDeclarationMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaClassDeclarationMatcher.java index 7461fdd..713f07f 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaClassDeclarationMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaClassDeclarationMatcher.java @@ -25,7 +25,7 @@ public class JavaClassDeclarationMatcher implements org.zwobble.precisely.Matche return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaClassDeclaration.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaClassDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaClassDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaClassDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaClassDeclaration::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaCompilationUnitMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaCompilationUnitMatcher.java index b2c3f8e..1c6541b 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaCompilationUnitMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaCompilationUnitMatcher.java @@ -25,7 +25,7 @@ public class JavaCompilationUnitMatcher implements org.zwobble.precisely.Matcher return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaCompilationUnit.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaCompilationUnitMatcher withPackageName(org.zwobble.precisely.Matcher> packageName) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaCompilationUnitMatcher withPackageName(org.zwobble.precisely.Matcher> packageName) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaCompilationUnitMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("packageName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaCompilationUnit::packageName, packageName))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaConstructorDeclarationMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaConstructorDeclarationMatcher.java index f755820..46bfd01 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaConstructorDeclarationMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaConstructorDeclarationMatcher.java @@ -25,7 +25,7 @@ public class JavaConstructorDeclarationMatcher implements org.zwobble.precisely. return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaConstructorDeclaration.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaConstructorDeclarationMatcher withTypeName(org.zwobble.precisely.Matcher typeName) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaConstructorDeclarationMatcher withTypeName(org.zwobble.precisely.Matcher typeName) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaConstructorDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("typeName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaConstructorDeclaration::typeName, typeName))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumConstantMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumConstantMatcher.java index 58d6f54..eee55dd 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumConstantMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumConstantMatcher.java @@ -25,7 +25,7 @@ public class JavaEnumConstantMatcher implements org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumConstantMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumConstantMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumConstant::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumDeclarationMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumDeclarationMatcher.java index 0c7be66..3dd438a 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumDeclarationMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaEnumDeclarationMatcher.java @@ -25,7 +25,7 @@ public class JavaEnumDeclarationMatcher implements org.zwobble.precisely.Matcher return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumDeclaration.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnumDeclaration::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldAccessMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldAccessMatcher.java index c716d82..28cdb24 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldAccessMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldAccessMatcher.java @@ -29,7 +29,7 @@ public class JavaFieldAccessMatcher implements org.zwobble.precisely.Matcher fieldName) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldAccessMatcher withFieldName(org.zwobble.precisely.Matcher fieldName) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldAccessMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("fieldName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldAccess::fieldName, fieldName))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldDeclarationMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldDeclarationMatcher.java index 303c088..ca79fc3 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldDeclarationMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaFieldDeclarationMatcher.java @@ -33,7 +33,7 @@ public class JavaFieldDeclarationMatcher implements org.zwobble.precisely.Matche return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldDeclaration::type, type))).toList()); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaFieldDeclaration::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaIdentifierMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaIdentifierMatcher.java new file mode 100644 index 0000000..19434cd --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaIdentifierMatcher.java @@ -0,0 +1,34 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.output.lang.java.ast; + +public class JavaIdentifierMatcher implements org.zwobble.precisely.Matcher { + public static org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifierMatcher isJavaIdentifier() { + return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifierMatcher(java.util.List.of()); + } + + private final java.util.List> submatchers; + + private JavaIdentifierMatcher(java.util.List> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifierMatcher withValue(org.zwobble.precisely.Matcher value) { + return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifierMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("value", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier::value, value))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifierMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifierMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaInterfaceDeclarationMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaInterfaceDeclarationMatcher.java index 0d8aef6..963a32d 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaInterfaceDeclarationMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaInterfaceDeclarationMatcher.java @@ -25,7 +25,7 @@ public class JavaInterfaceDeclarationMatcher implements org.zwobble.precisely.Ma return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaInterfaceDeclaration.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaInterfaceDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaInterfaceDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaInterfaceDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaInterfaceDeclaration::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodCallMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodCallMatcher.java index da2bc52..5fd64e0 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodCallMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodCallMatcher.java @@ -29,7 +29,7 @@ public class JavaMethodCallMatcher implements org.zwobble.precisely.Matcher methodName) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodCallMatcher withMethodName(org.zwobble.precisely.Matcher methodName) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodCallMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("methodName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodCall::methodName, methodName))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodDeclarationMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodDeclarationMatcher.java index 69ae9b6..5d22326 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodDeclarationMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodDeclarationMatcher.java @@ -25,7 +25,7 @@ public class JavaMethodDeclarationMatcher implements org.zwobble.precisely.Match return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodDeclaration.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodDeclaration::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodRefMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodRefMatcher.java index ecbf83b..5a3fa79 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodRefMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaMethodRefMatcher.java @@ -29,7 +29,7 @@ public class JavaMethodRefMatcher implements org.zwobble.precisely.Matcher methodName) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodRefMatcher withMethodName(org.zwobble.precisely.Matcher methodName) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodRefMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("methodName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaMethodRef::methodName, methodName))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaParamMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaParamMatcher.java index 52cc589..67d2848 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaParamMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaParamMatcher.java @@ -29,7 +29,7 @@ public class JavaParamMatcher implements org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaParamMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaParamMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaParam::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordComponentMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordComponentMatcher.java index 9b97101..376ba94 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordComponentMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordComponentMatcher.java @@ -29,7 +29,7 @@ public class JavaRecordComponentMatcher implements org.zwobble.precisely.Matcher return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordComponentMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordComponent::type, type))).toList()); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordComponentMatcher withName(org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordComponentMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordComponentMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordComponent::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordDeclarationMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordDeclarationMatcher.java index f937cf7..a19a6cf 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordDeclarationMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRecordDeclarationMatcher.java @@ -25,7 +25,7 @@ public class JavaRecordDeclarationMatcher implements org.zwobble.precisely.Match return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordDeclaration.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordDeclarationMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordDeclarationMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRecordDeclaration::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRefMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRefMatcher.java index cc68447..4e5a514 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRefMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaRefMatcher.java @@ -25,7 +25,7 @@ public class JavaRefMatcher implements org.zwobble.precisely.Matcher name) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRefMatcher withName(org.zwobble.precisely.Matcher name) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRefMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaRef::name, name))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticFieldAccessMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticFieldAccessMatcher.java index d66288e..9cd874d 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticFieldAccessMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticFieldAccessMatcher.java @@ -29,7 +29,7 @@ public class JavaStaticFieldAccessMatcher implements org.zwobble.precisely.Match return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticFieldAccessMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticFieldAccess::type, type))).toList()); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticFieldAccessMatcher withFieldName(org.zwobble.precisely.Matcher fieldName) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticFieldAccessMatcher withFieldName(org.zwobble.precisely.Matcher fieldName) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticFieldAccessMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("fieldName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticFieldAccess::fieldName, fieldName))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticMethodCallMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticMethodCallMatcher.java index 1837a34..7f23124 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticMethodCallMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaStaticMethodCallMatcher.java @@ -29,7 +29,7 @@ public class JavaStaticMethodCallMatcher implements org.zwobble.precisely.Matche return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticMethodCallMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticMethodCall::type, type))).toList()); } - public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticMethodCallMatcher withMethodName(org.zwobble.precisely.Matcher methodName) { + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticMethodCallMatcher withMethodName(org.zwobble.precisely.Matcher methodName) { return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticMethodCallMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("methodName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaStaticMethodCall::methodName, methodName))).toList()); } -- cgit v1.2.3