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

refactor: use isEmpty to make intention clear #2468

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public List<SourceFragment> getGroupedChildrenFragments() {
}

private SourceFragment removeSuffixSpace(List<SourceFragment> list) {
if (list.size() > 0) {
if (!list.isEmpty()) {
SourceFragment lastChild = list.get(list.size() - 1);
if (isSpaceFragment(lastChild)) {
list.remove(list.size() - 1);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/test/main/MainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public void testSourcePositionTreeIsCorrectlyOrdered() {
for (CtType type : types) {
SourcePosition sp = type.getPosition();
totalCount += assertSourcePositionTreeIsCorrectlyOrder(sp.getCompilationUnit().getOriginalSourceFragment(), 0, sp.getCompilationUnit().getOriginalSourceCode().length());
hasComment = hasComment || type.getComments().size() > 0;
hasComment = hasComment || !type.getComments().isEmpty();
};
assertTrue(totalCount > 1000);
assertTrue(hasComment);
Expand Down