@@ -285,29 +285,22 @@ private static SubstrateConstructorAccessor getConstructorAccessor(Constructor<?
285
285
}
286
286
287
287
private static <T extends AccessibleObject & Member > void checkMember (T member , boolean isStatic ) {
288
- if (!(Modifier .isStatic (member .getModifiers ()) == isStatic )) {
289
- throw checkMemberFailed (isStatic );
288
+ if (Modifier .isStatic (member .getModifiers ()) != isStatic ) {
289
+ throw VMError .shouldNotReachHere ("Cannot perform " +
290
+ (isStatic ? "static" : "non-static" ) + " operation on a " +
291
+ (isStatic ? "non-static" : "static" ) + " member" );
290
292
}
291
293
}
292
294
293
- private static RuntimeException checkMemberFailed (boolean isStatic ) {
294
- throw VMError .shouldNotReachHere ("Cannot perform " +
295
- (isStatic ? "static" : "non-static" ) + " operation on a " +
296
- (isStatic ? "non-static" : "static" ) + " member" );
297
- }
298
-
299
295
private static SubstrateAccessor getAccessor (Target_java_lang_invoke_MemberName memberName ) {
300
296
VMError .guarantee (memberName .isInvocable (), "Cannot perform invokeSpecial on a field" );
301
297
return memberName .isMethod () ? getMethodAccessor ((Method ) memberName .reflectAccess ) : getConstructorAccessor ((Constructor <?>) memberName .reflectAccess );
302
298
}
303
299
304
300
private static void checkArgs (Object [] args , int expectedLength , String methodName ) {
305
- if (!(( expectedLength == 0 && args == null ) || args .length == expectedLength ) ) {
306
- throw checkArgsFailed ( expectedLength , methodName ) ;
301
+ if (( expectedLength == 0 && args == null ) || args .length == expectedLength ) {
302
+ return ;
307
303
}
308
- }
309
-
310
- private static RuntimeException checkArgsFailed (int expectedLength , String methodName ) {
311
304
throw VMError .shouldNotReachHere (methodName + " requires exactly " + expectedLength + " arguments" );
312
305
}
313
306
0 commit comments