How to declare in Oxy method from Java interface properly

I have to declare and implement method for interface from java but I don’t know how to declare it properly in Oxy…
Oxidzier doesn’t work properly too… :slight_smile:

public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth)

I have a problem with List<? extends WeekViewEvent> ??

Best regards
Mateusz

I’m tot TOO familiar with java syntax but assuming this is a generic constraint, you probably want something like

method onMonthChange<T>(newYear: Integer; newMonth: Integer): List<T>; where T is WeekViewEvent

Hello Mark,
It doesn’t work.
I used gradle to import library : https://github.com/alamkanak/Android-Week-View.
I have to implement this interface to load data but I don’t how to declare it properly , I tried few but wihout success :frowning:

public interface MonthChangeListener
{
List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth);
}

Mateusz

So i can look at the quickly, can you either send me the .jar or the exact Gradle reference entry you are using? Or maybe even the entire project, if feasible, so i have a test bed already…

thanx,
marc

It is a reference :
compile ‘com.github.alamkanak:android-week-view:1.2.6’

thanks
Mateusz

ok, so in general this does compile:

  MainActivity = public class(Activity)
  public
    method onCreate(savedInstanceState: Bundle); override;
    
    method onMonthChange<T>(newYear: Integer; newMonth: Integer): List<T>; where T is WeekViewEvent;
    begin
    end;
  end;

but i need to know what interface you are trying to match, to see why t might mismatch. whats the interface name?

public interface MonthChangeListener

Got it. yeah, this does seem to be a compiler bug/limitation. unfortunately the error messages the wrong syntax as well — it may well be that we just don’t support this in Oxygene yet, at all :frowning:

i’ll need to log a bug for Carlo, but unfortunately he’s off the next two days.

possible workaround: make your class partial, add a second part using the Java language (which we now support in 9.0, experimentally) to implement this… Let me see if i can whoop up a sample for you quick.

If You can please give me some simple example :slight_smile:

This one compiles (in latest 9.1 beta, but should also be fine in 9.0):

com.remobjects.androidapplication19 2.zip (34.7 KB)

Thanks, logged as bugs://77355

Thank you Marc you are my GURU !!

1 Like

One is always glad to be of service. :slight_smile:

bugs://77355 got closed with status fixed.

This will be:

method onMonthChange(newYear: Integer; newMonth: Integer): List<WeekViewEvent>; 
    begin
    end;

In the next build.

Great!
Thank you !!

Logged as bugs://i65079.

bugs://i65079 was closed as fixed.