-
Notifications
You must be signed in to change notification settings - Fork 583
Update dependencies for Java 11 support #952
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
Conversation
cc @thekingnothing |
191b6fd
to
00442da
Compare
Looks like some code no longer compiles with the new version of EasyMock. Will look into that later. |
cglib, bytebuddy and EasyMock.
00442da
to
7248e23
Compare
Hmm, compiling with the new
cc @henri-tremblay in case he has any thoughts. As an aside, 2.0.0-RC.2 does not include all the modules. For example: https://repo1.maven.org/maven2/org/powermock/powermock-module-junit4/ |
@ijuma the 2.0.0-RC.2 should not be sync to Maven central at all. I didn't add [ci maven-central-release] to comments. I wanted to wait for your pull request before releasing artefacts to the central repository. |
That makes sense with regards to 2.0.0-RC.2, thanks (I misread the build output). |
It looks like a call to |
@thekingnothing any thoughts on how to fix this? Otherwise, we can maybe stick to EasyMock 3.6 for now. |
That would be sad sad sad. I can have a look but in a couple of days. |
Usually, such exception happens when bytecode framework fails to track either stack map or local variables (it was main trouble for me when I started migrate to ByteBuddy).
Usually, upgrading to latest version of Javassist helps. However, as I see we are trying to use the latest version of Javassist.
I can create a test to check what bytecode transformation leads to the exception and then raise a defect for Javassist. Meanwhile, we can try to use previous version of Javassist.
Best Regards,
Artur Zagretdinov
On 31 Oct 2018, at 16:21, Henri Tremblay <notifications@github.com<mailto:notifications@github.com>> wrote:
That would be sad sad sad. I can have a look but in a couple of days.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpowermock%2Fpowermock%2Fpull%2F952%23issuecomment-434749346&data=02%7C01%7C%7Ca97fcc2326124e82352e08d63f4cf3f3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636765997068001410&sdata=7MMQzPhuJz%2FZuXpwbIHi%2BvsZo3yeBHcO4Dhw6d9xlds%3D&reserved=0>, or mute the thread<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMkKAPYTfKoD4ohiQo0e4sCC87i6GZsfks5uqc4YgaJpZM4X_N0K&data=02%7C01%7C%7Ca97fcc2326124e82352e08d63f4cf3f3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636765997068001410&sdata=QVbOZRqkDgZC3dWA%2FQKpQfp6BFb5EmLoMXBVdqFSeaE%3D&reserved=0>.
|
javassist 3.24.0-GA has been released, but using that results in more test failures:
The new failures are not particularly informative:
|
Which Java version are you using? Because I did a `gradle build` using Java
8 and 9, it worked nicely. However, with Java 11 is doesn't compile because
Activation has been removed.
BTW, is there a build and install notice somewhere? Because, for instance,
importing the project in IntelliJ doesn't create any module. Slightly
annoying.
Le sam. 3 nov. 2018 13 h 21, Ismael Juma <notifications@github.com> a
écrit :
… javassist 3.24.0-GA has been released, but using that results in more test
failures:
AnnotationUsageTest. annotationsAreEnabledWhenUsingTheJUnitRule[0]
AnnotationUsageTest. annotationsAreEnabledWhenUsingTheJUnitRule[1]
LargeMethodTest. largeMethodShouldBeAbleToBeMocked
LargeMethodTest. largeMethodShouldBeAbleToBeMockedAndThrowException
LargeMethodTest. largeMethodShouldBeAbleToBeSuppressed
LargeMethodTest. largeMethodShouldBeOverridden
The new failures are not particularly informative:
java.lang.NoClassDefFoundError: Could not initialize class org.powermock.api.easymock.EasyMockConfiguration
at org.powermock.api.extension.listener.AnnotationEnabler.beforeTestMethod(AnnotationEnabler.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.powermock.reflect.internal.WhiteboxImpl.performMethodInvocation(WhiteboxImpl.java:1854)
at org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:706)
at org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:415)
at org.powermock.modules.junit4.rule.PowerMockStatement.injectMocksUsingAnnotationEnabler(PowerMockRule.java:125)
at org.powermock.modules.junit4.rule.PowerMockStatement.evaluate(PowerMockRule.java:71)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#952 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABKRM_LNPQ81FPcV6t5V9GlhvNaTssdgks5urdCDgaJpZM4X_N0K>
.
|
@henri-tremblay, you may use |
As I see, the tests are falling only in case if PowerMock uses in agent mode. In addition, the tests are falling randomly when different EasyMock methods are called. This root cause of the java.lang.NoClassDefFoundError is that
|
The errors above were with Java 8. I had tried Java 11 first and got the activation issue too. I pushed the javassist upgrade to check what happens in CI. |
Interesting moment, that PowerMock should not modify EasyMock classes, but only load them with ucstom class loader. This logic is hardcoded in PowerMockClassLoader. |
CI after the javassist upgrade:
|
I thinking about ignoring agent's tests and create an issue to investigate what the difference between agent and class loader ways bytecode transformation. |
@thekingnothing When is agent mode used? |
@thekingnothing I pushed a commit that ignores the agent tests that were failing. |
9fce8f8
to
105fc3c
Compare
There are 3 ways use PowerMock.
1) Via jUnit runner and classloader - preferable way as PowerMock classloader so all feature available. However limited use with over jUnit runners, does not work with Jacoco online instrumentation.
2) via jUnit rules and class loader. Although PowerMock classloader is still used to load classes, a test class with all its dependencies are reloaded via serialisation to xml. So it’s around two times slower and have the issue that not all classes can be serialised.
3) jUnit rule and agent - not all features available as byte code modification is limited via agent. However, works with all jUnit’s runners and does not required serialisation.
I guess that agents tries to modify EasyMock classes, when class loader - not.
Best Regards,
Artur Zagretdinov
On 4 Nov 2018, at 17:34, Ismael Juma <notifications@github.com<mailto:notifications@github.com>> wrote:
@thekingnothing<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fthekingnothing&data=02%7C01%7C%7Cf54685ae74734ff988b308d6427bd4bf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636769496943182368&sdata=tI16v8beRwIZ2p1HJoTN1LDVnKQM5FrwJUJJ98eOeWI%3D&reserved=0> I pushed a commit that ignores the agent tests that were failing.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpowermock%2Fpowermock%2Fpull%2F952%23issuecomment-435689415&data=02%7C01%7C%7Cf54685ae74734ff988b308d6427bd4bf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636769496943182368&sdata=40hjfZn31OgEAAU7lb2qe2ZkTXY%2FbktRtmiSbs%2FhWA0%3D&reserved=0>, or mute the thread<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMkKADL6W32LQgDKKITpTERoIMZM1VtGks5uryU9gaJpZM4X_N0K&data=02%7C01%7C%7Cf54685ae74734ff988b308d6427bd4bf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636769496943338633&sdata=Wsa%2FpBD4y13jqzdyU%2Btb5cOajN4XBglXdl3Ihvo4hNA%3D&reserved=0>.
|
Thanks for the 2.0.0 RC3 release. Kafka has been updated to use it along with EasyMock 4.0.1: |
Thanks for your pull request. |
When using the powermock-module-junit4-rule-agent there are java.lang.VerifyErrors. For example if you have some project with Spock 1.0 and use use the rule, it works just fine. As soon as you upgrade to 1.2 or 1.3 which dropped Java 6 support, you get various of these verify errors. They are all about "Expected stackmap frame at this location.". I'm no Byte Buddy expert, but from what I have read, the combination of ClassWriter.COMPUTE_MAXS with ClassReader.SKIP_FRAMES is not the best idea. ClassReader.SKIP_FRAMES will skip reading and visiting stack maps and stack map tables. The JavaDoc of that attribute says it is for example useful if you use ClassWriter.COMPUTE_FRAMES as it recalculates the stackmap frames anyway, so there is no need to parse and visit them. But like it is currently, they are neither parsed, nor visited, nor computed and thus they are missing when verifying. As far as I understood there are two ways to handle this, either use ClassWriter.COMPUTE_FRAMES and ClassReader.SKIP_FRAMES, as then the frames are not parsed or visited, but recalculated, or do not use both as they are then parsed, visited and in the case of this visitor just copied. As the visitor only removes the final modifiers for methods and classes now, I renamed it, disabled even the MAXS computation and disabled the frame skipping. From my test it seems to work better with this setting now and also all your tests are green (except three tests that are red for me even without my changes). Fixes #1005 Probably fixes #956, #1024, #926, #549, #558, #873, #693, #543 Update: also re-enabled the tests that were disabled due to this error in #952 I think the exclusion of TestNG classes in commit e948b49 was also due to this error and could probably be reverted. Work-around: Use JVM option -noverify to disable the verification that complains about the missing stackmap frames.
cglib, bytebuddy, javassist and easymock.