Java compiler internal error in .2351

This code fails in latest stable release, previous build .2347 works fine :

namespace consoleapplication11;

uses
  java.util;

type

T_GetLocalizedString = public procedure( var   _original : String;
                                            const _key      : String
                                          ) of object ;

T_Test = public class
public
  procedure test ( var   _original : String;
                   const _key      : String
                 ) ;
  begin
    writeLn('test');
  end ;

  procedure GisLocalizedStrings( const _fn : T_GetLocalizedString
                               ) ;
  begin
    var orig : String ;
    _fn( var orig, 'key') ;
  end ;

  procedure TestCall ;
  begin
    var orig : String ;
    CallTest( var orig, 'key') ;
  end ;

  property CallTest : T_GetLocalizedString ;
end ;

type
  Program = class
  public
    class method Main(args: array of String): Int32;
    begin
      var o := new T_Test ;

      o.CallTest := @o.test ;
      o.GisLocalizedStrings( @o.test ) ;
      o.TestCall;
    end;
  end;
end.

Seems to be a problem with assigning block method to property/event via @ operator. I managed to extract this example from bigger project where more such errors occur at :

  • assigning a method to property\event (vcl style)
  • passing a method to a function as parameter

Full error log :

Error (E0) Internal error: System.NullReferenceException: Object reference not set to an instance of an object.
   at RemObjects.Oxygene.Code.Compiler.Compiler.TryTurnIntoVariable(ScopeInfo aScope, Expression Value, Boolean aAssign, Boolean aAllowReadonly, Boolean aFail)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ValidateProcVarParameters(ScopeInfo aScope, IPosition Pos, MutableInvokeExpression aParams)
   at RemObjects.Oxygene.Code.Compiler.Compiler.FindBestMatch(IPosition aErrorPos, String aID, ScopeInfo aScope, BaseType aSelfType, FindBestMatchFlags aFlags, ResultList aRestList, MutableInvokeExpression aParams, Func`1 aAlternative)
   at RemObjects.Oxygene.Code.CallExpressionTransform.ResolveExpression(ScopeInfo aScope, CallExpression incall, CallMode aCM)
   at RemObjects.Oxygene.Code.Compiler.NewResolveExpressionAndStatement.VisitExpression(ScopeInfo aScope, Expression element)
   at RemObjects.Oxygene.Code.AnonymousMethodExpressionTransform.ResolveAnonymousMethod(ScopeInfo aScope, AnonymousMethodExpression anonymousMethodExpression, BaseType aFixedDelegate, IList`1 aUnresolvedMethodArguments, Boolean aSkipReset, Boolean aNoEscape)
   at RemObjects.Oxygene.Code.AnonymousMethodExpressionTransform.SelectAnonymousMethod(ScopeInfo aScope, AnonymousMethodExpression anonymousMethodExpression, BaseType aFixedDelegate, IList`1 aUnresolvedMethodArguments, Boolean aSkipReset, Boolean aNoEscape)
   at RemObjects.Oxygene.Code.AnonymousInterfaceImplementationExpressionTransform.ResolveExpression(ScopeInfo aScope, AnonymousInterfaceImplementationExpression element, Boolean aSkipReset, Boolean aNoEscape)
   at RemObjects.Oxygene.Code.AnonymousInterfaceImplementationExpressionTransform.TurnIntoSMI(ScopeInfo aScope, BaseType ParType, Expression val, Boolean aSkipReset, Boolean aNoEscape)
   at RemObjects.Oxygene.Code.Compiler.Compiler.AnonSelectCompatibleParameter(ScopeInfo aScope, BaseType SelfType, IList`1 GenPar, Argument& Par, IMethodInfo aMeth, IParamInfo B, BaseType ParType)
   at RemObjects.Oxygene.Code.Compiler.Compiler.FindBestMatch(IPosition aErrorPos, String aID, ScopeInfo aScope, BaseType aSelfType, FindBestMatchFlags aFlags, ResultList aRestList, MutableInvokeExpression aParams, Func`1 aAlternative)
   at RemObjects.Oxygene.Code.CallExpressionTransform.ResolveExpression(ScopeInfo aScope, CallExpression incall, CallMode aCM)
   at RemObjects.Oxygene.Code.Compiler.NewResolveExpressionAndStatement.VisitExpression(ScopeInfo aScope, Expression element)
   at RemObjects.Oxygene.Code.AssignmentStatementTransform.ResolveStatement(ScopeInfo aScope, AssignmentStatement assignmentStatement)
   at RemObjects.Oxygene.Code.Compiler.NewResolveExpressionAndStatement.VisitStatement(ScopeInfo aScope, Statement element)
   at RemObjects.Oxygene.Code.BeginStatementTransform.ResolveStatement(ScopeInfo aScope, BeginStatement beginStatement)
   at RemObjects.Oxygene.Code.Compiler.NewResolveExpressionAndStatement.VisitStatement(ScopeInfo aScope, Statement element)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ResolveMethodBody(ScopeInfo aScope, IMethodImplementation aMethod)
   at RemObjects.Oxygene.Code.Compiler.Compiler.<>c__DisplayClass43.<ResolveMembers>b__5(IParsedType aType)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ForAllInternalTypes(Action`1 aAt)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ResolveMembers()	consoleapplication11	Program.pas	37

Thanks, logged as bugs://81595

bugs://81595 got closed with status fixed.