Changeset 19109 in josm for trunk/test


Ignore:
Timestamp:
2024-06-17T21:36:37+02:00 (5 months ago)
Author:
taylor.smock
Message:

See #17858: Remove old workarounds for javabugs and update Utils#getLatestVersion

  • JDK-8180379: Fixed in Java 9+
  • JDK-8251377: Fixed in Java 11.0.14 (2021-09-02)
  • JDK-8262085: Fixed in Java 11.0.17 (2022-07-19)
Location:
trunk/test/unit/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r19056 r19109  
    496496        // See https://github.com/raphw/byte-buddy/blob/master/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java
    497497        // for currently supported Java versions.
    498         if (Utils.getJavaVersion() >= 19) {
     498        if (Utils.getJavaVersion() >= 22) {
    499499            // Byte Buddy often supports new class file versions for current EA releases if its experimental flag is set to true
    500500            System.setProperty("net.bytebuddy.experimental", "true");
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r18893 r19109  
    247247        }
    248248
    249         // On Java < 11 and headless mode, filter plugins requiring JavaFX as Monocle is not available
    250         int javaVersion = Utils.getJavaVersion();
    251         if (GraphicsEnvironment.isHeadless() && javaVersion < 11) {
    252             for (Iterator<PluginInformation> it = plugins.iterator(); it.hasNext();) {
    253                 PluginInformation pi = it.next();
    254                 if (pi.getRequiredPlugins().contains("javafx")) {
    255                     System.out.println("Ignoring " + pi.name + " (requiring JavaFX and we're using Java < 11 in headless mode)");
    256                     it.remove();
    257                 }
    258             }
    259         }
    260 
    261249        // Skip unofficial plugins in headless mode, too much work for us for little added-value
    262250        if (GraphicsEnvironment.isHeadless()) {
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r18893 r19109  
    33
    44import java.awt.Color;
    5 import java.awt.GraphicsEnvironment;
    6 import java.awt.Toolkit;
    75import java.awt.Window;
    86import java.awt.event.WindowEvent;
     
    1715import java.lang.annotation.RetentionPolicy;
    1816import java.lang.annotation.Target;
    19 import java.lang.reflect.Method;
    2017import java.nio.charset.StandardCharsets;
    2118import java.security.GeneralSecurityException;
     
    2623import java.util.concurrent.TimeUnit;
    2724import java.util.logging.Handler;
    28 import java.util.logging.Level;
    2925
    3026import org.awaitility.Awaitility;
     
    7874import org.openstreetmap.josm.tools.Logging;
    7975import org.openstreetmap.josm.tools.MemoryManagerTest;
    80 import org.openstreetmap.josm.tools.PlatformManager;
    81 import org.openstreetmap.josm.tools.Utils;
    8276import org.openstreetmap.josm.tools.bugreport.ReportedException;
    8377import org.openstreetmap.josm.tools.date.DateUtils;
     
    646640                }
    647641
    648                 workaroundJdkBug8159956();
    649642                new MainApplication();
    650643                JOSMFixture.initContentPane();
     
    653646                JOSMFixture.initMainMenu();
    654647            }
    655         }
    656     }
    657 
    658     private void workaroundJdkBug8159956() {
    659         // Note: This has been backported to Java 8u381 (2023-07-18)
    660         try {
    661             if (PlatformManager.isPlatformWindows() && Utils.getJavaVersion() == 8 && GraphicsEnvironment.isHeadless()) {
    662                 // https://bugs.openjdk.java.net/browse/JDK-8159956
    663                 Method initIDs = Toolkit.class.getDeclaredMethod("initIDs");
    664                 initIDs.setAccessible(true);
    665                 initIDs.invoke(Toolkit.getDefaultToolkit());
    666             }
    667         } catch (Exception e) {
    668             Logging.log(Level.WARNING, "Failed to Toolkit.initIDs", e);
    669648        }
    670649    }
Note: See TracChangeset for help on using the changeset viewer.