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

Remove Accessors #12310

Merged
merged 23 commits into from Feb 12, 2021
Merged

Remove Accessors #12310

merged 23 commits into from Feb 12, 2021

Conversation

sgtcoolguy
Copy link
Contributor

@sgtcoolguy sgtcoolguy commented Dec 2, 2020

JIRA: https://jira.appcelerator.org/browse/TIMOB-26119

Description:
This PR removes the getter/setter methods for properties where we can directly get/set the value for that property. If a get/set method is explicitly defined, it should not be removed. We've been threatening to remove these for years now. Time to rip off the band-aid.

Note that a lot of work is in the test suite. I needed to clean them up and explicitly test that many properties don't have accessors anymore to help me find what needed to be changed.

So the basic guideline I tried to follow here was:

  • If an underlying get/set method was tagged as both @Kroll.method and @Kroll.getProperty (or @Kroll.setProperty) I'd remove the @Kroll.method.
  • There are still get/set methods exposed to JS, but they should be "unusual" in the sense that they should accept additional arguments (i.e. a getter accepts some args, even optionally; a setter accepts two+ args)
    • For example Ti.Network.HTTPClient.setRequestHeader('headerName', 'value');
  • In a couple cases I left the getter/setter if we explicitly documented them and hadn't yet deprecated them (and they had properties you could access). I added deprecation notes in the api docs so we can eventually remove them.
  • For QuickSettingsService it had getter/setter pairs for underlying properties but did not expose the properties. In that case, I exposed the properties, documented them and left the getter/setters but marked them as deprecated in api docs.
  • I did not remove the deprecation messages baked into Android's proxy code
    • I assume we'll want to. I think at this point it's likely to just spit out false reports?

@build
Copy link
Contributor

build commented Dec 2, 2020

Warnings
⚠️

tests/Resources/ti.ui.tabgroup.test.js#L22 - tests/Resources/ti.ui.tabgroup.test.js line 22 – Avoid calling back inside of a promise. (promise/no-callback-in-promise)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L22 - tests/Resources/ti.ui.tabgroup.test.js line 22 – Avoid calling back inside of a promise. (promise/no-callback-in-promise)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L399 - tests/Resources/ti.ui.tabgroup.test.js line 399 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L402 - tests/Resources/ti.ui.tabgroup.test.js line 402 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L402 - tests/Resources/ti.ui.tabgroup.test.js line 402 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L427 - tests/Resources/ti.ui.tabgroup.test.js line 427 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L428 - tests/Resources/ti.ui.tabgroup.test.js line 428 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L428 - tests/Resources/ti.ui.tabgroup.test.js line 428 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L428 - tests/Resources/ti.ui.tabgroup.test.js line 428 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L429 - tests/Resources/ti.ui.tabgroup.test.js line 429 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L429 - tests/Resources/ti.ui.tabgroup.test.js line 429 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L465 - tests/Resources/ti.ui.tabgroup.test.js line 465 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L468 - tests/Resources/ti.ui.tabgroup.test.js line 468 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.tabgroup.test.js#L468 - tests/Resources/ti.ui.tabgroup.test.js line 468 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L21 - tests/Resources/ti.ui.window.test.js line 21 – Avoid calling back inside of a promise. (promise/no-callback-in-promise)

⚠️

tests/Resources/ti.ui.window.test.js#L21 - tests/Resources/ti.ui.window.test.js line 21 – Avoid calling back inside of a promise. (promise/no-callback-in-promise)

⚠️

tests/Resources/ti.ui.window.test.js#L696 - tests/Resources/ti.ui.window.test.js line 696 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.window.test.js#L699 - tests/Resources/ti.ui.window.test.js line 699 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L699 - tests/Resources/ti.ui.window.test.js line 699 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L718 - tests/Resources/ti.ui.window.test.js line 718 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.window.test.js#L719 - tests/Resources/ti.ui.window.test.js line 719 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L719 - tests/Resources/ti.ui.window.test.js line 719 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L719 - tests/Resources/ti.ui.window.test.js line 719 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.window.test.js#L720 - tests/Resources/ti.ui.window.test.js line 720 – 'e' is defined but never used. Allowed unused args must match /^_.+/u. (no-unused-vars)

⚠️

tests/Resources/ti.ui.window.test.js#L720 - tests/Resources/ti.ui.window.test.js line 720 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L720 - tests/Resources/ti.ui.window.test.js line 720 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L752 - tests/Resources/ti.ui.window.test.js line 752 – Each then() should return a value or throw (promise/always-return)

⚠️

tests/Resources/ti.ui.window.test.js#L755 - tests/Resources/ti.ui.window.test.js line 755 – Avoid nesting promises. (promise/no-nesting)

⚠️

tests/Resources/ti.ui.window.test.js#L755 - tests/Resources/ti.ui.window.test.js line 755 – Avoid nesting promises. (promise/no-nesting)

Messages
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖

✅ All tests are passing
Nice one! All 15074 tests are passing.
(There are 906 skipped tests not included in that total)

📖 👍 Hey!, You deleted more code than you added. That's awesome!

Generated by 🚫 dangerJS against b256dce

@garymathews
Copy link
Contributor

garymathews commented Feb 10, 2021

There's still some @Kroll.method entries in:

We may also want to deprecate these methods:

I see you deprecated some of them in our docs, but we can also add the @Deprecated annotation.

@sgtcoolguy
Copy link
Contributor Author

There's still some @Kroll.method entries in:

  • OK, I will push removal of the RecurrenceRule getters

We may also want to deprecate these methods:

I think these fall into the category of being existing documented methods. We may want to consider exposing as properties and deprecating long-term?

As noted in comments w/ Josh, this method should stay. I just missed documenting that Android has had it around since forever. I'll push that change to the docs.

We didn't expose this as a property before, so I am deprecating it for now but not removing it.

Given the nature of the API it felt odd to me to try and make it property only for text (but you'd need to use get/set for "data").

This method has been around forever and is documented. We could consider deprecating and pushing towards a property access usage. But we haven't documented it as a property ever - and I'm trying to only remove "auto-generated" getter/setters for documented properties but retain existing documented methods when possible.

So I think it may make sense to expose as a property here and eventually deprecate the method to prefer the property.

I see you deprecated some of them in our docs, but we can also add the @Deprecated annotation.

Copy link
Contributor

@vijaysingh-axway vijaysingh-axway left a comment

Choose a reason for hiding this comment

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

iOS looks good.

@sgtcoolguy sgtcoolguy merged commit a413a9e into tidev:master Feb 12, 2021
@sgtcoolguy sgtcoolguy deleted the accessors branch February 12, 2021 17:58
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

5 participants