On Thu, 30 Oct 2025 21:07:28 GMT, Roger Riggs <[email protected]> wrote:

> > Roger, I'm thinking about that example in `close()`. It would be a 
> > ready-to-run program, if not for the method name: `example`. Since the text 
> > already says that it's an example, we could rename the method to `main` 
> > without loss of information.
> 
> Good idea, thanks

Actually, I completely forgot that we don't even need to bother with `var`. 
[JEP 512] uses `import module java.base`, so `Reader` and `Writer` will be 
imported regardless. So, keep explicit types or use `var` -- your choice. 

The only thing that we'll need to do is change the snippet flavour. While 
__now__ it works as is, technically, there will no longer be the 
`ProcessExamples` class. From JEP 512:

> The Java compiler generates a class name when compiling a compact source 
> file, but that name is implementation-specific and should not be relied upon 
> in any source code -- not even source code in the compact source file itself.

So, we should use the `file` not `class` attribute, I think. See [JEP 413] for 
more info:

    {@snippet file=ProcessExamples.java region=example}

[JEP 512]: https://openjdk.org/jeps/512
[JEP 413]: https://openjdk.org/jeps/413

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26649#issuecomment-3470499640

Reply via email to