-
Notifications
You must be signed in to change notification settings - Fork 127
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
Bytecode modifications for object versioning #3091
Comments
Hi! I think I've already done most part of the feature. But I've just noticed that I don't understand why annotation
|
@SevyConst it's an our mistake, thank you. It the result |
@SevyConst if you took this task, it would be better to assign you to the ticket so nobody else touches it. |
@maxonfjvipon yes, it would be great |
@SevyConst the larger pull request - the harder it would be for review. I strongly recommend you to break it down into at least two steps. It would be easer for you to get your changes merged and for us to review it. |
Ok, I will do it |
Hi, @maxonfjvipon I wrote the integration test. It contains more than 1k lines, because the testing is very important for such core thing as versioning. I got stuck with qulice - there are 926 violations only in the test, though I had tried to write code in your style. Could you please recommend some tools for reformatting? |
@SevyConst that's the reason I recommended to split the task into the small peaces) |
@SevyConst sometimes IntelliJ IDEA auto-formatting helps |
…mployment Test (Konstantin Lopatko) Preview - what has been done at the current moment. - Add ASM library. You are already using it inside ByteBuddy (Mockito dependency) - Integration test is ready except code style. - Bytecode modification works as described in the issue
@yegor256 @maxonfjvipon thank you for answering. I have just made a pull-request so you can see what have been done at the current moment. That’s why I added not only the integration test but also a Mojo class. Please see the description of the pull request for more details. I also just have made some auto-formatting by IDEA but I don’t got into the details due to lack of time. Unfortunately, I will not have much time in the next 10 days |
One of the parts of the #1602 implementation is bytecode modifications.
We need separated standalone mojo in
eo-maven-plugin
.The parameters of the mojo:
Algorithm of the mojo:
.class
files.class
files@Versionized
annotation is used. Let's call this listL
.L
:3.1. modify corresponding
.class
file by appending hash (see parameters of the mojo) in front of every object usage from the listL
(ifA.class
contains the usage of objectorg.eolang.B
and objectB
inorg.eolang.B.class
has@Versionized
annotation, inA.class
this usage should be replaced with$hash.org.eolang.B
, see example)3.2. save modified
.class
file to output directory appending hash in front of relative path (if we modifiedorg/eolang/A.class
, it should be saved to output directory as$hash/org/eolang/A.class
)3.3 if object usage is not in the list
L
- it should not be modified in the.class
fileExample
input directory:
target/classes
output directory:
target/modified-classes
hash:
qwerty
Before
A.class (decompiled to java)
B.class (decompiled to java)
C.class (decompiled to java)
After:
A.class (decompiled to java)
B.class (decompiled to java)
C.class (decompiled to java)
Implemented mojo + integration test that confirms that mojo works = resolved issue.
The issue may be done in several steps (you may use less or more):
@Disabled
annotationThe text was updated successfully, but these errors were encountered: