module java.measure { | |
exports javax.measure; | |
exports javax.measure.format; | |
exports javax.measure.quantity; exports javax.measure.spi; | |
uses javax.measure.spi.ServiceProvider; | |
} |
module java.measure.minimal { | |
exports javax.measure; | |
} |
I don't think that we need "compact" profile. For me, optional parts in the specification only means that implementors do not need to implement the optional interfaces. The interfaces can be present in the JAR file but ignored.
Splitting JSR-363 API in many modules would pollute the module path with tiny modules (~5 kb) for no benefit I can see:
Le 16/04/2017 à 22:59, Werner Keil a écrit :
As we aim for 1.1 as a possible MR1, please for everything that you or others share on GitHub, let's use 1.1-SNAPSHOT for such experiments.
Sure, I will stay on SNAPSHOT and not use anything that looks like a release.
Martin
--
You received this message because you are subscribed to the Google Groups "Units Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to units-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
module my.uom.minimal { | |
exports javax.measure; | |
} |
I agree with Martin that we can have all interfaces in a single "API" module, and/or all interfaces + the required implementation as a single "required" module, and optional interfaces can come as the implementer wants (single or multiple modules).Regards,Leo.
Le 17/04/2017 à 22:27, Werner Keil a écrit:
> But the only required interfaces ARE those in the root package
> javax.measure:
>
Yes, but it does not means that the other interfaces can not be in the
same JAR file and just ignored by implementers.
> It would be rather sad and undermine the whole idea of compatibility
> if we left defining modules that match the 6 Profiles up to
> implementations.
>
This is only one aspect of compatibility. It is TCK role to verify if an
implementation is compliant with a profile, together with many other
requirements that can not be enforced by modularization.
> The difference in Java 9 is, the packages that you don't need are not
> "ignored" (but still usable because they are publicly visible) they
> are INVISIBLE in profiles and downstream apps that don't want to use them.
>
It is not sure that we will need to split in different modules for that
(it was not necessary at least in early proposal of Jigsaw). But even if
we lost the possibility to hide non-implemented interfaces, I think that
having visible interfaces has less inconvenient than
over-modularisation. I would agree about creating a module for each
profile if they were relatively large, but in JSR-363 case the modules
would be so tiny (e.g. 2.8 kb for javax.measure.format), I think that if
everyone was doing that we would replace the "classpath hell" situation
by a "module path hell". I don't think it would be in the interest of
Java ecosystem.
Le 18/04/2017 à 15:22, Werner Keil a écrit :
> But the only required interfaces ARE those in the root package
> javax.measure:
>
Yes, but it does not means that the other interfaces can not be in the
same JAR file and just ignored by implementers.
That was the case with all those "sun.misc.unsafe" packages they were supposed to be ignored by implementors, yet they were used by a large portion causing this "unsafe hell" which forced Oracle to even make it available though its JDK team originally intended to hide it:
Werner, this has nothing to do with our case!!!! sun.misc.unsafe has never been part of any public specification and was not supposed to be used by anyone outside JDK, under any circumstance. This example has nothing to do with optional API!
Again, unless Jigsaw was made available on a future Java ME, it is not about sizeIt's about defining proper modules for developers who want to add only what they need.
We don't need to split unit API in many modules for that. It
changes nothing to the fact that developers can implement only
what they need.
They are not just for the TCK, so whatever Jigsaw allows us to do, if we can define at least 6 of those 7 profiles ("SI Quantities" could be hard, I am not aware, that Jisaw allows to export just 7 distinct classes, but maybe it does?) via appropriate modules.
Fine for defining different profiles, but why those profiles
would need to be defined as different Jigsaw modules? I don't
think that visibility of one interface is a sufficient reason.
Many modules in the JDK have optional operations (e.g. JDBC is
full of optional features, with java.sql.DatabaseMetaData
describing what is supported); they do not split each of them in
separated modules for that reason, otherwise we would get an
explosion of modules amount.
Martin
Le 18/04/2017 à 22:21, Werner Keil a écrit :
We already extend the core with the "quantity" package. Which is optional for a good reason, so in a "base", "minimal" or "compact" profile/module it shouldn't be there.
I do not question the fact that some interfaces are optional. But being optional does not necessarily require being a separated module.
As for the java.sql example just look at the JDK sources (...snip...):
"java.sql.rowset" is a 207 kb module compared to 76 kb for the core "java.sql" module, so this separation makes a lot of sense for the common case when we need only the core JDBC interfaces. Such separation does not make sense for JSR-363, where for example "javax.measure.format" is only 2 kb.
I disagree about saying that modularization is not a matter of size. We do not split in different modules just because we can. We split in different modules when it is possible and it can save a significant amount of dependencies in common use cases.
So every package or small group of packages that are self-contained define their own module.
This is not my reading of JDK practice. The
"javax.transaction.xa" package is included in "java.sql" module
even if it could have been separated. The
"javax.sql.rowset.serial" package is included in "java.sql.rowset"
module even if it could have been separated. The
"javax.naming.ldap" package is included in "java.naming" module
even if it could have been separated. Etc. etc. etc. Many JDK
modules have packages that could have been in a separated module.
JDK does the same for sub-packages like java.util.logging
Logging is challenged by competitors (Log4J, SLF4J, etc.) and have been abstracted by the new System.Logger interface. Do you expect JSR-363 to be challenged by competitor API? (I'm not talking about implementations).
To summarize again: well though modularisation is nice, but
over-modularisation has inconvenient: it pollute the module path,
increase the risk of version mismatch and requires extra attention
from the developers. Those inconvenient have to be compensated by
advantages. In the case of JSR-363, there is none except hiding
non-implemented interfaces. This hiding is not a sufficient reason
in my opinion; the JDK has many interfaces that are
unconditionally provided and documented as optional.
Martin
Le 18/04/2017 à 22:21, Werner Keil a écrit :
We already extend the core with the "quantity" package. Which is optional for a good reason, so in a "base", "minimal" or "compact" profile/module it shouldn't be there.
I do not question the fact that some interfaces are optional. But being optional does not necessarily require being a separated module.
As for the java.sql example just look at the JDK sources (...snip...):
"java.sql.rowset" is a 207 kb module compared to 76 kb for the core "java.sql" module, so this separation makes a lot of sense for the common case when we need only the core JDBC interfaces. Such separation does not make sense for JSR-363, where for example "javax.measure.format" is only 2 kb.
I disagree about saying that modularization is not a matter of size. We do not split in different modules just because we can. We split in different modules when it is possible and it can save a significant amount of dependencies in common use cases.
So every package or small group of packages that are self-contained define their own module.
This is not my reading of JDK practice. The "javax.transaction.xa" package is included in "java.sql" module even if it could have been separated. The "javax.sql.rowset.serial" package is included in "java.sql.rowset" module even if it could have been separated. The "javax.naming.ldap" package is included in "java.naming" module even if it could have been separated. Etc. etc. etc. Many JDK modules have packages that could have been in a separated module.
JDK does the same for sub-packages like java.util.logging
Logging is challenged by competitors (Log4J, SLF4J, etc.) and have been abstracted by the new System.Logger interface. Do you expect JSR-363 to be challenged by competitor API? (I'm not talking about implementations).
module java.measure.core { | |
exports javax.measure; | |
} |
Le 19/04/2017 à 13:44, Werner Keil a écrit :
I did not have the time to run it even with JSON-P, but if what was done there in https://github.com/json-p/api-ri/tree/master/api/src/main/jdk9 can be done with more than one module-info file consisting of different number of packages, then we would not have to introduce a module-info directly into a particular package (which is possible and done, see the JDK)
module-info.java are not on a per-package basis. There
is only one module-info.java per module. The one that I
use for JSR-363 API is (the module name may need to be changed):
module javax.measure { requires java.logging; exports javax.measure; exports javax.measure.quantity; exports javax.measure.format; exports javax.measure.spi; uses javax.measure.spi.ServiceProvider; }
GeoAPI is a good example, e.g. does it really use a SystemOfUnits implementation or any of the SPI elements? Or does it implement UnitFormat? I know you mentioned some Format, but is it really required?
GeoAPI does not use SystemOfUnits or UnitFormat
itself, but it doesn't matter; having those interfaces in the JAR
file is not a problem at all even if GeoAPI does not use them. I
see no benefit in providing them in separated modules. Furthermore
while GeoAPI does not use SystemOfUnits or UnitFormat
itself, GeoAPI implementers can choose to use them (Apache SIS
implements all of them). Since the choice is left to implementers,
the various JSR-363 profiles are nothing but complications for
GeoAPI. We use only the full JAR file; doing otherwise would
increase the developer workload just for saving (maybe!) a tiny
amount of kilobytes on disk.
Martin
We are repeating ourselves in last emails. Can we agree on the following?
My opinion is that JSR-363 modularisation benefits are too small compared to inconvenient.
Martin
<profile> | |
<id>jdk8</id> | |
<properties> | |
<jdkVersion>1.8</jdkVersion> | |
</properties> | |
</profile> |