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
Support jdk11 #208
Support jdk11 #208
Conversation
@@ -28,7 +28,7 @@ jobs: | |||
uses: actions/setup-java@v3 | |||
with: | |||
distribution: 'temurin' | |||
java-version: '17' | |||
java-version: '11' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we perhaps setup a matrix here and test on both versions, or should we just be testing the lowest version and assuming the latest version is ok? I'm a bit unsure about what the best strategy is here for java.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a matrix, consisting of the minimum supported version (v11 with this change) and at least a couple more recent versions (including the most recent version, v17 prior to this change) would be a good idea. The evolution of Java between version 11 and 17 is not something I am familiar with though, so this could be an impossible request. Feedback appreciated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to use a version of Extism compiled with jdk17 on a jvm running on 11, and of course, I got the following error:
java.lang.RuntimeException: java.lang.UnsupportedClassVersionError:
org/extism/sdk/wasm/WasmSourceResolver has been compiled by a more recent
version of the Java Runtime (class file version 61.0),
this version of the Java Runtime only recognizes class file versions up to 55.0
The solution may be to compile the library in two versions using a java version array in github actions..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I think the array of versions makes sense. I think we'd also need to inject that version from the matrix into the pom.xml
on CI before running it though, right? Maybe other places too?
Thanks @Zwiterrion ! |
@Zwiterrion - I've added the matrix for version testing in this branch: https://github.com/extism/extism/tree/test-java-versions Within that new branch, I've updated the CI to manipulate I've got it set up to run versions 8, 11, and 17. But I'm not sure we need to go down to 8.. just figured it would be a good experiment. Please advise which version support you think is worth supporting! |
Perhaps @thomasdarimont has an opinion on this PR. I support adding more version to the test matrix. But when it comes to publishing jars it gets unclear to me what the consequences are. I think priorities, in this order, would be:
|
Thanks for the ping. I think having support for JDK 11 is fine if we want to keep the JNA library for accessing the extism native lib. So I'm fine with downgrading the current JDK version to 11. Perhaps at a later stage we could ditch the JNA library and leverage the FFI support that's coming to the JDK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few remarks.
public record ManifestHttpRequest(String url, Map<String, String> header, String method) { | ||
public class ManifestHttpRequest { | ||
|
||
private String url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String url; | |
private final String url; |
|
||
private String url; | ||
|
||
private Map<String, String> header; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Map<String, String> header; | |
private final Map<String, String> header; |
|
||
private Map<String, String> header; | ||
|
||
private String method; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String method; | |
private final String method; |
@@ -3,6 +3,12 @@ | |||
import java.util.Map; | |||
|
|||
// FIXME remove this and related stuff if not supported in java-sdk | |||
public record ManifestHttpRequest(String url, Map<String, String> header, String method) { | |||
public class ManifestHttpRequest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make the fields final, create accessor methods and create a constructor for passing the required parameters in.
public record MemoryOptions(@SerializedName("max") Integer max) { | ||
public class MemoryOptions { | ||
|
||
private @SerializedName("max") Integer max; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private @SerializedName("max") Integer max; | |
@SerializedName("max") | |
private final Integer max; |
@Override | ||
public String hash() { | ||
return hash; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provide an accessor method for data
.
public record PathWasmSource(String name, String path, String hash) implements WasmSource { | ||
public class PathWasmSource implements WasmSource { | ||
|
||
private String name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String name; | |
private final String name; |
|
||
private String name; | ||
|
||
private String path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String path; | |
private final String path; |
|
||
private String path; | ||
|
||
private String hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String hash; | |
private final String hash; |
@Override | ||
public String hash() { | ||
return hash; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide an accessor method for path
.
@nilslice regarding:
and
I don't think that's a good idea. Java is backward compatible in the sense that newer JREs can recognize older bytecode, but not vice versa. The |
@chabala - 😄 uh oh, my "I don't know Java" is showing... I just wanted to make sure we continue to test newer versions as well. I assumed we'd need to update the pom.xml to coincide with the version of Java being used, but if that's not the case then that simplifies things! |
No worries 😆 I figured I'd chime in as things looked to be going in a weird direction. I had asked about |
I suggest using at least Java 11. Java 8 is now almost 10 years old and many Java open source projects have removed support for Java 8. |
This sounds good to me. Unless someone feels very strongly about supporting Java 8, and would like to test & make whatever library changes are needed to support it, I think we can use Java 11 as the minimum supported version. |
@Zwiterrion - thank you for your work on this! When you have a minute, would you be able to include the changes suggested by @thomasdarimont? Thanks to my new knowledge from @chabala, the What do you think? |
@nilslice - It's fine for me, i'll try to include all changes suggested by @thomasdarimont on my branch. |
Hi @Zwiterrion - just wanted to check in on this. I looks like you made most of the changes - is my observation correct? We'd love to include this in the upcoming 0.2.0 release, but let me know if there is anything left here or if you would like some help! |
Hi @nilslice, I made the needed changes. The branch is ready to be merged. |
Hi, We want to use Extism on our project [Otoroshi](https://github.com/MAIF/otoroshi) but we need to run it on jdk11 This pull request makes everything run smoothly on jdk11 If you have any suggestion about this pull request, i'm open to it Thanks for your time
Hi, We want to use Extism on our project [Otoroshi](https://github.com/MAIF/otoroshi) but we need to run it on jdk11 This pull request makes everything run smoothly on jdk11 If you have any suggestion about this pull request, i'm open to it Thanks for your time
Hi,
We want to use Extism on our project Otoroshi but we need to run it on jdk11
This pull request makes everything run smoothly on jdk11
If you have any suggestion about this pull request, i'm open to it
Thanks for your time