2323import java .io .BufferedOutputStream ;
2424import java .io .BufferedReader ;
2525import java .io .BufferedWriter ;
26- import java .io .FileNotFoundException ;
2726import java .io .IOException ;
2827import java .io .InputStream ;
2928import java .io .InputStreamReader ;
3736import java .nio .charset .StandardCharsets ;
3837import java .nio .file .FileSystem ;
3938import java .nio .file .Files ;
39+ import java .nio .file .NoSuchFileException ;
4040import java .nio .file .Path ;
4141import javax .annotation .Nullable ;
4242import javax .annotation .WillNotClose ;
@@ -90,7 +90,7 @@ public PathFileObject(Location location, Path rootPath, Path relativePath) {
9090 requireNonNull (relativePath , "relativePath" );
9191
9292 if (!rootPath .isAbsolute ()) {
93- throw new IllegalArgumentException ("rootPath must be absolute" );
93+ throw new IllegalArgumentException ("Expected rootPath to be absolute, but got " + rootPath );
9494 }
9595
9696 this .location = location ;
@@ -101,7 +101,7 @@ public PathFileObject(Location location, Path rootPath, Path relativePath) {
101101 : relativePath ;
102102
103103 fullPath = rootPath .resolve (relativePath );
104- name = relativePath .toString ();
104+ name = this . relativePath .toString ();
105105 uri = fullPath .toUri ();
106106 kind = FileUtils .pathToKind (relativePath );
107107 }
@@ -138,8 +138,8 @@ public boolean equals(@Nullable Object other) {
138138 * Get the class access level, where appropriate.
139139 *
140140 * <p>In this implementation, this class will always return {@code null}, since this
141- * information is not readily available without preloading the file in question and
142- * parsing it first.
141+ * information is not readily available without preloading the file in question and parsing it
142+ * first.
143143 *
144144 * <p>At the time of writing, the OpenJDK implementations of the JavaFileObject class
145145 * do not provide an implementation for this method either.
@@ -227,8 +227,8 @@ public String getName() {
227227 * Determine the class nesting kind, where appropriate.
228228 *
229229 * <p>In this implementation, this class will always return {@code null}, since this
230- * information is not readily available without preloading the file in question and
231- * parsing it first.
230+ * information is not readily available without preloading the file in question and parsing it
231+ * first.
232232 *
233233 * <p>At the time of writing, the OpenJDK implementations of the JavaFileObject class
234234 * do not provide an implementation for this method either.
@@ -255,7 +255,7 @@ public Path getRelativePath() {
255255 *
256256 * @return the root path.
257257 */
258- public Path getRoot () {
258+ public Path getRootPath () {
259259 return rootPath ;
260260 }
261261
@@ -295,8 +295,8 @@ public boolean isNameCompatible(String simpleName, Kind kind) {
295295 * <p>The returned implementation will always be buffered.
296296 *
297297 * @return a buffered input stream.
298- * @throws FileNotFoundException if the file does not exist.
299- * @throws IOException if an IO error occurs.
298+ * @throws NoSuchFileException if the file does not exist.
299+ * @throws IOException if an IO error occurs.
300300 */
301301 @ Override
302302 @ WillNotClose
@@ -315,7 +315,6 @@ public BufferedInputStream openInputStream() throws IOException {
315315 *
316316 * <p>The returned implementation will always be buffered.
317317 *
318- *
319318 * @return a buffered output stream.
320319 * @throws IOException if an IO error occurs.
321320 */
@@ -336,8 +335,8 @@ public BufferedOutputStream openOutputStream() throws IOException {
336335 * @param ignoreEncodingErrors {@code true} to suppress encoding errors, or {@code false} to throw
337336 * them to the caller.
338337 * @return a buffered reader.
339- * @throws FileNotFoundException if the file does not exist.
340- * @throws IOException if an IO error occurs.
338+ * @throws NoSuchFileException if the file does not exist.
339+ * @throws IOException if an IO error occurs.
341340 */
342341 @ Override
343342 @ WillNotClose
@@ -351,7 +350,7 @@ public BufferedReader openReader(boolean ignoreEncodingErrors) throws IOExceptio
351350 /**
352351 * Open a writer to this file using the default charset (UTF-8).
353352 *
354- * <p>This will Ccreate the file first if it does not already exist. If it does exist,
353+ * <p>This will create the file first if it does not already exist. If it does exist,
355354 * this will first overwrite the file and truncate it.
356355 *
357356 * <p>This input stream must be closed once finished with, otherwise
0 commit comments