RFR: 8297444: Refactor the javacserver build tool [v2]

Erik Joelsson erikj at openjdk.org
Tue Nov 22 23:55:19 UTC 2022


On Tue, 22 Nov 2022 23:32:51 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> make/langtools/tools/javacserver/client/Client.java line 148:
>> 
>>> 146:         cmd.addAll(Arrays.asList(conf.javaCommand().split(" ")));
>>> 147:         // javacserver.server.Server is the server main class
>>> 148:         cmd.add("javacserver.server.Server");
>> 
>> Did you consider referencing the class name using `Server.class.getName()`?
>
> No, can't say I have. Do you think there is anything to gain by doing that? (Apart from possibly getting this right automatically if the class is renamed by IDE tools) (I'm not sure it would be a win in readability)

I like to reference class names that way so that it's typed instead of just a string. If the class changes name, you get a compilation error, and the IDE would handle refactoring automatically. Not a strong need in this particular instance, just something I generally tend to do.

-------------

PR: https://git.openjdk.org/jdk/pull/11298


More information about the compiler-dev mailing list