-
Notifications
You must be signed in to change notification settings - Fork 104
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
[JENKINS-67911] Stapler does not compile with Java 11 #343
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.
What is the intended way forward for view definitions? Are they supposed to call gettext("foo")
instead of _("foo")
after this change?
If so, do we expect developers to know about gettext to make the mnemonic connection, or would another name be better?
I could go either way on this one. No strong preference. |
I would not expect Groovy script authors to know about the new name. |
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.
Is there already text coverage for this function in-repo? I guess something in jenkins
would exercise it anyway.
Not that I can see, which is why I tested it manually. |
I am looking into making a unit test for this, hold on a bit… |
Can merge #344 into this, or merge that first and then merge in |
Done |
I thought about this some more and realized that maybe it is better to migrate callers over to avoid the risk that someday
I have opined in the past that I do not find code review feedback about naming to be all that interesting. It is very often a subjective matter. But also the style of this question is just not very conducive to the way my brain works. I have not intentionally been ignoring the question, but I find it difficult to have such conversations. The best way to get me to take action in a code review is to tell me that you don't like something, to explain the reason why you don't like it, and (ideally) to suggest a concrete solution or at least a concrete action item that I can take in order to drive resolution of the issue. This type of open-ended question- and discussion- focused code review is really difficult for me to navigate, as there is a lot of implicit communication (which is difficult for me). For example, when I read the question "would another name be better?" I can clearly tell that you have some sort of issue with the name, but it isn't clear to me what that issue is or how I could make you feel better about it. Whereas if you wrote something like: "I don't like the name A for reason X, and I think name B would be better for reason Y" then I would have something concrete to go on. |
@basil Thanks for your response. The name itself does not indicate a relationship to localization to me. I checked whether Now you may decide it's well-known enough, and/or that I'm an outlier with not seeing a relationship to localization, that's fine. Or that any name is better than (Besides the potential confusing around the purpose, it's also pretty close to |
Ah I see. When I first read this code, it seemed clear to me that Kohsuke's use of
And from the
So you can see the pattern here. So given the above, I thought it best to continue in the spirit of Kohsuke's design by evolving it in concert with how |
I also assumed you were following the GNU library convention (and I believe that was KK’s intent). As to whether we ought to advocate switching from |
Yeah, the further back you go in C/Unix history the more weird stuff you find. Such as |
FWIW I raised an issue here jenkinsci/design-library-plugin#15 to add some docs discouraging using them |
Problem
Compiling Stapler with Java 11 and
<release>11</release>
yields the following results:Solution
Rename the two _ functions as
gettext
, which is a valid Java 9+ identifier.For backward compatibility with scripts like this, define
_()
as a metamethod that delegates togettext()
.Testing done
Set a breakpoint in
gettext()
and verified I could hit it from the Configure System page after this PR just as I could hit the old_()
break point from that page before this PR.Also compiled Stapler successfully with Java 11 and
<release>11</release>
.Fixes #309