8039860: Fix fallthrough lint warnings in swing
authordarcy
Tue, 22 Apr 2014 17:55:25 -0700
changeset 24528 21c5bb3d76cc
parent 24527 779f94d50411
child 24529 c580bcb3aabc
8039860: Fix fallthrough lint warnings in swing Reviewed-by: malenkov
jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
jdk/src/share/classes/javax/swing/text/JTextComponent.java
jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java
jdk/src/share/classes/javax/swing/text/html/parser/Parser.java
jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java
jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue Apr 22 17:55:25 2014 -0700
@@ -1683,6 +1683,7 @@
      * adjustments that windows/metal do.  This is because gtk doesn't
      * provide margins/insets for checkbox/radiobuttons.
      */
+    @SuppressWarnings("fallthrough")
     private static class GnomeLayoutStyle extends DefaultLayoutStyle {
         private static GnomeLayoutStyle INSTANCE = new GnomeLayoutStyle();
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Tue Apr 22 17:55:25 2014 -0700
@@ -2409,6 +2409,7 @@
 
     // Windows LayoutStyle.  From:
     // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
+    @SuppressWarnings("fallthrough")
     private class WindowsLayoutStyle extends DefaultLayoutStyle {
         @Override
         public int getPreferredGap(JComponent component1,
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Tue Apr 22 17:55:25 2014 -0700
@@ -182,7 +182,6 @@
                 if (sortOrder != null) {
                      switch(sortOrder) {
                      case ASCENDING:
-                         /* falls through */
                      case DESCENDING:
                          switch (state) {
                          case NORMAL:
@@ -197,6 +196,7 @@
                          default:
                              /* do nothing */
                          }
+                         break;
                      default :
                          /* do nothing */
                      }
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Tue Apr 22 17:55:25 2014 -0700
@@ -2271,6 +2271,7 @@
 
     // From the JLF Design Guidelines:
     // http://www.oracle.com/technetwork/java/jlf-135985.html
+    @SuppressWarnings("fallthrough")
     private static class MetalLayoutStyle extends DefaultLayoutStyle {
         private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
 
@@ -2407,4 +2408,4 @@
             return 0;
         }
     }
-}
\ No newline at end of file
+}
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Tue Apr 22 17:55:25 2014 -0700
@@ -4473,6 +4473,7 @@
     // composed(uncommitted) text is done here after all input
     // method listeners get called for stealing the events.
     //
+    @SuppressWarnings("fallthrough")
     protected void processInputMethodEvent(InputMethodEvent e) {
         // let listeners handle the events
         super.processInputMethodEvent(e);
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Tue Apr 22 17:55:25 2014 -0700
@@ -2324,6 +2324,7 @@
          * @param itemNum number to format
          * @param type    type of ordered list
          */
+        @SuppressWarnings("fallthrough")
         String formatItemNum(int itemNum, char type) {
             String numStyle = "1";
 
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java	Tue Apr 22 17:55:25 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,12 +92,14 @@
      * tokens required in the input stream.
      * @return true if the model can terminate without further input
      */
+    @SuppressWarnings("fallthrough")
     public boolean terminate() {
         switch (model.type) {
           case '+':
             if ((value == 0) && !(model).empty()) {
                 return false;
             }
+            // Fall through
           case '*':
           case '?':
             return (next == null) || next.terminate();
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Tue Apr 22 17:55:25 2014 -0700
@@ -852,6 +852,7 @@
             if (lower) {
                 ch = 'a' + (ch - 'A');
             }
+            break;
 
           case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
           case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -876,6 +877,7 @@
                 if (lower) {
                     ch = 'a' + (ch - 'A');
                 }
+                break;
 
               case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
               case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -1214,6 +1216,7 @@
     /**
      * Parse attribute value. [33] 331:1
      */
+    @SuppressWarnings("fallthrough")
     String parseAttributeValue(boolean lower) throws IOException {
         int delim = -1;
 
@@ -1258,6 +1261,7 @@
               case '\t':
                   if (delim < 0)
                       c = ' ';
+                  // Fall through
               case ' ':
                 ch = readCh();
                 if (delim < 0) {
@@ -1559,6 +1563,7 @@
     /**
      * Parse a start or end tag.
      */
+    @SuppressWarnings("fallthrough")
     void parseTag() throws IOException {
         Element elem;
         boolean net = false;
@@ -1602,6 +1607,7 @@
                         continue;
                       case '>':
                         ch = readCh();
+                        return;
                       case -1:
                         return;
                       default:
@@ -1626,6 +1632,7 @@
                     switch(ch) {
                       case '>':
                         ch = readCh();
+                        // Fall through
                       case -1:
                         error("invalid.markup");
                         return;
@@ -1657,6 +1664,7 @@
             switch (ch = readCh()) {
               case '>':
                 ch = readCh();
+                // Fall through
               case '<':
                 // empty end tag. either </> or </<
                 if (recent == null) {
@@ -1675,6 +1683,7 @@
                 switch (ch) {
                   case '>':
                     ch = readCh();
+                    break;
                   case '<':
                     break;
 
@@ -1875,6 +1884,7 @@
         switch (ch) {
           case '/':
             net = true;
+            // Fall through
           case '>':
             ch = readCh();
             if (ch == '>' && net) {
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java	Tue Apr 22 17:55:25 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -868,6 +868,7 @@
     afterKeyword = false;
 }
 
+@SuppressWarnings("fallthrough")
 public void writeCharacter(char ch)
     throws IOException
 {
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java	Tue Apr 22 17:55:25 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,6 +148,7 @@
       handleText(s);
   }
 
+  @SuppressWarnings("fallthrough")
   public void write(char ch)
     throws IOException
   {