@@ -361,44 +361,44 @@ examples:
361361- description : ' '
362362 sources :
363363 - before : |
364- import java.io.FileReader;
365- import java.io.IOException;
366-
367364 class A {
368- void foo() throws IOException {
365+ void foo() throws IllegalAccessException {
369366 try {
370- new FileReader("").read ();
371- } catch (IOException e) {
372- throw e;
367+ throw new IllegalAccessException ();
368+ } catch (Exception e) {
369+ throw e; // `e` is removed below
373370 }
374371 }
375372 }
376373 after: |
377- import java.io.FileReader;
378- import java.io.IOException;
379-
380374 class A {
381- void foo() throws IOException {
382- new FileReader("").read ();
375+ void foo() throws IllegalAccessException {
376+ throw new IllegalAccessException ();
383377 }
384378 }
385379 language: java
386380 - description : ' '
387381 sources :
388382 - before : |
383+ import java.io.FileReader;
384+ import java.io.IOException;
385+
389386 class A {
390- void foo() throws IllegalAccessException {
387+ void foo() throws IOException {
391388 try {
392- throw new IllegalAccessException ();
393- } catch (Exception e) {
394- throw e; // `e` is removed below
389+ new FileReader("").read ();
390+ } catch (IOException e) {
391+ throw e;
395392 }
396393 }
397394 }
398395 after: |
396+ import java.io.FileReader;
397+ import java.io.IOException;
398+
399399 class A {
400- void foo() throws IllegalAccessException {
401- throw new IllegalAccessException ();
400+ void foo() throws IOException {
401+ new FileReader("").read ();
402402 }
403403 }
404404 language: java
@@ -3095,6 +3095,18 @@ examples:
30953095type : specs.openrewrite.org/v1beta/example
30963096recipeName : org.openrewrite.staticanalysis.SimplifyBooleanExpression
30973097examples :
3098+ - description : ' '
3099+ sources :
3100+ - before : |
3101+ fun getSymbol() : String? {
3102+ return null
3103+ }
3104+ language: kotlin
3105+ - before : |
3106+ val isPositive = getSymbol().equals("+") == true
3107+ after: |
3108+ val isPositive = getSymbol().equals("+")
3109+ language: kotlin
30983110 - description : ' '
30993111 sources :
31003112 - before : |
@@ -3114,18 +3126,6 @@ examples:
31143126 }
31153127 }
31163128 language: java
3117- - description : ' '
3118- sources :
3119- - before : |
3120- fun getSymbol() : String? {
3121- return null
3122- }
3123- language: kotlin
3124- - before : |
3125- val isPositive = getSymbol().equals("+") == true
3126- after: |
3127- val isPositive = getSymbol().equals("+")
3128- language: kotlin
31293129 ---
31303130type : specs.openrewrite.org/v1beta/example
31313131recipeName : org.openrewrite.staticanalysis.SimplifyBooleanExpressionWithDeMorgan
0 commit comments