1818import lombok .*;
1919import lombok .experimental .FieldDefaults ;
2020import lombok .experimental .NonFinal ;
21+ import org .jspecify .annotations .Nullable ;
2122import org .openrewrite .*;
2223import org .openrewrite .csharp .CSharpPrinter ;
2324import org .openrewrite .csharp .CSharpVisitor ;
24- import org .openrewrite .internal .lang .Nullable ;
2525import org .openrewrite .java .JavaPrinter ;
2626import org .openrewrite .java .internal .TypesInUse ;
2727import org .openrewrite .java .tree .*;
@@ -54,8 +54,7 @@ default <P> boolean isAcceptable(TreeVisitor<?, P> v, P p) {
5454 return v .isAdaptableTo (CSharpVisitor .class );
5555 }
5656
57- @ Nullable
58- default <P > J acceptCSharp (CSharpVisitor <P > v , P p ) {
57+ default <P > @ Nullable J acceptCSharp (CSharpVisitor <P > v , P p ) {
5958 return v .defaultValue (this , p );
6059 }
6160
@@ -121,11 +120,12 @@ public SourceFile withCharset(Charset charset) {
121120 return withCharsetName (charset .name ());
122121 }
123122
124- @ Nullable
125- public Package getPackageDeclaration () {
123+ @ Override
124+ public @ Nullable Package getPackageDeclaration () {
126125 return null ;
127126 }
128127
128+ @ Override
129129 public Cs .CompilationUnit withPackageDeclaration (Package packageDeclaration ) {
130130 return this ;
131131 }
@@ -164,15 +164,18 @@ public Cs.CompilationUnit withMembers(List<Statement> members) {
164164 return getPadding ().withMembers (JRightPadded .withElements (this .members , members ));
165165 }
166166
167+ @ Override
167168 @ Transient
168169 public List <Import > getImports () {
169170 return Collections .emptyList ();
170171 }
171172
173+ @ Override
172174 public Cs .CompilationUnit withImports (List <Import > imports ) {
173175 return this ;
174176 }
175177
178+ @ Override
176179 @ Transient
177180 public List <ClassDeclaration > getClasses () {
178181 return Collections .emptyList ();
@@ -213,6 +216,7 @@ public TypesInUse getTypesInUse() {
213216 return cache ;
214217 }
215218
219+ @ Override
216220 public Padding getPadding () {
217221 Padding p ;
218222 if (this .padding == null ) {
@@ -378,8 +382,7 @@ public Padding getPadding() {
378382 public static class Padding {
379383 private final ArrayRankSpecifier t ;
380384
381- @ Nullable
382- public JContainer <Expression > getSizes () {
385+ public @ Nullable JContainer <Expression > getSizes () {
383386 return t .sizes ;
384387 }
385388
@@ -514,12 +517,12 @@ final class AttributeList implements Cs {
514517 @ Nullable
515518 JRightPadded <Identifier > target ;
516519
517- @ Nullable
518- public J .Identifier getTarget () {
520+
521+ public J .@ Nullable Identifier getTarget () {
519522 return target == null ? null : target .getElement ();
520523 }
521524
522- public AttributeList withTarget (@ Nullable J . Identifier target ) {
525+ public AttributeList withTarget (J . @ Nullable Identifier target ) {
523526 return getPadding ().withTarget (JRightPadded .withElement (this .target , target ));
524527 }
525528
@@ -1259,8 +1262,7 @@ public Interpolation withExpression(Expression expression) {
12591262 @ Nullable
12601263 JRightPadded <Expression > alignment ;
12611264
1262- @ Nullable
1263- public Expression getAlignment () {
1265+ public @ Nullable Expression getAlignment () {
12641266 return alignment != null ? alignment .getElement () : null ;
12651267 }
12661268
@@ -1271,8 +1273,7 @@ public Interpolation withAlignment(@Nullable Expression alignment) {
12711273 @ Nullable
12721274 JRightPadded <Expression > format ;
12731275
1274- @ Nullable
1275- public Expression getFormat () {
1276+ public @ Nullable Expression getFormat () {
12761277 return format != null ? format .getElement () : null ;
12771278 }
12781279
@@ -1328,17 +1329,15 @@ public Interpolation withExpression(JRightPadded<Expression> expression) {
13281329 return t .expression == expression ? t : new Interpolation (t .id , t .prefix , t .markers , expression , t .alignment , t .format );
13291330 }
13301331
1331- @ Nullable
1332- public JRightPadded <Expression > getAlignment () {
1332+ public @ Nullable JRightPadded <Expression > getAlignment () {
13331333 return t .alignment ;
13341334 }
13351335
13361336 public Interpolation withAlignment (@ Nullable JRightPadded <Expression > alignment ) {
13371337 return t .alignment == alignment ? t : new Interpolation (t .id , t .prefix , t .markers , t .expression , alignment , t .format );
13381338 }
13391339
1340- @ Nullable
1341- public JRightPadded <Expression > getFormat () {
1340+ public @ Nullable JRightPadded <Expression > getFormat () {
13421341 return t .format ;
13431342 }
13441343
@@ -1525,12 +1524,12 @@ public UsingDirective withUnsafe(boolean unsafe) {
15251524 @ Nullable
15261525 JRightPadded <Identifier > alias ;
15271526
1528- @ Nullable
1529- public J .Identifier getAlias () {
1527+
1528+ public J .@ Nullable Identifier getAlias () {
15301529 return alias != null ? alias .getElement () : null ;
15311530 }
15321531
1533- public UsingDirective withAlias (@ Nullable J . Identifier alias ) {
1532+ public UsingDirective withAlias (J . @ Nullable Identifier alias ) {
15341533 return getPadding ().withAlias (JRightPadded .withElement (this .alias , alias ));
15351534 }
15361535
@@ -1591,8 +1590,7 @@ public UsingDirective withUnsafe(JLeftPadded<Boolean> unsafe) {
15911590 return t .unsafe == unsafe ? t : new UsingDirective (t .id , t .prefix , t .markers , t .global , t .statik , unsafe , t .alias , t .namespaceOrType );
15921591 }
15931592
1594- @ Nullable
1595- public JRightPadded <Identifier > getAlias () {
1593+ public @ Nullable JRightPadded <Identifier > getAlias () {
15961594 return t .alias ;
15971595 }
15981596
@@ -1657,25 +1655,25 @@ public CoordinateBuilder.Statement getCoordinates() {
16571655 return new CoordinateBuilder .Statement (this );
16581656 }
16591657
1658+ @ Override
16601659 public JavaType getType () {
16611660 return typeExpression .getType ();
16621661 }
16631662
1663+ @ Override
16641664 public PropertyDeclaration withType (@ Nullable JavaType type ) {
16651665 return getPadding ().withType (this .typeExpression .withType (type ));
16661666 }
16671667
1668- @ Nullable
1669- public NameTree getInterfaceSpecifier () {
1668+ public @ Nullable NameTree getInterfaceSpecifier () {
16701669 return interfaceSpecifier != null ? interfaceSpecifier .getElement () : null ;
16711670 }
16721671
16731672 public PropertyDeclaration withInterfaceSpecifier (@ Nullable NameTree interfaceSpecifier ) {
16741673 return getPadding ().withInterfaceSpecifier (JRightPadded .withElement (this .interfaceSpecifier , interfaceSpecifier ));
16751674 }
16761675
1677- @ Nullable
1678- public Expression getInitializer () {
1676+ public @ Nullable Expression getInitializer () {
16791677 return initializer != null ? initializer .getElement () : null ;
16801678 }
16811679
@@ -1711,8 +1709,7 @@ public TypeTree getType() {
17111709 return pd .typeExpression ;
17121710 }
17131711
1714- @ Nullable
1715- public JRightPadded <NameTree > getInterfaceSpecifier () {
1712+ public @ Nullable JRightPadded <NameTree > getInterfaceSpecifier () {
17161713 return pd .interfaceSpecifier ;
17171714 }
17181715
@@ -1742,8 +1739,7 @@ public PropertyDeclaration withType(TypeTree type) {
17421739 pd .initializer );
17431740 }
17441741
1745- @ Nullable
1746- public JLeftPadded <Expression > getInitializer () {
1742+ public @ Nullable JLeftPadded <Expression > getInitializer () {
17471743 return pd .initializer ;
17481744 }
17491745
0 commit comments