Skip to content

Commit 46d442e

Browse files
rewrite-scala: add public canonical constructors to S.TuplePattern and S.FunctionCall (#7462)
Both classes previously exposed only a private `@AllArgsConstructor`-generated canonical constructor whose first parameter is the padding `WeakReference`. Deserializers (such as moderne-ast-write's V3 codegen) skip non-public constructors and constructors that take a `WeakReference`, so these types were invisible to static codegen and fell through to the dynamic-schema read path — where, lacking any other public constructor, construction failed and source files were substituted with a `Quark` + `DeserializationError` marker. Adding `@RequiredArgsConstructor` generates a public canonical constructor that excludes the `@NonFinal` padding field, matching the pattern already used by `S.CompilationUnit` and by rewrite-java types such as `J.MethodInvocation`. The private padding-aware constructor remains for internal use.
1 parent 2b4cbc0 commit 46d442e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • rewrite-scala/src/main/java/org/openrewrite/scala/tree

rewrite-scala/src/main/java/org/openrewrite/scala/tree/S.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public S.CompilationUnit withStatements(List<JRightPadded<Statement>> statements
299299
*/
300300
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
301301
@EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true)
302+
@RequiredArgsConstructor
302303
@AllArgsConstructor(access = AccessLevel.PRIVATE)
303304
@Data
304305
final class TuplePattern implements S, Expression, TypedTree, VariableDeclarator {
@@ -687,6 +688,7 @@ public CoordinateBuilder.Statement getCoordinates() {
687688
*/
688689
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
689690
@EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true)
691+
@RequiredArgsConstructor
690692
@AllArgsConstructor(access = AccessLevel.PRIVATE)
691693
final class FunctionCall implements S, Expression, Statement, TypedTree {
692694

0 commit comments

Comments
 (0)