Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: refactor bad smell UnnecessaryToStringCall #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/spoon/ContractVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public <T> void visitCtTypeReference(CtTypeReference<T> reference) {
return;
}
final CtType<T> typeDeclaration = reference.getTypeDeclaration();
assertNotNull(reference.toString() + " cannot be found in ", typeDeclaration);
assertNotNull(reference + " cannot be found in ", typeDeclaration);
assertEquals(reference.getSimpleName(), typeDeclaration.getSimpleName());
assertEquals(reference.getQualifiedName(), typeDeclaration.getQualifiedName());

Expand All @@ -235,7 +235,7 @@ public <T> void visitCtExecutableReference(CtExecutableReference<T> reference) {
return;
}
final CtExecutable<T> executableDeclaration = reference.getExecutableDeclaration();
assertNotNull("cannot find decl for " + reference.toString(), executableDeclaration);
assertNotNull("cannot find decl for " + reference , executableDeclaration);
assertEquals(reference.getSimpleName(), executableDeclaration.getSimpleName());

// when a generic type is used in a parameter and return type, the shadow type doesn't have these information.
Expand Down Expand Up @@ -265,7 +265,7 @@ public <T> void visitCtExecutableReference(CtExecutableReference<T> reference) {
}

if (reference.getDeclaration() == null && CtShadowable.class.isAssignableFrom(executableDeclaration.getClass())) {
assertTrue("execDecl at " + reference.toString() + " must be shadow ", ((CtShadowable) executableDeclaration).isShadow());
assertTrue("execDecl at " + reference + " must be shadow ", ((CtShadowable) executableDeclaration).isShadow());
}

}
Expand Down Expand Up @@ -400,7 +400,7 @@ public void checkAssignmentContracts() {
CtExpression assigned = assign.getAssigned();
if (!(assigned instanceof CtFieldWrite
|| assigned instanceof CtVariableWrite || assigned instanceof CtArrayWrite)) {
throw new AssertionError("AssignmentContract error:" + assign.getPosition() + "\n" + assign.toString() + "\nAssigned is " + assigned.getClass());
throw new AssertionError("AssignmentContract error:" + assign.getPosition() + "\n" + assign + "\nAssigned is " + assigned.getClass());
}
}
}
Expand Down Expand Up @@ -464,7 +464,7 @@ public void checkModelIsTree() {
Exception firstStack = allElements.put(ele, secondStack);
if (firstStack != null) {
if (firstStack == dummyException) {
fail("The Spoon model is not a tree. The " + ele.getClass().getSimpleName() + ":" + ele.toString() + " is shared");
fail("The Spoon model is not a tree. The " + ele.getClass().getSimpleName() + ":" + ele + " is shared");
}
//the element ele was already visited. It means it used on more places
//report the stacktrace of first and second usage, so that place can be found easily
Expand Down