changeset 9960:ae68e97bb4c6

8039860: Fix fallthrough lint warnings in swing Reviewed-by: malenkov
author darcy
date Tue, 22 Apr 2014 17:55:25 -0700
parents ef1c998c0233
children a56aca1ce81b
files src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java src/share/classes/javax/swing/text/JTextComponent.java src/share/classes/javax/swing/text/html/StyleSheet.java src/share/classes/javax/swing/text/html/parser/ContentModelState.java src/share/classes/javax/swing/text/html/parser/Parser.java src/share/classes/javax/swing/text/rtf/RTFGenerator.java src/share/classes/javax/swing/text/rtf/RTFParser.java
diffstat 10 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/javax/swing/text/JTextComponent.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/javax/swing/text/html/StyleSheet.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/javax/swing/text/html/parser/ContentModelState.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/javax/swing/text/html/parser/Parser.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/javax/swing/text/rtf/RTFGenerator.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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/src/share/classes/javax/swing/text/rtf/RTFParser.java	Mon Apr 21 23:39:30 2014 -0700
+++ b/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
   {