Closed FroMage closed 8 years ago
So it has parts of:
java.base
java.desktop
java.jdbc
javax.xml
And the base Android stuff.
So this would be one module that you import instead of java.base
etc., and which contains all those packages?
It's not entirely clear yet. For one thing it does not actually contain these modules entirely, just parts of them. It's also unclear what version of the last three it provides, and I strongly suspect it depends on the Android version.
I suppose we could make the Android jar "provide" all these modules, like the JDK provides modules out of the bootclasspath. This way, users of those modules would not need to import the autonomous modules.
OTOH https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html suggests that the HttpClient on Android is outdated, so perhaps we should hide it?
And http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client claims it was removed (though I still see it in the jar).
Would we need extra "JigSaw" module/package lists? And would we then select the active one depending on the runtime? Because it seems that an import of "java.base" would mean something different from one case to another. There might be extra modules and others might be missing. Also the compiler should be able to warn when you try to import a module that's part of the JDK and not Android, etc etc. No?
ATM we do JDK module detection based on the running JVM. We can't detect Android since it's not a VM. I think we should add a new flag like --java-language-provider android/23.1.1
which would require that module to be in the module repo and treat it as the source of all JDK modules that exist in there. It would also reject imports of non-existent modules such as java.rmi
, and hopefully also consider that java.desktop
only contains a single package.
That flag would apply to (at least) the JVM compiler and tools like import-jar
.
I think we should still require explicit module imports for the JDK modules and junit/httpclient even though they're in that Android jar.
OTOH this may very well also impact the runtime via the metamodel and so there should also be a way to configure this flag via an API in Main
or other that we can call from the running Android program.
Related #1542
Done.
Android comes with its own JDK which contains the following packages: