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
Use HTTP constants instead of hard-coded strings #132
Conversation
Hello Tareq and thanks for this cleanup task. Is it possible to use static import ? It will be easier to read Thanks |
+1 |
Hi @benoitf, |
Hi Tareq, Sure we can discuss about that. Now developers are familiar with static import and it's trivial as well About finding from where the constant come from, you only have to hit the keyboard on your IDE as well Also to focus on the PR, reading POST in a JAXRS command, we don't need to see the Class directly as we know that value behind. but reader don't need to see as well the full package |
e642936
to
e6abd9b
Compare
Hi @benoitf I think we have a misunderstanding regarding the tests. I actually did agrees with you on this in my previous comment, simply because static imports of asserts is the de-facto standard way. Convenient enought. Regarding our issue. I intentionally mentioned formal in my previous reply, that's why I'm afraid any reliance on IDE capabilities is a questionable tolerance. The majority of the common commit reviewing tools (Gerrit, Git GUI, GitHub itself, ...) are straight forward and do not provide semantic referencing. Constant name is too short, fully qualified class is too long, so a standard class-field seems sound and even if we do tolerate due to IDE capabilities this won't be major factor because the IDE would distinguish HttpMethod of different packages. I guess Che's code itself is a good reference point, it is written with the common class-field notation. |
yes but short constants like GET, POST with kind of explicit content, they're commonly considered as static import. As in general the class prefix is useless as they will mostly provide the same value |
Hi @benoitf, |
I would say that static import is logical when you know the definition of the constant without the class notation. |
Hi @benoitf, I do get your point, let's converge on this issue. Given my previous explanations, do we have real-world project where this is accepted as a cross method for using such constants? let's agree that that spotify isn't, per my last reply. We also keep in mind that the bulk of Che's existing code isn't written this way. Since the discussion is on a less hard-technical issue I would like to have more than four eyes involved, this should be much beneficial for everyone. |
sure let's vote or let others speak about their thoughts |
@tareqhs plz comment https://dev.eclipse.org/mhonarc/lists/che-dev/msg00554.html |
Hi, |
Content-Type, application/<type>, test/plain, Content-Disposition, Method Added ExtMediaType to commons-lang for extended MediaType constants Signed-off-by: Tareq Sharafy <tareq.sharafy@sap.com>
e6abd9b
to
7e70386
Compare
looks like it's developer choice to use static import so it's gonna be accepted |
ok for merge. |
merged manually with a rebase |
also merged on 4.0 branch with cherry-pick |
Content-Type, application/, test/plain, Content-Disposition, Method
Added ExtMediaType to commons-lang for extended MediaType constants
Added "zip" and "tar" constants to builder
Signed-off-by: Tareq Sharafy tareq.sharafy@sap.com