8039860: Fix fallthrough lint warnings in swing

Reviewed-by: malenkov
This commit is contained in:
Joe Darcy 2014-04-22 17:55:25 -07:00
parent 7025bc84e6
commit f341bacaf3
10 changed files with 24 additions and 5 deletions

View File

@ -1683,6 +1683,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
* 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();

View File

@ -2409,6 +2409,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
// 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,

View File

@ -182,7 +182,6 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
if (sortOrder != null) {
switch(sortOrder) {
case ASCENDING:
/* falls through */
case DESCENDING:
switch (state) {
case NORMAL:
@ -197,6 +196,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
default:
/* do nothing */
}
break;
default :
/* do nothing */
}

View File

@ -2271,6 +2271,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
// 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 @@ public class MetalLookAndFeel extends BasicLookAndFeel
return 0;
}
}
}
}

View File

@ -4473,6 +4473,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
// 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);

View File

@ -2324,6 +2324,7 @@ public class StyleSheet extends StyleContext {
* @param itemNum number to format
* @param type type of ordered list
*/
@SuppressWarnings("fallthrough")
String formatItemNum(int itemNum, char type) {
String numStyle = "1";

View File

@ -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 @@ class ContentModelState {
* 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();

View File

@ -852,6 +852,7 @@ class Parser implements DTDConstants {
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 @@ class Parser implements DTDConstants {
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 @@ class Parser implements DTDConstants {
/**
* Parse attribute value. [33] 331:1
*/
@SuppressWarnings("fallthrough")
String parseAttributeValue(boolean lower) throws IOException {
int delim = -1;
@ -1258,6 +1261,7 @@ class Parser implements DTDConstants {
case '\t':
if (delim < 0)
c = ' ';
// Fall through
case ' ':
ch = readCh();
if (delim < 0) {
@ -1559,6 +1563,7 @@ class Parser implements DTDConstants {
/**
* Parse a start or end tag.
*/
@SuppressWarnings("fallthrough")
void parseTag() throws IOException {
Element elem;
boolean net = false;
@ -1602,6 +1607,7 @@ class Parser implements DTDConstants {
continue;
case '>':
ch = readCh();
return;
case -1:
return;
default:
@ -1626,6 +1632,7 @@ class Parser implements DTDConstants {
switch(ch) {
case '>':
ch = readCh();
// Fall through
case -1:
error("invalid.markup");
return;
@ -1657,6 +1664,7 @@ class Parser implements DTDConstants {
switch (ch = readCh()) {
case '>':
ch = readCh();
// Fall through
case '<':
// empty end tag. either </> or </<
if (recent == null) {
@ -1675,6 +1683,7 @@ class Parser implements DTDConstants {
switch (ch) {
case '>':
ch = readCh();
break;
case '<':
break;
@ -1875,6 +1884,7 @@ class Parser implements DTDConstants {
switch (ch) {
case '/':
net = true;
// Fall through
case '>':
ch = readCh();
if (ch == '>' && net) {

View File

@ -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 @@ public void writeEndgroup()
afterKeyword = false;
}
@SuppressWarnings("fallthrough")
public void writeCharacter(char ch)
throws IOException
{

View File

@ -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 @@ abstract class RTFParser extends AbstractFilter
handleText(s);
}
@SuppressWarnings("fallthrough")
public void write(char ch)
throws IOException
{