-
Notifications
You must be signed in to change notification settings - Fork 88
No empty UUID #720
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
base: main
Are you sure you want to change the base?
No empty UUID #720
Conversation
wip:
|
im stuck on this. How to proceed, please? |
import org.openrewrite.*; | ||
import org.openrewrite.java.JavaIsoVisitor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.openrewrite.*; | |
import org.openrewrite.java.JavaIsoVisitor; | |
import org.jspecify.annotations.Nullable; | |
import org.openrewrite.Cursor; | |
import org.openrewrite.ExecutionContext; | |
import org.openrewrite.Recipe; | |
import org.openrewrite.TreeVisitor; | |
import org.openrewrite.java.tree.Expression; | |
import org.openrewrite.java.tree.J; |
} | ||
|
||
@Override | ||
public J.If visitIf(J.If iff, ExecutionContext ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public J.If visitIf(J.If iff, ExecutionContext ctx) { | |
public J.@Nullable If visitIf(J.If iff, ExecutionContext ctx) { |
import org.openrewrite.DocumentExample; | ||
import org.openrewrite.Issue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.openrewrite.DocumentExample; | |
import org.openrewrite.Issue; | |
import org.openrewrite.DocumentExample; |
.parser(JavaParser.fromJavaVersion().classpath("junit-jupiter-params")); | ||
} | ||
|
||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Test | |
@DocumentExample | |
void uuidToStringIsBlankAlwaysFalse() { |
if (id.toString().isBlank()) { | ||
System.out.println("This will never happen"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (id.toString().isBlank()) { | |
System.out.println("This will never happen"); | |
} | |
boolean b = id.toString().isBlank(); // Always false |
import java.util.UUID; | ||
public class Test { | ||
public void test() { | ||
UUID id = UUID.randomUUID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UUID id = UUID.randomUUID(); | |
UUID id = UUID.randomUUID(); | |
boolean b = false; // Always false |
@DocumentExample | ||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DocumentExample | |
@Test | |
void uuidIsBlankInIfCondition() { |
public class Test { | ||
public void test() { | ||
UUID id = UUID.randomUUID(); | ||
boolean b = id.toString().isBlank(); // Always false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean b = id.toString().isBlank(); // Always false | |
if (id.toString().isBlank()) { | |
System.out.println("This will never happen"); | |
} |
UUID id = UUID.randomUUID(); | ||
boolean b = false; // Always false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UUID id = UUID.randomUUID(); | |
boolean b = false; // Always false | |
UUID id = UUID.randomUUID(); |
What's changed?
What's your motivation?
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Checklist