THRIFT-5005 Refactoring of the Delphi libs [ci skip]
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/src/Thrift.Collections.pas b/lib/delphi/src/Thrift.Collections.pas
index 3b56fe2..ad852ac 100644
--- a/lib/delphi/src/Thrift.Collections.pas
+++ b/lib/delphi/src/Thrift.Collections.pas
@@ -65,9 +65,9 @@
   end;
 
   TThriftDictionaryImpl<TKey,TValue> = class( TInterfacedObject, IThriftDictionary<TKey,TValue>, IThriftContainer, ISupportsToString)
-  private
+  strict private
     FDictionaly : TDictionary<TKey,TValue>;
-  protected
+  strict protected
     function GetEnumerator: TEnumerator<TPair<TKey,TValue>>;
 
     function GetKeys: TDictionary<TKey,TValue>.TKeyCollection;
@@ -142,9 +142,9 @@
   end;
 
   TThriftListImpl<T> = class( TInterfacedObject, IThriftList<T>, IThriftContainer, ISupportsToString)
-  private
+  strict private
     FList : TList<T>;
-  protected
+  strict protected
     function GetEnumerator: TEnumerator<T>;
     function GetCapacity: Integer;
     procedure SetCapacity(Value: Integer);
@@ -205,10 +205,10 @@
   end;
 
   THashSetImpl<TValue> = class( TInterfacedObject, IHashSet<TValue>, IThriftContainer, ISupportsToString)
-  private
+  strict private
     FDictionary : IThriftDictionary<TValue,Integer>;
     FIsReadOnly: Boolean;
-  protected
+  strict protected
     function GetEnumerator: TEnumerator<TValue>;
     function GetIsReadOnly: Boolean;
     function GetCount: Integer;
diff --git a/lib/delphi/src/Thrift.Processor.Multiplex.pas b/lib/delphi/src/Thrift.Processor.Multiplex.pas
index 8cf23db..622f730 100644
--- a/lib/delphi/src/Thrift.Processor.Multiplex.pas
+++ b/lib/delphi/src/Thrift.Processor.Multiplex.pas
@@ -62,19 +62,19 @@
 
 
   TMultiplexedProcessorImpl = class( TInterfacedObject, IMultiplexedProcessor, IProcessor)
-  private type
+  strict private type
     // Our goal was to work with any protocol.  In order to do that, we needed
     // to allow them to call readMessageBegin() and get a TMessage in exactly
     // the standard format, without the service name prepended to TMessage.name.
     TStoredMessageProtocol = class( TProtocolDecorator)
-    private
+    strict private
       FMessageBegin : TThriftMessage;
     public
       constructor Create( const protocol : IProtocol; const aMsgBegin : TThriftMessage);
       function ReadMessageBegin: TThriftMessage; override;
     end;
 
-  private
+  strict private
     FServiceProcessorMap : TDictionary<String, IProcessor>;
     FDefaultProcessor : IProcessor;
 
@@ -113,12 +113,6 @@
 end;
 
 
-function TMultiplexedProcessorImpl.TStoredMessageProtocol.ReadMessageBegin: TThriftMessage;
-begin
-  result := FMessageBegin;
-end;
-
-
 constructor TMultiplexedProcessorImpl.Create;
 begin
   inherited Create;
@@ -136,6 +130,12 @@
 end;
 
 
+function TMultiplexedProcessorImpl.TStoredMessageProtocol.ReadMessageBegin: TThriftMessage;
+begin
+  result := FMessageBegin;
+end;
+
+
 procedure TMultiplexedProcessorImpl.RegisterProcessor( const serviceName : String; const processor : IProcessor; const asDefault : Boolean);
 begin
   FServiceProcessorMap.Add( serviceName, processor);
diff --git a/lib/delphi/src/Thrift.Protocol.Compact.pas b/lib/delphi/src/Thrift.Protocol.Compact.pas
index 07cab9a..866bd26 100644
--- a/lib/delphi/src/Thrift.Protocol.Compact.pas
+++ b/lib/delphi/src/Thrift.Protocol.Compact.pas
@@ -47,7 +47,7 @@
         function GetProtocol( const trans: ITransport): IProtocol;
       end;
 
-  private const
+  strict private const
 
     { TODO
     static TStruct ANONYMOUS_STRUCT = new TStruct("");
@@ -61,7 +61,7 @@
     TYPE_BITS         = Byte( $07); // 0000 0111
     TYPE_SHIFT_AMOUNT = Byte( 5);
 
-  private type
+  strict private type
     // All of the on-wire type codes.
     Types = (
       STOP          = $00,
@@ -79,7 +79,7 @@
       STRUCT        = $0C
     );
 
-  private const
+  strict private const
     ttypeToCompactType : array[TType] of Types = (
       Types.STOP,           // Stop    = 0,
       Types(-1),            // Void    = 1,
@@ -115,7 +115,7 @@
       TType.Struct      // STRUCT
     );
 
-  private
+  strict private
     // Used to keep track of the last field for the current and previous structs,
     // so we can do the delta stuff.
     lastField_ : TStack<Integer>;
@@ -123,11 +123,11 @@
 
     // If we encounter a boolean field begin, save the TField here so it can
     // have the value incorporated.
-    private booleanField_ : TThriftField;
+    strict private booleanField_ : TThriftField;
 
     // If we Read a field header, and it's a boolean field, save the boolean
     // value here so that ReadBool can use it.
-    private  boolValue_  : ( unused, bool_true, bool_false);
+    strict private  boolValue_  : ( unused, bool_true, bool_false);
 
   public
     constructor Create(const trans : ITransport);
@@ -135,7 +135,7 @@
 
     procedure Reset;
 
-  private
+  strict private
     procedure WriteByteDirect( const b : Byte);  overload;
 
     // Writes a byte without any possibility of all that field header nonsense.
@@ -145,7 +145,7 @@
     // TODO: make a permanent buffer like WriteVarint64?
     procedure WriteVarint32( n : Cardinal);
 
-  private
+  strict private
     // The workhorse of WriteFieldBegin. It has the option of doing a 'type override'
     // of the type header. This is used specifically in the boolean field case.
     procedure WriteFieldBeginInternal( const field : TThriftField; typeOverride : Byte);
diff --git a/lib/delphi/src/Thrift.Protocol.JSON.pas b/lib/delphi/src/Thrift.Protocol.JSON.pas
index 30600aa..85cb973 100644
--- a/lib/delphi/src/Thrift.Protocol.JSON.pas
+++ b/lib/delphi/src/Thrift.Protocol.JSON.pas
@@ -52,17 +52,17 @@
         function GetProtocol( const trans: ITransport): IProtocol;
       end;
 
-  private
+  strict private
     class function GetTypeNameForTypeID(typeID : TType) : string;
     class function GetTypeIDForTypeName( const name : string) : TType;
 
-  protected
+  strict protected
     type
       // Base class for tracking JSON contexts that may require
       // inserting/Reading additional JSON syntax characters.
       // This base context does nothing.
       TJSONBaseContext = class
-      protected
+      strict protected
         FProto : Pointer;  // weak IJSONProtocol;
       public
         constructor Create( const aProto : IJSONProtocol);
@@ -74,7 +74,7 @@
       // Context for JSON lists.
       // Will insert/Read commas before each item except for the first one.
       TJSONListContext = class( TJSONBaseContext)
-      private
+      strict private
         FFirst : Boolean;
       public
         constructor Create( const aProto : IJSONProtocol);
@@ -86,7 +86,7 @@
       // pair, and commas before each key except the first. In addition, will indicate that numbers
       // in the key position need to be escaped in quotes (since JSON keys must be strings).
       TJSONPairContext = class( TJSONBaseContext)
-      private
+      strict private
         FFirst, FColon : Boolean;
       public
         constructor Create( const aProto : IJSONProtocol);
@@ -97,11 +97,13 @@
 
       // Holds up to one byte from the transport
       TLookaheadReader = class
-      protected
+      strict protected
         FProto : Pointer;  // weak IJSONProtocol;
+
+      protected
         constructor Create( const aProto : IJSONProtocol);
 
-      private
+      strict private
         FHasData : Boolean;
         FData    : Byte;
 
@@ -115,7 +117,7 @@
         function Peek : Byte;
       end;
 
-  protected
+  strict protected
     // Stack of nested contexts that we may be in
     FContextStack : TStack<TJSONBaseContext>;
 
@@ -135,12 +137,12 @@
     constructor Create( const aTrans : ITransport);
     destructor Destroy;   override;
 
-  protected
+  strict protected
     // IJSONProtocol
     // Read a byte that must match b; otherwise an exception is thrown.
     procedure ReadJSONSyntaxChar( b : Byte);
 
-  private
+  strict private
     // Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its corresponding hex value
     class function HexVal( ch : Byte) : Byte;
 
@@ -213,7 +215,7 @@
     function ReadBinary: TBytes; override;
 
 
-  private
+  strict private
     // Reading methods.
 
     // Read in a JSON string, unescaping as appropriate.
diff --git a/lib/delphi/src/Thrift.Protocol.Multiplex.pas b/lib/delphi/src/Thrift.Protocol.Multiplex.pas
index 93a3838..e5e0cd9 100644
--- a/lib/delphi/src/Thrift.Protocol.Multiplex.pas
+++ b/lib/delphi/src/Thrift.Protocol.Multiplex.pas
@@ -54,7 +54,7 @@
     {  Used to delimit the service name from the function name }
     SEPARATOR = ':';
 
-  private
+  strict private
      FServiceName : String;
 
   public
diff --git a/lib/delphi/src/Thrift.Protocol.pas b/lib/delphi/src/Thrift.Protocol.pas
index 47e88fe..7c80221 100644
--- a/lib/delphi/src/Thrift.Protocol.pas
+++ b/lib/delphi/src/Thrift.Protocol.pas
@@ -106,7 +106,6 @@
   end;
 
 
-
   IProtocolFactory = interface
     ['{7CD64A10-4E9F-4E99-93BF-708A31F4A67B}']
     function GetProtocol( const trans: ITransport): IProtocol;
@@ -123,7 +122,7 @@
       NOT_IMPLEMENTED = 5,
       DEPTH_LIMIT = 6
     );
-  protected
+  strict protected
     constructor HiddenCreate(const Msg: string);
     class function GetType: TExceptionType;  virtual; abstract;
   public
@@ -142,37 +141,37 @@
   end;
 
   TProtocolExceptionUnknown = class (TProtocolExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TProtocolException.TExceptionType;  override;
   end;
 
   TProtocolExceptionInvalidData = class (TProtocolExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TProtocolException.TExceptionType;  override;
   end;
 
   TProtocolExceptionNegativeSize = class (TProtocolExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TProtocolException.TExceptionType;  override;
   end;
 
   TProtocolExceptionSizeLimit = class (TProtocolExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TProtocolException.TExceptionType;  override;
   end;
 
   TProtocolExceptionBadVersion = class (TProtocolExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TProtocolException.TExceptionType;  override;
   end;
 
   TProtocolExceptionNotImplemented = class (TProtocolExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TProtocolException.TExceptionType;  override;
   end;
 
   TProtocolExceptionDepthLimit = class (TProtocolExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TProtocolException.TExceptionType;  override;
   end;
 
@@ -189,7 +188,7 @@
   end;
 
   TProtocolRecursionTrackerImpl = class abstract( TInterfacedObject, IProtocolRecursionTracker)
-  protected
+  strict protected
     FProtocol : IProtocol;
   public
     constructor Create( prot : IProtocol);
@@ -255,7 +254,7 @@
   end;
 
   TProtocolImpl = class abstract( TInterfacedObject, IProtocol)
-  protected
+  strict protected
     FTrans : ITransport;
     FRecursionLimit : Integer;
     FRecursionDepth : Integer;
@@ -326,33 +325,30 @@
 
 
   TBinaryProtocolImpl = class( TProtocolImpl )
-  protected
+  strict protected
     const
       VERSION_MASK : Cardinal = $ffff0000;
       VERSION_1 : Cardinal = $80010000;
-  protected
+  strict protected
     FStrictRead : Boolean;
     FStrictWrite : Boolean;
 
-  private
+  strict private
     function ReadAll( const pBuf : Pointer; const buflen : Integer; off: Integer; len: Integer ): Integer;  inline;
     function ReadStringBody( size: Integer): string;
 
   public
-
     type
       TFactory = class( TInterfacedObject, IProtocolFactory)
-      protected
+      strict protected
         FStrictRead : Boolean;
         FStrictWrite : Boolean;
-      public
         function GetProtocol( const trans: ITransport): IProtocol;
-        constructor Create( AStrictRead, AStrictWrite: Boolean ); overload;
-        constructor Create; overload;
+      public
+        constructor Create( const aStrictRead : Boolean = FALSE; const aStrictWrite: Boolean = TRUE); reintroduce;
       end;
 
-    constructor Create( const trans: ITransport); overload;
-    constructor Create( const trans: ITransport; strictRead: Boolean; strictWrite: Boolean); overload;
+    constructor Create( const trans: ITransport; strictRead: Boolean = FALSE; strictWrite: Boolean = TRUE); reintroduce;
 
     procedure WriteMessageBegin( const msg: TThriftMessage); override;
     procedure WriteMessageEnd; override;
@@ -405,7 +401,7 @@
     See p.175 of Design Patterns (by Gamma et al.)
   }
   TProtocolDecorator = class( TProtocolImpl)
-  private
+  strict private
     FWrappedProtocol : IProtocol;
 
   public
@@ -507,13 +503,13 @@
 
 implementation
 
-function ConvertInt64ToDouble( const n: Int64): Double;
+function ConvertInt64ToDouble( const n: Int64): Double;  inline;
 begin
   ASSERT( SizeOf(n) = SizeOf(Result));
   System.Move( n, Result, SizeOf(Result));
 end;
 
-function ConvertDoubleToInt64( const d: Double): Int64;
+function ConvertDoubleToInt64( const d: Double): Int64;  inline;
 begin
   ASSERT( SizeOf(d) = SizeOf(Result));
   System.Move( d, Result, SizeOf(Result));
@@ -595,8 +591,7 @@
   Result := '';
   b := ReadBinary;
   len := Length( b );
-  if len > 0 then
-  begin
+  if len > 0 then begin
     SetLength( Result, len);
     System.Move( b[0], Pointer(Result)^, len );
   end;
@@ -614,8 +609,7 @@
 begin
   len := Length(s);
   SetLength( b, len);
-  if len > 0 then
-  begin
+  if len > 0 then begin
     System.Move( Pointer(s)^, b[0], len );
   end;
   WriteBinary( b );
@@ -693,16 +687,9 @@
 
 { TBinaryProtocolImpl }
 
-constructor TBinaryProtocolImpl.Create( const trans: ITransport);
+constructor TBinaryProtocolImpl.Create( const trans: ITransport; strictRead, strictWrite: Boolean);
 begin
-  //no inherited
-  Create( trans, False, True);
-end;
-
-constructor TBinaryProtocolImpl.Create( const trans: ITransport; strictRead,
-  strictWrite: Boolean);
-begin
-  inherited Create( trans );
+  inherited Create( trans);
   FStrictRead := strictRead;
   FStrictWrite := strictWrite;
 end;
@@ -718,7 +705,7 @@
   buf : TBytes;
 begin
   size := ReadI32;
-  SetLength( buf, size );
+  SetLength( buf, size);
   FTrans.ReadAll( buf, 0, size);
   Result := buf;
 end;
@@ -853,10 +840,9 @@
 end;
 
 function TBinaryProtocolImpl.ReadStringBody( size: Integer): string;
-var
-  buf : TBytes;
+var buf : TBytes;
 begin
-  SetLength( buf, size );
+  SetLength( buf, size);
   FTrans.ReadAll( buf, 0, size );
   Result := TEncoding.UTF8.GetString( buf);
 end;
@@ -971,17 +957,14 @@
 end;
 
 procedure TBinaryProtocolImpl.WriteMessageBegin( const msg: TThriftMessage);
-var
-  version : Cardinal;
+var version : Cardinal;
 begin
-  if FStrictWrite then
-  begin
+  if FStrictWrite then begin
     version := VERSION_1 or Cardinal( msg.Type_);
     WriteI32( Integer( version) );
     WriteString( msg.Name);
     WriteI32( msg.SeqID);
-  end else
-  begin
+  end else begin
     WriteString( msg.Name);
     WriteByte(ShortInt( msg.Type_));
     WriteI32( msg.SeqID);
@@ -1099,19 +1082,13 @@
 
 { TBinaryProtocolImpl.TFactory }
 
-constructor TBinaryProtocolImpl.TFactory.Create(AStrictRead, AStrictWrite: Boolean);
+constructor TBinaryProtocolImpl.TFactory.Create( const aStrictRead, aStrictWrite: Boolean);
 begin
   inherited Create;
   FStrictRead := AStrictRead;
   FStrictWrite := AStrictWrite;
 end;
 
-constructor TBinaryProtocolImpl.TFactory.Create;
-begin
-  //no inherited;
-  Create( False, True )
-end;
-
 function TBinaryProtocolImpl.TFactory.GetProtocol( const trans: ITransport): IProtocol;
 begin
   Result := TBinaryProtocolImpl.Create( trans, FStrictRead, FStrictWrite);
diff --git a/lib/delphi/src/Thrift.Serializer.pas b/lib/delphi/src/Thrift.Serializer.pas
index 5f2905a..71b695c 100644
--- a/lib/delphi/src/Thrift.Serializer.pas
+++ b/lib/delphi/src/Thrift.Serializer.pas
@@ -36,7 +36,7 @@
 type
   // Generic utility for easily serializing objects into a byte array or Stream.
   TSerializer = class
-  private
+  strict private
     FStream    : TMemoryStream;
     FTransport : ITransport;
     FProtocol  : IProtocol;
@@ -60,7 +60,7 @@
 
   // Generic utility for easily deserializing objects from byte array or Stream.
   TDeserializer = class
-  private
+  strict private
     FStream    : TMemoryStream;
     FTransport : ITransport;
     FProtocol  : IProtocol;
diff --git a/lib/delphi/src/Thrift.Server.pas b/lib/delphi/src/Thrift.Server.pas
index 13c5762..c7cce73 100644
--- a/lib/delphi/src/Thrift.Server.pas
+++ b/lib/delphi/src/Thrift.Server.pas
@@ -61,7 +61,7 @@
   public
     type
       TLogDelegate = reference to procedure( const str: string);
-  protected
+  strict protected
     FProcessor : IProcessor;
     FServerTransport : IServerTransport;
     FInputTransportFactory : ITransportFactory;
@@ -80,51 +80,68 @@
     procedure Stop; virtual; abstract;
   public
     constructor Create(
-      const AProcessor :IProcessor;
-      const AServerTransport: IServerTransport;
-      const AInputTransportFactory : ITransportFactory;
-      const AOutputTransportFactory : ITransportFactory;
-      const AInputProtocolFactory : IProtocolFactory;
-      const AOutputProtocolFactory : IProtocolFactory;
-      const ALogDelegate : TLogDelegate
+      const aProcessor :IProcessor;
+      const aServerTransport: IServerTransport;
+      const aInputTransportFactory : ITransportFactory;
+      const aOutputTransportFactory : ITransportFactory;
+      const aInputProtocolFactory : IProtocolFactory;
+      const aOutputProtocolFactory : IProtocolFactory;
+      const aLogDelegate : TLogDelegate
       ); overload;
 
     constructor Create(
-      const AProcessor :IProcessor;
-      const AServerTransport: IServerTransport
+      const aProcessor :IProcessor;
+      const aServerTransport: IServerTransport
       ); overload;
 
     constructor Create(
-      const AProcessor :IProcessor;
-      const AServerTransport: IServerTransport;
-      const ALogDelegate: TLogDelegate
+      const aProcessor :IProcessor;
+      const aServerTransport: IServerTransport;
+      const aLogDelegate: TLogDelegate
       ); overload;
 
     constructor Create(
-      const AProcessor :IProcessor;
-      const AServerTransport: IServerTransport;
-      const ATransportFactory : ITransportFactory
+      const aProcessor :IProcessor;
+      const aServerTransport: IServerTransport;
+      const aTransportFactory : ITransportFactory
       ); overload;
 
     constructor Create(
-      const AProcessor :IProcessor;
-      const AServerTransport: IServerTransport;
-      const ATransportFactory : ITransportFactory;
-      const AProtocolFactory : IProtocolFactory
+      const aProcessor :IProcessor;
+      const aServerTransport: IServerTransport;
+      const aTransportFactory : ITransportFactory;
+      const aProtocolFactory : IProtocolFactory
       ); overload;
   end;
 
+
   TSimpleServer = class( TServerImpl)
-  private
+  strict private
     FStop : Boolean;
   public
-    constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport); overload;
-    constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
-      ALogDel: TServerImpl.TLogDelegate); overload;
-    constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
-      const ATransportFactory: ITransportFactory); overload;
-    constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
-      const ATransportFactory: ITransportFactory; const AProtocolFactory: IProtocolFactory); overload;
+    constructor Create(
+      const aProcessor: IProcessor;
+      const aServerTransport: IServerTransport
+      ); overload;
+
+    constructor Create(
+      const aProcessor: IProcessor;
+      const aServerTransport: IServerTransport;
+      const ALogDel: TServerImpl.TLogDelegate
+      ); overload;
+
+    constructor Create(
+      const aProcessor: IProcessor;
+      const aServerTransport: IServerTransport;
+      const aTransportFactory: ITransportFactory
+      ); overload;
+
+    constructor Create(
+      const aProcessor: IProcessor;
+      const aServerTransport: IServerTransport;
+      const aTransportFactory: ITransportFactory;
+      const aProtocolFactory: IProtocolFactory
+      ); overload;
 
     procedure Serve; override;
     procedure Stop; override;
@@ -135,8 +152,9 @@
 
 { TServerImpl }
 
-constructor TServerImpl.Create( const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport; const ALogDelegate: TLogDelegate);
+constructor TServerImpl.Create( const aProcessor: IProcessor;
+                                const aServerTransport: IServerTransport;
+                                const aLogDelegate: TLogDelegate);
 var
   InputFactory, OutputFactory : IProtocolFactory;
   InputTransFactory, OutputTransFactory : ITransportFactory;
@@ -149,8 +167,8 @@
 
   //no inherited;
   Create(
-    AProcessor,
-    AServerTransport,
+    aProcessor,
+    aServerTransport,
     InputTransFactory,
     OutputTransFactory,
     InputFactory,
@@ -159,8 +177,8 @@
   );
 end;
 
-constructor TServerImpl.Create(const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport);
+constructor TServerImpl.Create(const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport);
 var
   InputFactory, OutputFactory : IProtocolFactory;
   InputTransFactory, OutputTransFactory : ITransportFactory;
@@ -173,8 +191,8 @@
 
   //no inherited;
   Create(
-    AProcessor,
-    AServerTransport,
+    aProcessor,
+    aServerTransport,
     InputTransFactory,
     OutputTransFactory,
     InputFactory,
@@ -183,8 +201,8 @@
   );
 end;
 
-constructor TServerImpl.Create(const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory);
+constructor TServerImpl.Create(const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport; const aTransportFactory: ITransportFactory);
 var
   InputProtocolFactory : IProtocolFactory;
   OutputProtocolFactory : IProtocolFactory;
@@ -193,24 +211,24 @@
   OutputProtocolFactory := TBinaryProtocolImpl.TFactory.Create;
 
   //no inherited;
-  Create( AProcessor, AServerTransport, ATransportFactory, ATransportFactory,
+  Create( aProcessor, aServerTransport, aTransportFactory, aTransportFactory,
     InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
 end;
 
-constructor TServerImpl.Create(const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport;
-  const AInputTransportFactory, AOutputTransportFactory: ITransportFactory;
-  const AInputProtocolFactory, AOutputProtocolFactory: IProtocolFactory;
-  const ALogDelegate : TLogDelegate);
+constructor TServerImpl.Create(const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport;
+  const aInputTransportFactory, aOutputTransportFactory: ITransportFactory;
+  const aInputProtocolFactory, aOutputProtocolFactory: IProtocolFactory;
+  const aLogDelegate : TLogDelegate);
 begin
   inherited Create;
-  FProcessor := AProcessor;
-  FServerTransport := AServerTransport;
-  FInputTransportFactory := AInputTransportFactory;
-  FOutputTransportFactory := AOutputTransportFactory;
-  FInputProtocolFactory := AInputProtocolFactory;
-  FOutputProtocolFactory := AOutputProtocolFactory;
-  FLogDelegate := ALogDelegate;
+  FProcessor := aProcessor;
+  FServerTransport := aServerTransport;
+  FInputTransportFactory := aInputTransportFactory;
+  FOutputTransportFactory := aOutputTransportFactory;
+  FInputProtocolFactory := aInputProtocolFactory;
+  FOutputProtocolFactory := aOutputProtocolFactory;
+  FLogDelegate := aLogDelegate;
 end;
 
 class procedure TServerImpl.DefaultLogDelegate( const str: string);
@@ -223,14 +241,14 @@
   end;
 end;
 
-constructor TServerImpl.Create( const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
-  const AProtocolFactory: IProtocolFactory);
+constructor TServerImpl.Create( const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport; const aTransportFactory: ITransportFactory;
+  const aProtocolFactory: IProtocolFactory);
 begin
   //no inherited;
-  Create( AProcessor, AServerTransport,
-          ATransportFactory, ATransportFactory,
-          AProtocolFactory, AProtocolFactory,
+  Create( aProcessor, aServerTransport,
+          aTransportFactory, aTransportFactory,
+          aProtocolFactory, aProtocolFactory,
           DefaultLogDelegate);
 end;
 
@@ -250,8 +268,8 @@
 
 { TSimpleServer }
 
-constructor TSimpleServer.Create( const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport);
+constructor TSimpleServer.Create( const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport);
 var
   InputProtocolFactory : IProtocolFactory;
   OutputProtocolFactory : IProtocolFactory;
@@ -263,12 +281,12 @@
   InputTransportFactory := TTransportFactoryImpl.Create;
   OutputTransportFactory := TTransportFactoryImpl.Create;
 
-  inherited Create( AProcessor, AServerTransport, InputTransportFactory,
+  inherited Create( aProcessor, aServerTransport, InputTransportFactory,
     OutputTransportFactory, InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
 end;
 
-constructor TSimpleServer.Create( const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport; ALogDel: TServerImpl.TLogDelegate);
+constructor TSimpleServer.Create( const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport; const ALogDel: TServerImpl.TLogDelegate);
 var
   InputProtocolFactory : IProtocolFactory;
   OutputProtocolFactory : IProtocolFactory;
@@ -280,23 +298,23 @@
   InputTransportFactory := TTransportFactoryImpl.Create;
   OutputTransportFactory := TTransportFactoryImpl.Create;
 
-  inherited Create( AProcessor, AServerTransport, InputTransportFactory,
+  inherited Create( aProcessor, aServerTransport, InputTransportFactory,
     OutputTransportFactory, InputProtocolFactory, OutputProtocolFactory, ALogDel);
 end;
 
-constructor TSimpleServer.Create( const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory);
+constructor TSimpleServer.Create( const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport; const aTransportFactory: ITransportFactory);
 begin
-  inherited Create( AProcessor, AServerTransport, ATransportFactory,
-    ATransportFactory, TBinaryProtocolImpl.TFactory.Create, TBinaryProtocolImpl.TFactory.Create, DefaultLogDelegate);
+  inherited Create( aProcessor, aServerTransport, aTransportFactory,
+    aTransportFactory, TBinaryProtocolImpl.TFactory.Create, TBinaryProtocolImpl.TFactory.Create, DefaultLogDelegate);
 end;
 
-constructor TSimpleServer.Create( const AProcessor: IProcessor;
-  const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
-  const AProtocolFactory: IProtocolFactory);
+constructor TSimpleServer.Create( const aProcessor: IProcessor;
+  const aServerTransport: IServerTransport; const aTransportFactory: ITransportFactory;
+  const aProtocolFactory: IProtocolFactory);
 begin
-  inherited Create( AProcessor, AServerTransport, ATransportFactory,
-    ATransportFactory, AProtocolFactory, AProtocolFactory, DefaultLogDelegate);
+  inherited Create( aProcessor, aServerTransport, aTransportFactory,
+    aTransportFactory, aProtocolFactory, aProtocolFactory, DefaultLogDelegate);
 end;
 
 procedure TSimpleServer.Serve;
diff --git a/lib/delphi/src/Thrift.Socket.pas b/lib/delphi/src/Thrift.Socket.pas
index f0cab79..b33f202 100644
--- a/lib/delphi/src/Thrift.Socket.pas
+++ b/lib/delphi/src/Thrift.Socket.pas
@@ -81,7 +81,7 @@
   TScopeId = record
   public
     Value: ULONG;
-  private
+  strict private
     function GetBitField(Loc: Integer): Integer; inline;
     procedure SetBitField(Loc: Integer; const aValue: Integer); inline;
   public
@@ -125,7 +125,7 @@
   ISmartPointer<T> = reference to function: T;
 
   TSmartPointer<T> = class(TInterfacedObject, ISmartPointer<T>)
-  private
+  strict private
     FValue: T;
     FDestroyer: TSmartPointerDestroyer<T>;
   public
@@ -147,7 +147,7 @@
     class constructor Create;
     class destructor Destroy;
     class procedure DefaultLogDelegate(const Str: string);
-  protected type
+  strict protected type
     IGetAddrInfoWrapper = interface
       function Init: Integer;
       function GetRes: PAddrInfoW;
diff --git a/lib/delphi/src/Thrift.Stream.pas b/lib/delphi/src/Thrift.Stream.pas
index 3308c53..7cb9219 100644
--- a/lib/delphi/src/Thrift.Stream.pas
+++ b/lib/delphi/src/Thrift.Stream.pas
@@ -36,7 +36,6 @@
   Thrift.Utils;
 
 type
-
   IThriftStream = interface
     ['{2A77D916-7446-46C1-8545-0AEC0008DBCA}']
     procedure Write( const buffer: TBytes; offset: Integer; count: Integer);  overload;
@@ -51,9 +50,9 @@
   end;
 
   TThriftStreamImpl = class( TInterfacedObject, IThriftStream)
-  private
+  strict private
     procedure CheckSizeAndOffset( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer);  overload;
-  protected
+  strict protected
     procedure Write( const buffer: TBytes; offset: Integer; count: Integer); overload; inline;
     procedure Write( const pBuf : Pointer; offset: Integer; count: Integer);  overload; virtual;
     function Read( var buffer: TBytes; offset: Integer; count: Integer): Integer; overload; inline;
@@ -66,10 +65,10 @@
   end;
 
   TThriftStreamAdapterDelphi = class( TThriftStreamImpl )
-  private
+  strict private
     FStream : TStream;
     FOwnsStream : Boolean;
-  protected
+  strict protected
     procedure Write( const pBuf : Pointer; offset: Integer; count: Integer); override;
     function Read( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer; override;
     procedure Open; override;
@@ -83,9 +82,9 @@
   end;
 
   TThriftStreamAdapterCOM = class( TThriftStreamImpl)
-  private
+  strict private
     FStream : IStream;
-  protected
+  strict protected
     procedure Write( const pBuf : Pointer; offset: Integer; count: Integer); override;
     function Read( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer; override;
     procedure Open; override;
diff --git a/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas b/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas
index c666e7f..87bf23b 100644
--- a/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas
+++ b/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas
@@ -41,7 +41,7 @@
 
 type
   TMsxmlHTTPClientImpl = class( TTransportImpl, IHTTPClient)
-  private
+  strict private
     FUri : string;
     FInputStream : IThriftStream;
     FOutputStream : IThriftStream;
@@ -52,7 +52,7 @@
     FCustomHeaders : IThriftDictionary<string,string>;
 
     function CreateRequest: IXMLHTTPRequest;
-  protected
+  strict protected
     function GetIsOpen: Boolean; override;
     procedure Open(); override;
     procedure Close(); override;
diff --git a/lib/delphi/src/Thrift.Transport.Pipes.pas b/lib/delphi/src/Thrift.Transport.Pipes.pas
index 77a343b..9368f2f 100644
--- a/lib/delphi/src/Thrift.Transport.Pipes.pas
+++ b/lib/delphi/src/Thrift.Transport.Pipes.pas
@@ -199,7 +199,7 @@
     FClientAnonWrite  : THandle;
 
     FTimeOut: DWORD;
-  protected
+  strict protected
     function Accept(const fnAccepting: TProc): ITransport; override;
 
     function CreateAnonPipe : Boolean;
diff --git a/lib/delphi/src/Thrift.Transport.WinHTTP.pas b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
index 262e38f..0bf7e45 100644
--- a/lib/delphi/src/Thrift.Transport.WinHTTP.pas
+++ b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
@@ -37,7 +37,7 @@
 
 type
   TWinHTTPClientImpl = class( TTransportImpl, IHTTPClient)
-  private
+  strict private
     FUri : string;
     FInputStream : IThriftStream;
     FOutputMemoryStream : TMemoryStream;
@@ -51,14 +51,14 @@
     function CreateRequest: IWinHTTPRequest;
     function SecureProtocolsAsWinHTTPFlags : Cardinal;
 
-  private
+  strict private
     type
       TErrorInfo = ( SplitUrl, WinHTTPSession, WinHTTPConnection, WinHTTPRequest, RequestSetup, AutoProxy );
 
       THTTPResponseStream = class( TThriftStreamImpl)
-      private
+      strict private
         FRequest : IWinHTTPRequest;
-      protected
+      strict protected
         procedure Write( const pBuf : Pointer; offset: Integer; count: Integer); override;
         function Read( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer; override;
         procedure Open; override;
@@ -71,7 +71,7 @@
         destructor Destroy; override;
       end;
 
-  protected
+  strict protected
     function GetIsOpen: Boolean; override;
     procedure Open(); override;
     procedure Close(); override;
diff --git a/lib/delphi/src/Thrift.Transport.pas b/lib/delphi/src/Thrift.Transport.pas
index df087a1..b6e3c99 100644
--- a/lib/delphi/src/Thrift.Transport.pas
+++ b/lib/delphi/src/Thrift.Transport.pas
@@ -64,7 +64,7 @@
   end;
 
   TTransportImpl = class( TInterfacedObject, ITransport)
-  protected
+  strict protected
     function GetIsOpen: Boolean; virtual; abstract;
     property IsOpen: Boolean read GetIsOpen;
     function Peek: Boolean; virtual;
@@ -93,7 +93,7 @@
         BadArgs,
         Interrupted
       );
-  protected
+  strict protected
     constructor HiddenCreate(const Msg: string);
     class function GetType: TExceptionType;  virtual; abstract;
   public
@@ -110,37 +110,37 @@
   end;
 
   TTransportExceptionUnknown = class (TTransportExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TTransportException.TExceptionType;  override;
   end;
 
   TTransportExceptionNotOpen = class (TTransportExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TTransportException.TExceptionType;  override;
   end;
 
   TTransportExceptionAlreadyOpen = class (TTransportExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TTransportException.TExceptionType;  override;
   end;
 
   TTransportExceptionTimedOut = class (TTransportExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TTransportException.TExceptionType;  override;
   end;
 
   TTransportExceptionEndOfFile = class (TTransportExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TTransportException.TExceptionType;  override;
   end;
 
   TTransportExceptionBadArgs = class (TTransportExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TTransportException.TExceptionType;  override;
   end;
 
   TTransportExceptionInterrupted = class (TTransportExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TTransportException.TExceptionType;  override;
   end;
 
@@ -182,7 +182,7 @@
   end;
 
   TServerTransportImpl = class( TInterfacedObject, IServerTransport)
-  protected
+  strict protected
     procedure Listen; virtual; abstract;
     procedure Close; virtual; abstract;
     function Accept( const fnAccepting: TProc): ITransport;  virtual; abstract;
@@ -199,9 +199,9 @@
 
   TTcpSocketStreamImpl = class( TThriftStreamImpl )
 {$IFDEF OLD_SOCKETS}
-  private type
+  strict private type
     TWaitForData = ( wfd_HaveData, wfd_Timeout, wfd_Error);
-  private
+  strict private
     FTcpClient : TCustomIpClient;
     FTimeout : Integer;
     function Select( ReadReady, WriteReady, ExceptFlag: PBoolean;
@@ -210,10 +210,10 @@
                           var wsaError, bytesReady : Integer): TWaitForData;
 {$ELSE}
     FTcpClient: TSocket;
-  protected const
+  strict protected const
     SLEEP_TIME = 200;
 {$ENDIF}
-  protected
+  strict protected
     procedure Write( const pBuf : Pointer; offset, count: Integer); override;
     function Read( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer; override;
     procedure Open; override;
@@ -239,10 +239,10 @@
   end;
 
   TStreamTransportImpl = class( TTransportImpl, IStreamTransport)
-  protected
+  strict protected
     FInputStream : IThriftStream;
     FOutputStream : IThriftStream;
-  protected
+  strict protected
     function GetIsOpen: Boolean; override;
 
     function GetInputStream: IThriftStream;
@@ -261,12 +261,12 @@
   end;
 
   TBufferedStreamImpl = class( TThriftStreamImpl)
-  private
+  strict private
     FStream : IThriftStream;
     FBufSize : Integer;
     FReadBuffer : TMemoryStream;
     FWriteBuffer : TMemoryStream;
-  protected
+  strict protected
     procedure Write( const pBuf : Pointer; offset: Integer; count: Integer); override;
     function Read( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer; override;
     procedure Open;  override;
@@ -280,7 +280,7 @@
   end;
 
   TServerSocketImpl = class( TServerTransportImpl)
-  private
+  strict private
 {$IFDEF OLD_SOCKETS}
     FServer : TTcpServer;
     FPort : Integer;
@@ -290,7 +290,7 @@
 {$ENDIF}
     FUseBufferedSocket : Boolean;
     FOwnsServer : Boolean;
-  protected
+  strict protected
     function Accept( const fnAccepting: TProc) : ITransport; override;
   public
 {$IFDEF OLD_SOCKETS}
@@ -306,7 +306,7 @@
   end;
 
   TBufferedTransportImpl = class( TTransportImpl )
-  private
+  strict private
     FInputBuffer : IThriftStream;
     FOutputBuffer : IThriftStream;
     FTransport : IStreamTransport;
@@ -314,7 +314,7 @@
 
     procedure InitBuffers;
     function GetUnderlyingTransport: ITransport;
-  protected
+  strict protected
     function GetIsOpen: Boolean; override;
     procedure Flush; override;
   public
@@ -329,7 +329,7 @@
   end;
 
   TSocketImpl = class(TStreamTransportImpl)
-  private
+  strict private
 {$IFDEF OLD_SOCKETS}
     FClient : TCustomIpClient;
 {$ELSE}
@@ -345,7 +345,7 @@
 {$ENDIF}
 
     procedure InitSocket;
-  protected
+  strict protected
     function GetIsOpen: Boolean; override;
   public
     procedure Open; override;
@@ -368,11 +368,11 @@
   end;
 
   TFramedTransportImpl = class( TTransportImpl)
-  private const
+  strict private const
     FHeaderSize : Integer = 4;
-  private class var
+  strict private class var
     FHeader_Dummy : array of Byte;
-  protected
+  strict protected
     FTransport : ITransport;
     FWriteBuffer : TMemoryStream;
     FReadBuffer : TMemoryStream;
diff --git a/lib/delphi/src/Thrift.TypeRegistry.pas b/lib/delphi/src/Thrift.TypeRegistry.pas
index c18e97f..3d31c52 100644
--- a/lib/delphi/src/Thrift.TypeRegistry.pas
+++ b/lib/delphi/src/Thrift.TypeRegistry.pas
@@ -29,7 +29,7 @@
   TFactoryMethod<T> = function:T;
 
   TypeRegistry = class
-  private
+  strict private
     class var FTypeInfoToFactoryLookup : TDictionary<Pointer, Pointer>;
   public
     class constructor Create;
diff --git a/lib/delphi/src/Thrift.pas b/lib/delphi/src/Thrift.pas
index abc0c1e..716e4d2 100644
--- a/lib/delphi/src/Thrift.pas
+++ b/lib/delphi/src/Thrift.pas
@@ -52,7 +52,7 @@
         UnsupportedClientType
       );
 {$SCOPEDENUMS OFF}
-  protected
+  strict protected
     constructor HiddenCreate(const Msg: string);
     class function GetType: TExceptionType;  virtual; abstract;
     class function GetSpecializedExceptionType(AType: TExceptionType): TApplicationExceptionSpecializedClass;
@@ -76,57 +76,57 @@
   end;
 
   TApplicationExceptionUnknown = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionUnknownMethod = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionInvalidMessageType = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionWrongMethodName = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionBadSequenceID = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionMissingResult = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionInternalError = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionProtocolError = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionInvalidTransform = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionInvalidProtocol = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
   TApplicationExceptionUnsupportedClientType = class (TApplicationExceptionSpecialized)
-  protected
+  strict protected
     class function GetType: TApplicationException.TExceptionType;  override;
   end;
 
diff --git a/lib/delphi/test/serializer/TestSerializer.dpr b/lib/delphi/test/serializer/TestSerializer.dpr
index 56d0d15..39752cf 100644
--- a/lib/delphi/test/serializer/TestSerializer.dpr
+++ b/lib/delphi/test/serializer/TestSerializer.dpr
@@ -22,7 +22,10 @@
 {$APPTYPE CONSOLE}
 
 uses
-  Classes, Windows, SysUtils, Generics.Collections,
+  Classes,
+  Windows,
+  SysUtils,
+  Generics.Collections,
   Thrift in '..\..\src\Thrift.pas',
   Thrift.Exception in '..\..\src\Thrift.Exception.pas',
   Thrift.Socket in '..\..\src\Thrift.Socket.pas',
@@ -41,8 +44,6 @@
   DebugProtoTest,
   TestSerializer.Data;
 
-
-
 type
   TTestSerializer = class //extends TestCase {
   private type