@@ -299,10 +299,7 @@ class RuntimeExitOrHaltMethod extends Method {
299
299
( this .hasName ( "exit" ) or this .hasName ( "halt" ) ) and
300
300
this .getNumberOfParameters ( ) = 1 and
301
301
this .getParameter ( 0 ) .getType ( ) .( PrimitiveType ) .hasName ( "int" ) and
302
- this .getDeclaringType ( )
303
- .getASupertype * ( )
304
- .getSourceDeclaration ( )
305
- .hasQualifiedName ( "java.lang" , "Runtime" )
302
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeRuntime
306
303
}
307
304
}
308
305
@@ -315,10 +312,7 @@ class RuntimeAddOrRemoveShutdownHookMethod extends Method {
315
312
( this .hasName ( "addShutdownHook" ) or this .hasName ( "removeShutdownHook" ) ) and
316
313
this .getNumberOfParameters ( ) = 1 and
317
314
this .getParameter ( 0 ) .getType ( ) .( RefType ) .hasQualifiedName ( "java.lang" , "Thread" ) and
318
- this .getDeclaringType ( )
319
- .getASupertype * ( )
320
- .getSourceDeclaration ( )
321
- .hasQualifiedName ( "java.lang" , "Runtime" )
315
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeRuntime
322
316
}
323
317
}
324
318
@@ -414,33 +408,29 @@ class ForbiddenSerializationMethod extends Method {
414
408
415
409
/**
416
410
* A method named `enableReplaceObject` declared in
417
- * the class `java.io.ObjectInputStream ` or a subclass thereof.
411
+ * the class `java.io.ObjectOutputStream ` or a subclass thereof.
418
412
*/
419
413
class EnableReplaceObjectMethod extends Method {
420
414
EnableReplaceObjectMethod ( ) {
421
415
this .hasName ( "enableReplaceObject" ) and
422
416
this .getNumberOfParameters ( ) = 1 and
423
417
this .getParameter ( 0 ) .getType ( ) .( PrimitiveType ) .hasName ( "boolean" ) and
424
- this .getDeclaringType ( )
425
- .getASupertype * ( )
426
- .getSourceDeclaration ( )
427
- .hasQualifiedName ( "java.io" , "ObjectOutputStream" )
418
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof
419
+ TypeObjectOutputStream
428
420
}
429
421
}
430
422
431
423
/**
432
424
* A method named `replaceObject` declared in
433
- * the class `java.io.ObjectInputStream ` or a subclass thereof.
425
+ * the class `java.io.ObjectOutputStream ` or a subclass thereof.
434
426
*/
435
427
class ReplaceObjectMethod extends Method {
436
428
ReplaceObjectMethod ( ) {
437
429
this .hasName ( "replaceObject" ) and
438
430
this .getNumberOfParameters ( ) = 1 and
439
431
this .getParameter ( 0 ) .getType ( ) instanceof TypeObject and
440
- this .getDeclaringType ( )
441
- .getASupertype * ( )
442
- .getSourceDeclaration ( )
443
- .hasQualifiedName ( "java.io" , "ObjectOutputStream" )
432
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof
433
+ TypeObjectOutputStream
444
434
}
445
435
}
446
436
@@ -453,10 +443,7 @@ class EnableResolveObjectMethod extends Method {
453
443
this .hasName ( "enableResolveObject" ) and
454
444
this .getNumberOfParameters ( ) = 1 and
455
445
this .getParameter ( 0 ) .getType ( ) .( PrimitiveType ) .hasName ( "boolean" ) and
456
- this .getDeclaringType ( )
457
- .getASupertype * ( )
458
- .getSourceDeclaration ( )
459
- .hasQualifiedName ( "java.io" , "ObjectInputStream" )
446
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeObjectInputStream
460
447
}
461
448
}
462
449
@@ -469,10 +456,7 @@ class ResolveObjectMethod extends Method {
469
456
this .hasName ( "resolveObject" ) and
470
457
this .getNumberOfParameters ( ) = 1 and
471
458
this .getParameter ( 0 ) .getType ( ) instanceof TypeObject and
472
- this .getDeclaringType ( )
473
- .getASupertype * ( )
474
- .getSourceDeclaration ( )
475
- .hasQualifiedName ( "java.io" , "ObjectInputStream" )
459
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeObjectInputStream
476
460
}
477
461
}
478
462
@@ -485,10 +469,7 @@ class ResolveClassMethod extends Method {
485
469
this .hasName ( "resolveClass" ) and
486
470
this .getNumberOfParameters ( ) = 1 and
487
471
this .getParameter ( 0 ) .getType ( ) .( RefType ) .hasQualifiedName ( "java.io" , "ObjectStreamClass" ) and
488
- this .getDeclaringType ( )
489
- .getASupertype * ( )
490
- .getSourceDeclaration ( )
491
- .hasQualifiedName ( "java.io" , "ObjectInputStream" )
472
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeObjectInputStream
492
473
}
493
474
}
494
475
@@ -500,16 +481,8 @@ class ResolveProxyClassMethod extends Method {
500
481
ResolveProxyClassMethod ( ) {
501
482
this .hasName ( "resolveProxyClass" ) and
502
483
this .getNumberOfParameters ( ) = 1 and
503
- this .getParameter ( 0 )
504
- .getType ( )
505
- .( Array )
506
- .getComponentType ( )
507
- .( RefType )
508
- .hasQualifiedName ( "java.lang" , "String" ) and
509
- this .getDeclaringType ( )
510
- .getASupertype * ( )
511
- .getSourceDeclaration ( )
512
- .hasQualifiedName ( "java.io" , "ObjectInputStream" )
484
+ this .getParameter ( 0 ) .getType ( ) .( Array ) .getComponentType ( ) instanceof TypeString and
485
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeObjectInputStream
513
486
}
514
487
}
515
488
@@ -598,16 +571,13 @@ class SystemOrRuntimeLoadLibraryMethod extends Method {
598
571
SystemOrRuntimeLoadLibraryMethod ( ) {
599
572
( this .hasName ( "load" ) or this .hasName ( "loadLibrary" ) ) and
600
573
this .getNumberOfParameters ( ) = 1 and
601
- this .getParameter ( 0 ) .getType ( ) . ( RefType ) . hasQualifiedName ( "java.lang" , "String" ) and
574
+ this .getParameter ( 0 ) .getType ( ) instanceof TypeString and
602
575
(
603
576
this .getDeclaringType ( )
604
577
.getASupertype * ( )
605
578
.getSourceDeclaration ( )
606
579
.hasQualifiedName ( "java.lang" , "System" ) or
607
- this .getDeclaringType ( )
608
- .getASupertype * ( )
609
- .getSourceDeclaration ( )
610
- .hasQualifiedName ( "java.lang" , "Runtime" )
580
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeRuntime
611
581
)
612
582
}
613
583
}
@@ -619,9 +589,6 @@ class SystemOrRuntimeLoadLibraryMethod extends Method {
619
589
class RuntimeExecMethod extends Method {
620
590
RuntimeExecMethod ( ) {
621
591
this .hasName ( "exec" ) and
622
- this .getDeclaringType ( )
623
- .getASupertype * ( )
624
- .getSourceDeclaration ( )
625
- .hasQualifiedName ( "java.lang" , "Runtime" )
592
+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeRuntime
626
593
}
627
594
}
0 commit comments