Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of AWT runtime initialized classes not observable for other extensions #32069

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import static io.quarkus.deployment.builditem.nativeimage.UnsupportedOSBuildItem.Os.WINDOWS;

import io.quarkus.awt.runtime.graal.AwtFeature;
import java.util.stream.Stream;

import io.quarkus.awt.runtime.graal.DarwinAwtFeature;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildProducer;
Expand All @@ -13,6 +14,7 @@
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeMinimalJavaVersionBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem;
import io.quarkus.deployment.builditem.nativeimage.UnsupportedOSBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
Expand All @@ -26,7 +28,6 @@ FeatureBuildItem feature() {

@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
void nativeImageFeatures(BuildProducer<NativeImageFeatureBuildItem> nativeImageFeatures) {
nativeImageFeatures.produce(new NativeImageFeatureBuildItem(AwtFeature.class));
nativeImageFeatures.produce(new NativeImageFeatureBuildItem(DarwinAwtFeature.class));
}

Expand Down Expand Up @@ -197,4 +198,21 @@ JniRuntimeAccessBuildItem setupJava2DClasses() {
"sun.java2d.SunGraphics2D",
"sun.java2d.SurfaceData");
}

@BuildStep
void runtimeInitializedClasses(BuildProducer<RuntimeInitializedPackageBuildItem> runtimeInitilizedPackages) {
/*
* Note that this initialization is not enough if user wants to deserialize actual images
* (e.g. from XML). AWT Extension must be loaded for decoding JDK supported image formats.
*/
Stream.of("com.sun.imageio",
"java.awt",
"javax.imageio",
"sun.awt",
"sun.font",
"sun.java2d")
.map(RuntimeInitializedPackageBuildItem::new)
.forEach(runtimeInitilizedPackages::produce);
}

}

This file was deleted.