4242import java .util .function .Function ;
4343import java .util .stream .Collectors ;
4444
45- import jdk .graal .compiler .options .OptionsContainer ;
4645import org .graalvm .collections .EconomicMap ;
4746import org .graalvm .nativeimage .ImageSingletons ;
4847import org .graalvm .nativeimage .hosted .Feature ;
7473import jdk .graal .compiler .options .OptionDescriptor ;
7574import jdk .graal .compiler .options .OptionDescriptors ;
7675import jdk .graal .compiler .options .OptionStability ;
76+ import jdk .graal .compiler .options .OptionsContainer ;
7777import jdk .graal .compiler .options .OptionsParser ;
7878
7979class APIOptionHandler extends NativeImage .OptionHandler <NativeImage > {
@@ -410,7 +410,10 @@ String translateOption(ArgumentQueue argQueue) {
410410 OptionInfo option = null ;
411411 boolean whitespaceSeparated = false ;
412412 String [] optionNameAndOptionValue = null ;
413- OptionOrigin argumentOrigin = OptionOrigin .from (argQueue .argumentOrigin );
413+ String argumentOriginString = OptionOrigin .from (argQueue .argumentOrigin ).toString ();
414+ if (nativeImage .useBundle ()) {
415+ argumentOriginString = nativeImage .bundleSupport .cleanupBuilderOutput (argumentOriginString );
416+ }
414417 found : for (OptionInfo optionInfo : apiOptions .values ()) {
415418 for (String variant : optionInfo .variants ) {
416419 String optionName ;
@@ -437,7 +440,7 @@ String translateOption(ArgumentQueue argQueue) {
437440 argQueue .poll ();
438441 String optionValue = argQueue .peek ();
439442 if (optionValue == null ) {
440- NativeImage .showError (headArg + " from " + argumentOrigin + " requires option argument" );
443+ NativeImage .showError (headArg + " from " + argumentOriginString + " requires option argument" );
441444 }
442445 option = optionInfo ;
443446 optionNameAndOptionValue = new String []{headArg , optionValue };
@@ -457,14 +460,14 @@ String translateOption(ArgumentQueue argQueue) {
457460 }
458461 if (option != null ) {
459462 if (!option .deprecationWarning .isEmpty ()) {
460- LogUtils .warning ("Using a deprecated option " + optionNameAndOptionValue [0 ] + " from " + argumentOrigin + ". " + option .deprecationWarning );
463+ LogUtils .warning ("Using a deprecated option " + optionNameAndOptionValue [0 ] + " from " + argumentOriginString + ". " + option .deprecationWarning );
461464 }
462465 String builderOption = option .builderOption ;
463466 /* If option is in group, defaultValue has different use */
464467 String optionValue = option .group != null ? null : option .defaultValue ;
465468 if (optionNameAndOptionValue .length == 2 ) {
466469 if (option .defaultFinal ) {
467- NativeImage .showError ("Passing values to option " + optionNameAndOptionValue [0 ] + " from " + argumentOrigin + " is not supported." );
470+ NativeImage .showError ("Passing values to option " + optionNameAndOptionValue [0 ] + " from " + argumentOriginString + " is not supported." );
468471 }
469472 optionValue = optionNameAndOptionValue [1 ];
470473 }
0 commit comments