Home > Software design >  Will be using a wiremock-jre-8 dependency within a java 11 project an issue?
Will be using a wiremock-jre-8 dependency within a java 11 project an issue?

Time:10-31

Disclamer

Sorry in advance if this is a stupid question, but my research to clarify this was not as successful as i needed it to be.

Problem description

I am working on a project using jdk 11 and in order get decent testcoverage, i added something to mock calls/answers to/from external services. So i included wiremock. As suggested on their setup getting-started section, i included

testImplementation "com.github.tomakehurst:wiremock-jre8:2.34.0"

Even though everything works on my machine (and tests run fine on the pipeline), i don't know if this will potentially cause issues on other machines. The architect involved in the project also stated his concern that we do only use jre 11.

Therefore i need some more insight to either change things up or argue why this is not an issue.

Attempts so far

I expected there to be an higher version of wiremock on mavencentral, but ther were only two projects:

To my surprise, wiremock-jre8 was the most recent version. I don't know what the older version was compiled with but i was using annotations that wouldn't work with the 2020 version either way. So it would be nice to not downgrade the current implementation to a less readable solution.

I should mention, that i only guess that wiremock-jre8 has been compiled with jdk8 from the naming. I did not find any evidence about what compiler did produce the bytecode for either of those dependencies or clues on how to interpret this.

When trying to figure out how back and forwards combability works with java, the compiler and the produced bytecode, i found this older post. In short it states:

Compatibility from the point of view of javac (as it is the part specific to the JDK), meaning that the bytecode generated can be run in future releases of the jvm (that is more related to the JRE, but also bundled in the JDK).

  • JDK's are (usually) forward compatible.
  • JRE's are (usually) backward compatible.

I do understand that in parts, but not fully concerning my issue. Especially the "usually" part. So are there some more insights someone has to spare to enlighten me? :)

CodePudding user response:

The Download and Installation section of their documentation contains this sentence:

Additionally, versions of these JARs are distributed for both Java 7 and Java 8 .

So if you are still running Java 1.7 you must use the version for Java 7.

For all later versions of Java there is the version for Java 8 (the version that you use.)

Since this is an actively supported project any problems related to Java versions later than Java 8 will be properly addressed and resolved (see for example Build on & fully support JDK 17 which was resolved in "com.github.tomakehurst:wiremock-jre8:2.32.0").

  • Related