From 7b2d3e1db607aa1ea1751caab6f54e33c1350901 Mon Sep 17 00:00:00 2001 From: Martin Dietze Date: Wed, 6 Mar 2019 17:37:35 +0800 Subject: [PATCH 1/2] Issue #727: Integrated 'Jsr305AnnotationsCheck', originally from 'https://github.com/bjrke/JSR305CheckstylePlugin' --- .../src/checkstyle_packages.xml | 1 + .../jsr305/checkstyle-metadata.properties | 5 + .../checks/jsr305/checkstyle-metadata.xml | 24 + sevntu-checks/pom.xml | 11 + sevntu-checks/sevntu-checks.xml | 8 + .../checks/jsr305/Jsr305AnnotationsCheck.java | 990 ++++++++++++++++++ .../checks/jsr305/package-info.java | 24 + .../main/resources/checkstyle_packages.xml | 1 + .../checks/jsr305/messages.properties | 25 + .../jsr305/Jsr305AnnotationsCheckTest.java | 83 ++ .../jsr305/Jsr305AnnotionsTestUtil.java | 232 ++++ .../checks/jsr305/test/ArraysTestObject.java | 140 +++ .../checks/jsr305/test/ClassTestObject.java | 195 ++++ .../jsr305/test/ConstructorTestObject.java | 107 ++ .../test/DefaultParameterTestObject.java | 42 + .../test/DefectConstructorTestObject.java | 37 + .../checks/jsr305/test/EnumTestObject.java | 96 ++ .../jsr305/test/InheritanceTestObject.java | 102 ++ .../checks/jsr305/test/LambdaTestObject.java | 44 + .../jsr305/test/ParameterTestObject.java | 101 ++ .../jsr305/test/PrimitivesTestObject.java | 120 +++ .../jsr305/test/ReturnValueTestObject.java | 129 +++ .../main/resources/checkstyle_packages.xml | 2 + .../sonar/checkstyle-extensions.xml | 26 + 24 files changed, 2545 insertions(+) create mode 100755 eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties create mode 100644 eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/jsr305/Jsr305AnnotationsCheck.java create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/jsr305/package-info.java create mode 100644 sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/jsr305/messages.properties create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/Jsr305AnnotationsCheckTest.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/Jsr305AnnotionsTestUtil.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/ArraysTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/ClassTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/ConstructorTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/DefaultParameterTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/DefectConstructorTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/EnumTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/InheritanceTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/LambdaTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/ParameterTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/PrimitivesTestObject.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/jsr305/test/ReturnValueTestObject.java diff --git a/eclipsecs-sevntu-plugin/src/checkstyle_packages.xml b/eclipsecs-sevntu-plugin/src/checkstyle_packages.xml index 548ff7ec08..e0dcf7c99d 100644 --- a/eclipsecs-sevntu-plugin/src/checkstyle_packages.xml +++ b/eclipsecs-sevntu-plugin/src/checkstyle_packages.xml @@ -15,6 +15,7 @@ + diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties new file mode 100755 index 0000000000..04925d2d62 --- /dev/null +++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties @@ -0,0 +1,5 @@ +Jsr305AnnotationsCheck.desc = Checks method parameters and return values for the presence of @Nonnull, @Nullable, or @CheckForNull annotations. +Jsr305AnnotationsCheck.packages=Packages to be checked. +Jsr305AnnotationsCheck.excludePackages=Packages excluded from checking. +Jsr305AnnotationsCheck.allowOverridingReturnValue=Allow Overriding return values, useful for upgrading. +Jsr305AnnotationsCheck.allowOverridingParameter=Allow Overriding paramaters, useful for upgrading. diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml new file mode 100644 index 0000000000..ff34ea4df3 --- /dev/null +++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml @@ -0,0 +1,24 @@ + + + + + + + + Checks method parameters and return values for the presence of @Nonnull, @Nullable, or @CheckForNull annotations. + + Packages to be checked. + + + Packages excluded from checking. + + + Allow Overriding return values, useful for upgrading. + + + Allow Overriding paramaters, useful for upgrading. + + + + + diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 971587eadc..0629f68a1e 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -42,6 +42,17 @@ test ${checkstyle.eclipse-cs.version} + + + com.google.code.findbugs + jsr305 + 3.0.1 + + + com.google.code.findbugs + annotations + 3.0.1 + junit junit diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml index d4c7612e18..f327bee93b 100644 --- a/sevntu-checks/sevntu-checks.xml +++ b/sevntu-checks/sevntu-checks.xml @@ -216,6 +216,14 @@ + + + + + + + + + + com.github.sevntu.checkstyle.checks.jsr305.Jsr305AnnotationsCheck + Line Length Extended + + Checks for long lines. + Checker/TreeWalker/com.github.sevntu.checkstyle.checks.jsr305.Jsr305AnnotationsCheck + + + + Packages to be checked. + + + + Packages excluded from checking. + + + false + Allow Overriding return values, useful for upgrading. + + + false + Allow Overriding paramaters, useful for upgrading. + + + com.github.sevntu.checkstyle.checks.sizes.LineLengthExtendedCheck From 4321c9d0ba3ac1477653625a8c940501923e1b9c Mon Sep 17 00:00:00 2001 From: Martin Dietze Date: Thu, 7 Mar 2019 03:18:05 +0100 Subject: [PATCH 2/2] Issue #727: checkstyle-metadata.xml now passes xmllint --valid --- .../jsr305/checkstyle-metadata.properties | 3 +- .../checks/jsr305/checkstyle-metadata.xml | 46 +++++++++++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties index 04925d2d62..ed52855a1f 100755 --- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties +++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.properties @@ -1,4 +1,5 @@ -Jsr305AnnotationsCheck.desc = Checks method parameters and return values for the presence of @Nonnull, @Nullable, or @CheckForNull annotations. +Jsr305AnnotationsCheck.name=Jsr305AnnotationsCheck +Jsr305AnnotationsCheck.desc=Checks method parameters and return values for the presence of @Nonnull, @Nullable, or @CheckForNull annotations. Jsr305AnnotationsCheck.packages=Packages to be checked. Jsr305AnnotationsCheck.excludePackages=Packages excluded from checking. Jsr305AnnotationsCheck.allowOverridingReturnValue=Allow Overriding return values, useful for upgrading. diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml index ff34ea4df3..b8687b4ff6 100644 --- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml +++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/jsr305/checkstyle-metadata.xml @@ -1,24 +1,52 @@ - - + + - + - Checks method parameters and return values for the presence of @Nonnull, @Nullable, or @CheckForNull annotations. + %Jsr305AnnotationsCheck.desc - Packages to be checked. + %Jsr305AnnotationsCheck.packages - Packages excluded from checking. + %Jsr305AnnotationsCheck.excludePackages - Allow Overriding return values, useful for upgrading. + %Jsr305AnnotationsCheck.allowOverridingReturnValue - Allow Overriding paramaters, useful for upgrading. + %Jsr305AnnotationsCheck.allowOverridingParameter - + + + + + + + + + + + + + + + + + + + + + + + + + + +