Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Ruboto should call #initialize on entry objects when they are created. #386

Open
donv opened this Issue Mar 31, 2013 · 8 comments

Comments

Projects
None yet
3 participants
Owner

donv commented Mar 31, 2013

Our examples don't use #initialize, but developers coming from Ruby expect it to be called.

Owner

donv commented Mar 31, 2013

It looks like calling #initialize on an Activity after it has been created messes up the state somehow.

@headius is calling #initialize on a java class after construction is completed a bad idea?

Owner

donv commented Mar 31, 2013

@rscottm The description of Activity never mentions the constructor as a part of the life cycle. Maybe we should ignore the initialize method?

Owner

rscottm commented Apr 1, 2013

Activity does present a special case because we're not doing real
subclassing. I'm sure that on the Java side, people use the Activity
subclass' constructor to do some initialization. I would find it handy to
have an initialize method called in Ruby just to do some setup (it is
sometimes a pain to worry about that in on_create).

I think the main argument for trying to find a way to call initialize is
that Ruby developers will assume it will be called.

I'm looking at the code, and wondering if initialize does get called in
some circumstances. Specifically, the line:

JRubyAdapter.runRubyMethod(rubyClass, "new");

It seems like new should call initialize (standard Ruby). Does this just
mean that it is only an issue in some of the other Activity startup
situations?
On Mar 31, 2013 4:11 AM, "Uwe Kubosch" notifications@github.com wrote:

@rscottm https://github.com/rscottm The description of Activity never
mentions the constructor as a part of the life cycle. Maybe we should
ignore the initialize method?


Reply to this email directly or view it on GitHubhttps://github.com/ruboto/ruboto/issues/386#issuecomment-15689989
.

Owner

donv commented Apr 1, 2013

The case you mentioned where "new" is called is when there is no Ruby script for the given activity. In that case there will not be any initialize method either.

In all cases (I think) the "new" method is called by the Android framework before control is given to our code. That means that "new" is called before we load the script to define "initialize". Any call to "initialize" would have to be performed by us, and we would have to ensure that the call does _NOT_ propagate to the Java super class initialization since that part has already been run.

Owner

donv commented Apr 6, 2013

@rscottm could you follow up on this one? I think calling initialize is a good thing if it exists, but it is not very important for me personally.

Owner

donv commented Apr 20, 2013

@rscottm Any chance you could look at this? Else I will postpone it.

Owner

rscottm commented Apr 21, 2013

I'd say postpone it. I looked into it a little, but I don't see it as that
important.
On Apr 20, 2013 5:09 AM, "Uwe Kubosch" notifications@github.com wrote:

@rscottm https://github.com/rscottm Any chance you could look at this?
Else I will postpone it.


Reply to this email directly or view it on GitHubhttps://github.com/ruboto/ruboto/issues/386#issuecomment-16703043
.

Owner

donv commented Apr 21, 2013

Postponed to 1.1.

@donv donv modified the milestones: 1.1.1, 1.1 May 18, 2014

@donv donv modified the milestones: 1.1.2, 1.1.1 Jul 1, 2014

@donv donv modified the milestones: 1.1.3, 1.1.2 Jul 9, 2014

@donv donv modified the milestones: 1.1.3, 1.1.4 Oct 13, 2014

@donv donv modified the milestones: 1.3.1, 1.3.0 Apr 5, 2015

@donv donv modified the milestones: 1.3.1, 1.3.2 Oct 12, 2015

@donv donv modified the milestones: 1.3.2, 1.3.3 Dec 22, 2015

@gfowley gfowley modified the milestones: 1.4.1, 1.4.2 Jan 21, 2016

@donv donv modified the milestones: 1.5.0, 1.5.1 Nov 17, 2016

@donv donv modified the milestones: 1.6.0, 1.6.1 Dec 27, 2016

@donv donv modified the milestones: 1.6.1, 1.6.2 Mar 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment