-
Notifications
You must be signed in to change notification settings - Fork 121
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
Entity Provider for java.nio.file.Path #1275
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I see no reason not to add this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon further review: I have some comments/questions.
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/spec/filter/interceptor/JAXRSClientIT.java
Outdated
Show resolved
Hide resolved
* interceptors when mapping representations to Java types and vice versa. | ||
*/ | ||
@Test | ||
@Tag("xml_binding") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: All of these tests (including what was added here) have this @Tag
. Do they really all require xml_binding
? If not then this may be a problem (even for Jakarta Rest 4.0) since xml_binding is no longer required by the Platform, so none of these tests will run assuming tests tagged this way will be excluded. This applies to all new tests in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, given Jakarta XML Binding is no longer required, implementations won't need to run these effectively allowing implementations to pass without even implementing the feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually did a 1:1 copy from the "file" originals, just replacing "file" by "path". So I assume that why you mention was already wrong before. I hence kindly ask to separate that discussion from this PR, and address that issue in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've written Issue 1277 to document this. However, I don't see the point of adding additional tests that will not run. I understand that you may not have time to evaluate/address all of the tests in this class, but any new that you add should not have that dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what is the correct solution?
- Simply removing
@Tag("xml_binding")
from the added test? - Not adding the test at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked these tags and need to say that I would prefer to keep them as part of this MR as we should not mix two otherwise independent issues. The point is that this issue is solely a 1:1 copy of existing code, and there is already a plan to fix that existing code, so then it should be easy to fix these copies in one shot. The problem with fixing this MR upfront simply is that they are embedded in a larger framework, and it is that larger framework that depends on JAXB. So a fix of the test copies is impossible without fixing the original tests in the same commit. As there already are plans to fix those original tests eventually, it makes not much sense to mix things here and make my life in this MR harder than essentially needed.
Having said that, please let's fix the tags later so we can simply and easily proceed here. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point Markus. As long as Issue 1277 is addressed prior to the next release. Can you confirm that the new TCK tests you've added have run successfully (since they currently would be skipped as part of a Jakarta Rest 4.0 TCK execution correct?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should be adding new TCK tests that don't run. It kind of defeats the purpose of a test. While I can understand that's how the old tests work, there's not reason to make new tests work the same way. There could very easily be a new jsonContent
instance variable created that these tests use. I see no reason for it to to be XML content. It could even be plain text.
There would be new interceptors needed too, but again IMO that's not really a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jim-krueger I cannot confirm that they run, as there is not yet any implementation that fulfils the new API (or maybe I misunderstood your question).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamezp For me it is a big deal, as it imposes unnecessary work for me now and it imposes a temporary deviation from the original code, which I want to prevent as good as possible. OTOH as you feel this is not a big deal, maybe you like to chime in and fix #1277 upfront, so I can rebase on the already fixed code base in a second step? We can leave open this PR for the time being. WDYT?
Will answer open question ASAP, unfortunately CORONA hit me, so it might take a few days. Sorry! |
Get well Markus, no rush. Also, it seems like now would be a good time to create a release plan for 4.1 (or 5.0 if needed) and add this to it. @spericas / others, do you concur? |
Do we have any release drivers for 4.1? |
As long as we all commit to really getting 5.0 thru the door in time, then I have no driver for 4.1. Looking at how things worked out in the past months, I doubt that this time it will work out better than the years before, so maybe we should start with 4.1 instead of 5.0... |
Kindly asking everybody to vote on this PR. Thanks! :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What is the real benefit in natively supporting |
Besides migrating JAX-RS's API to modern Java, it mostly is performance (not necessarily speed, but mostly power savings). In short, there is a huge difference how a file is handled by the JRE (all work done by JRE) internally to how a path is (if any possible, all work offloaded to OS). Falling back to files, when you actually have a path, is squandering valuable resources. In modern Java, nobody should ever go with file but always with path. If you are interested in more details, we should spin-off the thread. |
@jansupol How does Jersey handle |
From what I gather, the implementations for Path and File are basically identical:
Based on this, it's difficult to justify the advantages over the costs of needing to update all implementations, docs, etc. that this PR proposes. |
No need to convince me. It was me who wrote "PathProvider". In fact, I would even go as far to say that support for "File" should become deprecated eventually. It simply is dead legacy. As an OpenJDK NIO2 contributor I like to make everybody understand that "File" is a rather outdated concept, while "Path" is what every new software should go with. The difference is not what Jersey does, but what the JRE does. For those interested in the details, I would be more than happy to explain in a separate thread. Edit: The core idea of this MR is to modernize JAX-RS, and using "Path" should be a no-brainer, actually. Sticking with File but not supporting Path is simply ridiculous and draws a picture of an old man's ancient not actively maintained API. |
From an API perspective, I understand that |
Santiago, I think there is a misunderstanding, so let me clarify -- even if I still think that it would be better to start a new thread elsewhere, as this explanation is partly off-topic IMHO as it is about OpenJDK and Jersey, not about JAX-RS. Maybe my reasoning was misleading. I do not see why you link this PR with my current implementation inside Jersey in particular (which is something which might change further over time, and which I actually changed in the NIO2-area several times just recently, so for this PR it plays absolutely no role how good or not-so-well done my solution in Jersey is currently or will be in future); the idea of this PR is to allow optimized implementations, which might or might not happen eventually or might or might not exist currently. Current Jersey itelf might or might not experience a benefit from Looking at OpenJDK's source code of
Jersey: I already optimized Jersey (at least in part) for NIO2, i. e. for native use of Regarding your non-technical arguments, I like to say the following:
|
The discussion is very much about JAX-RS, the side note about implementations was prompted by your performance claims.
JAX-RS implementations drive the JRE, the JRE does not drive itself. I'm not opposed to this new feature, but as I stated above, I'm not convinced it is worth the effort. Hopefully others can comment and we can proceed with it. |
Given we support the File, I would not want to restrain the customers from using NIO API, On the other hand, I see the real usage of Path much lower than the usage of the Status Codes defined in RFC 9110, which still did not make it to Jakarta REST |
Now that we all have exchanged our personal opinions, in the name of modern Java, I do beg all committers to vote +1. Thanks. |
Closing #1274
This pull request provides the needed changes in the spec document and the TCK to support
java.nio.file.Path
entity providers.