Update checkstyle to 8.10

- fix issues detected
  - YANG custom registrator should be subject to checkstyle
  - fix Java 8 syntax related violations

Change-Id: I0fc52c6612a40d851fd9bc3bf019621776b1f92a
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/pwaas/DefaultL2TunnelHandler.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/pwaas/DefaultL2TunnelHandler.java
index eb18381..c736614 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/pwaas/DefaultL2TunnelHandler.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/pwaas/DefaultL2TunnelHandler.java
@@ -425,7 +425,7 @@
 
         // iterate over links and get all devices in the order
         // we find them
-        List<DeviceId> deviceList = new ArrayList<DeviceId>();
+        List<DeviceId> deviceList = new ArrayList<>();
         for (Link link : path) {
             if (!deviceList.contains(link.src().deviceId())) {
                 deviceList.add(link.src().deviceId());
@@ -894,6 +894,7 @@
         }
     }
 
+    @Override
     @Deprecated
     public void tearDown(Set<L2TunnelDescription> pwToRemove) {
 
@@ -1125,10 +1126,10 @@
                      dstMac);
             FilteringObjective.Builder filteringObjectiveBuilder =
                     createNormalPipelineFiltObjective(inPort, l2Tunnel.transportVlan(), dstMac);
-            context = new DefaultObjectiveContext(( objective ) ->
+            context = new DefaultObjectiveContext((objective) ->
                                                           log.debug("Special filtObj for  " + "for {} populated",
                                                                     l2Tunnel.tunnelId()),
-                                                  ( objective, error ) ->
+                                                  (objective, error) ->
                                                           log.warn("Failed to populate " +
                                                                            "special filtObj " +
                                                                            "rule for {}: {}",
@@ -1665,9 +1666,9 @@
                      dstMac);
             FilteringObjective.Builder filteringObjectiveBuilder =
                     createNormalPipelineFiltObjective(inPort, l2Tunnel.transportVlan(), dstMac);
-            context = new DefaultObjectiveContext(( objective ) ->
+            context = new DefaultObjectiveContext((objective) ->
                                                           log.debug("Special filtObj for  " + "for {} removed",
-                                                                    l2Tunnel.tunnelId()), ( objective, error ) ->
+                                                                    l2Tunnel.tunnelId()), (objective, error) ->
                     log.warn("Failed to populate " + "special filtObj " +
                                      "rule for {}: {}", l2Tunnel.tunnelId(), error));
             TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
diff --git a/bucklets/yang.bucklet b/bucklets/yang.bucklet
index 7ef9b33..8d5d83f 100644
--- a/bucklets/yang.bucklet
+++ b/bucklets/yang.bucklet
@@ -67,7 +67,7 @@
           deps = deps + YANG_TOOLS,
           resources = [ ':' + schema ],
           resources_root = ".",
-          do_checkstyle = False,
+          do_checkstyle = True,
           do_javadocs = False,
         )
     else:
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java
index f31ba18..1dc1d8d 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java
@@ -511,7 +511,7 @@
         }
     }
 
-    private void dump(String format, Object ... args) {
+    private void dump(String format, Object... args) {
         if (dump) {
             print(format, args);
         }
@@ -603,6 +603,7 @@
             flowRules.add(flowRule);
         }
 
+        @Override
         public String toString() {
             return MoreObjects.toStringHelper(getClass())
                     .omitNullValues()
diff --git a/core/api/src/main/java/org/onosproject/net/intent/Key.java b/core/api/src/main/java/org/onosproject/net/intent/Key.java
index fc2da89..fadf8b9 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/Key.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/Key.java
@@ -44,6 +44,7 @@
         return hash;
     }
 
+    @SuppressWarnings("checkstyle:EqualsHashCode")
     @Override
     public int hashCode() {
         return Long.hashCode(hash);
diff --git a/lib/BUCK b/lib/BUCK
index 155d066..07fa1de 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,5 +1,4 @@
-# ***** This file was auto-generated at Wed, 16 May 2018 01:37:51 GMT. Do not edit this file manually. *****
-# ***** This file was auto-generated at Wed, 9 May 2018 07:17:00 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Fri, 18 May 2018 23:14:52 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 pass_thru_pom(
@@ -1189,10 +1188,10 @@
 
 remote_jar (
   name = 'checkstyle',
-  out = 'checkstyle-6.19.jar',
-  url = 'mvn:com.puppycrawl.tools:checkstyle:jar:6.19',
-  sha1 = 'df5c3a46239d66c623922992a98080ae7f6cc932',
-  maven_coords = 'com.puppycrawl.tools:checkstyle:jar:NON-OSGI:6.19',
+  out = 'checkstyle-8.10.jar',
+  url = 'mvn:com.puppycrawl.tools:checkstyle:jar:8.10',
+  sha1 = 'd7cd09c4d1240b3acc3041fcb47fd74ae351698b',
+  maven_coords = 'com.puppycrawl.tools:checkstyle:jar:NON-OSGI:8.10',
   visibility = [ 'PUBLIC' ],
 )
 
diff --git a/lib/deps.json b/lib/deps.json
index 701aed1..2ffee82 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -226,7 +226,7 @@
     "slf4j-jdk14": "mvn:org.slf4j:slf4j-jdk14:1.7.25",
     "typesafe-config": "mvn:com.typesafe:config:1.2.1",
     "validation-api": "mvn:javax.validation:validation-api:1.1.0.Final",
-    "checkstyle": "mvn:com.puppycrawl.tools:checkstyle:6.19",
+    "checkstyle": "mvn:com.puppycrawl.tools:checkstyle:8.10",
     "apache-karaf": "mvn:org.onosproject:apache-karaf-offline:tar.gz:3.0.8",
     "apache-karaf-patches": "mvn:org.onosproject:onos-apache-karaf-patches:tar.gz:3.0.8",
     "bndlib": "mvn:biz.aQute.bnd:biz.aQute.bndlib:jar:3.1.0",
diff --git a/lib/pom.xml b/lib/pom.xml
index d406833..581e2d3 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -956,7 +956,7 @@
                     <dependency>
                         <groupId>com.puppycrawl.tools</groupId>
                         <artifactId>checkstyle</artifactId>
-                        <version>6.19</version>
+                        <version>8.10</version>
                     </dependency>
                 </dependencies>
                 <configuration>
diff --git a/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/CienaWaveserverAiModelRegistrator.java b/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/CienaWaveserverAiModelRegistrator.java
index f986281..257428d 100644
--- a/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/CienaWaveserverAiModelRegistrator.java
+++ b/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/CienaWaveserverAiModelRegistrator.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.models.ciena;
+package org.onosproject.models.ciena.waveserverai;
 
 import com.google.common.collect.ImmutableMap;
 import org.onosproject.yang.AbstractYangModelRegistrator;
@@ -26,8 +26,6 @@
 import org.onosproject.yang.runtime.AppModuleInfo;
 import org.onosproject.yang.runtime.DefaultAppModuleInfo;
 
-import java.util.List;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
diff --git a/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/package-info.java b/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/package-info.java
index fd62c24..0b5cc91 100644
--- a/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/package-info.java
+++ b/models/ciena/waveserverai/src/main/java/org/onosproject/models/ciena/waveserverai/package-info.java
@@ -14,6 +14,6 @@
  * limitations under the License.
  */
 /**
- * Yang models for Ciena Waveserver Ai
+ * Yang models for Ciena Waveserver Ai.
  */
 package org.onosproject.models.ciena.waveserverai;
diff --git a/models/openconfig/src/main/java/org/onosproject/models/openconfig/OpenConfigModelRegistrator.java b/models/openconfig/src/main/java/org/onosproject/models/openconfig/OpenConfigModelRegistrator.java
index 92fe966..d3e985a 100644
--- a/models/openconfig/src/main/java/org/onosproject/models/openconfig/OpenConfigModelRegistrator.java
+++ b/models/openconfig/src/main/java/org/onosproject/models/openconfig/OpenConfigModelRegistrator.java
@@ -29,10 +29,22 @@
 import org.onosproject.yang.gen.v1.openconfigaaa.rev20170706.OpenconfigAaaTacacs;
 import org.onosproject.yang.gen.v1.openconfigaaatypes.rev20170706.OpenconfigAaaTypes;
 import org.onosproject.yang.gen.v1.openconfigacl.rev20170526.OpenconfigAcl;
-import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.*;
+import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.OpenconfigAft;
+import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.OpenconfigAftCommon;
+import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.OpenconfigAftEthernet;
+import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.OpenconfigAftIpv4;
+import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.OpenconfigAftIpv6;
+import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.OpenconfigAftMpls;
+import org.onosproject.yang.gen.v1.openconfigaft.rev20170510.OpenconfigAftPf;
 import org.onosproject.yang.gen.v1.openconfigaftnetworkinstance.rev20170113.OpenconfigAftNetworkInstance;
 import org.onosproject.yang.gen.v1.openconfigafttypes.rev20170510.OpenconfigAftTypes;
-import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.*;
+import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.OpenconfigBgp;
+import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.OpenconfigBgpCommon;
+import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.OpenconfigBgpCommonMultiprotocol;
+import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.OpenconfigBgpCommonStructure;
+import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.OpenconfigBgpGlobal;
+import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.OpenconfigBgpNeighbor;
+import org.onosproject.yang.gen.v1.openconfigbgp.rev20170730.OpenconfigBgpPeerGroup;
 import org.onosproject.yang.gen.v1.openconfigbgppolicy.rev20170730.OpenconfigBgpPolicy;
 import org.onosproject.yang.gen.v1.openconfigbgptypes.rev20170730.OpenconfigBgpErrors;
 import org.onosproject.yang.gen.v1.openconfigbgptypes.rev20170730.OpenconfigBgpTypes;
@@ -74,7 +86,12 @@
 import org.onosproject.yang.gen.v1.openconfigopticalamplifier.rev20170708.OpenconfigOpticalAmplifier;
 import org.onosproject.yang.gen.v1.openconfigospfpolicy.rev20160822.OpenconfigOspfPolicy;
 import org.onosproject.yang.gen.v1.openconfigospftypes.rev20170228.OpenconfigOspfTypes;
-import org.onosproject.yang.gen.v1.openconfigospfv2.rev20170228.*;
+import org.onosproject.yang.gen.v1.openconfigospfv2.rev20170228.OpenconfigOspfv2;
+import org.onosproject.yang.gen.v1.openconfigospfv2.rev20170228.OpenconfigOspfv2Area;
+import org.onosproject.yang.gen.v1.openconfigospfv2.rev20170228.OpenconfigOspfv2AreaInterface;
+import org.onosproject.yang.gen.v1.openconfigospfv2.rev20170228.OpenconfigOspfv2Common;
+import org.onosproject.yang.gen.v1.openconfigospfv2.rev20170228.OpenconfigOspfv2Global;
+import org.onosproject.yang.gen.v1.openconfigospfv2.rev20170228.OpenconfigOspfv2Lsdb;
 import org.onosproject.yang.gen.v1.openconfigpacketmatch.rev20170526.OpenconfigPacketMatch;
 import org.onosproject.yang.gen.v1.openconfigpacketmatchtypes.rev20170526.OpenconfigPacketMatchTypes;
 import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.OpenconfigPlatform;
@@ -89,7 +106,11 @@
 import org.onosproject.yang.gen.v1.openconfigpolicytypes.rev20170714.OpenconfigPolicyTypes;
 import org.onosproject.yang.gen.v1.openconfigprocmon.rev20170706.OpenconfigProcmon;
 import org.onosproject.yang.gen.v1.openconfigrelayagent.rev20160516.OpenconfigRelayAgent;
-import org.onosproject.yang.gen.v1.openconfigribbgp.rev20161017.*;
+import org.onosproject.yang.gen.v1.openconfigribbgp.rev20161017.OpenconfigRibBgp;
+import org.onosproject.yang.gen.v1.openconfigribbgp.rev20161017.OpenconfigRibBgpAttributes;
+import org.onosproject.yang.gen.v1.openconfigribbgp.rev20161017.OpenconfigRibBgpSharedAttributes;
+import org.onosproject.yang.gen.v1.openconfigribbgp.rev20161017.OpenconfigRibBgpTableAttributes;
+import org.onosproject.yang.gen.v1.openconfigribbgp.rev20161017.OpenconfigRibBgpTables;
 import org.onosproject.yang.gen.v1.openconfigribbgpext.rev20161017.OpenconfigRibBgpExt;
 import org.onosproject.yang.gen.v1.openconfigribbgptypes.rev20161017.OpenconfigRibBgpTypes;
 import org.onosproject.yang.gen.v1.openconfigroutingpolicy.rev20170714.OpenconfigRoutingPolicy;
@@ -129,6 +150,7 @@
     }
 
 
+    @SuppressWarnings("checkstyle:MethodLength")
     private static Map<YangModuleId, AppModuleInfo> getAppInfo() {
 
         return ImmutableMap.<YangModuleId, AppModuleInfo>builder()
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java
index cb9568b..9885574 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java
@@ -285,7 +285,7 @@
 
     }
 
-    private FlowEntry createFlowEntryForFlowMod(FlowEntryState ...state) {
+    private FlowEntry createFlowEntryForFlowMod(FlowEntryState...state) {
         FlowEntryState flowState = state.length > 0 ? state[0] : FlowEntryState.FAILED;
         FlowRule.Builder builder = DefaultFlowRule.builder()
                 .forDevice(deviceId)
diff --git a/providers/openflow/packet/src/test/java/org/onosproject/provider/of/packet/impl/OpenFlowPacketProviderTest.java b/providers/openflow/packet/src/test/java/org/onosproject/provider/of/packet/impl/OpenFlowPacketProviderTest.java
index 3e42d8f..46305a6 100644
--- a/providers/openflow/packet/src/test/java/org/onosproject/provider/of/packet/impl/OpenFlowPacketProviderTest.java
+++ b/providers/openflow/packet/src/test/java/org/onosproject/provider/of/packet/impl/OpenFlowPacketProviderTest.java
@@ -196,7 +196,7 @@
         return builder.build();
     }
 
-    private static TrafficTreatment treatment(Instruction ... insts) {
+    private static TrafficTreatment treatment(Instruction... insts) {
         TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
         for (Instruction i : insts) {
             builder.add(i);
@@ -350,7 +350,7 @@
     private class TestOpenFlowSwitch implements OpenFlowSwitch {
 
         RoleState state;
-        List<OFMessage> sent = new ArrayList<OFMessage>();
+        List<OFMessage> sent = new ArrayList<>();
         OFFactory factory = OFFactoryVer10.INSTANCE;
 
         @Override
diff --git a/tools/build/conf/pom.xml b/tools/build/conf/pom.xml
index e52327a..fa09c99 100644
--- a/tools/build/conf/pom.xml
+++ b/tools/build/conf/pom.xml
@@ -38,7 +38,7 @@
         <dependency>
             <groupId>com.puppycrawl.tools</groupId>
             <artifactId>checkstyle</artifactId>
-            <version>6.19</version>
+            <version>8.10</version>
         </dependency>
     </dependencies>
 
diff --git a/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml b/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml
index cf8fe4d..a236f73 100644
--- a/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml
+++ b/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml
@@ -128,30 +128,33 @@
         <property name="fileExtensions" value="java"/>
     </module>
 
+    <module name="SuppressWarningsFilter" />
 
-    <module name="SuppressionCommentFilter">
-        <property name="offCommentFormat"
-                  value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
-        <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
-    </module>
-
-    <module name="SuppressWithNearbyCommentFilter">
-        <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE"/>
-        <property name="checkFormat" value=".*"/>
-        <property name="influenceFormat" value="0"/>
-    </module>
-
-    <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES  -->
-    <module name="SuppressWithNearbyCommentFilter">
-        <property name="commentFormat"
-                  value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
-        <property name="checkFormat" value="$1"/>
-        <property name="influenceFormat" value="$2"/>
-    </module>
+    <module name="SuppressWithPlainTextCommentFilter"/>
 
     <module name="TreeWalker">
+        <module name="SuppressWarningsHolder" />
 
-        <module name="FileContentsHolder"/>
+        <module name="SuppressionCommentFilter">
+            <property name="offCommentFormat"
+                      value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
+            <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
+        </module>
+
+        <module name="SuppressWithNearbyCommentFilter">
+            <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE"/>
+            <property name="checkFormat" value=".*"/>
+            <property name="influenceFormat" value="0"/>
+        </module>
+
+        <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES  -->
+        <module name="SuppressWithNearbyCommentFilter">
+            <property name="commentFormat"
+                      value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
+            <property name="checkFormat" value="$1"/>
+            <property name="influenceFormat" value="$2"/>
+        </module>
+
         <!-- Checks for Javadoc comments.                     -->
         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
         <module name="JavadocMethod">
diff --git a/tools/build/conf/src/main/resources/onos/checkstyle.xml b/tools/build/conf/src/main/resources/onos/checkstyle.xml
index ce6351f..d3cc730 100644
--- a/tools/build/conf/src/main/resources/onos/checkstyle.xml
+++ b/tools/build/conf/src/main/resources/onos/checkstyle.xml
@@ -123,34 +123,38 @@
     <!-- </module> -->
 
     <module name="RegexpHeader">
+        <!-- The following line is different for maven due to how the maven checkstyle plugin works -->
         <property name="headerFile" value="tools/build/conf/src/main/resources/onos/onos-java.header"/>
         <property name="fileExtensions" value="java"/>
     </module>
 
+    <module name="SuppressWarningsFilter" />
 
-    <module name="SuppressionCommentFilter">
-        <property name="offCommentFormat"
-                  value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
-        <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
-    </module>
-
-    <module name="SuppressWithNearbyCommentFilter">
-        <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE"/>
-        <property name="checkFormat" value=".*"/>
-        <property name="influenceFormat" value="0"/>
-    </module>
-
-    <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES  -->
-    <module name="SuppressWithNearbyCommentFilter">
-        <property name="commentFormat"
-                  value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
-        <property name="checkFormat" value="$1"/>
-        <property name="influenceFormat" value="$2"/>
-    </module>
+    <module name="SuppressWithPlainTextCommentFilter"/>
 
     <module name="TreeWalker">
+        <module name="SuppressWarningsHolder" />
 
-        <module name="FileContentsHolder"/>
+        <module name="SuppressionCommentFilter">
+            <property name="offCommentFormat"
+                      value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
+            <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
+        </module>
+
+        <module name="SuppressWithNearbyCommentFilter">
+            <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE"/>
+            <property name="checkFormat" value=".*"/>
+            <property name="influenceFormat" value="0"/>
+        </module>
+
+        <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES  -->
+        <module name="SuppressWithNearbyCommentFilter">
+            <property name="commentFormat"
+                      value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
+            <property name="checkFormat" value="$1"/>
+            <property name="influenceFormat" value="$2"/>
+        </module>
+
         <!-- Checks for Javadoc comments.                     -->
         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
         <module name="JavadocMethod">