Why doesn’t Java 9 simply convert all jars on the classpath to automatic modules?

To understand our categories:

>Platform explicit module > Application explicit module > open module > automatic module > unnamed module

All classes and jars in the classpath will be part of the unnamed module But why do we need anything? What are the advantages of automatic module? I can "ask" those damn traditional cans to make them an automatic module Didn't I include it?

Solution

There are at least two reasons:

>As with conventional modules, some checks of the module system by the automatic module are suspicious, such as not splitting packages Since jars on the classpath can (and occasionally) split packages, checking them will be backward compatible and will destroy many applications. > Unnamed modules can read all platform modules, while automatic modules can only read those modules that enter the module diagram This means you need Java Jars for desktop modules (for example) will work from the classpath, but not from the module diagram, unless Java Desktop also places it in the graph (via dependencies or – add modules)

I don't have time to check the second one now, but this is what the state of the module system says:

The solution applies to declared dependencies, and automatic module declaration is none

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>