<AWT Dev> JDK 9 RFR of JDK-8039861: Fix fallthrough lint warnings in awt
Joe Darcy
joe.darcy at oracle.com
Thu Apr 17 16:41:07 UTC 2014
Hi Petr,
Thanks for the review. While preparing to push this, I noticed another
instance of this situation in XComponentPeer.java:
--- a/src/solaris/classes/sun/awt/X11/XComponentPeer.java Thu Apr 17
16:26:45 2014 +0400
+++ b/src/solaris/classes/sun/awt/X11/XComponentPeer.java Thu Apr 17
09:38:13 2014 -0700
@@ -548,6 +548,7 @@
}
}
+ @SuppressWarnings("fallthrough")
public void handleEvent(java.awt.AWTEvent e) {
if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed()
&& target.isEnabled()) {
if (e instanceof MouseEvent) {
The switch statement in question already has the fallthrough commented
switch(id) {
case PaintEvent.PAINT:
// Got native painting
paintPending = false;
// Fallthrough to next statement
case PaintEvent.UPDATE:
// Skip all painting while layouting and all UPDATEs
// while waiting for native paint
if (!isLayouting && !paintPending) {
paintArea.paint(target,false);
}
so I'll add the annotation at the time time.
Thanks,
-Joe
On 04/15/2014 10:37 AM, Petr Pchelko wrote:
> Hello, Joe.
>
> The fix looks good to me.
>
> With best regards. Petr.
>
> 10 апр. 2014 г., в 6:44 до полудня, Joe Darcy <joe.darcy at oracle.com> написал(а):
>
>> Hello,
>>
>> Please review the changes for
>>
>> JDK-8039861: Fix fallthrough lint warnings in awt
>> http://cr.openjdk.java.net/~darcy/8039861.0/
>>
>> Thanks,
>>
>> -Joe
>>
>> --- old/src/share/classes/java/awt/dnd/DragSourceContext.java 2014-04-09 19:41:33.000000000 -0700
>> +++ new/src/share/classes/java/awt/dnd/DragSourceContext.java 2014-04-09 19:41:33.000000000 -0700
>> @@ -472,7 +472,7 @@
>> * <code>ENTER</code>, <code>OVER</code>,
>> * <code>CHANGED</code>
>> */
>> -
>> + @SuppressWarnings("fallthrough")
>> protected synchronized void updateCurrentCursor(int sourceAct, int targetAct, int status) {
>>
>> // if the cursor has been previously set then don't do any defaults
>> --- old/src/share/classes/sun/awt/image/GifImageDecoder.java 2014-04-09 19:41:33.000000000 -0700
>> +++ new/src/share/classes/sun/awt/image/GifImageDecoder.java 2014-04-09 19:41:33.000000000 -0700
>> @@ -114,6 +114,7 @@
>> /**
>> * produce an image from the stream.
>> */
>> + @SuppressWarnings("fallthrough")
>> public void produceImage() throws IOException, ImageFormatException {
>> try {
>> readHeader();
>> @@ -238,7 +239,7 @@
>> if (frameno == 0) {
>> return;
>> }
>> - // NOBREAK
>> + // Fall through
>>
>> case TERMINATOR:
>> if (nloops == 0 || nloops-- >= 0) {
>> --- old/src/share/classes/sun/awt/image/PixelConverter.java 2014-04-09 19:41:34.000000000 -0700
>> +++ new/src/share/classes/sun/awt/image/PixelConverter.java 2014-04-09 19:41:33.000000000 -0700
>> @@ -53,6 +53,7 @@
>>
>> protected PixelConverter() {}
>>
>> + @SuppressWarnings("fallthrough")
>> public int rgbToPixel(int rgb, ColorModel cm) {
>> Object obj = cm.getDataElements(rgb, null);
>> switch (cm.getTransferType()) {
>> --- old/src/solaris/classes/sun/awt/X11/XWM.java 2014-04-09 19:41:34.000000000 -0700
>> +++ new/src/solaris/classes/sun/awt/X11/XWM.java 2014-04-09 19:41:34.000000000 -0700
>> @@ -1112,6 +1112,7 @@
>> * Therefore, a compound state is just ICONIFIED | anything else.
>> *
>> */
>> + @SuppressWarnings("fallthrough")
>> boolean supportsExtendedState(int state) {
>> switch (state) {
>> case Frame.MAXIMIZED_VERT:
>> @@ -1131,6 +1132,7 @@
>> return true;
>> }
>> }
>> + /* FALLTROUGH */
>> default:
>> return false;
>> }
>>
More information about the awt-dev
mailing list