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

Suppress useless companion for Kotlin-As-Java #2681

Merged
merged 6 commits into from Oct 31, 2022

Conversation

atyrin
Copy link
Contributor

@atyrin atyrin commented Sep 26, 2022

  • hide a companion object if it contains only const/@JvmField/lateinit properties or @JvmStatic functions
  • lift the declarations to outer class from the companion
  • mark lifted declarations as static
  • mark const/@JvmField/lateinit properties as static for named objects
  • remove getter/setter for const/lateinit properties in named objects/companions
  • add the companion property to the outer class

Fix #200, fix #2086

* hide companion object if it contains only const/lateinit/@JvmField properties or @JvmStatic functions
* lift the declarations to outer class from companion
* mark lifted declarations as static
* mark const/JvmField/lateinit properties as static for named objects
* remove getter/setter for lifted from companion properties and named objects
* fix visibility modifiers for lifter properties
* fix always public top level constants
If a companion object rendered for the class then the static property for accessing the object is shown.
Copy link
Member

@zarechenskiy zarechenskiy left a comment

Choose a reason for hiding this comment

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

I've finished with the first review round, nice job 👍

Copy link
Member

@IgnatBeresnev IgnatBeresnev left a comment

Choose a reason for hiding this comment

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

Well done! Left some minor comments to discuss

Copy link
Member

@IgnatBeresnev IgnatBeresnev left a comment

Choose a reason for hiding this comment

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

Left some minor suggestion, the rest LGTM for the most part 👍

@IgnatBeresnev IgnatBeresnev merged commit faca33f into master Oct 31, 2022
@IgnatBeresnev IgnatBeresnev deleted the filter-empty-companion-as-java branch October 31, 2022 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants