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

module-info.java missing "exports" #409

Closed
triathematician opened this issue Jan 15, 2021 · 10 comments
Closed

module-info.java missing "exports" #409

triathematician opened this issue Jan 15, 2021 · 10 comments
Labels
Milestone

Comments

@triathematician
Copy link

Attempting to use com.fasterxml.jackson.kotlin fails because "Symbol is declared in module 'com.fasterxml.jackson.kotlin' which does not export package 'com.fasterxml.jackson.module.kotlin'"

I believe module-info should have an exports line added:

module com.fasterxml.jackson.kotlin {
    requires java.desktop;
    requires kotlin.stdlib;
    requires com.fasterxml.jackson.annotation;
    requires com.fasterxml.jackson.databind;

    exports com.fasterxml.jackson.module.kotlin;

    provides com.fasterxml.jackson.databind.Module with com.fasterxml.jackson.module.kotlin.KotlinModule;
}
@cowtowncoder
Copy link
Member

cowtowncoder commented Jan 16, 2021

@triathematician Is this with version 2.12.1?

And yes, I think that would be needed indeed.

@triathematician
Copy link
Author

yes, version 2.12.1

@cowtowncoder cowtowncoder changed the title module-info missing "exports" module-info.java missing "exports" Jan 29, 2021
@cowtowncoder cowtowncoder added this to the 2.12.2 milestone Jan 29, 2021
cowtowncoder added a commit that referenced this issue Jan 29, 2021
@cowtowncoder
Copy link
Member

cowtowncoder commented Jan 29, 2021

Fixed as suggested, will be in 2.12.2.

Also pushed snapshot for 2.12.2-SNAPSHOT to Sonatype OSS repo if anyone could test (that or just build from 2.12 branch).

@csotiriou
Copy link

csotiriou commented Feb 2, 2021

I had the same problem, and although 2.12.0-SNAPSHOT fixes the error inside the module-info.java, my application still cannot see the Kotlin-specific converters like objectMapper.convertValue(...). It only sees the Java ones, not the Kotlin extension. Note: I built from source.

@cowtowncoder
Copy link
Member

@csotiriou I had a typo -- fix will be in 2.12.2, not 2.12.0 that was released earlier.

But I am not sure ObjectMapper.convertValue() would be related to module info, since that should only affect visibility (and class loading) of types?

@csotiriou
Copy link

Well, I had a typo myself. :) I was actually building 1.12.2-SNAPSHOT.

I switched to using com.fasterxml.jackson.module.kotlin.jacksonObjectMapper and it's fine. I am stuck at other issues for the time being - I will post back here if I have any other problems, thanks.

@cowtowncoder
Copy link
Member

:) ok makes sense!

@csotiriou
Copy link

@cowtowncoder I believe I found an error (just started using Java 9 modules, so please bear with me). I believe an additional line should be added: requires kotlin.reflect; to the module-info.

I have a JavaFX application, and I received the following error while using this library with Retrofit

Exception in thread "OkHttp Dispatcher" java.lang.IllegalAccessError: class com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector (in module com.fasterxml.jackson.kotlin) cannot access class kotlin.reflect.jvm.internal.KotlinReflectionInternalError (in module kotlin.reflect) because module com.fasterxml.jackson.kotlin does not read module kotlin.reflect

Adding requires kotlin.reflect in the module-info.jave file solved the problem for me.

@GedMarc
Copy link

GedMarc commented Feb 3, 2021

that is possible

cowtowncoder added a commit that referenced this issue Feb 3, 2021
@cowtowncoder
Copy link
Member

@csotiriou Thank you: I added that requires directive; please lmk if there are remaining issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants