CARVIEW |
Select Language
HTTP/2 301
server: AkamaiGHost
content-length: 0
location: https://mail.openjdk.org/pipermail/jpms-spec-observers/2016-July/000452.html
date: Tue, 29 Jul 2025 23:14:38 GMT
HTTP/2 200
content-type: text/html
last-modified: Wed, 13 Jul 2016 18:06:22 GMT
etag: "12a2-537883e308380"
accept-ranges: bytes
x-akamai-transformed: 0 - 0 -
vary: Accept-Encoding
content-encoding: gzip
date: Tue, 29 Jul 2025 23:14:39 GMT
content-length: 1911
set-cookie: _abck=1978D93D90339820AA9A9866610E4C20~-1~YAAQNAHARWA7Lz2YAQAAwm93WA6BV8K5jvSc0qhL5GhQ41Xh6MtLBAWhPQbOwvN2pve01AdVdYOGGxNJfoDiT/I4X3NH5+gZPX/xFN4f3im/axj7jkPhrh7DS7XefgQaukbR2jUi0vCgJy54p/eFvl+5rK6RGk7MQzTtURACltl+ovY/NdLflyS5wEXXq50gBftCZGQfjyI2WzfkOFGHO2wIX76mTj7MYp00uVz0SJ16XwRRzBKWfCqZgRiR2QTy4R7qYnq5AKDUOB5MCptteRs0KL6a3rf88td6q8i0c66qXRrEy+hjYXCsM27CNYWw3GhNRxRj9c90QNu0TPJXzgSx8dJMy/n0zop3ShimoIeS7cUi9Tg81yhIBemsoiotADvRAaXGG2nnzmIixz+/AKXR23IaCeKP12Q/otvnqtalZ2DW/9sXUEQTx7V3PofTFkYRN68=~-1~-1~-1; Domain=.openjdk.org; Path=/; Expires=Wed, 29 Jul 2026 23:14:39 GMT; Max-Age=31536000; Secure
set-cookie: bm_sz=DF198F5BC02D952A1EB5DB60C20E572E~YAAQNAHARWE7Lz2YAQAAwm93WBx2ZwA5Ds6cPtqKmtry65glbkk6x3s6Z7Hhs51xBWnVG7FlUbNOGap18T4i+odH0RqZUYDXZL6QArVin/mBFPSKjPeph/EaTJhK08TlBwXJUbHwwqmKpxs5+1cPHHGLMEWrjn8sqxy5nHqosoYNTxNwc/3ukhZ/U8dbXr4ymqcEP2yl2chVtWXyvubqd2gmVM2E97DGpVtaiumjfSv4SiDEXUSQQVHJkr4EQByNKbo3GMFVlmAe+kwvsyIWG/DmfA8XfnGt6X3cj/4izX8DBsgy5Pj4j3kqoEjzEtxkp/QLq2j4bJuJkYppZ9Wkrt5bTWhzYlTampVOE2g199F5qAET/yYY+hY=~4469047~4605232; Domain=.openjdk.org; Path=/; Expires=Wed, 30 Jul 2025 03:14:38 GMT; Max-Age=14399
Issue #ServiceLoaderEnhancement
Fri Jul 1 09:27:39 UTC 2016
More information about the jpms-spec-observers mailing list
Issue #ServiceLoaderEnhancement
Stephen Colebourne scolebourne at joda.orgFri Jul 1 09:27:39 UTC 2016
- Previous message: Proposal: #ModuleAnnotations and #ModuleDeprecation
- Next message: Issue #ServiceLoaderEnhancement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The ServiceLoader API is to be pushed as a key class by the module system. This issue is proposing enhancements to the API. Others may want to add their own proposals. Currently, ServiceLoader requires service implementations to have a public no-args constructor on a public class. This is very restrictive, especially in a Java 8 world of immutable classes and factory methods (with constructors actively avoided). JSR-310 has a service for loading Chronology implementations. In ThreeTen-Extra, I have a number of additional implementations [1]. Unfortunately, all the implementations are forced to have a public no-args constructor, as ServiceLoader cannot make use of the singleton INSTANCE constant. As can be seen, I have to mark the public no-args constructor as deprecated [2]. This state of affairs is frankly ridiculous, and is one of the reasons putting me off using ServiceLoader non-JDK code. I propose that the spec of ServiceLoader is extended to make it more useful. Firstly, I propose that all reflection by ServiceLoader should use setAccessible(true) to allow providers to be non-public. Secondly, I propose that if no public no-args constructor is found on the provider class, ServiceLoader should locate a public static constant named "INSTANCE" and use that instead. This proposal could be extended further. Instead of searching for "INSTANCE", it could look for all public static constants of the provider type, allowing one provider class to result in many provider instances. Thirdly, it should be possible to access the set of provider classes without instantiating them. This would allow applications to use the module-info design for services without using ServiceLoader, eg to reflect on the provider classes, perhaps to search for annotations. I hope this proposal is given serious consideration, as at present the design of ServiceLoader is simply too restrictive to be appropriate to be hard coded into the module specification. Stephen [1] https://github.com/ThreeTen/threeten-extra/tree/master/src/main/java/org/threeten/extra/chrono [2] https://github.com/ThreeTen/threeten-extra/blob/master/src/main/java/org/threeten/extra/chrono/CopticChronology.java#L71
- Previous message: Proposal: #ModuleAnnotations and #ModuleDeprecation
- Next message: Issue #ServiceLoaderEnhancement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the jpms-spec-observers mailing list