The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,482 other followers

Delphi: “Override method %s.%s should match case of ancestor %s.%s (H2365)”

Posted by jpluimers on 2019/12/17

If you write consistent code, you will never see [WayBackOverride method %s.%s should match case of ancestor %s.%s (H2365), but a long while ago I bumped into a project where some the developers had trouble using their shift key and failed to use code completion in quite a few parts of the source code.

So next a lot of lines containing things like Begin, whIle, repeaT, wrong indentations (not just at the wrong level, but even getting things indented at the same level wrong).

Code formatted like this was no exception, not even for methods bound to events:

procedure  TForm1.Button1CLick(SendeR  : TOBJect ) ;
  Button2Click  (Sender );

You cannot disable this hint individually as it is not on the list at [WayBack] Delphi XE2’s hidden hints and warnings options | Marc Durdin’s Blog, so you either have to fix the code (which I prefer), or disable all hints with {$ HINTS OFF} as per [WayBackcompiler construction – Can specific Delphi hints be disabled? – Stack Overflow (thanks Lars Truijens).

The above occasion was the first and only time I saw the hint H2365 until recently when I again bumped into a project that had grown over a long time needing some maintenance.

This reminded me I should have blogged about it, found back [] H2365 Override method %s.%s should match case of ancestor %s.%s (Delphi) Today was the first time I have ever seen this compiler hint. Why does Delphi… – Graeme Geldenhuys – Google+ and dug a bit deeper.

TheH2365 was – until [Archive.isH2365 … – RAD Studio XE3 – documented as “No further information is available for this error or warning.” which luckily changed with in [] H2365 …  – RAD Studio XE4 got documented starting with the quotes below.

It still doesn’t explain the origin of the hint, but luckily there is [WayBack] compiler construction – It seems that sometimes Delphi is case-sensitive – override method should match case of ancestor – Stack Overflow:

  • It’s a hint that’s in place to protect your code when cooperating with 3rd party code.
    This hint was introduced with the addition of Delphi for .net, because some other .net platforms are case-sensitive.

It is complements to my initial thoughts on which case sensitivity topics are related to the hint:

  • case sensitivity was introduced for unit names that for a while now must match the filenames
  • some Windows API functions are case sensitive
  • some .NET languages are case sensitive, so .NET or COM interop could be related (I’m not sure if there is case sensitivity there: too long ago I did tat)
  • the infamous “Register” procedure for component registration is case sensitive

From the documentation:

H2365 Override method %s.%s should match case of ancestor %s.%s (Delphi)

When overriding a method, the best practice is to match the case of the ancestor method. This prevents any downstream failure that would not be anticipated by a Delphi user, who expects case-insensitivity.


Hint H2365 is emitted in the following case:

  TClass1 = class
    procedure VirtualMethod; virtual; abstract;
  TClass2 = class(TClass1)
    procedure virtualmethod; override; 
procedure TClass2.virtualmethod;

Here are some situations in which Delphi is case-sensitive:

It then goes on explaining a few places where Delphi is case-sensitive, but fails to explain why the hint is actually important.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: