Replace deprecated usages

This commit is contained in:
Clément Fournier
2020-01-17 15:11:01 +01:00
parent 8d38036015
commit 26a5971af3
61 changed files with 129 additions and 134 deletions

View File

@ -367,7 +367,7 @@ public interface NodeStream<T extends Node> extends Iterable<@NonNull T> {
* Returns a node stream containing all the (first-degree) parents of the nodes
* contained in this stream.
*
* <p>This is equivalent to {@code map(Node::jjtGetParent)}.
* <p>This is equivalent to {@code map(Node::getParent)}.
*
* @return A stream of parents
*

View File

@ -371,7 +371,7 @@ class JavaParser {
private void injectTop() {
AbstractJavaNode top = (AbstractJavaNode) jjtree.popNode();
AbstractJavaNode prev = (AbstractJavaNode) jjtree.peekNode();
prev.jjtAddChild(top, prev.jjtGetNumChildren());
prev.jjtAddChild(top, prev.getNumChildren());
prev.jjtSetLastToken(top.jjtGetLastToken());
}

View File

@ -207,12 +207,12 @@ public final class ASTAmbiguousName extends AbstractJavaExpr implements ASTRefer
// this reference and the lambdas can be optimised to a singleton
shrinkOneSegment(
simpleName -> {
simpleName.jjtGetParent().setImage(simpleName.getImage());
simpleName.jjtGetParent().removeChildAtIndex(simpleName.jjtGetChildIndex());
simpleName.getParent().setImage(simpleName.getImage());
simpleName.getParent().removeChildAtIndex(simpleName.getIndexInParent());
return null;
},
(ambig, simpleName) -> {
ambig.jjtGetParent().setImage(simpleName);
ambig.getParent().setImage(simpleName);
return null;
}
);

View File

@ -55,7 +55,7 @@ public final class ASTAnonymousClassDeclaration extends AbstractJavaTypeNode imp
* Returns the body of the anonymous class.
*/
public ASTClassOrInterfaceBody getBody() {
return (ASTClassOrInterfaceBody) jjtGetChild(0);
return (ASTClassOrInterfaceBody) getChild(0);
}

View File

@ -42,7 +42,7 @@ public final class ASTArgumentList extends AbstractJavaNode implements Iterable<
* Returns the number of arguments of this list.
*/
public int getArgumentCount() {
return jjtGetNumChildren();
return getNumChildren();
}
@Override

View File

@ -36,12 +36,12 @@ public final class ASTArrayAccess extends AbstractJavaExpr implements ASTAssigna
@NonNull
@Override
public ASTExpression getQualifier() {
return (ASTExpression) jjtGetChild(0);
return (ASTExpression) getChild(0);
}
/** Returns the expression within the brackets. */
public ASTExpression getIndexExpression() {
return (ASTExpression) jjtGetChild(1);
return (ASTExpression) getChild(1);
}

View File

@ -46,13 +46,13 @@ public final class ASTArrayAllocation extends AbstractJavaExpr implements ASTPri
* Returns the node representing the array type being instantiated.
*/
public ASTArrayType getTypeNode() {
return (ASTArrayType) jjtGetChild(0);
return (ASTArrayType) getChild(0);
}
/** Returns the initializer, if present. */
@Nullable
public ASTArrayInitializer getArrayInitializer() {
return AstImplUtil.getChildAs(this, jjtGetNumChildren() - 1, ASTArrayInitializer.class);
return AstImplUtil.getChildAs(this, getNumChildren() - 1, ASTArrayInitializer.class);
}
/**

View File

@ -40,7 +40,7 @@ public final class ASTArrayDimExpr extends ASTArrayTypeDim implements Annotatabl
public ASTExpression getLengthExpression() {
return (ASTExpression) jjtGetChild(jjtGetNumChildren() - 1);
return (ASTExpression) getChild(getNumChildren() - 1);
}
}

View File

@ -62,8 +62,8 @@ public final class ASTArrayDimensions extends AbstractJavaTypeNode implements It
}
@Override
public ASTArrayTypeDim jjtGetChild(int index) {
return (ASTArrayTypeDim) super.jjtGetChild(index);
public ASTArrayTypeDim getChild(int index) {
return (ASTArrayTypeDim) super.getChild(index);
}
/**
@ -72,6 +72,6 @@ public final class ASTArrayDimensions extends AbstractJavaTypeNode implements It
* is always greater than 0.
*/
public int getSize() {
return jjtGetNumChildren();
return getNumChildren();
}
}

View File

@ -35,12 +35,12 @@ public final class ASTArrayType extends AbstractJavaTypeNode implements ASTRefer
}
public ASTArrayDimensions getDimensions() {
return (ASTArrayDimensions) jjtGetChild(1);
return (ASTArrayDimensions) getChild(1);
}
public ASTType getElementType() {
return (ASTType) jjtGetChild(0);
return (ASTType) getChild(0);
}
@Override

View File

@ -36,10 +36,10 @@ public interface ASTAssignableExpr extends ASTPrimaryExpression {
@NonNull
default AccessType getAccessType() {
Node parent = this.jjtGetParent();
Node parent = this.getParent();
if (parent instanceof ASTUnaryExpression && !((ASTUnaryExpression) parent).getOperator().isPure()
|| jjtGetChildIndex() == 0 && parent instanceof ASTAssignmentExpression) {
|| getIndexInParent() == 0 && parent instanceof ASTAssignmentExpression) {
return AccessType.WRITE;
}

View File

@ -35,7 +35,7 @@ public final class ASTAssignmentExpression extends AbstractJavaExpr implements I
/** Returns the left-hand side, ie the expression being assigned to. */
@Override
public ASTAssignableExpr getLeftOperand() {
return (ASTAssignableExpr) jjtGetChild(0);
return (ASTAssignableExpr) getChild(0);
}

View File

@ -55,7 +55,7 @@ public final class ASTBlock extends AbstractStatement implements Iterable<ASTSta
@Override
public ASTStatement jjtGetChild(int index) {
return (ASTStatement) super.jjtGetChild(index);
public ASTStatement getChild(int index) {
return (ASTStatement) super.getChild(index);
}
}

View File

@ -29,7 +29,7 @@ public final class ASTCastExpression extends AbstractJavaExpr implements ASTExpr
}
public ASTExpression getOperand() {
return (ASTExpression) jjtGetChild(jjtGetNumChildren() - 1);
return (ASTExpression) getChild(getNumChildren() - 1);
}
@Override

View File

@ -41,7 +41,7 @@ public final class ASTClassLiteral extends AbstractJavaExpr implements ASTPrimar
public boolean isVoid() {
return jjtGetNumChildren() == 0;
return getNumChildren() == 0;
}
@ -50,6 +50,6 @@ public final class ASTClassLiteral extends AbstractJavaExpr implements ASTPrimar
*/
@Nullable
public ASTType getTypeNode() {
return isVoid() ? null : (ASTType) jjtGetChild(0);
return isVoid() ? null : (ASTType) getChild(0);
}
}

View File

@ -30,7 +30,7 @@ public final class ASTConditionalExpression extends AbstractJavaExpr implements
* That is the expression before the '?'.
*/
public ASTExpression getCondition() {
return (ASTExpression) jjtGetChild(0);
return (ASTExpression) getChild(0);
}
@ -48,7 +48,7 @@ public final class ASTConditionalExpression extends AbstractJavaExpr implements
* if the guard evaluates to false.
*/
public ASTExpression getElseBranch() {
return (ASTExpression) jjtGetChild(2);
return (ASTExpression) getChild(2);
}

View File

@ -55,7 +55,7 @@ public final class ASTConstructorCall extends AbstractJavaExpr implements ASTPri
* the new instance of Outer.
*/
public boolean isQualifiedInstanceCreation() {
return jjtGetChild(0) instanceof ASTPrimaryExpression;
return getChild(0) instanceof ASTPrimaryExpression;
}
/**
@ -76,8 +76,8 @@ public final class ASTConstructorCall extends AbstractJavaExpr implements ASTPri
public ASTArgumentList getArguments() {
int idx = jjtGetNumChildren() - (isAnonymousClass() ? 2 : 1);
return (ASTArgumentList) jjtGetChild(idx);
int idx = getNumChildren() - (isAnonymousClass() ? 2 : 1);
return (ASTArgumentList) getChild(idx);
}
/** Returns true if type arguments to the constructed instance's type are inferred. */
@ -101,14 +101,14 @@ public final class ASTConstructorCall extends AbstractJavaExpr implements ASTPri
* method returns false.
*/
public boolean isAnonymousClass() {
return jjtGetChild(jjtGetNumChildren() - 1) instanceof ASTAnonymousClassDeclaration;
return getChild(getNumChildren() - 1) instanceof ASTAnonymousClassDeclaration;
}
@Nullable
public ASTAnonymousClassDeclaration getAnonymousClassDeclaration() {
return isAnonymousClass()
? (ASTAnonymousClassDeclaration) jjtGetChild(jjtGetNumChildren() - 1)
? (ASTAnonymousClassDeclaration) getChild(getNumChildren() - 1)
: null;
}
}

View File

@ -27,7 +27,7 @@ public final class ASTDefaultValue extends AbstractJavaNode {
* Returns the constant value nested in this node.
*/
public ASTMemberValue getConstant() {
return (ASTMemberValue) jjtGetChild(0);
return (ASTMemberValue) getChild(0);
}
@Override

View File

@ -78,7 +78,7 @@ public final class ASTEnumConstant extends AbstractJavaNode
* there is none.
*/
public ASTAnonymousClassDeclaration getAnonymousClass() {
return AstImplUtil.getChildAs(this, jjtGetNumChildren() - 1, ASTAnonymousClassDeclaration.class);
return AstImplUtil.getChildAs(this, getNumChildren() - 1, ASTAnonymousClassDeclaration.class);
}
}

View File

@ -41,6 +41,6 @@ public final class ASTExpressionStatement extends AbstractStatement {
/** Returns the contained expression. */
@NonNull
public ASTExpression getExpr() {
return (ASTExpression) jjtGetChild(0);
return (ASTExpression) getChild(0);
}
}

View File

@ -38,7 +38,7 @@ public final class ASTForUpdate extends AbstractJavaNode {
/** Returns the expression list nested within this node. */
public ASTStatementExpressionList getExprList() {
return (ASTStatementExpressionList) jjtGetChild(0);
return (ASTStatementExpressionList) getChild(0);
}
}

View File

@ -59,7 +59,7 @@ public final class ASTForeachStatement extends AbstractStatement {
* loop.
*/
public ASTStatement getBody() {
return (ASTStatement) jjtGetChild(jjtGetNumChildren() - 1);
return (ASTStatement) getChild(getNumChildren() - 1);
}
}

View File

@ -43,7 +43,7 @@ public final class ASTFormalParameters extends AbstractJavaNode implements Itera
* This excludes the receiver parameter, if any.
*/
public int getParameterCount() {
return getFirstChild() instanceof ASTReceiverParameter ? jjtGetNumChildren() - 1 : jjtGetNumChildren();
return getFirstChild() instanceof ASTReceiverParameter ? getNumChildren() - 1 : getNumChildren();
}
@Override

View File

@ -43,7 +43,7 @@ public class ASTInstanceOfExpression extends AbstractJavaExpr implements ASTExpr
}
public ASTTypeExpression getRightOperand() {
return (ASTTypeExpression) jjtGetChild(1);
return (ASTTypeExpression) getChild(1);
}
/** Gets the wrapped type node. */

View File

@ -47,8 +47,8 @@ public final class ASTIntersectionType extends AbstractJavaTypeNode
@Override
public ASTType jjtGetChild(int index) {
return (ASTType) super.jjtGetChild(index);
public ASTType getChild(int index) {
return (ASTType) super.getChild(index);
}

View File

@ -45,7 +45,7 @@ public final class ASTLabeledStatement extends AbstractStatement {
* Returned the statement named by this label.
*/
public ASTStatement getStatement() {
return (ASTStatement) jjtGetChild(1);
return (ASTStatement) getChild(1);
}
}

View File

@ -36,12 +36,12 @@ public final class ASTLambdaExpression extends AbstractMethodLikeNode implements
public ASTLambdaParameterList getParameters() {
return (ASTLambdaParameterList) jjtGetChild(0);
return (ASTLambdaParameterList) getChild(0);
}
public boolean isBlockBody() {
return jjtGetChild(1) instanceof ASTBlock;
return getChild(1) instanceof ASTBlock;
}
public boolean isExpressionBody() {

View File

@ -28,7 +28,7 @@ public final class ASTLambdaParameterList extends AbstractJavaNode implements It
}
public int getParameterCount() {
return jjtGetNumChildren();
return getNumChildren();
}
@ -45,8 +45,8 @@ public final class ASTLambdaParameterList extends AbstractJavaNode implements It
@Override
public ASTLambdaParameter jjtGetChild(int index) {
return (ASTLambdaParameter) super.jjtGetChild(index);
public ASTLambdaParameter getChild(int index) {
return (ASTLambdaParameter) super.getChild(index);
}

View File

@ -43,6 +43,6 @@ public final class ASTLocalClassStatement extends AbstractStatement implements L
*/
@NonNull
public ASTClassOrInterfaceDeclaration getDeclaration() {
return (ASTClassOrInterfaceDeclaration) jjtGetChild(0);
return (ASTClassOrInterfaceDeclaration) getChild(0);
}
}

View File

@ -41,8 +41,8 @@ public final class ASTMemberValuePair extends AbstractJavaNode {
@Override
public ASTNormalAnnotation jjtGetParent() {
return (ASTNormalAnnotation) super.jjtGetParent();
public ASTNormalAnnotation getParent() {
return (ASTNormalAnnotation) super.getParent();
}

Some files were not shown because too many files have changed in this diff Show More