JDK-8211132 : Support {@systemProperty } tag
  • Type: CSR
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 12
  • Submitted: 2018-09-25
  • Updated: 2019-11-25
  • Resolved: 2018-11-01
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Summary
-------

Provide a means to document system properties in documentation comments.

Problem
-------

There is no explicit support for documenting the system properties 
"defined" by an API. This leads to inconsistent ad-hoc techniques that are not readily searchable.

Solution
--------

Provide a new inline tag `{@systemProperty` _property-name_`}`, which is initially informally equivalent to `{@index ` _property-name_ `system property}`, where _property-name_ represents the name of a system property.  In other words, instances of the tag are replaced inline by the name of the property, and the name is put in both the interactive search index, and the static `A-Z` index.

The tag can be used in the documentation comments for modules, packages, types, fields and executable members.

Future extensions, but not a goal at this time:

* Create a new "summary" page that enumerates all the system properties defined in all the declarations being documented. This might be modeled on the "Constant Values" page.

* Extend `@see` and `{@link}` to be able to refer to places where a system property is defined with `{@systemProperty}`.

Alternatives:

Instead of supporting a new tag, we could just establish a convention of using the equivalent `{@index}` tag. However, that would make it harder to extend the feature in future with additional behavior specific to system properties.

Instead of using an inline tag, we could use a block tag, similar to tags like `@param`, `@return`, etc. This would allow the doclet to provide more support for the display of the definitions. However, such a change would be much more disruptive to existing documentation, which already uses tables, lists and other display artifacts to show the properties defined in an API.

Specification
-------------

There are two specifications to be updated:

1. The Documentation Comment Tag Specification

    `{@systemProperty` _property-name_ `}`

    Identify _property-name_ as the name of a system property. The name should be a "dotted identifier". In particular, it must not contain white space characters, or characters such as `}`. No other content is permitted in the tag; the possibility of additional content is reserved for future use. The tag can be used in the documentation comments for modules, packages, types, fields and executable members.

    Exact diff of doc-comment-spec attached

2. The `com.sun.source.doctree` package in the Compiler Tree API.
    
    A new subtype of `InlineTagTree` is introduced, together with a new member in `DocTree.Kind`, as well as corresponding updates for `DocTreeVisitor`, etc.
    
    Specification attached, also available at 
    http://cr.openjdk.java.net/~pmuthuswamy/5076751/specdiff


Comments
As a potential follow-on, I would like to see a similar {@securityProperty <name>} tag added for documenting security properties.
07-12-2018

At least historically, there have been system properties associated with JDK-specific APIs too, that is APIs in packages like jdk.* or oracle.*.
14-11-2018

Based on data from [~pmuthuswamy], here is list of properties and the classes in which they apper, here is a list of (some of) the properties in the documentation ```` awt.appletWarning java.desktop/java.awt.Window awt.dnd.drag.threshold java.desktop/java.awt.dnd.DragSource awt.image.incrementaldraw java.desktop/java.awt.Component awt.image.redrawrate java.desktop/java.awt.Component com.sun.net.httpserver.HttpServerProvider jdk.httpserver/com.sun.net.httpserver.spi.HttpServerProvider java.awt.headless java.desktop/java.awt.Toolkit java.awt.smartInvalidate java.desktop/java.awt.Component java.awt.Window.locationByPlatform java.desktop/java.awt.Window java.class.path java.base/java.lang.ClassLoader java.desktop.appName java.desktop/java.awt.Taskbar java.home java.base/java.lang.System java.locale.providers java.base/java.util.spi.LocaleServiceProvider java.naming.authoritative java.naming/javax.naming.Context java.naming.batchsize java.naming/javax.naming.Context java.naming.dns.url java.naming/javax.naming.Context java.naming.factory.control java.naming/javax.naming.ldap.LdapContext java.naming.factory.initial java.naming/javax.naming.Context java.naming.factory.object java.naming/javax.naming.Context java.naming.factory.state java.naming/javax.naming.Context java.naming.factory.url.pkgs java.naming/javax.naming.Context java.naming.provider.url java.naming/javax.naming.Context java.nio.channels.DefaultThreadPool.initialSize java.base/java.nio.channels.AsynchronousChannelGroup java.nio.channels.DefaultThreadPool.threadFactory java.base/java.nio.channels.AsynchronousChannelGroup java.nio.channels.spi.AsynchronousChannelProvider java.base/java.nio.channels.spi.AsynchronousChannelProvider java.nio.channels.spi.SelectorProvider java.base/java.nio.channels.spi.SelectorProvider java.nio.file.spi.DefaultFileSystemProvider java.base/java.nio.file.spi.FileSystemProvider java.protocol.handler.pkgs java.base/java.net.URL java.rmi.server.codebase java.rmi/java.rmi.server.RMIClassLoader java.rmi.server.hostname java.rmi/java.rmi.server.RMISocketFactory java.rmi.server.randomIDs java.rmi/java.rmi.server.ObjID java.rmi.server.RMIClassLoaderSpi java.rmi/java.rmi.server.RMIClassLoader java.security.auth.login.config jdk.security.auth/com.sun.security.auth.login.ConfigFile java.system.class.loader java.base/java.lang.ClassLoader java.time.zone.DefaultZoneRulesProvider java.base/java.time.zone.ZoneRulesProvider java.util.concurrent.ForkJoinPool.common.parallelism java.base/java.util.concurrent.ForkJoinPool java.util.concurrent.ForkJoinPool.common.threadFactory java.base/java.util.concurrent.ForkJoinPool java.util.currency.data java.base/java.util.Currency java.util.jar.Pack200.Packer java.base/java.util.jar.Pack200 java.util.jar.Pack200.Unpacker java.base/java.util.jar.Pack200 java.util.logging.config.class java.logging/java.util.logging.LogManager java.util.logging.config.file java.logging/java.util.logging.LogManager java.util.logging.SimpleFormatter.format java.logging/java.util.logging.SimpleFormatter java.util.prefs.PreferencesFactory java.prefs/java.util.prefs.Preferences java.util.PropertyResourceBundle.encoding java.base/java.util.PropertyResourceBundle java.util.secureRandomSeed java.base/java.util.concurrent.ThreadLocalRandom java.util.secureRandomSeed java.base/java.util.SplittableRandom java.vendor java.base/java.lang.System java.vendor.url java.base/java.lang.System java.vendor.version java.base/java.lang.System java.version.date java.base/java.lang.System java.version java.base/java.lang.System java.vm.specification.version java.base/java.lang.System javax.accessibility.assistive_technologies java.desktop/java.awt.Toolkit javax.management.builder.initial java.management/java.lang.management.ManagementFactory javax.management.builder.initial java.management/javax.management.MBeanServerFactory javax.rmi.ssl.client.enabledCipherSuites java.rmi/java.rmi.ssl.SslRMIClientSocketFactory javax.rmi.ssl.client.enabledProtocol java.rmi/java.rmi.ssl.SslRMIClientSocketFactory javax.smartcardio.TerminalFactory.DefaultType java.smartcardio/javax.smartcardio.TerminalFactory javax.sound.midi.Receiver java.desktop/javax.sound.midi.MidiSystem javax.sound.midi.Sequencer java.desktop/javax.sound.midi.MidiSystem javax.sound.midi.Synthesizer java.desktop/javax.sound.midi.MidiSystem javax.sound.midi.Transmitter java.desktop/javax.sound.midi.MidiSystem javax.sound.sampled.Clip java.desktop/javax.sound.sampled.AudioSystem javax.sound.sampled.Port java.desktop/javax.sound.sampled.AudioSystem javax.sound.sampled.SourceDataLine java.desktop/javax.sound.sampled.AudioSystem javax.sound.sampled.TargetDataLine java.desktop/javax.sound.sampled.AudioSystem javax.xml.catalog.defer java.xml/javax.xml.catalog.CatalogFeatures javax.xml.catalog.files java.xml/javax.xml.catalog.CatalogFeatures javax.xml.catalog.resolve java.xml/javax.xml.catalog.CatalogFeatures javax.xml.datatype.DatatypeFactory java.xml/javax.xml.datatype.DatatypeFactory javax.xml.parsers.DocumentBuilderFactory java.xml/javax.xml.parsers.DocumentBuilderFactory javax.xml.parsers.SAXParserFactory java.xml/javax.xml.parsers.SAXParserFactory javax.xml.stream.XMLEventFactory java.xml/javax.xml.stream.XMLEventFactory javax.xml.stream.XMLInputFactory java.xml/javax.xml.stream.XMLInputFactory javax.xml.stream.XMLOutputFactory java.xml/javax.xml.stream.XMLOutputFactory javax.xml.transform.TransformerFactory java.xml/javax.xml.transform.TransformerFactory jaxp.debug java.xml/javax.xml.xpath.XPathFactory jdk.io.permissionsUseCanonicalPath java.base/java.io.FilePermission jdk.serialFilter java.base/java.io.ObjectInputFilter.Config jmx.remote.protocol.provider.pkgs java.management/javax.management.remote.JMXConnectorFactory org.openjdk.java.util.stream.tripwire java.base/java.util.PrimitiveIterator org.openjdk.java.util.stream.tripwire java.base/java.util.Spliterator org.w3c.dom.DOMImplementationSourceList java.xml/org.w3c.dom.bootstrap.DOMImplementationRegistry org.xml.sax.driver java.xml/org.xml.sax.helpers.XMLReaderFactory org.xml.sax.parser java.xml/org.xml.sax.helpers.ParserFactory rowset.provider.classname java.sql.rowset/java,sql.rowset.spi.SyncFactory sun.security.krb5.principal jdk.security.auth/com.sun.security.auth.login.Krb5LoginModule suppressSwingDropSupport java.desktop/javax.swing.JApplet suppressSwingDropSupport java.desktop/javax.swing.JComponent suppressSwingDropSupport java.desktop/javax.swing.JDialog suppressSwingDropSupport java.desktop/javax.swing.JFrame swing.actions.reconfigureOnNull java.desktop/javax.swing.Action swing.boldMetal java.desktop/javax.swing.plaf.metal.DefaultMetalTheme swing.crossplatformlaf java.desktop/javax.swing.UIManager swing.defaultlaf java.desktop/javax.swing.UIManager swing.metalTheme java.desktop/javax.swing.plaf.metal.MetalLookAndFeel swing.systemlaf java.desktop/javax.swing.UIManager ```` (This list does not appear to include entries defined in these files: open/src/java.base/share/classes/java/net/doc-files/net-properties.html open/src/java.desktop/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html)
14-11-2018

[~darcy] Thanks for the feedback. The way to look at this feature is that it provides a way to identify the existing place in the docs where each system property is defined, such that it can be indexed and searched for. Complex rules about the set of valid values for a property do not belong in an inline tag: they are better described narratively, as now, in the documentation for the enclosing type/package/module, or in a doc-files subdirectory of a package or module. If we were inventing this 20 years ago, it might have been reasonable to "do things differently", perhaps using a block tag (similar to @param or @return) instead of an inline tag. But even so, there is a separate issue that even now, block tags cannot have nested inline tags. The one downside of the current proposal is while we could generate a summary page, we don't have a convenient short description to put beside each property name on the summary page. That is why we explicitly restrict the contents of the new tag, so that we can add such the ability to put a short description into the tag if and when we get to create the summary page.
01-11-2018

I'm a bit of two minds about this request. Not being able to document system property in an identifiable way is a long-standing deficient that I'm happy to see being addressed. I'm moving this request to Approved, but strongly encourage the javadoc team to augment the capabilities of this feature. For example, system properties often have non-trivial grammar and semantics and being able to document and then pull out such details would be very helpful, as would creating a summary page as mentioned in the Solution section. It doesn't sound like there would be any checks on uniqueness of the tag definitions. Another possible extension is some notation to signify a JDK-defined property vs a Java SE-defined property. Starting with "java.*" is a good heuristic of a Java SE property, but does not hold in all cases.
01-11-2018

There's two levels to consider here ... quoting, to allow whitespace and most non-identifier characters, and escaping, to allow quote characters. It's not clear that supporting either is worthwhile. As an analogy, I note that JVMS has very few restrictions on names in classifies, but JLS imposes many restrictions at the language level. If quoting/escaping ever becomes necessary, it can be done as a backwards-compatible update to the implementation, without changing any public API.
18-10-2018

As of now we have not included any quoting mechanism for arbitrary characters as most of the system properties in JDK API are simple alphanumerics with dots. we can consider this.
18-10-2018

With respect to the allowed characters in the property-name: There is currently no restriction on the names of system properties as defined by the System properties methods though conventional properties are simple alphanumerics with dots as in reverse dns notation. Is there a quoting mechanism that allows arbitrary characters?
17-10-2018