You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2016/12/26 21:24:58 UTC

[jira] [Comment Edited] (SOLR-9893) EasyMock/Mockito no longer works with Java 9 b148+

    [ https://issues.apache.org/jira/browse/SOLR-9893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15779005#comment-15779005 ] 

Uwe Schindler edited comment on SOLR-9893 at 12/26/16 9:24 PM:
---------------------------------------------------------------

Hi Mark,
I fully agree with you. I will keep this issue open as a blocker. I will first fix the remaining issues in Lucene and then check out all usages of mocking libraries. Unfortunately, as you said, we have multiple mock libs. But all have the same problem behind: CGLIB. The underlying issue is the static initializer of CGLIB's ReflectUtils. I will open a bug report on their Github account later.

Java 9 will (hopefully) be released this summer, so we should really work on solving the remaining Java 9 issues. From my participation in OpenJDK mailing lists.

One "quick'n'dirty" solution would be to add a command line option to the test runners in Solr only that opens "java.lang" for reflection (which is still possible). As this only affects tests and not production code, we may be able to live with this. I will also investigate that.


was (Author: thetaphi):
Hi Make,
I fully agree with you. I will keep this issue open as a blocker. I will first fix the remaining issues in Lucene and then check out all usages of mocking libraries. Unfortunately, as you said, we have multiple mock libs. But all have the same problem behind: CGLIB. The underlying issue is the static initializer of CGLIB's ReflectUtils. I will open a bug report on their Github account later.

Java 9 will (hopefully) be released this summer, so we should really work on solving the remaining Java 9 issues. From my participation in OpenJDK mailing lists.

One "quick'n'dirty" solution would be to add a command line option to the test runners in Solr only that opens "java.lang" for reflection (which is still possible). As this only affects tests and not production code, we may be able to live with this. I will also investigate that.

> EasyMock/Mockito no longer works with Java 9 b148+
> --------------------------------------------------
>
>                 Key: SOLR-9893
>                 URL: https://issues.apache.org/jira/browse/SOLR-9893
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Tests
>    Affects Versions: 6.x, master (7.0)
>            Reporter: Uwe Schindler
>            Priority: Blocker
>
> EasyMock does not work anymore with latest Java 9, because it uses cglib behind that is trying to access a protected method inside the runtime using setAccessible. This is no longer allowed by Java 9.
> Actually this is really stupid. Instead of forcefully making the protected defineClass method available to the outside, it is much more correct to just subclass ClassLoader (like the Lucene expressions module does).
> I tried updating to easymock/mockito, but all that does not work, approx 25 tests fail. The only way is to disable all Mocking tests in Java 9. The underlying issue in cglib is still not solved, master's code is here: https://github.com/cglib/cglib/blob/master/cglib/src/main/java/net/sf/cglib/core/ReflectUtils.java#L44-L62
> As we use an old stone-aged version of mockito (1.x), a fix is not expected to happen, although cglib might fix this!
> What should we do? This stupid issue prevents us from testing Java 9 with Solr completely! 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org