Skip to content

Commit

Permalink
Issue checkstyle#15456: Define violation messages for PackageAnnotati…
Browse files Browse the repository at this point in the history
…onCheck
  • Loading branch information
luvtyping authored and romani committed Dec 4, 2024
1 parent 09301b3 commit 05b69c6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ public final class InlineConfigParser {
* Until <a href="https://github.com/checkstyle/checkstyle/issues/15456">#15456</a>.
*/
private static final Set<String> SUPPRESSED_CHECKS = Set.of(
"com.puppycrawl.tools.checkstyle.checks.annotation.PackageAnnotationCheck",
"com.puppycrawl.tools.checkstyle.checks.annotation.SuppressWarningsCheck",
"com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck",
"com.puppycrawl.tools.checkstyle.checks.blocks.EmptyCatchBlockCheck",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
//non-compiled with javac: compiling on jdk before 8
//more details at https://github.com/checkstyle/checkstyle/issues/7846
@Deprecated
package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation; // violation
package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation;
// violation above, 'Package annotations must be in the package-info.java info.'

public class InputPackageAnnotation2 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.jupiter.api.Test;

import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;

public class PackageAnnotationCheckExamplesTest extends AbstractExamplesModuleTestSupport {
@Override
Expand All @@ -42,18 +43,14 @@ public void testExample1() throws Exception {

@Test
public void testExample2() throws Exception {
final String[] expected = {

};
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;

verifyWithInlineConfigParser(getPath("Example2.java"), expected);
}

@Test
public void testExample3() throws Exception {
final String[] expected = {

};
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;

verifyWithInlineConfigParser(getPath("example3/package-info.java"), expected);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
//non-compiled with javac: Compilable with Java7

// xdoc section -- start
@Deprecated // violation below
@Deprecated
package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation;
// violation above, 'Package annotations must be in the package-info.java info.'

class Example1 {}
// xdoc section -- end
3 changes: 2 additions & 1 deletion src/xdocs/checks/annotation/packageannotation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
</source>
<p id="Example1-code">Example of class with violation:</p>
<source>
@Deprecated // violation below
@Deprecated
package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation;
// violation above, 'Package annotations must be in the package-info.java info.'

class Example1 {}
</source>
Expand Down

0 comments on commit 05b69c6

Please sign in to comment.