Bug 2411 - TimePicker updated field types
Summary: TimePicker updated field types
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.0
Hardware: PC Windows
: Low enhancement
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2011-12-07 23:20 UTC by Roman Kalantari
Modified: 2013-12-05 18:36 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Roman Kalantari 2011-12-07 23:20:23 UTC
CurrentHour and CurrentMinute take a Java.Lang.Integer, should be .net int type.

Also SetIs24HourView and Is24HourView could be a property?
Comment 1 Atsushi Eno 2011-12-08 08:12:20 UTC
They are indeed Java.Lang.Integer in Java API. I'm not sure if this should be / can be convertible to primitive int for interoperability purpose right now.
Comment 2 Jonathan Pryor 2012-09-24 09:41:23 UTC
We wouldn't want them to be `int`, because a Java.Lang.Integer can be null, while an `int` can't.

We could plausibly convert Java.Lang.Integer into an `int?` (`Nullable<int>`), but that raises object identity issues, e.g. if the Java API is:

    // Java
    public class IntegerExample {
        public static final Integer MAX = new Integer (42);
        public void doSomething(Integer value) {
            if (value == MAX) // note: object identity!
                do_something ();
                throw new RuntimeException ("Invalid Value!");

(Yes, stupid example is stupid...)

Because `==` in Java is always equivalent to C# object.ReferenceEquality(), in order for that API to work we MUST provide the SAME IntegerExample.MAX Java instance to IntegerExample.doSomething(), otherwise it'll throw an exception.

Furthermore, because Nullable<int> is a value type, there's no reasonable way to re-obtain the "correct" existing Java instance; we'd always have to create a new java.lang.Integer instance.

In short, in edge cases this is a Bad Idea...
Comment 3 Jonathan Pryor 2012-09-24 09:45:27 UTC
Regarding Is24HourView, the reason it's not bound as a property is because of our property name convention check:

	(Name.Length > 3 && Name.StartsWith ("Is")  && 
		char.IsUpper (Name [2]) && 
		retval.JavaName == "boolean")))

The name length matches, it starts with "Is" (after PascalCase-ization), but "24" isn't an uppercase letter. Consequently, it's not considered to be a property, though clearly it could be. This is an oversight.

Furthermore, if Is24HourView were bound as a property, it's possible (but untested) that setIs24HourView() would be bound as the property.

We could fix this in a future release, but such a change would be an ABI break and thus can't be done until we're willing to force a breaking change + recompile on everyone.
Comment 4 Peter Collins 2013-05-21 16:00:36 UTC
The reported issue is addressed by Comment #2. I will be flagging this as a potential enhancement (Comment 3) to be decided on.
Comment 5 PJ 2013-11-19 17:05:47 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 6 PJ 2013-12-05 18:36:15 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.