Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8167523

JDK 9 build failure on MacOS due to unhandled cases in switch statement

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 9
    • 9
    • client-libs
    • 2d
    • 9
    • b143
    • os_x

      /jdk9-client/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m:92:13: error: 4 enumeration values not handled in switch: 'NSEventPhaseNone', 'NSEventPhaseStationary', 'NSEventPhaseChanged'... [-Werror,-Wswitch]
          switch (phase) {
                  ^
      1 error generated.
      make[3]: *** [/jdk9-client/build/macosx-x86_64-normal-server-release/support/native/java.desktop/libawt_lwawt/LWCToolkit.o] Error 1
      make[3]: *** Waiting for unfinished jobs....

      This may not fail with the current official xcode 6.3 but does
      fail with xcode 7.0 which I expect many people use.

      This code was added in the fix for
      8166591: [macos 10.12] Trackpad scrolling of text on OS X 10.12 Sierra is very fast (Trackpad, Retina only)

      The fix appears to be to add a "default" option to the switch.

      diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
      --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
      +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
      @@ -93,8 +93,8 @@
               case NSEventPhaseBegan: return SCROLL_PHASE_BEGAN;
               case NSEventPhaseCancelled: return SCROLL_PHASE_CANCELLED;
               case NSEventPhaseEnded: return SCROLL_PHASE_ENDED;
      + default: return SCROLL_PHASE_CONTINUED;
           }
      - return SCROLL_PHASE_CONTINUED;
       }
       [~enoconn]

      This builds with JPRT too ..

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: