Enable checkstyle

Change-Id: Ib1944d6aad665656d8a99d6663f8dca31aaf916e
diff --git a/build.gradle b/build.gradle
index a827935..dc1803f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@
   id 'java-library'
   id 'maven' // TODO: migrate to 'maven-publish'
   id 'signing'
-  //id 'checkstyle'
+  id 'checkstyle'
   id 'org.sonarqube' version '3.0'
   id 'net.saliman.cobertura' version '4.0.0'
 }
@@ -50,11 +50,11 @@
   }
 }
 
-tasks.withType(Checkstyle) {
-  checkstyleClasspath = project.configurations.checkstyleConfig
-  checkstyleTest {
-    configFile file('config/checkstyle/checkstyle-test.xml')
-  }
+checkstyle {
+  toolVersion '8.23'
+}
+checkstyleTest {
+  configFile file('config/checkstyle/checkstyle-test.xml')
 }
 
 cobertura {
diff --git a/config/checkstyle/checkstyle-test.xml b/config/checkstyle/checkstyle-test.xml
index 503f6e0..65c2586 100644
--- a/config/checkstyle/checkstyle-test.xml
+++ b/config/checkstyle/checkstyle-test.xml
@@ -1,64 +1,64 @@
 <?xml version="1.0"?>
-<!--
-  ~ jndn-mock
-  ~ Copyright (c) 2016, Intel Corporation.
-  ~
-  ~ This program is free software; you can redistribute it and/or modify it
-  ~ under the terms and conditions of the GNU Lesser General Public License,
-  ~ version 3, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope it will be useful, but WITHOUT ANY
-  ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-  ~ FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
-  ~ more details.
-  -->
-
 <!DOCTYPE module PUBLIC
-          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
-          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+          "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+          "https://checkstyle.org/dtds/configuration_1_3.dtd">
 
 <!--
 
-  Based on http://checkstyle.sourceforge.net/sun_style.html, the
   Checkstyle configuration that checks the sun coding conventions from:
 
     - the Java Language Specification at
-      http://java.sun.com/docs/books/jls/second_edition/html/index.html
+      https://docs.oracle.com/javase/specs/jls/se11/html/index.html
 
-    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+    - the Sun Code Conventions at https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
 
     - the Javadoc guidelines at
-      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+      https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
 
-    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+    - the JDK Api documentation https://docs.oracle.com/en/java/javase/11/
 
     - some best practices
 
   Checkstyle is very configurable. Be sure to read the documentation at
-  http://checkstyle.sourceforge.net (or in your downloaded distribution).
+  https://checkstyle.org (or in your downloaded distribution).
 
   Most Checks are configurable, be sure to consult the documentation.
 
   To completely disable a check, just comment it out or delete it from the file.
+  To suppress certain violations please review suppression filters.
 
   Finally, it is worth reading the documentation.
 
 -->
 
 <module name="Checker">
-    <!--
-        If you set the basedir property below, then all reported file
-        names will be relative to the specified directory. See
-        http://checkstyle.sourceforge.net/5.x/config.html#Checker
+  <!--
+      If you set the basedir property below, then all reported file
+      names will be relative to the specified directory. See
+      https://checkstyle.org/config.html#Checker
 
-        <property name="basedir" value="${basedir}"/>
-    -->
+      <property name="basedir" value="${basedir}"/>
+  -->
+  <property name="severity" value="error"/>
 
-    <property name="fileExtensions" value="java, properties, xml"/>
+  <property name="fileExtensions" value="java, properties, xml"/>
+
+  <!-- Excludes all 'module-info.java' files              -->
+  <!-- See https://checkstyle.org/config_filefilters.html -->
+  <module name="BeforeExecutionExclusionFileFilter">
+    <property name="fileNamePattern" value="module\-info\.java$"/>
+  </module>
+
+  <!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
+  <module name="SuppressionFilter">
+    <property name="file" value="${org.checkstyle.sun.suppressionfilter.config}"
+              default="checkstyle-suppressions.xml" />
+    <property name="optional" value="true"/>
+  </module>
 
     <!-- Checks that a package-info.java file exists for each package.     -->
     <!-- See http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage -->
-    <!--<module name="JavadocPackage"/>-->
+    <!-- <module name="JavadocPackage"/> -->
 
     <!-- Checks whether files end with a new line.                        -->
     <!-- See http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile -->
@@ -96,16 +96,14 @@
 
         <!-- Checks for Javadoc comments.                     -->
         <!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
-        <!--<module name="JavadocMethod">-->
-            <!--<property name="excludeScope" value="private"/>-->
-        <!--</module>-->
-        <module name="JavadocType">
-            <property name="excludeScope" value="private"/>
-        </module>
+        <module name="InvalidJavadocPosition"/>
+        <!-- <module name="JavadocMethod"/> -->
+        <module name="JavadocType"/>
         <module name="JavadocVariable">
             <property name="excludeScope" value="private"/>
         </module>
         <module name="JavadocStyle"/>
+        <!-- <module name="MissingJavadocMethod"/> -->
 
         <!-- Checks for Naming Conventions.                  -->
         <!-- See http://checkstyle.sourceforge.net/config_naming.html -->
@@ -172,26 +170,34 @@
         <!-- <module name="HiddenField"/> -->
         <module name="IllegalInstantiation"/>
         <module name="InnerAssignment"/>
-        <!--<module name="MagicNumber"/>-->
+        <!-- <module name="MagicNumber"/> -->
         <module name="MissingSwitchDefault"/>
+        <module name="MultipleVariableDeclarations"/>
         <module name="SimplifyBooleanExpression"/>
         <module name="SimplifyBooleanReturn"/>
 
         <!-- Checks for class design                         -->
         <!-- See http://checkstyle.sourceforge.net/config_design.html -->
-        <!--<module name="DesignForExtension"/>-->
+        <!-- <module name="DesignForExtension"/> -->
         <module name="FinalClass"/>
         <module name="HideUtilityClassConstructor"/>
         <module name="InterfaceIsType"/>
-        <!--<module name="VisibilityModifier"/>-->
+        <!-- <module name="VisibilityModifier"/> -->
 
         <!-- Miscellaneous other checks.                   -->
         <!-- See http://checkstyle.sourceforge.net/config_misc.html -->
         <module name="ArrayTypeStyle"/>
-        <module name="FinalParameters"/>
-        <!--<module name="TodoComment"/>-->
+        <!-- <module name="FinalParameters"/> -->
+        <!-- <module name="TodoComment"/> -->
         <module name="UpperEll"/>
 
+    <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
+    <module name="SuppressionXpathFilter">
+      <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
+                default="checkstyle-xpath-suppressions.xml" />
+      <property name="optional" value="true"/>
+    </module>
+
     </module>
 
 </module>
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
index 9fb4286..073fdbf 100644
--- a/config/checkstyle/checkstyle.xml
+++ b/config/checkstyle/checkstyle.xml
@@ -1,83 +1,83 @@
 <?xml version="1.0"?>
-<!--
-  ~ jndn-mock
-  ~ Copyright (c) 2016, Intel Corporation.
-  ~
-  ~ This program is free software; you can redistribute it and/or modify it
-  ~ under the terms and conditions of the GNU Lesser General Public License,
-  ~ version 3, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope it will be useful, but WITHOUT ANY
-  ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-  ~ FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
-  ~ more details.
-  -->
-
 <!DOCTYPE module PUBLIC
-          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
-          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+          "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+          "https://checkstyle.org/dtds/configuration_1_3.dtd">
 
 <!--
 
-  Based on http://checkstyle.sourceforge.net/sun_style.html, the
   Checkstyle configuration that checks the sun coding conventions from:
 
     - the Java Language Specification at
-      http://java.sun.com/docs/books/jls/second_edition/html/index.html
+      https://docs.oracle.com/javase/specs/jls/se11/html/index.html
 
-    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+    - the Sun Code Conventions at https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
 
     - the Javadoc guidelines at
-      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+      https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
 
-    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+    - the JDK Api documentation https://docs.oracle.com/en/java/javase/11/
 
     - some best practices
 
   Checkstyle is very configurable. Be sure to read the documentation at
-  http://checkstyle.sourceforge.net (or in your downloaded distribution).
+  https://checkstyle.org (or in your downloaded distribution).
 
   Most Checks are configurable, be sure to consult the documentation.
 
   To completely disable a check, just comment it out or delete it from the file.
+  To suppress certain violations please review suppression filters.
 
   Finally, it is worth reading the documentation.
 
 -->
 
 <module name="Checker">
-    <!--
-        If you set the basedir property below, then all reported file
-        names will be relative to the specified directory. See
-        http://checkstyle.sourceforge.net/5.x/config.html#Checker
+  <!--
+      If you set the basedir property below, then all reported file
+      names will be relative to the specified directory. See
+      https://checkstyle.org/config.html#Checker
 
-        <property name="basedir" value="${basedir}"/>
-    -->
+      <property name="basedir" value="${basedir}"/>
+  -->
+  <property name="severity" value="error"/>
 
-    <property name="fileExtensions" value="java, properties, xml"/>
+  <property name="fileExtensions" value="java, properties, xml"/>
+
+  <!-- Excludes all 'module-info.java' files              -->
+  <!-- See https://checkstyle.org/config_filefilters.html -->
+  <module name="BeforeExecutionExclusionFileFilter">
+    <property name="fileNamePattern" value="module\-info\.java$"/>
+  </module>
+
+  <!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
+  <module name="SuppressionFilter">
+    <property name="file" value="${org.checkstyle.sun.suppressionfilter.config}"
+              default="checkstyle-suppressions.xml" />
+    <property name="optional" value="true"/>
+  </module>
 
     <!-- Checks that a package-info.java file exists for each package.     -->
-    <!-- See http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage -->
-    <module name="JavadocPackage"/>
+    <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage -->
+    <!-- <module name="JavadocPackage"/> -->
 
     <!-- Checks whether files end with a new line.                        -->
-    <!-- See http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile -->
+    <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
     <module name="NewlineAtEndOfFile"/>
 
     <!-- Checks that property files contain the same keys.         -->
-    <!-- See http://checkstyle.sourceforge.net/config_misc.html#Translation -->
+    <!-- See https://checkstyle.org/config_misc.html#Translation -->
     <module name="Translation"/>
 
     <!-- Checks for Size Violations.                    -->
-    <!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
+    <!-- See https://checkstyle.org/config_sizes.html -->
     <module name="FileLength"/>
 
     <!-- Checks for whitespace                               -->
-    <!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
+    <!-- See https://checkstyle.org/config_whitespace.html -->
     <module name="FileTabCharacter"/>
 
     <!-- Miscellaneous other checks.                   -->
-    <!-- See http://checkstyle.sourceforge.net/config_misc.html -->
+    <!-- See https://checkstyle.org/config_misc.html -->
     <module name="RegexpSingleline">
        <property name="format" value="\s+$"/>
        <property name="minimum" value="0"/>
@@ -86,7 +86,7 @@
     </module>
 
     <!-- Checks for Headers                                -->
-    <!-- See http://checkstyle.sourceforge.net/config_header.html   -->
+    <!-- See https://checkstyle.org/config_header.html   -->
     <!-- <module name="Header"> -->
     <!--   <property name="headerFile" value="${checkstyle.header.file}"/> -->
     <!--   <property name="fileExtensions" value="java"/> -->
@@ -95,20 +95,18 @@
     <module name="TreeWalker">
 
         <!-- Checks for Javadoc comments.                     -->
-        <!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
-        <module name="JavadocMethod">
-            <property name="excludeScope" value="private"/>
-        </module>
-        <module name="JavadocType">
-            <property name="excludeScope" value="private"/>
-        </module>
+        <!-- See https://checkstyle.org/config_javadoc.html -->
+        <module name="InvalidJavadocPosition"/>
+        <module name="JavadocMethod"/>
+        <module name="JavadocType"/>
         <module name="JavadocVariable">
             <property name="excludeScope" value="private"/>
         </module>
         <module name="JavadocStyle"/>
+        <!-- <module name="MissingJavadocMethod"/> -->
 
         <!-- Checks for Naming Conventions.                  -->
-        <!-- See http://checkstyle.sourceforge.net/config_naming.html -->
+        <!-- See https://checkstyle.org/config_naming.html -->
         <module name="ConstantName"/>
         <module name="LocalFinalVariableName"/>
         <module name="LocalVariableName"/>
@@ -120,7 +118,7 @@
         <module name="TypeName"/>
 
         <!-- Checks for imports                              -->
-        <!-- See http://checkstyle.sourceforge.net/config_import.html -->
+        <!-- See https://checkstyle.org/config_imports.html -->
         <module name="AvoidStarImport"/>
         <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
         <module name="RedundantImport"/>
@@ -129,7 +127,7 @@
         </module>
 
         <!-- Checks for Size Violations.                    -->
-        <!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
+        <!-- See https://checkstyle.org/config_sizes.html -->
         <module name="LineLength">
             <property name="max" value="120"/>
         </module>
@@ -137,7 +135,7 @@
         <module name="ParameterNumber"/>
 
         <!-- Checks for whitespace                               -->
-        <!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
+        <!-- See https://checkstyle.org/config_whitespace.html -->
         <module name="EmptyForIteratorPad"/>
         <module name="GenericWhitespace"/>
         <module name="MethodParamPad"/>
@@ -152,12 +150,12 @@
         <module name="WhitespaceAround"/>
 
         <!-- Modifier Checks                                    -->
-        <!-- See http://checkstyle.sourceforge.net/config_modifiers.html -->
+        <!-- See https://checkstyle.org/config_modifiers.html -->
         <module name="ModifierOrder"/>
         <module name="RedundantModifier"/>
 
         <!-- Checks for blocks. You know, those {}'s         -->
-        <!-- See http://checkstyle.sourceforge.net/config_blocks.html -->
+        <!-- See https://checkstyle.org/config_blocks.html -->
         <module name="AvoidNestedBlocks"/>
         <module name="EmptyBlock"/>
         <module name="LeftCurly"/>
@@ -165,7 +163,7 @@
         <module name="RightCurly"/>
 
         <!-- Checks for common coding problems               -->
-        <!-- See http://checkstyle.sourceforge.net/config_coding.html -->
+        <!-- See https://checkstyle.org/config_coding.html -->
         <module name="AvoidInlineConditionals"/>
         <module name="EmptyStatement"/>
         <module name="EqualsHashCode"/>
@@ -174,26 +172,34 @@
         <module name="InnerAssignment"/>
         <module name="MagicNumber"/>
         <module name="MissingSwitchDefault"/>
+        <module name="MultipleVariableDeclarations"/>
         <module name="SimplifyBooleanExpression"/>
         <module name="SimplifyBooleanReturn"/>
 
         <!-- Checks for class design                         -->
-        <!-- See http://checkstyle.sourceforge.net/config_design.html -->
-        <!--<module name="DesignForExtension"/>-->
+        <!-- See https://checkstyle.org/config_design.html -->
+        <!-- <module name="DesignForExtension"/> -->
         <module name="FinalClass"/>
         <module name="HideUtilityClassConstructor"/>
         <module name="InterfaceIsType"/>
         <module name="VisibilityModifier">
-            <property name="publicMemberPattern" value="^(on|sent).*$"/>
+            <property name="allowPublicFinalFields" value="true"/>
         </module>
 
         <!-- Miscellaneous other checks.                   -->
-        <!-- See http://checkstyle.sourceforge.net/config_misc.html -->
+        <!-- See https://checkstyle.org/config_misc.html -->
         <module name="ArrayTypeStyle"/>
-        <module name="FinalParameters"/>
-        <!--<module name="TodoComment"/>-->
+        <!-- <module name="FinalParameters"/> -->
+        <!-- <module name="TodoComment"/> -->
         <module name="UpperEll"/>
 
+    <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
+    <module name="SuppressionXpathFilter">
+      <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
+                default="checkstyle-xpath-suppressions.xml" />
+      <property name="optional" value="true"/>
+    </module>
+
     </module>
 
 </module>
diff --git a/src/main/java/com/intel/jndn/mock/MeasurableFace.java b/src/main/java/com/intel/jndn/mock/MeasurableFace.java
index c862756..2374995 100644
--- a/src/main/java/com/intel/jndn/mock/MeasurableFace.java
+++ b/src/main/java/com/intel/jndn/mock/MeasurableFace.java
@@ -20,7 +20,7 @@
 import java.util.Collection;
 
 /**
- * Provide API for measuring packet use on a given face
+ * Provide API for measuring packet use on a given face.
  *
  * @author Andrew Brown, andrew.brown@intel.com
  */
diff --git a/src/main/java/com/intel/jndn/mock/MockForwarder.java b/src/main/java/com/intel/jndn/mock/MockForwarder.java
index 84c18bc..5a86624 100644
--- a/src/main/java/com/intel/jndn/mock/MockForwarder.java
+++ b/src/main/java/com/intel/jndn/mock/MockForwarder.java
@@ -132,7 +132,7 @@
   }
 
   /**
-   * Mock-specific API for recording the source and destination of incoming interests
+   * Mock-specific API for recording the source and destination of incoming interests.
    */
   public interface OnInterestReceived {
     /**
diff --git a/src/main/java/com/intel/jndn/mock/forwarder/LocalFibEntry.java b/src/main/java/com/intel/jndn/mock/forwarder/LocalFibEntry.java
index 6d7ce1b..2882402 100644
--- a/src/main/java/com/intel/jndn/mock/forwarder/LocalFibEntry.java
+++ b/src/main/java/com/intel/jndn/mock/forwarder/LocalFibEntry.java
@@ -34,7 +34,8 @@
   private final Face registrationFace;
   private final RegistrationOptions flags;
 
-  public LocalFibEntry(Name prefix, MockForwarder.OnInterestReceived callback, Face registrationFace, RegistrationOptions flags) {
+  public LocalFibEntry(Name prefix, MockForwarder.OnInterestReceived callback, Face registrationFace,
+                       RegistrationOptions flags) {
     this.prefix = prefix;
     this.callback = callback;
     this.registrationFace = registrationFace;
diff --git a/src/main/java/com/intel/jndn/mock/forwarder/OnPrefixRegistration.java b/src/main/java/com/intel/jndn/mock/forwarder/OnPrefixRegistration.java
index 670445a..eda501a 100644
--- a/src/main/java/com/intel/jndn/mock/forwarder/OnPrefixRegistration.java
+++ b/src/main/java/com/intel/jndn/mock/forwarder/OnPrefixRegistration.java
@@ -56,7 +56,9 @@
     LOGGER.info("Received registration request: " + interest.toUri());
     ControlParameters params = decodeParameters(interest);
 
-    MockForwarder.FibEntry entry = new ClientFibEntry(params.getName(), (MockTransport) destinationTransport, params.getForwardingFlags());
+    MockForwarder.FibEntry entry = new ClientFibEntry(params.getName(),
+                                                      (MockTransport) destinationTransport,
+                                                      params.getForwardingFlags());
     fib.add(entry);
     LOGGER.info("Added new route " + params.getName() + " to: " + destinationTransport);
 
diff --git a/src/main/java/com/intel/jndn/mock/forwarder/PitImpl.java b/src/main/java/com/intel/jndn/mock/forwarder/PitImpl.java
index 81eb15f..c89f8d7 100644
--- a/src/main/java/com/intel/jndn/mock/forwarder/PitImpl.java
+++ b/src/main/java/com/intel/jndn/mock/forwarder/PitImpl.java
@@ -24,7 +24,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
- * Naive implementation of a pending interest table
+ * Naive implementation of a Pending Interest Table.
  *
  * @author Andrew Brown, andrew.brown@intel.com
  */
diff --git a/src/test/java/com/intel/jndn/mock/MockForwarderTest.java b/src/test/java/com/intel/jndn/mock/MockForwarderTest.java
index 6bf09ab..b36cbd4 100644
--- a/src/test/java/com/intel/jndn/mock/MockForwarderTest.java
+++ b/src/test/java/com/intel/jndn/mock/MockForwarderTest.java
@@ -103,4 +103,4 @@
     response2.await(1, TimeUnit.SECONDS);
     assertTrue(received.get());
   }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/intel/jndn/mock/forwarder/MockForwarderVisibilityTest.java b/src/test/java/com/intel/jndn/mock/forwarder/MockForwarderVisibilityTest.java
index 4e8d685..5f7791d 100644
--- a/src/test/java/com/intel/jndn/mock/forwarder/MockForwarderVisibilityTest.java
+++ b/src/test/java/com/intel/jndn/mock/forwarder/MockForwarderVisibilityTest.java
@@ -23,7 +23,7 @@
 import org.junit.Test;
 
 /**
- * Ensure MockForwarder methods are visible publicly; does not test functionality
+ * Ensure MockForwarder methods are visible publicly; does not test functionality.
  *
  * @author Andrew Brown, andrew.brown@intel.com
  */