Open Issues Need Help
View All on GitHubAI Summary: The OpenRewrite `UnnecessaryParentheses` recipe incorrectly removes parentheses from `switch` expressions when they are immediately followed by method calls (e.g., `(switch(...) { ... }).length()`). This removal results in invalid Java code that fails to compile with an "';' expected" error, as parentheses are syntactically required for chaining methods directly after a `switch` expression.
OpenRewrite recipes for identifying and fixing static analysis issues.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: This GitHub issue requests an OpenRewrite recipe to address SonarQube rule `java:S3457` by replacing `\n` with `%n` within format strings. The recipe should target calls to `String.format` and `PrintStream#printf`, ensuring platform-independent newlines are used in formatting operations.
OpenRewrite recipes for identifying and fixing static analysis issues.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: This issue proposes refactoring code to prefer `System.getProperty()` over `System.getenv()` for specific, well-documented system options, such as using `System.getProperty("user.home")` instead of `System.getenv("HOME")`. The primary goal is to enhance code portability across different environments.
OpenRewrite recipes for identifying and fixing static analysis issues.
OpenRewrite recipes for identifying and fixing static analysis issues.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: Debug and fix a NullPointerException in the OpenRewrite recipe `ReplaceCollectionToArrayArgWithEmptyArray`. The recipe aims to automatically fix static analysis issues related to using empty arrays as arguments in `Collection.toArray()`. The bug manifests when processing certain Java code, leading to a NullPointerException. The task involves analyzing the recipe's code, identifying the root cause of the NPE (likely related to null checks or handling of edge cases), and implementing a fix to ensure the recipe functions correctly without throwing exceptions.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: Create an OpenRewrite recipe that identifies and replaces instances of string concatenation used for type conversion (e.g., "" + 1) with the more efficient and readable String.valueOf() method. The recipe should be robust enough to handle various data types and contexts, and include unit tests.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: Create an OpenRewrite recipe that automatically removes redundant null checks in Java code when an instanceof check is already present. The recipe should identify code blocks where a null check is combined with an instanceof check on the same variable and refactor the code to remove the unnecessary null check.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: Create an OpenRewrite recipe that automatically refactors Java code to use varargs with Arrays.asList instead of explicitly creating a new array, improving code readability. The recipe should identify instances where a new array is passed to Arrays.asList and rewrite them to use the varargs syntax.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: Create an OpenRewrite recipe that automatically replaces instances of generating random integers using `Random.nextDouble()` followed by casting or rounding with the more efficient and direct `Random.nextInt()` method.
OpenRewrite recipes for identifying and fixing static analysis issues.
AI Summary: Create an OpenRewrite recipe that identifies and automatically refactors Java code where `Pattern.compile()` is called repeatedly with the same literal regular expression, replacing it with a single, pre-compiled `final` Pattern instance for improved efficiency. The recipe should handle various ways of constructing regular expressions in Java and only apply the refactoring when the pattern is a literal or constant.
OpenRewrite recipes for identifying and fixing static analysis issues.