Skip to content

Possible resolution of KT-58964 (Consider moving content of section 5.1.2 (Sealed classes and interfaces) under section 4.1 (Declarations > Classifier declaration)) - #134

Merged
ice-phoenix merged 1 commit into
Kotlin:developfrom
MarkTheHopeful:kotlin-2.0/KT-58964
Mar 5, 2025

Conversation

@MarkTheHopeful

Copy link
Copy Markdown

Changed the subsubsection to be about all three modifiers instead just restating information about abstract (since neither open nor sealed are mentioned before chapter 5). Both abstract and sealed are mostly links to the corresponding subsubsections in the "Inheritance" chapter (5), however there is no specific part about the open modifier, despite it being used heavily in both text and examples of chapters 3 and 4.

@ice-phoenix ice-phoenix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In general, LGTM! Please rebase to the latest develop and fix the nitpicks, thanks!

Comment thread docs/src/md/kotlin.core/declarations.md Outdated
Class inheritance behaviour can be changed using modifiers, such as `open`, [`abstract`][Abstract classes] and [`sealed`][Sealed classes and interfaces].

- Modifier `open` allows for a class to be inherited from. By default classes are [closed][Classifier type inheritance] (that is, they cannot be inherited from), one should add this modifier to change the behaviour.
- Modifier [`abstract`][Abstract classes] allows for a class to have members without implementation (that is, *abstract members*). Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects. Abstract members should be implemented in a subtype of this abstract class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Modifier [`abstract`][Abstract classes] allows for a class to have members without implementation (that is, *abstract members*). Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects. Abstract members should be implemented in a subtype of this abstract class.
- Modifier [`abstract`][Abstract classes] allows for a class to have members without implementation (that is, *abstract members*). Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects. Abstract members must be implemented in a non-abstract subtype of this abstract class.

Comment thread docs/src/md/kotlin.core/declarations.md Outdated

- Modifier `open` allows for a class to be inherited from. By default classes are [closed][Classifier type inheritance] (that is, they cannot be inherited from), one should add this modifier to change the behaviour.
- Modifier [`abstract`][Abstract classes] allows for a class to have members without implementation (that is, *abstract members*). Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects. Abstract members should be implemented in a subtype of this abstract class.
- Modifier [`sealed`][Sealed classes and interfaces] works similarly to the `abstract`, but for *sealed* classes inheritance is limited to the module it was defined in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Modifier [`sealed`][Sealed classes and interfaces] works similarly to the `abstract`, but for *sealed* classes inheritance is limited to the module it was defined in.
- Modifier [`sealed`][Sealed classes and interfaces] works similarly to the `abstract` modifier, but for *sealed* classes inheritance is limited to the module it was defined in.

@ice-phoenix
ice-phoenix merged commit 6abcfff into Kotlin:develop Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants