Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are terminating digits forbidden in module names? [duplicate]

I am trying to run below code using jdk-9 but facing problem when compile using command

Command

 javac -d mods .\module-info.java com\nirav\modi\Test.java

Error

.\module-info.java:1: error: class, interface, or enum expected
module module1 { }
^
1 error

module-info.java

module module1 { 

}

Test.java

package com.nirav.modi;

class Test {

    public static void main(String args[]){

        System.out.println("Hello Modular...");

    }

}

package structure is like below

module1\module-info.java
module1\com\nirav\modi\Test.java

JDK Version

java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+153)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+153, mixed mode)
like image 577
NIrav Modi Avatar asked Dec 14 '25 12:12

NIrav Modi


2 Answers

Per the Jigsaw Issues List, a module name cannot end with a number. The purpose is to discourage authors from encoding version numbers in module names.

like image 164
Jason Avatar answered Dec 16 '25 05:12

Jason


JSR 376 is not final yet and there are several topics still under discussion. The latest proposal on the #VersionsInModuleNames topic is here:

http://mail.openjdk.java.net/pipermail/jpms-spec-experts/2017-March/000659.html

like image 22
Alan Bateman Avatar answered Dec 16 '25 04:12

Alan Bateman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!