|
44 | 44 | import org.graalvm.nativeimage.impl.AnnotationExtractor; |
45 | 45 | import org.graalvm.nativeimage.impl.ImageSingletonsSupport; |
46 | 46 |
|
| 47 | +import com.oracle.svm.core.SubstrateOptions; |
47 | 48 | import com.oracle.svm.core.SubstrateUtil; |
48 | 49 | import com.oracle.svm.core.imagelayer.ImageLayerBuildingSupport; |
49 | 50 | import com.oracle.svm.core.layeredimagesingleton.LayeredImageSingletonSupport; |
@@ -430,7 +431,9 @@ private void addSingleton(Class<?> key, Object value) { |
430 | 431 | traitMap.getTrait(SingletonTraitKind.LAYERED_INSTALLATION_KIND).ifPresent(trait -> { |
431 | 432 | var kind = SingletonLayeredInstallationKind.getInstallationKind(trait); |
432 | 433 | if (forbiddenInstallationKinds.contains(kind)) { |
433 | | - throw VMError.shouldNotReachHere("Singleton with installation kind %s can no longer be added: %s", kind, value); |
| 434 | + if (SubstrateOptions.LayerOptionVerification.getValue()) { |
| 435 | + throw VMError.shouldNotReachHere("Singleton with installation kind %s can no longer be added: %s", kind, value); |
| 436 | + } |
434 | 437 | } |
435 | 438 | }); |
436 | 439 | } |
@@ -633,10 +636,10 @@ public SingletonTraitMap getUninstalledSingletonTraitMap(Class<?> key) { |
633 | 636 | var installationKindSupplierClass = annotation.layeredInstallationKind(); |
634 | 637 | /* |
635 | 638 | * Initial Layer information should never be injected, as either |
636 | | - * |
| 639 | + * |
637 | 640 | * 1) We are building the initial layer, so it should be present in the |
638 | 641 | * configObject which it exists. |
639 | | - * |
| 642 | + * |
640 | 643 | * 2) We are building an extension layer, so it is not relevant for this |
641 | 644 | * layer. |
642 | 645 | */ |
|
0 commit comments