Compiler error with Elements 9.x

I have the following lines of code in a android lib:

method CropImageView.init(c: Context);
begin
    mImageView := new ImageView( c );
    mImageView.setLayoutParams( new  ViewGroup.LayoutParams( -1, -1 ) );
    ...

With Elements 9.0 the lib compiles without errors.
Now with 9.1 the following error occurs:
(E319) No overloaded constructor with 3 parameters for type “ViewGroup.LayoutParams”

I don’t understand why because i set only 2 parameters ( -1, -1 ).

I tried using only one parameter:

method CropImageView.init(c: Context);
begin
    mImageView := new ImageView( c );
    mImageView.setLayoutParams( new  ViewGroup.LayoutParams( -1 ) );
    ...

In this case i have the following error:
No overloaded constructor with these parameters for type “ViewGroup.LayoutParams”, best matching overload is "constructor (width: Integer; height: Integer)"
parameter 1 is “CropImageView” should be “Integer”

???

That sounds like a bug yes.

Thanks, logged as bugs://78009

I checked with different versions, it seems the error occurs on all 9.x versions.
I tested with 9.0.97.2071, 9.1.99.2141, 9.1.99.2151 and the 9.2.0.2157 beta.
Now i downgraded to version 8.3.95.2031 and the library compiles without error.

Btw, i’m using Java 1.8.0.131 64 bit if this is important.

With fridays beta I tried this:

namespace org.me.androidapplication2;

interface

uses
  java.util,
  android.app,
  android.content,
  android.os,
  android.util,
  android.view,
  android.widget;

type
  MainActivity = public class(Activity)
  public
    method onCreate(savedInstanceState: Bundle); override;
  end;

implementation

method MainActivity.onCreate(savedInstanceState: Bundle);
begin
  inherited;

  var mImageView := new ImageView( nil );
  mImageView.setLayoutParams( new  ViewGroup.LayoutParams( -1, -1 ) );
  // Set our view from the "main" layout resource
  ContentView := R.layout.main;
end;

end.

and that works. Do you have a more complete sample I can try?

Weird.
I compiled your example with Elements 9.1 without error.

But on this code the error occurs:

namespace Test;

interface

uses
  java.util,
  android.app,
  android.content,
  android.os,
  android.util,
  android.view,
  android.widget;

type
  CropImageView = public class(FrameLayout)
  public
    constructor(c: Context);
    method init(c: Context);
  end;

implementation

constructor CropImageView(c: Context);
begin
    inherited constructor( c );
    init( c );
end;

method CropImageView.init(c: Context);
begin
    var mImageView := new ImageView( c );
    mImageView.setLayoutParams( new  ViewGroup.LayoutParams( -1, -1 ) );
end;

end.

Smallest example:

namespace Test;

interface

uses
  java.util,
  android.app,
  android.content,
  android.os,
  android.util,
  android.view,
  android.widget;

type
//  Test = public class(FrameLayout)
  Test = public class(Activity)
  public
    method init;
  end;

implementation

method Test.init;
begin
    var mImageView := new ImageView( nil );
    mImageView.setLayoutParams( new ViewGroup.LayoutParams( -1, -1 ) );
end;

end.

If class is Activity then it compiles without error.
If class is FrameLayout then the error occurs.

thanks. I’ll take a look. Pretty sure it has to do with the implicit “self” normally done for nested types (But shouldn’t happen here)

bugs://78009 got closed with status fixed.