引用自this source ,它提到了
The name of the directory containing a module’s sources should be equal to the name of the module, e.g. for de.consol.devday.service
考虑到文件夹名称受到操作系统的字符限制(例如 Windows 的最大长度为 255)并且这可能会限制我们如何命名文件夹和模块,这是一个好的建议吗?
希望Java核心团队的人能够对此发表见解并提供建议。
引用here中的另一个例子:-
模块名称跟随文件夹名称,文件夹名称受 255 个字符限制,是否可扩展?
在实际代码中,很可能文件夹名称可能不会达到该限制,但是应该在官方 Java 文档中提到这种限制以考虑这种方式(也许有?或者有人可以指出如果是的话? )
谢谢
最佳答案
虽然我不像你想象的那样来自 java 核心团队,但是 The State of the Module System读起来是这样的 -
A module declaration is compiled, by convention, into a file named module-info.class, placed similarly in the class-file output directory.
操作系统的字符限制可能会限制我们如何命名文件夹和模块,但理想情况下,恕我直言,即使 255 个字符也足以规定任何良好的命名约定和设计。
补充一下,module-info.java
声明与现有的 package-info.java
类似(模块与包)。声明,但后者仅用于文档目的。
关于java - Java 9 中文件夹/目录名称为模块名称是否存在问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46460013/