Skip to content

Support @GenerateObjCCompanion for static @Property methods.#2793

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_940556527
Open

Support @GenerateObjCCompanion for static @Property methods.#2793
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_940556527

Conversation

@copybara-service

Copy link
Copy Markdown

Support @GenerateObjCCompanion for static @Property methods.

When @GenerateObjCCompanion generates companion protocol declarations (@protocol FooCompanion), static methods annotated with @Property should be emitted as instance properties rather than class properties (@Property (class, ...)).

In TypeDeclarationGenerator, pass whether code is being generated for a Kotlin companion protocol to printPseudoProperty so that the class attribute is omitted when declaring companion protocol properties. Also pass ElementUtil.isStatic(methodElement) to findSetterMethod so setters for static properties are found correctly.

When @GenerateObjCCompanion generates companion protocol declarations (@protocol FooCompanion), static methods annotated with @Property should be emitted as instance properties rather than class properties (@Property (class, ...)).

In TypeDeclarationGenerator, pass whether code is being generated for a Kotlin companion protocol to printPseudoProperty so that the class attribute is omitted when declaring companion protocol properties. Also pass ElementUtil.isStatic(methodElement) to findSetterMethod so setters for static properties are found correctly.

PiperOrigin-RevId: 940556527
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.

1 participant