Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-23117] Hyperloop: Android: Support calls to super-class #29

Merged
merged 1 commit into from May 10, 2016

Conversation

sgtcoolguy
Copy link
Contributor

https://jira.appcelerator.org/browse/TIMOB-23117

This adds support for calling methods on the superclass. I didn't test every possible scenario, but the main use case which is when we extend a base Java class in JS and override a method and want to call up into the super implementation. Here's a very simple contrived example:

var CustomView = View.extend({
        isLongClickable: function() {
            Ti.API.info('overridden View#isLongClickable()');
            Ti.API.info('this: ' + this);
            var superResult = this.super.isLongClickable();
            Ti.API.info('result from super: ' + superResult);
            return superResult;
        }
    });

Note the explicit use of this.super. super is itself a keyword in JS, so we need to be explicit and call this.super.whateverMethod(arg1, arg2);


@Kroll.getProperty @Kroll.method
public InstanceProxy getSuper() {
if (!ProxyBuilder.isProxyClass(this.clazz)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clazz because class is a reserved word?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, unfortunately

@hansemannn
Copy link
Contributor

CR + FT passed, PR approved!

@hansemannn hansemannn merged commit ec4604e into tidev:master May 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants