Merge remote-tracking branch 'origin/master' into ecoreopt-hybrid

This commit is contained in:
Yasumasa Suenaga 2026-01-11 16:42:11 +09:00
commit 92e9155276
2 changed files with 18 additions and 11 deletions

View File

@ -64,7 +64,7 @@ public final class Main {
}
public Provider() {
this(Main::loadBundlingEnvironment);
this(DefaultBundlingEnvironmentLoader.INSTANCE);
}
@Override
@ -104,7 +104,7 @@ public final class Main {
}
static int run(PrintWriter out, PrintWriter err, String... args) {
return run(Main::loadBundlingEnvironment, out, err, args);
return run(DefaultBundlingEnvironmentLoader.INSTANCE, out, err, args);
}
static int run(Supplier<CliBundlingEnvironment> bundlingEnvSupplier, PrintWriter out, PrintWriter err, String... args) {
@ -310,9 +310,14 @@ public final class Main {
return System.getProperty("java.version");
}
private static CliBundlingEnvironment loadBundlingEnvironment() {
return ServiceLoader.load(
CliBundlingEnvironment.class,
CliBundlingEnvironment.class.getClassLoader()).findFirst().orElseThrow();
private enum DefaultBundlingEnvironmentLoader implements Supplier<CliBundlingEnvironment> {
INSTANCE;
@Override
public CliBundlingEnvironment get() {
return ServiceLoader.load(
CliBundlingEnvironment.class,
CliBundlingEnvironment.class.getClassLoader()).findFirst().orElseThrow();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,8 +45,9 @@ abstract class TestTask implements Runnable {
}
public void ensureReadyAndWaiting(Thread vt, Thread.State expState, ReentrantLock rlock) {
sleep(50); // reliability: wait for a potential class loading to complete
// wait while the thread is not ready or thread state is unexpected
while (!threadReady || (vt.getState() != expState) || !rlock.hasQueuedThreads()) {
while (!threadReady || (vt.getState() != expState) || !rlock.hasQueuedThread(vt)) {
sleep(1);
}
}
@ -125,11 +126,12 @@ public class ThreadListStackTracesTest {
int jvmtiExpState = (expState == Thread.State.WAITING) ?
JVMTI_THREAD_STATE_WAITING :
JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;
Thread.State state = vt.getState();
System.out.printf("State: expected: %s single: %x multi: %x\n",
vt.getState(), singleState, multiState);
System.out.printf("State: expected: %s, vt.getState(): %s, jvmtiExpState: %x single: %x multi: %x\n",
expState, state, jvmtiExpState, singleState, multiState);
if (vt.getState() != expState) {
if (state != expState) {
failed("Java thread state is wrong");
}
if ((singleState & jvmtiExpState) == 0) {