Skip to content
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

Provide Java 9 compatibility #520

Closed
4 tasks done
szpak opened this issue Jul 30, 2016 · 18 comments
Closed
4 tasks done

Provide Java 9 compatibility #520

szpak opened this issue Jul 30, 2016 · 18 comments
Labels

Comments

@szpak
Copy link
Member

szpak commented Jul 30, 2016

Once having Mockito 2.0 out the door it would be good to explore Java 9 compatibility.

Basic todo list:

Open Java 9 related issues.

@bric3
Copy link
Contributor

bric3 commented Jul 31, 2016

I agree with that however note that mockito 2.1 should still be Java 5 compatible (we still build Java 5 binaries with Java 6).
Before that we need to branch mockito 2.x to support old JDKs and make mockito 3 Java 8 min.

@szpak
Copy link
Member Author

szpak commented Jul 31, 2016

we still build Java 5 binaries with Java 6

I'm afraid we are not:

sourceCompatibility = 1.6
targetCompatibility = 1.6

If Java 5 is in fact a target of Mockito 2.0 I could add Animal sniffer verification that we don't use Java 6 API in the code.

We would probably need to decide if 2.1 is just for things that were able to finish before 2.0-final (and important bugfixes) or there are plans to keep a serious development of 2.x line after 2.1 (with backporting non Java 8 specific changes from 3.x branch).

@bric3
Copy link
Contributor

bric3 commented Jul 31, 2016

Damn I didn't see this change. I'm on my phone.

However that's fine for me.

@bric3
Copy link
Contributor

bric3 commented Jul 31, 2016

Maybe something to mention in the migration guide though.

@bric3
Copy link
Contributor

bric3 commented Jul 31, 2016

Otherwise for 2.1 I think we will only include few API refactoring like ArgumentCaptor. And bugfixes otherwise it will delay serious work on mockito 3.
Also I don't want to backport java 8 code to mockito 2.
My idea is to have a 2.x branch, we can adjust the build script to release on this branch too.

@raphw
Copy link
Member

raphw commented Aug 4, 2016

Just for information, the parts Mockito uses of Byte Buddy are already fully Java 9 compatible. I do not see any problems on migration.

@TimvdLippe
Copy link
Contributor

I think this is ready now?

@raphw
Copy link
Member

raphw commented Dec 3, 2016

@bric3
Copy link
Contributor

bric3 commented Dec 6, 2016

Really don't focus too much on Java 9 it's still months away.

@ceki
Copy link

ceki commented Feb 15, 2017

For your information, logback uses Mockito version 1.10.19 which is apparently not Java 9 compatible. It follows that logback build fails under Java 9.

@raphw
Copy link
Member

raphw commented Feb 15, 2017

Mockito 2 is Java 9 compatible.

@ceki
Copy link

ceki commented Feb 15, 2017

Great. Thank you.

@raphw raphw closed this as completed Feb 15, 2017
@raphw raphw reopened this Feb 15, 2017
@sdfelts
Copy link

sdfelts commented Mar 27, 2017

Running on version 1.9.5 with Jigsaw b162 with --permit-illegal-access.

I'm seeing the following warning.
WARNING: Illegal access by org.mockito.cglib.core.ReflectUtils$2 (file:gradle_cache/caches/modules-2/files-2.1/org.mockito/mockito-all/1.9.5/79a8984096fc6591c1e3690e07d41be506356fa5/mockito-all-1.9.5.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

Maybe related:
WARNING: Illegal access by net.sf.cglib.core.ReflectUtils$1 (file:gradle_cache/caches/modules-2/files-2.1/cglib/cglib-nodep/3.2.4/42c972dee25a436b32c6027e848287ff47ed6750/cglib-nodep-3.2.4.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

Is this fixed in 2.x? Or is there handling if this call fails?

@TimvdLippe
Copy link
Contributor

It might be fixed with Mockito 2 yes, as we are not using CGLib anymore. No promises though 😉

@sdfelts
Copy link

sdfelts commented Apr 4, 2017

I confirmed that the org.mockito.cglib.core.ReflectUtils is gone in 2.x and mockito no longer depends on net.sf.cglib.core.

@raphw
Copy link
Member

raphw commented Aug 5, 2017

Byte Buddy 1.7.2 now supports Java 9 class files.

@mockitoguy
Copy link
Member

Byte Buddy 1.7.2 now supports Java 9 class files.

Should we just bump bytebuddy to the latest version? Cheers!

@TimvdLippe
Copy link
Contributor

Closing as at last #863 has been fixed as well. Java 9 woohoo 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants