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 explicit dependency of JniGenerator on JavaGenerator #1636

Merged
merged 13 commits into from
Jan 14, 2025

Conversation

pwrobeldev
Copy link
Contributor

@pwrobeldev pwrobeldev commented Dec 16, 2024

------ Motivation ------

Types defined in generator/jni were tightly coupled with types from
generator/java.

There are more languages than Java, that could use JNI in the future.
Therefore, removing the explicit dependencies could be beneficial
by avoiding changes in JNI code and making this layer future-proof.

------ Solution ------

Removed the explicit dependencies on types and functions related to
generator/java from generator/jni by injecting them via constructors.

…solver

The dependency is now injected via constructor of
JniGeneratorPredicates, which receives common
PlatformSignatureResolver interface.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The platform type attribute is now injected via the
constructor of JniGeneratorPredicates.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
This change removes explicit usage of 'external.java'
field. Instead, 'getFor(platformAttribute)' is used.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
This change removes the dependency on JavaGenerator
from JniTemplates class. Instead of accessing the
class directly, JniTemplates receives the needed
data via constructor.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The platform type attribute is now injected via the
constructor of JniTemplates.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
This change removes the explicit dependency to JavaSignatureResolver
from JniTemplates. Instead the PlatformSigantureResolver interface is
used.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
This change removes the explicit dependency to JavaNameRules
from instance of JniNameResolver. Instead, the common base
class is used: NameRules.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The dependency to a concrete type called JavaNameRules
has been replaced by the usage of the common base
class called NameRules.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
To remove the dependency to 'java' field of
LimeExternalDescriptor, the member function
'getFor(platformAttribute)' was used.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
To remove the explicit usage of static functions from
JavaNameRules, which are related to 'external types',
a map called 'externalNameRules' is now accepted by
the constructor of JniTemplates, which is later utilized
by JniNameResolver.

The interested classes from JNI directory should use
JniNameResolver.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
To avoid the explicit usage of the mentioned field
'platformAttribute' is injected via constructor.

It is later used to call 'getFor(platformAttribute)'
to remove the dependency to types related to java
directory.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
@pwrobeldev pwrobeldev marked this pull request as ready for review December 16, 2024 11:40
@pwrobeldev pwrobeldev merged commit b453f88 into master Jan 14, 2025
17 checks passed
@pwrobeldev pwrobeldev deleted the pwrobeldev/make-jni-independent branch January 14, 2025 07:08
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