@@ -299,10 +299,7 @@ class RuntimeExitOrHaltMethod extends Method {
299299 ( this .hasName ( "exit" ) or this .hasName ( "halt" ) ) and
300300 this .getNumberOfParameters ( ) = 1 and
301301 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
306303 }
307304}
308305
@@ -315,10 +312,7 @@ class RuntimeAddOrRemoveShutdownHookMethod extends Method {
315312 ( this .hasName ( "addShutdownHook" ) or this .hasName ( "removeShutdownHook" ) ) and
316313 this .getNumberOfParameters ( ) = 1 and
317314 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
322316 }
323317}
324318
@@ -414,33 +408,29 @@ class ForbiddenSerializationMethod extends Method {
414408
415409/**
416410 * 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.
418412 */
419413class EnableReplaceObjectMethod extends Method {
420414 EnableReplaceObjectMethod ( ) {
421415 this .hasName ( "enableReplaceObject" ) and
422416 this .getNumberOfParameters ( ) = 1 and
423417 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
428420 }
429421}
430422
431423/**
432424 * 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.
434426 */
435427class ReplaceObjectMethod extends Method {
436428 ReplaceObjectMethod ( ) {
437429 this .hasName ( "replaceObject" ) and
438430 this .getNumberOfParameters ( ) = 1 and
439431 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
444434 }
445435}
446436
@@ -453,10 +443,7 @@ class EnableResolveObjectMethod extends Method {
453443 this .hasName ( "enableResolveObject" ) and
454444 this .getNumberOfParameters ( ) = 1 and
455445 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
460447 }
461448}
462449
@@ -469,10 +456,7 @@ class ResolveObjectMethod extends Method {
469456 this .hasName ( "resolveObject" ) and
470457 this .getNumberOfParameters ( ) = 1 and
471458 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
476460 }
477461}
478462
@@ -485,10 +469,7 @@ class ResolveClassMethod extends Method {
485469 this .hasName ( "resolveClass" ) and
486470 this .getNumberOfParameters ( ) = 1 and
487471 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
492473 }
493474}
494475
@@ -500,16 +481,8 @@ class ResolveProxyClassMethod extends Method {
500481 ResolveProxyClassMethod ( ) {
501482 this .hasName ( "resolveProxyClass" ) and
502483 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
513486 }
514487}
515488
@@ -598,16 +571,13 @@ class SystemOrRuntimeLoadLibraryMethod extends Method {
598571 SystemOrRuntimeLoadLibraryMethod ( ) {
599572 ( this .hasName ( "load" ) or this .hasName ( "loadLibrary" ) ) and
600573 this .getNumberOfParameters ( ) = 1 and
601- this .getParameter ( 0 ) .getType ( ) . ( RefType ) . hasQualifiedName ( "java.lang" , "String" ) and
574+ this .getParameter ( 0 ) .getType ( ) instanceof TypeString and
602575 (
603576 this .getDeclaringType ( )
604577 .getASupertype * ( )
605578 .getSourceDeclaration ( )
606579 .hasQualifiedName ( "java.lang" , "System" ) or
607- this .getDeclaringType ( )
608- .getASupertype * ( )
609- .getSourceDeclaration ( )
610- .hasQualifiedName ( "java.lang" , "Runtime" )
580+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeRuntime
611581 )
612582 }
613583}
@@ -619,9 +589,6 @@ class SystemOrRuntimeLoadLibraryMethod extends Method {
619589class RuntimeExecMethod extends Method {
620590 RuntimeExecMethod ( ) {
621591 this .hasName ( "exec" ) and
622- this .getDeclaringType ( )
623- .getASupertype * ( )
624- .getSourceDeclaration ( )
625- .hasQualifiedName ( "java.lang" , "Runtime" )
592+ this .getDeclaringType ( ) .getASupertype * ( ) .getSourceDeclaration ( ) instanceof TypeRuntime
626593 }
627594}
0 commit comments