Use ByteBuddy to instrument classes instead Javassist #727
Comments
Refactoring MockClassLoader - extract Javassist relative code to a new classes. Signed-off-by: Arthur Zagretdinov <arthur.zagretdinov@outlook.com>
Refactoring MockClassLoader - extract Javassist relative code to a new classes. Signed-off-by: Arthur Zagretdinov <arthur.zagretdinov@outlook.com>
Refactoring MockClassLoader - extract Javassist relative code to a new classes.
Refactoring MockTransformer - split transformer to set of small classes.
Refactoring MockClassLoader - extract Javassist relative code to a new classes.
Refactoring MockTransformer - split transformer to set of small classes.
Hi, When this is supposed to be ready? |
Hi,
I hope I will finish by the end of June. I've created an issue for ByteBuddy project to clarify what is possible to do with using ByteBuddy (raphw/byte-buddy#296).
Best regrads,
Arthur Zagretdinov
On 26 Apr 2017, at 10:49, fabriziomieli <notifications@github.com<mailto:notifications@github.com>> wrote:
Hi, When this is supposed to be ready?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#727 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMkKAFdZCxJDidiRZ435ivYLJgm0Tsbyks5rzwUkgaJpZM4LBFW1>.
|
Thank you very much |
Implement modifiers related transformer Signed-off-by: Arthur Zagretdinov <arthur.zagretdinov@outlook.com>
Implement static initialiser transformer Signed-off-by: Arthur Zagretdinov <arthur.zagretdinov@outlook.com>
Refactoring MockClassLoader - extract Javassist relative code to a new classes.
Refactoring MockTransformer - split transformer to set of small classes.
Implement modifiers related transformer Signed-off-by: Arthur Zagretdinov <arthur.zagretdinov@outlook.com>
Implement static initialiser transformer Signed-off-by: Arthur Zagretdinov <arthur.zagretdinov@outlook.com>
Fix issues after merging with master
Will you release this feature when it is ready or only as part of PowerMock 2.0? |
I'm going to release it as part of PowerMock 2.0, because the change for ButyBuddy is close intertwined with clearing PowerMock from copy-pasted mockito code. |
The 2.0 release looks quite big so I guess the earlier estimate of end of june (you did mean 2017, right?) will be pushed back quite a bit? |
Thanks for the update. For background, enterprise users like myself are moving ahead with newer java releases which now release every six months. For existing unit test bases that use powermock, we have to either switch to 2.x or hold our entire unit test bases to older java versions.
Thanks for the clarification. I only found the source tag but not any released binaries. Up until now, I've always pulled powermock releases from maven central, including the latest 1.7.4 release from April. Are you no longer releasing binaries to maven central for 2.x? Was this intentional or an oversight? Or should users stop using maven central and use the maven repository from bintray instead? |
It was done intentionally as I don't want to span Maven Central with a lot of beta version. PowerMocks migrated to continue delivery, so it means that each pull request merged to release branches is being published to a repository as an artifact. However, I understood that could development PowerMock 2.0 could take a lot time (not so many as it already has taken), I decided to split beta release to Bintray and GA release to maven central. |
I'm excluding this feature from PowerMock 2.0.0 as working on it took to many time and I'm not able to finish it in near future. I will release PowerMock 2.0.0 with all changes and full supporting Mockito 2.x and then will continue work on this feature as a part of PowerMock 3.x where I will drop supporting Java less than 1.8 |
@thekingnothing |
) Preparing PowerMock 2.0 Release without ByteBuddy * Remove all ByteBuddy Classloader code (#727) * Fix tests * Update Libraries
@thekingnothing, I notice ByteBuddy changes backed out as part of PR 948. Then I saw PR 910 mentioned in the release notes 2.0.0 RC1 but I assume this is just referring to what you had backed out. However, I still might not be understanding these changes correctly. Can you clarify what is or isn't being included with respect to ByteBuddy for the 2.0.0 release? I am primarily concerned about java version support. My organization needs to be able to support new Java releases as they come out, which is now every six months. Based on my observations, this appears to depend on which version of what byte code library being used, ByteBuddy vs Javassist. For example, I seemed to be able to do static mocking in Java 11 with PowerMock 2.0.0 beta 11 with Mockito 2.23 and ByteBuddy 1.9. So, if PowerMock 2.0.0 switches back to using Javassist then will static mocking no long work in java > 8 again? To support new java, such as java 11, will I be able to switch to the 2.0.0 release or should I should stay on beta 11 or use later a 3.0 snapshot with preliminary ByteBuddy support re-introduced? |
With PowerMock 22 using Javassist again, it looks like PowerMock would only work with Java 9 but not 10 or 11. At least, the pom.xml for PowerMock 2.0.0-RC.2 shows a dependency on Javassist 3.22.0-GA which looks to support Java 9. Perhaps it be possible to use PowerMock with Javassist 3.24.0-GA for Java 11 support instead? Previously, with PowerMock 2.0.0 beta 11, I was able to use ByteBuddy 1.9 for Java 11 support. |
I agree that ByteBuddy is a great well-supported library. However, it does not cover all PowerMock needs, at least for now. It’s well applied when you need advice your code or generates a code. However, to support such features as constructor stubbing, mocking constructor calls or mocking System class I have to modify bytecode in instruction level where ByteBuddy features end. I have only one option - use ASM in addition to ByteBuddy. As it means that I have to:
As result, it takes a lot of time to implement the features that already worked with Javassist. I tried to implement it for 6 months, however, with a time that I can give to PowerMock I did not achieve a big progress. The task is too complicated. You need fully focus on it - what hardly achievable when you work for 30-60 minutes per day. I’m not going to stop working at all on migrating to ByteBuddy. I just changed priorities to be able to release what was already implemented the year ago. At the end of the day, my decision is aimed to be able to deliver supporting new Java. Thank @ijuma, he provided the pull request to support Java 11 (#952) and @eolivelli who raised the pull request with the fix for Java 12 (#939). |
Is this issue still on the table? |
I understand it so that ByteBuddy should be on the table. Without it the JaCoCo report would not cover these tests with PowerMock or Mockito. At least this is my understanding, and some people would see other reasons especially internal ones in PowerMock. |
Is this issue still on the table? |
Is this issue still on the table ? we do have any alternative approach. Thanks |
How is the current state of this? |
Hello, Just another user affected by the 'zero' JaCoCo results with Powermock If so can somebody do the following:
|
The PR #911 that says fixes this issue is unrelated and must be a typo in the commit message. As a user eagerly awaiting online instrumentation I thank you for all the hard work towards this goal. |
Hello ByteBuddy implementation will be in your next release ? |
Really looking forward to the ByteBuddy release to fix the Jacoco problem. |
Looking forward to ByteBuddy release |
Really looking forward to the ByteBuddy release |
1 similar comment
Really looking forward to the ByteBuddy release |
Really looking forward to the ByteBuddy release. I want to use JaCoCo and Powermock comfortably. |
Been watching this thread for over a year. |
any progress with this issue? |
The main issue with Javassist it's that it read classes from disk before instrumenting. Such behaviour breaks compatibility with other tools which are instrumenting classes (see discussion jacoco/jacoco#51)
ByteBuddy could help us to resolve the issue and supporting online Jacoco Instrumenting.
ByteBudy agent has to be used for implementation of powermock-agent
The text was updated successfully, but these errors were encountered: