-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Java 11 api usage prevents titanium being used on android and with Scala #133
Comments
Hi, Anyway, the code could be modularized, and for example |
While there are plenty of projects that still use Java 8, I agree with @filip26 that refactoring this codebase to support Java 8 is not the way to go. In fact, one of the appealing aspects of this codebase is its use of the Java 11 APIs (in particular |
Okay, sure but is there a solution for android then? |
jsonld-java project supports JSON-LD 1.0 and Java 8 |
I had a look through and, apart from the use of Happy to submit a PR with that change if you will accept it. If not, I can create a fork. Having JSON-LD 1.1 and an implementation of URDNA2015 is really helpful. |
Contribution is welcome, but we need to restructure the project.
Do you intend to maintain the Android build in the future? |
@filip26 Thanks for that. Under that assumption that an android module is, in effect, a DocumentLoader implementation, perhaps a few other classes and some maven boilerplate then, yes, I'd be happy to maintain that part. Is there a chat channel on which we can go over the details? |
I have submitted a draft PR (#137). It provides backwards compatibility but does not yet provide any modularisation. |
@jtownson thank you for the PR. I'm thinking about having multiple sources and using maven profiles. e.g.
We can use I'll setup gitter later today so we can discuss that. @acoburn What do you think about this solution? |
@filip26 I guess that move needs you or somebody with a good handle on what is going on in other project branches, but let me know if I can help in any way. I note that the project is dependency free -- with the exception of jakarta-json -- so I've refactored the draft PR to only depend on JDK classes. |
@jtownson Hi, I've created a new branch I'm not sure, using multiple source directories, build classifiers, and profiles is the right way to do that. But the main objective is to avoid having one generic core/shared artifact that is built with java8 and two other packages (java11, android) depending on that package. Downside is that any extension must be built separately for java11 and android. Any help, advice is welcome. I tend to prefer We can discuss changes online at Titanium Gitter if you like. |
@jtownson the code is separated and compilable. Unfortunately your PR is not mergeable. I'm sorry for that, please let's discuss changes in advance next time. You can implement I expect that booth HttpLoaders will share something like |
@filip26 I've created a new PR, based on your maven changes and implementing the missing bits. |
@jtownson that's great. thanks. I see it uses |
Well, I had noted the project was, thusfar, dependency free, which seems a good thing. Also, I could not really uncover any evidence to suggest the things okhttp could provide -- caching, pooling, compression, async calls, etc -- are actually needed yet. |
To me, OkHttp is the main reason for making a special build. It's slightly faster and less buggy than |
@jtownson Anyway, I'm going to merge the PR into |
@filip26 if you want the OkHttp version, I've pushed it to the head of experiment/android-build in my account. Feel free to pull it across. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Problem faced using on android
Calls such as
com.apicatalog.jsonld.JsonLd.toRdf(...)
instantiate a defaultDocumentLoader
which has a dependency on Java 11'sjava.net.http.HttpClient
. If the calling code tries to set options such asJsonLd.toRdf(...).loader(jdk8CompatibleLoader)
this fails to circumvent the loading of Java 11 classes (because the default java 11DocumentLoader
instance is created eagerly).Problem faced using from Scala
Scala projects still commonly use Java 8 as the runtime. The problem above thus causes incompatible class version errors.
Describe the solution you'd like
I recommend you refactor the code so that the core API is compatible with Java 8. For android, it would work if any concrete, default implementations which depend on Java 11 classes are not loaded in the case where the user provides overriding options. For Scala, I think you would have to actually compile under Java 8 (which would require reworking classes such as 'com.apicatalog.jsonld.loader.HttpLoader').
The text was updated successfully, but these errors were encountered: