Re: WO and Java 11
Re: WO and Java 11
- Subject: Re: WO and Java 11
- From: Henrique Prange <email@hidden>
- Date: Tue, 16 Oct 2018 20:49:10 -0300
Hi Hugi,
I did some experiments using Java 11 last weekend. I've tried to migrate our
main application. It's a large app containing approximately 7200 unit tests. I
was expecting lots of issues. Surprisingly, though, I found just a handful of
them.
1. WOInject doesn't work
The custom classloader used by WOInject doesn't work with Java 11. Fortunately,
there's already a pull request [1] with the fix. Version 1.3-SNAPSHOT based on
that branch has been deployed to the WOCommunity repository if anyone wants to
try it.
2. Classpath resources not found while executing tests
Tests stoped finding resources in the classpath. Probably because of the new
module system and its side-effects. I had to replace code like this:
URL url = TestClass.class.getClass().getResource("/MyResource");
With code like that:
URL url =
Thread.currentThread().getContextClassLoader().getResource("MyResource");
3. Socket timeouts when running SMTP related unit tests
It's not related to WO stuff, but SMTP related unit tests aren't working
anymore. I have socket timeouts all the time. I remember having problems when
migrating to Java 8 too. A system level configuration solved the issue at the
time. It might also be the case with Java 11. I've been ignoring these tests
until I find the cause of the problem.
4. Wonder
I haven't spent enough time with Wonder yet. Anyway, I know that the
ERExtensions framework has some compilation failures. Even though I haven't
tried, I expect frameworks like ERProfiling also to break. Most problems that I
had were related to code involving or messing with classloaders.
5. Mockito 1.9.x and Guice 4.0 warning messages
Older versions of Mockito make illegal reflective access to the
java.lang.ClassLoader.defineClass method. For now, it is just a warning, but,
as they keep alerting, "all illegal access operations will be denied in a
future release.” I'm pretty sure the latest version (2.23.0) does solve this
problem. Unfortunately, Mockit 2.x isn't compatible with WOUnit yet [2].
The same problem happens with Guice, and the same solution applies. Just
upgrade to the latest version (4.2.1).
In summary, depending on your WO app dependencies and if you're not willing to
move into the new module system, you might be able to migrate to Java 11
without further ado. I've shared a sample WO app on Github [3] showing how to
configure the Maven build to work with Java 11.
Oh! And there's one more thing...
In my experience, Java tooling is still not ready for Java 11. I see errors
popping up consistently in the latest release of Eclipse. Usually caused by
missing classes that were part of the JDK in previous versions. Other tools
refuse entirely to open.
As a workaround, I'm "disabling" Java 11 as the default installation in my
system. I did that by appending a ".disabled" extension to the Info.plist at
the JDK 11 Contents folder:
/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Info.plist.disabled
I know. It's ugly. Yet, I can build my projects with Java 11 while running my
tools on Java 8.
[1]https://github.com/hprange/woinject/pull/15
[2]https://github.com/hprange/wounit/issues/49
[3]https://github.com/hprange/wo-java11-sample
Cheers,
HP
> On Oct 5, 2018, at 4:13 PM, Hugi Thordarson <email@hidden> wrote:
>
> So… Java is moving forward pretty fast these days. I'd like to move to 11
> ASAP but I just wanted to check with the community first. Any luck?
>
> - hugi
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden