Skip to content

Commit

Permalink
[Mono.Android] Bind java.time and java.time.chrono packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpobst committed Aug 10, 2023
1 parent 06224f3 commit 9f42b8e
Show file tree
Hide file tree
Showing 7 changed files with 1,544 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/Mono.Android/Java.Time.Chrono/AbstractChronology.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#if ANDROID_26
using System;
using Android.Runtime;
using Java.Time.Chrono;

namespace Java.Time.Chrono
{
public abstract partial class AbstractChronology
{
public int CompareTo (Java.Lang.Object obj) => CompareTo (obj.JavaCast<IChronology> ());
}
}
#endif

14 changes: 14 additions & 0 deletions src/Mono.Android/Java.Time/LocalDate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#if ANDROID_26
using System;
using Android.Runtime;
using Java.Time.Chrono;

namespace Java.Time
{
public sealed partial class LocalDate
{
public int CompareTo (Java.Lang.Object obj) => CompareTo (obj.JavaCast<IChronoLocalDate> ());
}
}
#endif

14 changes: 14 additions & 0 deletions src/Mono.Android/Java.Time/LocalDateTime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#if ANDROID_26
using System;
using Android.Runtime;
using Java.Time.Chrono;

namespace Java.Time
{
public sealed partial class LocalDateTime
{
public int CompareTo (Java.Lang.Object obj) => CompareTo (obj.JavaCast<IChronoLocalDateTime> ());
}
}
#endif

14 changes: 14 additions & 0 deletions src/Mono.Android/Java.Time/ZonedDateTime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#if ANDROID_26
using System;
using Android.Runtime;
using Java.Time.Chrono;

namespace Java.Time
{
public sealed partial class ZonedDateTime
{
public int CompareTo (Java.Lang.Object obj) => (this as IChronoZonedDateTime).CompareTo (obj.JavaCast<IChronoZonedDateTime> ());
}
}
#endif

4 changes: 4 additions & 0 deletions src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
<Compile Include="Android.Telecom\InCallService.cs" />
<Compile Include="Android.Views\WindowManagerLayoutParams.cs" />
<Compile Include="Java.Lang.Invoke\MethodType.cs" />
<Compile Include="Java.Time.Chrono\AbstractChronology.cs" />
<Compile Include="Java.Time\ZonedDateTime.cs" />
<Compile Include="Java.Time\LocalDateTime.cs" />
<Compile Include="Java.Time\LocalDate.cs" />
</ItemGroup>

<Import Project="..\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems" Label="Shared" Condition="Exists('..\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems')" />
Expand Down
1,418 changes: 1,418 additions & 0 deletions src/Mono.Android/PublicAPI/API-34/PublicAPI.Unshipped.txt

Large diffs are not rendered by default.

69 changes: 66 additions & 3 deletions src/Mono.Android/metadata
Original file line number Diff line number Diff line change
Expand Up @@ -1337,9 +1337,72 @@
(It's all Xamarin's fault to have introduced enumification, after all. -->
<attr path="/api/package[@name='android.media']/class[@name='AudioFocusRequest']" name="managedName" api-since="26">AudioFocusRequestClass</attr>

<!-- FIXME: fix build and enable these packages -->
<remove-node path="/api/package[@name='java.time']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']" api-since="26" />
<!-- Lots of covariant and override fixes needed to get these classes to build -->
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='HijrahChronology']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='HijrahDate']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='JapaneseChronology']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='JapaneseDate']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='MinguoChronology']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='MinguoDate']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='ThaiBuddhistChronology']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']/class[@name='ThaiBuddhistDate']" api-since="26" />

<!-- java.time types make heavy use of covariant return types that require extensive fixing -->
<attr path="/api/package[@name='java.time']/class[@name='Instant']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='Instant']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='LocalDate']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='LocalDate']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='LocalDateTime']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='LocalDateTime']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='LocalTime']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='LocalTime']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='OffsetDateTime']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='OffsetDateTime']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='OffsetTime']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='OffsetTime']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='Year']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='Year']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='YearMonth']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='YearMonth']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='ZonedDateTime']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time']/class[@name='ZonedDateTime']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>

<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDate']/method[@name='minus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDate']/method[@name='minus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDate']/method[@name='plus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDate']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDate']/method[@name='with' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAdjuster']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDate']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>

<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDateTime']/method[@name='minus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDateTime']/method[@name='minus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDateTime']/method[@name='plus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDateTime']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDateTime']/method[@name='with' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAdjuster']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoLocalDateTime']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>

<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoZonedDateTime']/method[@name='minus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoZonedDateTime']/method[@name='minus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoZonedDateTime']/method[@name='plus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoZonedDateTime']/method[@name='plus' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='java.time.temporal.TemporalUnit']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoZonedDateTime']/method[@name='with' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAdjuster']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>
<attr path="/api/package[@name='java.time.chrono']/interface[@name='ChronoZonedDateTime']/method[@name='with' and count(parameter)=2 and parameter[1][@type='java.time.temporal.TemporalField'] and parameter[2][@type='long']]" name="managedReturn" api-since="26">Java.Time.Temporal.ITemporal</attr>

<attr path="/api/package[@name='java.time.chrono']/class[@name='IsoChronology']/method[@name='dateEpochDay' and count(parameter)=1 and parameter[1][@type='long']]" name="managedOverride" api-since="26">override</attr>
<attr path="/api/package[@name='java.time.chrono']/class[@name='IsoChronology']/method[@name='dateYearDay' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='int']]" name="managedOverride" api-since="26">override</attr>
<attr path="/api/package[@name='java.time.chrono']/class[@name='IsoChronology']/method[@name='eraOf' and count(parameter)=1 and parameter[1][@type='int']]" name="managedOverride" api-since="26">override</attr>
<attr path="/api/package[@name='java.time.chrono']/class[@name='IsoChronology']/method[@name='date' and count(parameter)=3 and parameter[1][@type='int'] and parameter[2][@type='int'] and parameter[3][@type='int']]" name="managedOverride" api-since="26">override</attr>
<attr path="/api/package[@name='java.time.chrono']/class[@name='IsoChronology']/method[@name='date' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAccessor']]" name="managedOverride" api-since="26">override</attr>
<attr path="/api/package[@name='java.time.chrono']/class[@name='IsoChronology']/method[@name='epochSecond' and count(parameter)=7 and parameter[1][@type='int'] and parameter[2][@type='int'] and parameter[3][@type='int'] and parameter[4][@type='int'] and parameter[5][@type='int'] and parameter[6][@type='int'] and parameter[7][@type='java.time.ZoneOffset']]" name="managedOverride" api-since="34">none</attr>

<attr path="/api/package[@name='java.time']/class[@name='LocalDate']/method[@name='getChronology' and count(parameter)=0]" name="managedReturn" api-since="26">Java.Time.Chrono.IChronology</attr>
<attr path="/api/package[@name='java.time']/class[@name='LocalDate']/method[@name='until' and count(parameter)=1 and parameter[1][@type='java.time.chrono.ChronoLocalDate']]" name="managedReturn" api-since="26">Java.Time.Chrono.IChronoPeriod</attr>

<attr path="/api/package[@name='java.time']/class[@name='Period']/method[@name='getChronology' and count(parameter)=0]" name="managedReturn" api-since="26">Java.Time.Chrono.IChronology</attr>
<attr path="/api/package[@name='java.time']/class[@name='Period']/method[@name='minus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Chrono.IChronoPeriod</attr>
<attr path="/api/package[@name='java.time']/class[@name='Period']/method[@name='multipliedBy' and count(parameter)=1 and parameter[1][@type='int']]" name="managedReturn" api-since="26">Java.Time.Chrono.IChronoPeriod</attr>
<attr path="/api/package[@name='java.time']/class[@name='Period']/method[@name='normalized' and count(parameter)=0]" name="managedReturn" api-since="26">Java.Time.Chrono.IChronoPeriod</attr>
<attr path="/api/package[@name='java.time']/class[@name='Period']/method[@name='plus' and count(parameter)=1 and parameter[1][@type='java.time.temporal.TemporalAmount']]" name="managedReturn" api-since="26">Java.Time.Chrono.IChronoPeriod</attr>

<!-- FIXME: fix build and enable this method -->
<remove-node path="/api/package[@name='android.text']/class[@name='TextUtils']/method[@name='listEllipsize']" api-since="26" />
Expand Down

0 comments on commit 9f42b8e

Please sign in to comment.