Skip to content

Commit

Permalink
Issue checkstyle#10649: Migrate to Inline Config Parser in SuppressWa…
Browse files Browse the repository at this point in the history
…rningsCheckTest
  • Loading branch information
shashwatj07 committed Aug 20, 2021
1 parent c9826c1 commit c61f91e
Show file tree
Hide file tree
Showing 34 changed files with 207 additions and 184 deletions.
1 change: 0 additions & 1 deletion pom.xml
Expand Up @@ -1781,7 +1781,6 @@

<exclude>**/InnerTypeLastCheckTest.class</exclude>

<exclude>**/SuppressWarningsCheckTest.class</exclude>

<exclude>**/ParenPadCheckTest.class</exclude>

Expand Down

Large diffs are not rendered by default.

Expand Up @@ -71,7 +71,7 @@ void doFoo(String s, @SuppressWarnings({"unchecked"})String y) {
}
}

@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 2 violations
class Cond {

@SuppressWarnings({(false) ? "" : "unchecked"}) // violation
Expand All @@ -91,7 +91,7 @@ public void aCond2() {
}

@java.lang.SuppressWarnings({(false) ? "unchecked" :
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // 2 violations
(false) ? "unchecked" : ("" == "") ? (false) ? (true) ? "" : // violation
"foo" : " " : // violation
"unused"})
Expand Down
Expand Up @@ -12,13 +12,13 @@
package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings;
import java.lang.annotation.Documented;

@SuppressWarnings({"unchecked", "unused"}) // violation
@SuppressWarnings({"unchecked", "unused"}) // 2 violations
public class InputSuppressWarningsCompactNonConstant2
{
@SuppressWarnings({" "}) // violation
class Empty {

@SuppressWarnings({"unchecked", ""}) // violation
@SuppressWarnings({"unchecked", ""}) // 2 violations
public Empty() {

}
Expand All @@ -27,7 +27,7 @@ public Empty() {
@SuppressWarnings({"unused"}) // violation
enum Duh {

@SuppressWarnings({"unforgiven", " un"}) // violation
@SuppressWarnings({"unforgiven", " un"}) // 2 violations
D;

public static void foo() {
Expand All @@ -54,7 +54,7 @@ public String toString() {
@SuppressWarnings({}) // violation
@interface MoreSweetness {

@SuppressWarnings({"unused", "bleh"}) // violation
@SuppressWarnings({"unused", "bleh"}) // 2 violations
int cool();
}

Expand All @@ -71,29 +71,29 @@ void doFoo(String s, @SuppressWarnings({"unchecked"})String y) { // violation
}
}

@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 4 violations
class Cond {

@SuppressWarnings({(false) ? "" : "unchecked"}) // violation
@SuppressWarnings({(false) ? "" : "unchecked"}) // 2 violations
public Cond() {

}

@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // violation
(false) ? (true) ? " " : "unused" : "unchecked"}) // violation
@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // 3 violations
(false) ? (true) ? " " : "unused" : "unchecked"}) // 3 violations
public void aCond1() {

}

@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // violation
@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // 3 violations
public void aCond2() {

}

@java.lang.SuppressWarnings({(false) ? "unchecked" : // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // violation
(false) ? "unchecked" : ("" == "") ? (false) ? (true) ? "" : // violation
"foo" : " " : // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // 4 violations
(false) ? "unchecked" : ("" == "") ? (false) ? (true) ? "" : // 2 violations
"foo" : " " : // 2 violations
"unused"}) // violation
public void seriously() {

Expand Down
Expand Up @@ -69,7 +69,7 @@ void doFoo(String s, @SuppressWarnings({"unchecked"})String y) {
}
}

@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 2 violations
class Cond {

@SuppressWarnings({(false) ? "" : "unchecked"})
Expand Down
Expand Up @@ -12,7 +12,7 @@
package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings;
import java.lang.annotation.Documented;

@SuppressWarnings({"unchecked", "unused"}) // violation
@SuppressWarnings({"unchecked", "unused"}) // 2 violations
public class InputSuppressWarningsCompactNonConstant4
{
@SuppressWarnings({" "})
Expand Down Expand Up @@ -71,21 +71,21 @@ void doFoo(String s, @SuppressWarnings({"unchecked"})String y) { // violation
}
}

@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 2 violations
class Cond {

@SuppressWarnings({(false) ? "" : "unchecked"}) // violation
public Cond() {

}

@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // violation
(false) ? (true) ? " " : "unused" : "unchecked"}) // violation
@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // 2 violations
(false) ? (true) ? " " : "unused" : "unchecked"}) // 2 violations
public void aCond1() {

}

@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // violation
@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // 2 violations
public void aCond2() {

}
Expand Down
Expand Up @@ -12,7 +12,7 @@
package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings;
import java.lang.annotation.Documented;

@SuppressWarnings({"unchecked", "unused"}) // violation
@SuppressWarnings({"unchecked", "unused"}) // 2 violations
public class InputSuppressWarningsCompactNonConstant5
{
@SuppressWarnings({" "})
Expand Down Expand Up @@ -71,29 +71,29 @@ void doFoo(String s, @SuppressWarnings({"unchecked"})String y) { // violation
}
}

@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 2 violations
class Cond {

@SuppressWarnings({(false) ? "" : "unchecked"}) // violation
public Cond() {

}

@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // violation
(false) ? (true) ? " " : "unused" : "unchecked"}) // violation
@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // 2 violations
(false) ? (true) ? " " : "unused" : "unchecked"}) // 2 violations
public void aCond1() {

}

@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // violation
@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // 2 violations
public void aCond2() {

}

@java.lang.SuppressWarnings({(false) ? "unchecked" : // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // violation
(false) ? "unchecked" : ("" == "") ? (false) ? (true) ? "" :
"foo" : " " : // violation
(false) ? "unchecked" : ("" == "") ? (false) ? (true) ? "" : // violation
"foo" : " " :
"unused"}) // violation
public void seriously() {

Expand Down
Expand Up @@ -12,13 +12,13 @@
package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings;
import java.lang.annotation.Documented;

@SuppressWarnings({"unchecked", "unused"}) // violation
@SuppressWarnings({"unchecked", "unused"}) // 2 violations
public class InputSuppressWarningsCompactNonConstant6
{
@SuppressWarnings({" "}) // violation
class Empty {

@SuppressWarnings({"unchecked", ""}) // violation
@SuppressWarnings({"unchecked", ""}) // 2 violations
public Empty() {

}
Expand All @@ -27,7 +27,7 @@ public Empty() {
@SuppressWarnings({"unused"}) // violation
enum Duh {

@SuppressWarnings({"unforgiven", " un"}) // violation
@SuppressWarnings({"unforgiven", " un"}) // 2 violations
D;

public static void foo() {
Expand All @@ -54,7 +54,7 @@ public String toString() {
@SuppressWarnings({}) // violation
@interface MoreSweetness {

@SuppressWarnings({"unused", "bleh"}) // violation
@SuppressWarnings({"unused", "bleh"}) // 2 violations
int cool();
}

Expand All @@ -71,29 +71,29 @@ void doFoo(String s, @SuppressWarnings({"unchecked"})String y) { // violation
}
}

@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings({(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 4 violations
class Cond {

@SuppressWarnings({(false) ? "" : "unchecked"}) // violation
@SuppressWarnings({(false) ? "" : "unchecked"}) // 2 violations
public Cond() {

}

@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // violation
(false) ? (true) ? " " : "unused" : "unchecked"}) // violation
@SuppressWarnings({(false) ? (true) ? " " : "unused" : "unchecked", // 3 violations
(false) ? (true) ? " " : "unused" : "unchecked"}) // 3 violations
public void aCond1() {

}

@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // violation
@SuppressWarnings({(false) ? "unchecked" : (true) ? " " : "unused"}) // 3 violations
public void aCond2() {

}

@java.lang.SuppressWarnings({(false) ? "unchecked" : // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // violation
(false) ? "unchecked" : ("" == "") ? (false) ? (true) ? "" : // violation
"foo" : " " : // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // 4 violations
(false) ? "unchecked" : ("" == "") ? (false) ? (true) ? "" : // 2 violations
"foo" : " " : // 2 violations
"unused"}) // violation
public void seriously() {

Expand Down
Expand Up @@ -71,7 +71,7 @@ void doFoo(String s, @SuppressWarnings(value={"unchecked"})String y) {
}
}

@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 2 violations
class Cond {

@SuppressWarnings(value={(false) ? "" : "unchecked"}) // violation
Expand All @@ -91,9 +91,9 @@ public void aCond2() {
}

@java.lang.SuppressWarnings(value={(false) ? "unchecked" :
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // 2 violations
(false) ? "unchecked" :
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused"}) // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused"}) // 2 violations
public void seriously() {

}
Expand Down
Expand Up @@ -12,13 +12,13 @@
package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings;
import java.lang.annotation.Documented;

@SuppressWarnings(value={"unchecked", "unused"}) // violation
@SuppressWarnings(value={"unchecked", "unused"}) // 2 violations
public class InputSuppressWarningsExpandedNonConstant2
{
@SuppressWarnings(value={" "}) // violation
class Empty {

@SuppressWarnings(value={"unchecked", ""}) // violation
@SuppressWarnings(value={"unchecked", ""}) // 2 violations
public Empty() {

}
Expand All @@ -27,7 +27,7 @@ public Empty() {
@SuppressWarnings(value={"unused"}) // violation
enum Duh {

@SuppressWarnings(value={"unforgiven", " un"}) // violation
@SuppressWarnings(value={"unforgiven", " un"}) // 2 violations
D;

public static void foo() {
Expand All @@ -54,7 +54,7 @@ public String toString() {
@SuppressWarnings(value={}) // violation
@interface MoreSweetness {

@SuppressWarnings(value={"unused", "bleh"}) // violation
@SuppressWarnings(value={"unused", "bleh"}) // 2 violations
int cool();
}

Expand All @@ -71,29 +71,29 @@ void doFoo(String s, @SuppressWarnings(value={"unchecked"})String y) { // violat
}
}

@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 4 violations
class Cond {

@SuppressWarnings(value={(false) ? "" : "unchecked"}) // violation
@SuppressWarnings(value={(false) ? "" : "unchecked"}) // 2 violations
public Cond() {

}

@SuppressWarnings(value={(false) ? (true) ? " " : "unused" : "unchecked", // violation
(false) ? (true) ? " " : "unused" : "unchecked"}) // violation
@SuppressWarnings(value={(false) ? (true) ? " " : "unused" : "unchecked", // 3 violations
(false) ? (true) ? " " : "unused" : "unchecked"}) // 3 violations
public void aCond1() {

}

@SuppressWarnings(value={(false) ? "unchecked" : (true) ? " " : "unused"}) // violation
@SuppressWarnings(value={(false) ? "unchecked" : (true) ? " " : "unused"}) // 3 violations
public void aCond2() {

}

@java.lang.SuppressWarnings(value={(false) ? "unchecked" : // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused", // 4 violations
(false) ? "unchecked" : // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused"}) // violation
("" == "") ? (false) ? (true) ? "" : "foo" : " " : "unused"}) // 4 violations
public void seriously() {

}
Expand Down
Expand Up @@ -71,7 +71,7 @@ void doFoo(String s, @SuppressWarnings(value={"unchecked"})String y) { // violat
}
}

@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 2 violations
class Cond {

@SuppressWarnings(value={(false) ? "" : "unchecked"}) // violation
Expand Down
Expand Up @@ -69,7 +69,7 @@ void doFoo(String s, @SuppressWarnings(value={"unchecked"})String y) {
}
}

@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // violation
@SuppressWarnings(value={(false) ? "unchecked" : "", (false) ? "unchecked" : ""}) // 2 violations
class Cond {

@SuppressWarnings(value={(false) ? "" : "unchecked"})
Expand Down

0 comments on commit c61f91e

Please sign in to comment.