@@ -18,13 +18,13 @@ abstract class SerializableType extends ValueOrRefType {
1818 * deserialization mechanism.
1919 */
2020 abstract Callable getADeserializationCallback ( ) ;
21-
21+
2222 /**
2323 * A field whose value is restored during a deserialization, rendering it
2424 * potentially untrusted.
2525 */
2626 abstract Field getASerializedField ( ) ;
27-
27+
2828 /**
2929 * Get a callback that is automatically executed (without user code
3030 * interaction) when an object instance is deserialized. This includes
@@ -33,12 +33,15 @@ abstract class SerializableType extends ValueOrRefType {
3333 Callable getAnAutomaticCallback ( ) {
3434 result = this .getADeserializationCallback ( ) or
3535 result .( Destructor ) .getDeclaringType ( ) = this or
36- result = any ( Method m | m .getDeclaringType ( ) = this and
37- m .hasName ( "Dispose" ) and (
38- m .getNumberOfParameters ( ) = 0 or
39- m .getNumberOfParameters ( ) = 1 and m .getParameter ( 0 ) .getType ( ) instanceof BoolType
36+ result = any ( Method m |
37+ m .getDeclaringType ( ) = this and
38+ m .hasName ( "Dispose" ) and
39+ (
40+ m .getNumberOfParameters ( ) = 0
41+ or
42+ m .getNumberOfParameters ( ) = 1 and m .getParameter ( 0 ) .getType ( ) instanceof BoolType
43+ )
4044 )
41- )
4245 }
4346}
4447
@@ -47,24 +50,24 @@ abstract class SerializableType extends ValueOrRefType {
4750 * attribute.
4851 */
4952class BinarySerializableType extends SerializableType {
50- BinarySerializableType ( ) {
51- this .getAnAttribute ( ) .getType ( ) .hasName ( "SerializableAttribute" )
52- }
53-
53+ BinarySerializableType ( ) { this .getAnAttribute ( ) .getType ( ) .hasName ( "SerializableAttribute" ) }
54+
5455 /**
5556 * In addition to the defaults, a `BinarySerializer` will call any method annotated
5657 * with an `OnDeserialized` or `OnDeserializing` attribute, as well as an
5758 * `OnDeserialization` method.
5859 */
5960 override Callable getADeserializationCallback ( ) {
60- result .( SerializationConstructor ) .getDeclaringType ( ) = this or
61- result = this .getAMethod ( ) and (
61+ result .( SerializationConstructor ) .getDeclaringType ( ) = this
62+ or
63+ result = this .getAMethod ( ) and
64+ (
6265 result .( Attributable ) .getAnAttribute ( ) .getType ( ) .hasName ( "OnDeserializedAttribute" ) or
6366 result .( Attributable ) .getAnAttribute ( ) .getType ( ) .hasName ( "OnDeserializingAttribute" ) or
6467 result .hasName ( "OnDeserialization" )
6568 )
6669 }
67-
70+
6871 override Field getASerializedField ( ) {
6972 result .getDeclaringType ( ) = this and
7073 not result .getAnAttribute ( ) .getType ( ) .hasName ( "NonSerializedAttribute" ) and
@@ -77,10 +80,8 @@ class BinarySerializableType extends SerializableType {
7780 * then it is serialized and deserialized in a special way.
7881 */
7982class CustomBinarySerializableType extends BinarySerializableType {
80- CustomBinarySerializableType ( ) {
81- this .getABaseType * ( ) .hasName ( "ISerializable" )
82- }
83-
83+ CustomBinarySerializableType ( ) { this .getABaseType * ( ) .hasName ( "ISerializable" ) }
84+
8485 /**
8586 * For custom deserialization, the `BinarySerializer` will call the serialization constructor.
8687 */
@@ -101,4 +102,4 @@ class DangerousCallable extends Callable {
101102 //assembly
102103 this .( Method ) .getQualifiedName ( ) .matches ( "System.Reflection.Assembly.%Load%" )
103104 }
104- }
105+ }
0 commit comments