square / moshi

A modern JSON library for Kotlin and Java.
https://square.github.io/moshi/1.x/
Apache License 2.0
9.65k stars 750 forks source link

JPMS issue with Moshi 1.15.0 #1710

Open pemistahl opened 1 year ago

pemistahl commented 1 year ago

I'm the author of a modularized library written in Kotlin. I use the following artifacts as dependencies for my library:

While trying to update Moshi from 1.14.0 to 1.15.0, I add the following lines to my library's module-info.java, according to the module names that have been introduced in 1.15.0, probably as the result of request #1579:

requires com.squareup.moshi;
requires com.squareup.moshi.kotlin;

However, module resolution fails with the following exception:

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules com.squareup.moshi and com.squareup.moshi.kotlin export package com.squareup.moshi to module okio

You have created split packages here which is not allowed in the Java module system. A module is not allowed to read the same package from two different modules. Can you please fix this? Until then, I stay with Moshi 1.14.0. Thank you.

black2unicorn commented 12 months ago

enough is enough

pemistahl commented 11 months ago

@black2unicorn How am I supposed to interpret your comment?

ZacSweers commented 11 months ago

Can you paste the full trace? You've truncated it to the point where it's a little vague. A reproducible sample would be helpful

pemistahl commented 9 months ago

Sorry for the late response. There is no stacktrace. The Java compiler just returns the error mentioned above. Additionally, it just returns the following:

error: module com.github.pemistahl.lingua reads package com.squareup.moshi from both com.squareup.moshi and com.squareup.moshi.kotlin

As I said previously, a Java module is not allowed to read the same package from two different modules. So you need to use different packages in both artifacts so that the Java module system works properly.

Anyway, I will most probably exchange Moshi with another library which is more reliable and contains fewer bugs. Please just keep this problem in mind. Thank you.