Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Expose test data publicly #71
It is good style to also file a downstream PR with a snapshot dependency demonstrating how you would expect to use this new API in another plugin. I
referenced this pull request
Jun 13, 2017
I see no problem with the proposal since
setData() is already public.
The current code will expose the internal implementation, it needs to be wrapped by something like
Collections.unmodifyableList(). And you need to ensure there is no usages of the method. The latter one may be complicated, because it is package-restricted and hence may be used in other plugins due to the detaching from the Jenkins core (not sure if Jenkins bytecode transformer blocks it). Maybe creating another public method is the safest option. E.g.
Javadoc would be also useful
Thanks for your feedback!
Wouldn't set the collection to unmodifyableList kind of defeat the purpose which is to feed/modify data into this collection? (cf https://github.com/jenkinsci/junit-plugin/blob/master/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java#L185)
If we are to create a new method, maybe I can suggest switching from exposing the collection to adding an addTestData public method ?
If future developments show a need to actually modify already added data, then we could rediscuss about exposing the collection,
What do you think about this change in proposal?
Noted about javadoc!
It will, I should have read the PR description carefully