Javascript: fix errors from upcoming rules_java update

This commit is contained in:
Paolo Tranquilli
2025-11-11 11:52:36 +01:00
parent 8624f9c660
commit 6ef314ed03
18 changed files with 24 additions and 22 deletions

View File

@@ -286,6 +286,7 @@ public class Parser {
raise(pos, msg, false);
}
@SuppressWarnings("ReturnValueIgnored")
protected void raise(Position loc, String msg, boolean recoverable) {
msg += " (" + loc.getLine() + ":" + loc.getColumn() + ")";
SyntaxError err = new SyntaxError(msg, loc, this.pos);
@@ -3114,7 +3115,7 @@ public class Parser {
}
first = false;
}
if (oldStrict == Boolean.FALSE) this.setStrict(false);
if (oldStrict.equals(Boolean.FALSE)) this.setStrict(false);
return this.finishNode(new BlockStatement(new SourceLocation(startLoc), body));
}

View File

@@ -141,6 +141,7 @@ public class FlowParser extends ESNextParser {
options.onRecoverableError(this.onRecoverableError);
}
@SuppressWarnings("ReturnValueIgnored")
private void commit() {
// commit buffered tokens
options.onToken(this.onToken);

View File

@@ -35,8 +35,8 @@ public abstract class AFunctionExpression extends Expression implements IFunctio
id,
params,
body,
generator == Boolean.TRUE,
async == Boolean.TRUE,
generator.equals(Boolean.TRUE),
async.equals(Boolean.TRUE),
typeParameters,
parameterTypes,
parameterDecorators,

View File

@@ -10,7 +10,7 @@ public class ComprehensionBlock extends Expression {
super("ComprehensionBlock", loc);
this.left = left;
this.right = right;
this.of = of != Boolean.FALSE;
this.of = !of.equals(Boolean.FALSE);
}
@Override

View File

@@ -19,7 +19,7 @@ public class ComprehensionExpression extends Expression {
this.body = body;
this.blocks = blocks;
this.filter = filter;
this.generator = generator == Boolean.TRUE;
this.generator = generator.equals(Boolean.TRUE);
}
@Override

View File

@@ -16,7 +16,7 @@ public class ForInStatement extends EnhancedForStatement {
public ForInStatement(
SourceLocation loc, Node left, Expression right, Statement body, Boolean each) {
super("ForInStatement", loc, left, right, body);
this.each = each == Boolean.TRUE;
this.each = each.equals(Boolean.TRUE);
}
public boolean isEach() {

View File

@@ -27,8 +27,8 @@ public abstract class InvokeExpression extends Expression implements INodeWithSy
this.callee = callee;
this.typeArguments = typeArguments;
this.arguments = arguments;
this.optional = optional == Boolean.TRUE;
this.onOptionalChain = onOptionalChain == Boolean.TRUE;
this.optional = optional.equals(Boolean.TRUE);
this.onOptionalChain = onOptionalChain.equals(Boolean.TRUE);
}
/** The callee expression of this invocation. */

View File

@@ -76,7 +76,7 @@ public class Literal extends Expression implements ITypeExpression {
if (isRegExp()) return false;
return value == null
|| value instanceof Number && ((Number) value).intValue() == 0
|| value == Boolean.FALSE
|| value.equals(Boolean.FALSE)
|| value instanceof String && ((String) value).isEmpty();
}

View File

@@ -22,9 +22,9 @@ public class MemberExpression extends Expression
super("MemberExpression", loc);
this.object = object;
this.property = property;
this.computed = computed == Boolean.TRUE;
this.optional = optional == Boolean.TRUE;
this.onOptionalChain = onOptionalChain == Boolean.TRUE;
this.computed = computed.equals(Boolean.TRUE);
this.optional = optional.equals(Boolean.TRUE);
this.onOptionalChain = onOptionalChain.equals(Boolean.TRUE);
}
@Override

View File

@@ -59,8 +59,8 @@ public class Property extends Node {
}
this.rawValue = rawValue;
this.kind = Kind.valueOf(StringUtil.uc(kind));
this.computed = computed == Boolean.TRUE;
this.method = method == Boolean.TRUE;
this.computed = computed.equals(Boolean.TRUE);
this.method = method.equals(Boolean.TRUE);
this.decorators = new ArrayList<Decorator>();
}

View File

@@ -10,7 +10,7 @@ public class TemplateElement extends Expression {
super("TemplateElement", loc);
this.cooked = cooked;
this.raw = raw;
this.tail = tail == Boolean.TRUE;
this.tail = tail.equals(Boolean.TRUE);
}
@Override

View File

@@ -14,7 +14,7 @@ public class UnaryExpression extends Expression {
super("UnaryExpression", loc);
this.operator = operator;
this.argument = argument;
this.prefix = prefix == Boolean.TRUE;
this.prefix = prefix.equals(Boolean.TRUE);
}
@Override

View File

@@ -11,7 +11,7 @@ public class UpdateExpression extends Expression {
super("UpdateExpression", loc);
this.operator = operator;
this.argument = argument;
this.prefix = prefix == Boolean.TRUE;
this.prefix = prefix.equals(Boolean.TRUE);
}
@Override

View File

@@ -8,7 +8,7 @@ public class YieldExpression extends Expression {
public YieldExpression(SourceLocation loc, Expression argument, Boolean delegating) {
super("YieldExpression", loc);
this.argument = argument;
this.delegating = delegating == Boolean.TRUE;
this.delegating = delegating.equals(Boolean.TRUE);
}
@Override

View File

@@ -18,7 +18,7 @@ public class FunctionType extends JSDocTypeExpression {
JSDocTypeExpression result) {
super(loc, "FunctionType");
this._this = _this;
this._new = _new == Boolean.TRUE;
this._new = _new.equals(Boolean.TRUE);
this.params = params;
this.result = result;
}

View File

@@ -19,7 +19,7 @@ public abstract class UnaryTypeConstructor extends JSDocTypeExpression {
String operator) {
super(loc, type);
this.expression = expression;
this.prefix = prefix == Boolean.TRUE;
this.prefix = prefix.equals(Boolean.TRUE);
this.operator = operator;
}

View File

@@ -11,7 +11,7 @@ public class CharacterClass extends RegExpTerm {
public CharacterClass(SourceLocation loc, List<RegExpTerm> elements, Boolean inverted) {
super(loc, "CharacterClass");
this.elements = elements;
this.inverted = inverted == Boolean.TRUE;
this.inverted = inverted.equals(Boolean.TRUE);
}
@Override

View File

@@ -10,7 +10,7 @@ public abstract class Quantifier extends RegExpTerm {
public Quantifier(SourceLocation loc, String type, RegExpTerm operand, Boolean greedy) {
super(loc, type);
this.operand = operand;
this.greedy = greedy == Boolean.TRUE;
this.greedy = greedy.equals(Boolean.TRUE);
}
/** The quantified term. */