Skip to content
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

Rename Record to avoid name clash with java.lang.Record #99

Closed
maffe opened this issue Mar 31, 2020 · 4 comments
Closed

Rename Record to avoid name clash with java.lang.Record #99

maffe opened this issue Mar 31, 2020 · 4 comments
Milestone

Comments

@maffe
Copy link

@maffe maffe commented Mar 31, 2020

Java 14 introduces java.lang.Record. If that name is kept in future Java versions, org.xbill.DNS.Record should be renamed to something else (for example, DnsRecord) to avoid having to reference org.xbill.DNS.Record by its fully qualified name on each usage.

(While we’re at naming: the package name should be lowercase as uppercase letters indicate a class name.)

@ibauersachs
Copy link
Member

@ibauersachs ibauersachs commented May 2, 2020

The package name is unfortunate. It has been like that for 20+ years, which is why I'm probably not going to change it until it breaks.

As for Record, this is really awful. Putting such a generic new name into java.lang will break sources for hundreds of projects. I'll keep this in mind for v4 if the JDK sticks with it into an LTS version. However, I hope they'll reconsider and use a different package or name.

@ibauersachs ibauersachs added this to the v4 milestone May 2, 2020
@demonti
Copy link
Contributor

@demonti demonti commented May 8, 2020

Regarding the "records" extension: Maybe I am missing something, but I do not see a big problem at the moment. It is not forbidden to use a name of a class, interface, enum or exception of java.lang package in any other package. One still can reference the java.lang item by using the package prefix if needed. Additionally, the java.lang.Record class will only be rarely directly used. Only if one imports the dnsjava classes via a wildcard import problems will occur, but this is a bad practice anyway. A problem could occur due to the new "record" keyword, as the code frequently uses "record" as an identifier. However, the specification tells that it is not a real keyword like "class", but a "restricted" identifier with a special meaning in some contexts. So in respect of the records, I am confident that no big changes need to be made.

@maffe
Copy link
Author

@maffe maffe commented May 8, 2020

Okay, after adding import org.xbill.DNS.Record; manually I can use it like in previous Java versions. I’m a bit spoiled by my IDE, it didn’t offer adding the import as usual but instead complained about the method missing in java.lang.Record. Maybe I should file a request for improvement there.

@ibauersachs
Copy link
Member

@ibauersachs ibauersachs commented Jun 22, 2020

I'm closing this in favor of @demonti's explanation, the big changes this would cause inside the library and for consumers, as wells as Java 14's release notes: https://bugs.openjdk.java.net/browse/JDK-8236439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.