JDK 9 RFR of JDK-8039864: Fix fallthrough lint warnings in other libs
Lance @ Oracle
lance.andersen at oracle.com
Thu Apr 10 10:51:43 UTC 2014
+1
Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com
Sent from my iPad
On Apr 10, 2014, at 1:02 AM, Joe Darcy <joe.darcy at oracle.com> wrote:
> Hello,
>
> I've started looking at cleaning up the fallthrough lint warnings in the jdk repo. Please review the affected files in the "other libs" area:
>
> JDK-8039864: Fix fallthrough lint warnings in other libs
> http://cr.openjdk.java.net/~darcy/8039864.0/
>
> Thanks,
>
> -Joe
>
> --- old/src/share/classes/sun/tools/java/Environment.java 2014-04-09 21:57:38.000000000 -0700
> +++ new/src/share/classes/sun/tools/java/Environment.java 2014-04-09 21:57:38.000000000 -0700
> @@ -648,6 +648,7 @@
> * 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;
> --- old/src/share/classes/sun/tools/java/Scanner.java 2014-04-09 21:57:39.000000000 -0700
> +++ new/src/share/classes/sun/tools/java/Scanner.java 2014-04-09 21:57:39.000000000 -0700
> @@ -511,6 +511,7 @@
> * 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 @@
> // 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 @@
> * 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 @@
> return xscan();
> }
>
> + @SuppressWarnings("fallthrough")
> protected long xscan() throws IOException {
> final ScannerInputReader in = this.in;
> long retPos = pos;
> @@ -1006,6 +1010,7 @@
> token = COMMENT;
> return retPos;
> }
> + // Fall through
> case ' ':
> case '\t':
> case '\f':
> --- old/src/share/classes/sun/tools/javac/Main.java 2014-04-09 21:57:40.000000000 -0700
> +++ new/src/share/classes/sun/tools/javac/Main.java 2014-04-09 21:57:39.000000000 -0700
> @@ -192,6 +192,7 @@
> /**
> * Run the compiler
> */
> + @SuppressWarnings("fallthrough")
> public synchronized boolean compile(String argv[]) {
> String sourcePathArg = null;
> String classPathArg = null;
> --- old/src/share/classes/sun/tools/jinfo/JInfo.java 2014-04-09 21:57:40.000000000 -0700
> +++ new/src/share/classes/sun/tools/jinfo/JInfo.java 2014-04-09 21:57:40.000000000 -0700
> @@ -41,6 +41,7 @@
> */
> 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 @@
> case "-help":
> case "-h":
> usage(0);
> + // Fall through
> default:
> if (args.length == 1) {
> // no flags specified, we do -sysprops and -flags
> --- old/src/share/classes/sun/tools/tree/AssignOpExpression.java 2014-04-09 21:57:41.000000000 -0700
> +++ new/src/share/classes/sun/tools/tree/AssignOpExpression.java 2014-04-09 21:57:40.000000000 -0700
> @@ -53,7 +53,7 @@
> * Select the type
> *
> */
> -
> + @SuppressWarnings("fallthrough")
> final void selectType(Environment env, Context ctx, int tm) {
> Type rtype = null; // special conversion type for RHS
> switch(op) {
> --- old/src/share/classes/sun/tools/tree/NewInstanceExpression.java 2014-04-09 21:57:41.000000000 -0700
> +++ new/src/share/classes/sun/tools/tree/NewInstanceExpression.java 2014-04-09 21:57:41.000000000 -0700
> @@ -487,6 +487,7 @@
> 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());
>
More information about the core-libs-dev
mailing list