Skip to content

Conversation

@Dohbedoh
Copy link
Collaborator

@reviewbybees

@Dohbedoh Dohbedoh force-pushed the bugfix/actionscomplexvalues branch from 1d579d4 to c057362 Compare July 30, 2018 17:18
@Dohbedoh Dohbedoh requested review from aheritier and duemir August 3, 2018 07:45

@Test
public void testTriggerWithComplexActionValues() throws Exception {
String json = "{\"id\":12345678,\"title\":\"Test Trigger\",\"active\":true,\"position\":45,\"conditions\":{\"all\":[],\"any\":[{\"field\":\"comment_includes_word\",\"operator\":\"includes\",\"value\":\"@triggerTest\"}]},\"actions\":[{\"field\":\"notification_target\",\"value\":[\"1234567890\",[[\"key1\",\"value1\"],[\"key2\",\"value2\"]]]}],\"createdAt\":null,\"updatedAt\":null}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dohbedoh Maybe it's like this in others tests but couldn't we move them to resources files and load them to have a better readability ?

Copy link
Collaborator Author

@Dohbedoh Dohbedoh Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Note: the compact json is used for the last assertion of each test.

Copy link
Collaborator

@duemir duemir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs consideration.
Is there maven tooling we can add that would ensure backward compatibility?

}

public void setValue(String[] value) {
public void setValue(Object[] value) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The internal structure change is OK.
The problem, I believe, is changing the method signatures. The clients compiled against the older versions won't be able to use this new version because of class casting or method-binding issues if I understand correctly.
This, therefore, might need a major version bump.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past I used Clirr ( http://www.mojohaus.org/clirr-maven-plugin/ ) but I don't think it was updated to manage recent java versions. But for sure such tools are existing @duemir @Dohbedoh

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right I think this breaks compatibility. Although the signature change to a broader class... I am not sure at the moment how we could avoid this to fix that bug. Only solution I could think of is to use a custom Jackson serializer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrays are covariant in Java so the setter is probably not an issue.
The getter is what worries me since in the client's code there'll be an assignment to a String[] but the new code returns Object[]

Copy link
Collaborator

@PierreBtz PierreBtz Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember reading a solution for this kind of issue used by netbeans consisting of patching the bytecode.

Here you go: https://books.google.fr/books?id=VXKBgiD57lwC&printsec=frontcover&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false

Go page 44, google is kind enough to grant access to this specific page :)
Read the Mangling the Class file content section (read the full book if you have the opportunity it's rich :)).

@Dohbedoh Dohbedoh force-pushed the bugfix/actionscomplexvalues branch from b84f846 to 042b5bd Compare October 16, 2018 11:20
Copy link
Contributor

@aheritier aheritier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aheritier aheritier added this to the 0.11.0 milestone Nov 28, 2019
@aheritier aheritier merged commit cb359ab into cloudbees-oss:master Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants