<Swing Dev> JDK 9 RFR of 8044698: Fix finally lint warnings in javax.swing

Henry Jen henry.jen at oracle.com
Tue Jun 3 18:02:19 UTC 2014


Looks good to me.

Cheers,
Henry

On 06/03/2014 10:53 AM, Joe Darcy wrote:
> Hello,
>
> Please review this change to fix
>
>      8044698: Fix finally lint warnings in javax.swing
>      http://cr.openjdk.java.net/~darcy/8044698.0/
>
> The "finally" javac lint warning issues a warning when a finally block
> always completes abruptly. This happens if an exception is thrown in the
> finally block, but by the definitions in the JLS, also happens for a
> return statement in the block. (A return statement in a finally will
> make pending exceptions be ignored as well as an another in-progress
> return statement.)
>
> For the method in question here, the fix is simple. Since the entire
> code of the method is in a single try block and the return statement is
> the last statement in the finally clause, the return statement is just
> moved outside of the finally block:
>
> --- old/src/share/classes/javax/swing/JEditorPane.java    2014-06-03
> 10:40:24.000000000 -0700
> +++ new/src/share/classes/javax/swing/JEditorPane.java    2014-06-03
> 10:40:24.000000000 -0700
> @@ -679,8 +679,8 @@
>                           }
>                       });
>                   }
> -                return (pageLoaded ? page : old);
>               }
> +            return (pageLoaded ? page : old);
>           }
>
>           /**
>
> The other return statements in the try block are consistent with the
> last return statement's handling of pageLoaded. In other words, the
> other return statements return old when pageLoaded is false. Therefore,
> the value computed by "return (pageLoaded ? page : old);" is consistent
> with computed values of the other return statements.
>
> Thanks,
>
> -Joe



More information about the swing-dev mailing list