Ideally the content copied to the clipboard from snippets containing code should be compilable. For variable initialization, the snippet
* {@snippet lang=java :
* Path path = ...
* }
should be manifested in the clipboard as something like
Path path = null;
rather than
Path path = ...
which could be effected using @replace:
* {@snippet lang=java :
* Path path = null; // @replace substring=“ = null;” replacement=“...”
* }
In the case of non-specific omitted code such as
* {@snippet lang=java id="be" :
* try {
* begin();
* // Perform blocking I/O operation here
* ...
the snippet could be changed to
* {@snippet lang=java id="be" :
* try {
* begin();
* // Perform blocking I/O operation here
* code: // @replace substring=“code:” replacement=“...”
* {@snippet lang=java :
* Path path = ...
* }
should be manifested in the clipboard as something like
Path path = null;
rather than
Path path = ...
which could be effected using @replace:
* {@snippet lang=java :
* Path path = null; // @replace substring=“ = null;” replacement=“...”
* }
In the case of non-specific omitted code such as
* {@snippet lang=java id="be" :
* try {
* begin();
* // Perform blocking I/O operation here
* ...
the snippet could be changed to
* {@snippet lang=java id="be" :
* try {
* begin();
* // Perform blocking I/O operation here
* code: // @replace substring=“code:” replacement=“...”
- is blocked by
-
JDK-8308233 Copy-to-clipboard button should use unprocessed snippet text
- Closed
- relates to
-
JDK-8307409 Refactor usage examples to use @snippet in the java.nio packages
- Resolved
-
JDK-8308016 Use snippets in java.io package
- Resolved
-
JDK-8325990 Remove use of snippet @replace annotation in java.base
- Resolved