41
41
import com .oracle .svm .common .option .CommonOptionParser .OptionParseResult ;
42
42
import com .oracle .svm .common .option .UnsupportedOptionClassException ;
43
43
import com .oracle .svm .core .util .InterruptImageBuilding ;
44
- import com .oracle .svm .core .util .VMError ;
45
44
import com .oracle .svm .util .LogUtils ;
46
45
47
46
import jdk .graal .compiler .options .OptionDescriptor ;
@@ -63,8 +62,7 @@ static OptionParseResult parseOption(EconomicMap<String, OptionDescriptor> optio
63
62
try {
64
63
return CommonOptionParser .parseOption (options , isHosted , option , valuesMap , optionPrefix , booleanOptionFormat );
65
64
} catch (UnsupportedOptionClassException e ) {
66
- VMError .shouldNotReachHere (e .getMessage ());
67
- return null ;
65
+ throw new AssertionError ("Should not reach here" , e );
68
66
}
69
67
}
70
68
@@ -160,7 +158,6 @@ public static double parseDouble(String v) {
160
158
* @return recommendation for setting a option value (e.g., for option 'Name' and value 'file'
161
159
* it returns "-H:Name=file")
162
160
*/
163
- @ Platforms (Platform .HOSTED_ONLY .class )
164
161
public static String commandArgument (OptionKey <?> option , String value ) {
165
162
return commandArgument (option , value , null );
166
163
}
@@ -175,7 +172,6 @@ public static String commandArgument(OptionKey<?> option, String value) {
175
172
* @return recommendation for setting a option value (e.g., for option 'Name' and value 'file'
176
173
* it returns "-H:Name=file")
177
174
*/
178
- @ Platforms (Platform .HOSTED_ONLY .class )
179
175
public static String commandArgument (OptionKey <?> option , String value , String apiOptionName ) {
180
176
/* Ensure descriptor is loaded */
181
177
OptionDescriptor optionDescriptor = option .loadDescriptor ();
@@ -193,7 +189,9 @@ public static String commandArgument(OptionKey<?> option, String value, String a
193
189
}
194
190
195
191
if (optionDescriptor .getOptionValueType () == Boolean .class ) {
196
- VMError .guarantee (value .equals ("+" ) || value .equals ("-" ), "Boolean option value can be only + or -" );
192
+ if (!value .equals ("+" ) && !value .equals ("-" )) {
193
+ throw new AssertionError ("Boolean option value can be only + or -" );
194
+ }
197
195
for (APIOption apiOption : apiOptions ) {
198
196
String selected = selectVariant (apiOption , apiOptionName );
199
197
if (selected != null ) {
@@ -240,12 +238,10 @@ public static String commandArgument(OptionKey<?> option, String value, String a
240
238
}
241
239
}
242
240
243
- @ Platforms (Platform .HOSTED_ONLY .class )
244
241
public static String commandArgument (OptionKey <?> option , String value , String apiOptionName , boolean escape , boolean newLine ) {
245
242
return formatCommandArgument (commandArgument (option , value , apiOptionName ), escape , newLine );
246
243
}
247
244
248
- @ Platforms (Platform .HOSTED_ONLY .class )
249
245
public static String commandArgument (OptionKey <?> option , String value , boolean escape , boolean newLine ) {
250
246
return formatCommandArgument (commandArgument (option , value ), escape , newLine );
251
247
}
@@ -262,7 +258,9 @@ private static String formatCommandArgument(String optionMessage, boolean escape
262
258
}
263
259
264
260
private static String selectVariant (APIOption apiOption , String apiOptionName ) {
265
- VMError .guarantee (apiOption .name ().length > 0 , "APIOption requires at least one name" );
261
+ if (apiOption .name ().length <= 0 ) {
262
+ throw new AssertionError ("APIOption requires at least one name" );
263
+ }
266
264
if (!apiOption .deprecated ().equals ("" )) {
267
265
return null ; /* Never select deprecated API options. */
268
266
}
0 commit comments