TMS FixInsight 2019.11

  

I'm happy to announce FixInsight 2019.11 release

What's New

* New : Rule W531 Actual parameter of FreeAndNil() must be a reference to class instance
* New : Rule W534 Class instance passed but interface expected
* Fixed : FixInsight hangs in some cases when running W525
* Fixed : File specified in {$INCLUDE} directive cannot be found in some cases
* Fixed : Access Violation on IDE start
* Fixed : “Load Defaults” button in Settings dialog doesn't restore general settings
* Fixed : Several parser issues

I'll add few more words about new features.

Rule W531 ensures that the parameter of FreeAndNil() is be a reference to a class instance. Due to FreeAndNil() implementation details, compiler is not able to check its parameter type.

This compiles, but this is wrong:

var
Intf: IInterface;
begin
FreeAndNil(Intf);
end;

Rule W534 ensures that a class instance is not passed when an interface is expected. This may compile, but due to reference counting a class can be released right after such method call.

Example:

type
ISomeInterface = interface
['{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}']
end;

TSomeClass = class(TInterfacedObject, ISomeInterface)
end;

procedure DoSomethingWithSomeInterface(const SomeInterface: ISomeInterface);
begin
// …
end;

procedure DoSomethingWithSomeClass;
var
SomeClass: TSomeClass;
begin
SomeClass := TSomeClass.Create;
try
DoSomethingWithSomeInterface(SomeClass); // <= W534
// After this call SomeClass will be released due to reference counting
finally
SomeClass.Free; // cannot be released twice
end;
end;

Also there are new parameters for command line tool. In this release FixInsight needs to know more about your project.

FixInsightCL –project=c:\source\example.dpr
–libpath=”C:\Program Files (x86)\Embarcadero\Studio\20.0\source”
–unitscopes=Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;System;Xml;Data;Datasnap;Web;Soap
–libpath should point to your Delphi source folder. And I suggest to copy values for –unitscopes and –unitaliases parameters from your project options.

Comments are closed.