Repository navigation
Bump minimum JDK requirement from 8 to 11 - #259
Conversation
mskacelik
left a comment
There was a problem hiding this comment.
there are few examples where the codebase mentions something related to need of newer JDK features (might be worth it to investigate):
Also don't forget to update README.md and CONTRIBUTING.md (for some reason they have inconsistent maven versions).
There was a problem hiding this comment.
FindBugs only supports till JDK8 - i.e. https://findbugs.sourceforge.net/
use instead SpotBugs (https://spotbugs.github.io/) which is for JDK11+
7fd1c43 to
ca6124c
Compare
|
@xjusko |
|
Also |
@mskacelik I will look at those later. I would like to merge this and open a PR for JPMS. |
|
|
||
| @AfterEach | ||
| public void tearDown() { | ||
| // URLClassLoader.close() requires JDK7+ |
There was a problem hiding this comment.
so do I understand there is no need for the archiveCl.close() here? TBF, I am not even sure what URLClassLoader is...
| @Override | ||
| public Enumeration<URL> getResources(final String name) throws IOException { | ||
| if (name.contains("donotchange")) { | ||
| // Collections.emptyEnumeration() requires JDK7+ |
There was a problem hiding this comment.
Just a note, this could have been replaced with the Collections.emptyEnumeration() (as the comment suggests), instead of the NOOP enumeration. But on the other hand this is not a blocker, since I think overall Enumeration usage is super old (Java 1.0 feature), and nobody should really use it (e.g. this should be replaced with either Iterator<URL>, Collection<?>, or List<URL>).
But that could be done later (I would imagine that we will have more of these super legacy code changes from JDK 1-8 -> JDK 11 before the 2.0.0 release).
|
|
||
| // Here the exception should be thrown | ||
| Assertions.assertThrows(IllegalArgumentException.class, () -> archive.addPackages(true, Package.getPackage(packageName))); | ||
| Assertions.assertThrows(IllegalArgumentException.class, () -> archive.addPackages(true, ClassLoader.getSystemClassLoader().getDefinedPackage(packageName))); |
There was a problem hiding this comment.
This is solid change, if the getDefinedPackage returns a null (which I suspect it does), but I find funny that this test is pretty much testing that the JDK package utility method returns a null (i.e.
@Test
public void testAddNonExistentPackage() {
JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
Assertions.assertThrows(IllegalArtumentException.class, () -> archive.addPackages(true, (Package) null);
}N.B. after checking the JIRA, Package.getPackage() was probably used to be consistent with the reproducer, but since Package.getPackage() is obsolete since JDK 9+, I think we can just have null instead.
WDYT?
There was a problem hiding this comment.
OR it could be also testing this one:
i.e. directly addPackages(true, "non.existent.package")
There was a problem hiding this comment.
Actually, according to this:
It seems like the Package... packages variation uses the addPackages(boolean recursive, String... packages) under the hood anyway.
There was a problem hiding this comment.
Ok, I change my mind, I would leave the (Package) null for the parameter, I think other variations could be added later, ideally we would need to have better coverage for the test, but I think that is a different issue.
| <!-- Versioning --> | ||
| <version.com.sun.activation.javax.activation>1.2.0</version.com.sun.activation.javax.activation> | ||
|
|
||
| <!-- Plugin versions --> |
| <!-- Plugin versions --> | ||
| <version.maven-compiler-plugin.compilerVersion>1.8</version.maven-compiler-plugin.compilerVersion> | ||
| <version.org.codehaus.mojo.findbugs-maven-plugin>3.0.5</version.org.codehaus.mojo.findbugs-maven-plugin> | ||
| <version.com.github.spotbugs.spotbugs-maven-plugin>4.8.6.6</version.com.github.spotbugs.spotbugs-maven-plugin> |
There was a problem hiding this comment.
Current version seems to be 4.10.4.0 (i.e. https://github.com/spotbugs/spotbugs-maven-plugin/releases/tag/spotbugs-maven-plugin-4.10.4.0), any reason why was 4.8.6.6 chosen instead?
There was a problem hiding this comment.
Thanks for catching this; I missed it.
There was a problem hiding this comment.
After looking into it, I will have to use 4.10.3.0, as that is the latest version which works with Maven 3.6.3. And I would like to keep that Maven as the minimum requirement.
| fail-fast: false | ||
| matrix: | ||
| java-version: [ 8, 11, 17 ] | ||
| java-version: [ 11, 17, 21 ] |

Closes #258