From 002e08e73db63112884a1726220d918795f28840 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 10 Apr 2014 08:43:46 -0700 Subject: [PATCH] 8039864: Fix fallthrough lint warnings in other libs Reviewed-by: alanb, lancea --- jdk/src/share/classes/sun/tools/java/Environment.java | 1 + jdk/src/share/classes/sun/tools/java/Scanner.java | 5 +++++ jdk/src/share/classes/sun/tools/javac/Main.java | 1 + jdk/src/share/classes/sun/tools/jinfo/JInfo.java | 2 ++ jdk/src/share/classes/sun/tools/tree/AssignOpExpression.java | 2 +- .../share/classes/sun/tools/tree/NewInstanceExpression.java | 1 + 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/tools/java/Environment.java b/jdk/src/share/classes/sun/tools/java/Environment.java index 51b09dcb736..76f9c01e9a7 100644 --- a/jdk/src/share/classes/sun/tools/java/Environment.java +++ b/jdk/src/share/classes/sun/tools/java/Environment.java @@ -648,6 +648,7 @@ public class Environment implements Constants { * Return true if an implicit cast from this type to * the given type is allowed. */ + @SuppressWarnings("fallthrough") public boolean implicitCast(Type from, Type to) throws ClassNotFound { if (from == to) return true; diff --git a/jdk/src/share/classes/sun/tools/java/Scanner.java b/jdk/src/share/classes/sun/tools/java/Scanner.java index 9152f48b24f..7dfa6ee37c8 100644 --- a/jdk/src/share/classes/sun/tools/java/Scanner.java +++ b/jdk/src/share/classes/sun/tools/java/Scanner.java @@ -511,6 +511,7 @@ class Scanner implements Constants { * Scan a number. The first digit of the number should be the current * character. We may be scanning hex, decimal, or octal at this point */ + @SuppressWarnings("fallthrough") private void scanNumber() throws IOException { boolean seenNonOctal = false; boolean overflow = false; @@ -532,6 +533,7 @@ class Scanner implements Constants { // We can't yet throw an error if reading an octal. We might // discover we're really reading a real. seenNonOctal = true; + // Fall through case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': seenDigit = true; @@ -668,6 +670,7 @@ class Scanner implements Constants { * Scan a float. Should be called with the current character is either * the 'e', 'E' or '.' */ + @SuppressWarnings("fallthrough") private void scanReal() throws IOException { boolean seenExponent = false; boolean isSingleFloat = false; @@ -984,6 +987,7 @@ class Scanner implements Constants { return xscan(); } + @SuppressWarnings("fallthrough") protected long xscan() throws IOException { final ScannerInputReader in = this.in; long retPos = pos; @@ -1006,6 +1010,7 @@ class Scanner implements Constants { token = COMMENT; return retPos; } + // Fall through case ' ': case '\t': case '\f': diff --git a/jdk/src/share/classes/sun/tools/javac/Main.java b/jdk/src/share/classes/sun/tools/javac/Main.java index 2c50e3a3972..94308c5a0f3 100644 --- a/jdk/src/share/classes/sun/tools/javac/Main.java +++ b/jdk/src/share/classes/sun/tools/javac/Main.java @@ -192,6 +192,7 @@ class Main implements Constants { /** * Run the compiler */ + @SuppressWarnings("fallthrough") public synchronized boolean compile(String argv[]) { String sourcePathArg = null; String classPathArg = null; diff --git a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java index c1e9d5ffb82..f02eb27d2e2 100644 --- a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java +++ b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java @@ -41,6 +41,7 @@ import sun.tools.attach.HotSpotVirtualMachine; */ public class JInfo { + @SuppressWarnings("fallthrough") public static void main(String[] args) throws Exception { if (args.length == 0) { usage(1); // no arguments @@ -118,6 +119,7 @@ public class JInfo { case "-help": case "-h": usage(0); + // Fall through default: if (args.length == 1) { // no flags specified, we do -sysprops and -flags diff --git a/jdk/src/share/classes/sun/tools/tree/AssignOpExpression.java b/jdk/src/share/classes/sun/tools/tree/AssignOpExpression.java index fdde301667e..b3493bc7d9a 100644 --- a/jdk/src/share/classes/sun/tools/tree/AssignOpExpression.java +++ b/jdk/src/share/classes/sun/tools/tree/AssignOpExpression.java @@ -53,7 +53,7 @@ class AssignOpExpression extends BinaryAssignExpression { * Select the type * */ - + @SuppressWarnings("fallthrough") final void selectType(Environment env, Context ctx, int tm) { Type rtype = null; // special conversion type for RHS switch(op) { diff --git a/jdk/src/share/classes/sun/tools/tree/NewInstanceExpression.java b/jdk/src/share/classes/sun/tools/tree/NewInstanceExpression.java index cb018a0f51a..0347c41efbf 100644 --- a/jdk/src/share/classes/sun/tools/tree/NewInstanceExpression.java +++ b/jdk/src/share/classes/sun/tools/tree/NewInstanceExpression.java @@ -487,6 +487,7 @@ class NewInstanceExpression extends NaryExpression { public void codeValue(Environment env, Context ctx, Assembler asm) { codeCommon(env, ctx, asm, true); } + @SuppressWarnings("fallthrough") private void codeCommon(Environment env, Context ctx, Assembler asm, boolean forValue) { asm.add(where, opc_new, field.getClassDeclaration());