Skip to content

Execution failure on "type of ..." declarations #361

Closed
@PatrikGuthenberg

Description

@PatrikGuthenberg

Prerequisites

  • This bug is in SonarDelphi, not SonarQube or my Delphi code.
  • This bug has not already been reported.

SonarDelphi version

1.5.0

Delphi version

12.0

SonarQube version

10.7

Issue description

Scanning Delphi code with a "type of ..." declaration causes an execution failure.

Exception:


java.lang.ClassCastException: class au.com.integradev.delphi.antlr.ast.node.CommonDelphiNodeImpl cannot be cast to class org.sonar.plugins.communitydelphi.api.ast.TypeNode (au.com.integradev.delphi.antlr.ast.node.CommonDelphiNodeImpl and org.sonar.plugins.communitydelphi.api.ast.TypeNode are in unnamed module of loader org.sonar.classloader.ClassRealm @15b642b9)
        at au.com.integradev.delphi.antlr.ast.node.TypeOfTypeNodeImpl.createType(TypeOfTypeNodeImpl.java:41)
        at au.com.integradev.delphi.antlr.ast.node.TypeNodeImpl.getType(TypeNodeImpl.java:82)
        at au.com.integradev.delphi.antlr.ast.node.TypeDeclarationNodeImpl.getType(TypeDeclarationNodeImpl.java:224)
        at au.com.integradev.delphi.symbol.declaration.TypeNameDeclarationImpl.<init>(TypeNameDeclarationImpl.java:51)
...

Steps to reproduce

All it takes is the "TTypeOfType = type of TAnyType;" declaration in the type section of a Delphi unit.

Minimal Delphi code exhibiting the issue

unit test;

interface

type

  TAnyType = record

  end;

  TTypeOfType = type of TAnyType;

implementation

end.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions