Module naming restrictions
Stephan Herrmann
stephan.herrmann at berlin.de
Tue Apr 25 11:49:20 UTC 2017
When you say "bug" do you mean
(a) the name of that automatic module should avoid any Java keyword, or
(b) Java keywords should be accepted as (part of) a module name?
Option (a) would require a change in the specification of ModuleFinder
whereas (b) currently conflicts with JLS 7.7 which clearly states
A module name consists of one or more Java identifiers (§3.8) separated by "." tokens.
While neither (a) nor (b) is fulfilled, libraries with a Java keyword in their name
simply cannot be used as automatic modules, right?
Stephan
On 25.04.2017 09:50, Remi Forax wrote:
> Seems to be a bug to me.
>
> Rémi
>
> ----- Mail original -----
>> De: "Rafael Winterhalter" <rafael.wth at gmail.com>
>> À: "jigsaw-dev" <jigsaw-dev at openjdk.java.net>
>> Envoyé: Mardi 25 Avril 2017 09:12:04
>> Objet: Module naming restrictions
>
>> Hello,
>>
>> I did another update of my libraries to support Java 9 and found out that
>> Byte Buddy cannot easily be used as an automatic module. It is published as
>> byte-buddy.jar to Maven Central where its automatic module name would be
>> byte.buddy. This does however not compile due to "byte" being a keyword in
>> Java. Here is what javac gives me:
>>
>> src/module-info.java:2: error: <identifier> expected
>> requires byte.buddy;
>> ^
>> 1 error
>>
>> I expect that this is not a common problem but not an uncommon one either.
>> Looking for artifacts named after Java keywords in Maven Central, you can
>> find quite a few.
>>
>> I do not know if this is technically feasible but I suggest that module
>> names should not come with any restrictions due to the historic freedom in
>> naming which would just cause confusion if some projects had to be renamed
>> just to satisfy the module descriptors restrictions.
>>
>> Best regards, Rafael
More information about the jigsaw-dev
mailing list