[scala] Avoid using @Image

This commit is contained in:
Andreas Dangel
2023-12-19 20:44:42 +01:00
parent 76f2c12d83
commit 34693e4ca0
18 changed files with 18 additions and 34 deletions

View File

@ -20,8 +20,7 @@ public final class ASTLitBoolean extends AbstractScalaNode<Lit.Boolean> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitByte extends AbstractScalaNode<Lit.Byte> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitChar extends AbstractScalaNode<Lit.Char> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitDouble extends AbstractScalaNode<Lit.Double> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitFloat extends AbstractScalaNode<Lit.Float> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitInt extends AbstractScalaNode<Lit.Int> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitLong extends AbstractScalaNode<Lit.Long> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitNull extends AbstractScalaNode<Lit.Null> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitShort extends AbstractScalaNode<Lit.Short> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitString extends AbstractScalaNode<Lit.String> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitSymbol extends AbstractScalaNode<Lit.Symbol> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTLitUnit extends AbstractScalaNode<Lit.Unit> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return String.valueOf(node.value());
}
}

View File

@ -20,8 +20,7 @@ public final class ASTNameAnonymous extends AbstractScalaNode<Name.Anonymous> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return node.value();
}
}

View File

@ -20,8 +20,7 @@ public final class ASTNameIndeterminate extends AbstractScalaNode<Name.Indetermi
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return node.value();
}
}

View File

@ -20,8 +20,7 @@ public final class ASTTermName extends AbstractScalaNode<Term.Name> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return node.value();
}
}

View File

@ -20,8 +20,7 @@ public final class ASTTypeName extends AbstractScalaNode<Type.Name> {
return visitor.visit(this, data);
}
@Override
public String getImage() {
public String getValue() {
return node.value();
}
}

View File

@ -49,7 +49,7 @@ class ScalaRuleTest extends BaseScalaTest {
@Override
public RuleContext visit(ASTTermApply node, RuleContext data) {
ASTTermName child = node.getFirstChildOfType(ASTTermName.class);
if (child != null && child.hasImageEqualTo("println")) {
if (child != null && "println".equals(child.getValue())) {
addViolation(data, node);
}
return data;

View File

@ -19,7 +19,7 @@ class XPathRuleTest extends BaseScalaTest {
@Test
void testPrintHelloWorld() {
Report report = evaluate(SCALA_TEST, "//TermApply/TermName[@Image=\"println\"]");
Report report = evaluate(SCALA_TEST, "//TermApply/TermName[@Value=\"println\"]");
RuleViolation rv = report.getViolations().get(0);
assertEquals(2, rv.getBeginLine());
}