Skip to content

Commit

Permalink
J.MethodDeclaration#typeParameters has a non-standard accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Nov 22, 2024
1 parent af610ae commit 82897f8
Showing 1 changed file with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@
package org.openrewrite.javascript.remote;

import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.Tree;
import org.openrewrite.internal.ListUtils;
import org.openrewrite.marker.Markers;
import org.openrewrite.tree.*;
import org.openrewrite.java.JavaVisitor;
import org.openrewrite.java.tree.*;
import org.openrewrite.javascript.JavaScriptIsoVisitor;
import org.openrewrite.javascript.tree.*;
import org.openrewrite.javascript.tree.JS;

import java.util.List;

Expand Down Expand Up @@ -225,6 +222,12 @@ public JS.Union visitUnion(JS.Union union, P p) {
return union;
}

@Override
public JS.Intersection visitIntersection(JS.Intersection intersection, P p) {
ListUtils.map(intersection.getTypes(), el -> visitAndValidate(el, Expression.class, p));
return intersection;
}

@Override
public JS.Void visitVoid(JS.Void void_, P p) {
visitAndValidate(void_.getExpression(), Expression.class, p);
Expand Down Expand Up @@ -301,6 +304,20 @@ public JS.FunctionDeclaration visitFunctionDeclaration(JS.FunctionDeclaration fu
return functionDeclaration;
}

@Override
public JS.TypeLiteral visitTypeLiteral(JS.TypeLiteral typeLiteral, P p) {
visitAndValidate(typeLiteral.getMembers(), J.Block.class, p);
return typeLiteral;
}

@Override
public JS.IndexSignatureDeclaration visitIndexSignatureDeclaration(JS.IndexSignatureDeclaration indexSignatureDeclaration, P p) {
ListUtils.map(indexSignatureDeclaration.getModifiers(), el -> visitAndValidate(el, J.Modifier.class, p));
visitAndValidate(indexSignatureDeclaration.getParameters(), J.class, p);
visitAndValidate(indexSignatureDeclaration.getTypeExpression(), Expression.class, p);
return indexSignatureDeclaration;
}

@Override
public J.AnnotatedType visitAnnotatedType(J.AnnotatedType annotatedType, P p) {
ListUtils.map(annotatedType.getAnnotations(), el -> visitAndValidate(el, J.Annotation.class, p));
Expand Down Expand Up @@ -539,7 +556,7 @@ public J.MemberReference visitMemberReference(J.MemberReference memberReference,
public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration methodDeclaration, P p) {
ListUtils.map(methodDeclaration.getLeadingAnnotations(), el -> visitAndValidate(el, J.Annotation.class, p));
ListUtils.map(methodDeclaration.getModifiers(), el -> visitAndValidate(el, J.Modifier.class, p));
visitAndValidate(methodDeclaration.getTypeParameters(), J.TypeParameters.class, p);
visitAndValidate(methodDeclaration.getPadding().getTypeParameters(), J.TypeParameters.class, p);
visitAndValidate(methodDeclaration.getReturnTypeExpression(), TypeTree.class, p);
visitAndValidate(methodDeclaration.getParameters(), Statement.class, p);
visitAndValidate(methodDeclaration.getThrows(), NameTree.class, p);
Expand Down

0 comments on commit 82897f8

Please sign in to comment.