Skip to content

Kotlin: hide elements that not need to be visible#1792

Merged
pwrobeldev merged 9 commits intomasterfrom
pwrobeldev/hide-kotlin-elements-that-not-need-to-be-visible
Jan 22, 2026
Merged

Kotlin: hide elements that not need to be visible#1792
pwrobeldev merged 9 commits intomasterfrom
pwrobeldev/hide-kotlin-elements-that-not-need-to-be-visible

Conversation

@pwrobeldev
Copy link
Contributor

@pwrobeldev pwrobeldev commented Jan 20, 2026

This commit hides the element generated for Kotlin code, which do not need to
be visible for the end users. The introduced changes are as follows:

  1. The static functions generated for constructors are private now.
  2. The 'internal types' generated when using 'external type descriptors' for Kotlin use 'internal' keyword for visibility.
  3. Because of (2) the converter classes for the external types (which are called only by JNI layer) also must be internal.

Moreover, this commit improves the documentation of KotlinNativeBase.
KDoc syntax is used to properly render the comments.

To ensure the same level of API documentation
that Java provides the comment in 'KotlinNativeBase'
should use '/**' to be recognized by Dokka engine.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The comment uses '/**' to be recognized by
Dokka engine.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
These functions do not need to be public. They
should not be directly accessed by the users of
the types -- instead, the users should use the
usual constructors.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
These functions should not be accessed by the users.
They are just the implementation details.

The users should access the usual constructors.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
In Gluecodium we can specify 'external' types for Kotlin.
When such type is specified, then in all APIs we use it,
but in JNI layer we convert it to our internal representation.

Such internal representation is later converted to and from C++.
The class which is the 'internal representation' should not be
public -- it is just the implementation detail.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The internal representation should not be public.
Therefore, such types are annotated as internal.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The converter classes are also an implementation detail.
They are accessed from JNI layer. The user should not access
them.

In Java they are package-private. Therefore, in Kotlin we
make them 'internal'.

Because 'internal representation type' generated for external
type is internal, the methods, which use it must also be internal.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
@pwrobeldev pwrobeldev marked this pull request as ready for review January 21, 2026 11:48
@pwrobeldev pwrobeldev requested a review from Hsilgos January 21, 2026 11:48
@pwrobeldev pwrobeldev merged commit bc6a7d4 into master Jan 22, 2026
19 checks passed
@pwrobeldev pwrobeldev deleted the pwrobeldev/hide-kotlin-elements-that-not-need-to-be-visible branch January 22, 2026 06:11
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