8325687: SimpleJavaFileObject specification would benefit from implSpec

Reviewed-by: jlahoda, iris
This commit is contained in:
Joe Darcy 2024-02-16 22:56:16 +00:00
parent b5df2f4314
commit 3b76372254
2 changed files with 34 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -165,7 +165,7 @@ public interface JavaFileManager extends Closeable, Flushable, OptionChecker {
* The result of this method is undefined if this is an output
* location.
*
* @implNote This implementation returns true if the name includes
* @implSpec This implementation returns true if the name includes
* the word "MODULE".
*
* @return true if this location is expected to contain modules

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -79,10 +79,10 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* {@inheritDoc FileObject}
* @implSpec
* This implementation always throws {@linkplain
* UnsupportedOperationException}. Subclasses can change this
* behavior as long as the contract of {@link FileObject} is
* obeyed.
* UnsupportedOperationException}.
*/
@Override
public InputStream openInputStream() throws IOException {
@ -90,10 +90,10 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* {@inheritDoc FileObject}
* @implSpec
* This implementation always throws {@linkplain
* UnsupportedOperationException}. Subclasses can change this
* behavior as long as the contract of {@link FileObject} is
* obeyed.
* UnsupportedOperationException}.
*/
@Override
public OutputStream openOutputStream() throws IOException {
@ -101,9 +101,10 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* Wraps the result of {@linkplain #getCharContent} in a Reader.
* Subclasses can change this behavior as long as the contract of
* {@link FileObject} is obeyed.
* {@inheritDoc FileObject}
* @implSpec
* This implementation wraps the result of {@link #getCharContent}
* in a {@link Reader}.
*
* @param ignoreEncodingErrors {@inheritDoc}
* @return a Reader wrapping the result of getCharContent
@ -123,10 +124,10 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* {@inheritDoc FileObject}
* @implSpec
* This implementation always throws {@linkplain
* UnsupportedOperationException}. Subclasses can change this
* behavior as long as the contract of {@link FileObject} is
* obeyed.
* UnsupportedOperationException}.
*/
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
@ -134,9 +135,10 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* Wraps the result of openOutputStream in a Writer. Subclasses
* can change this behavior as long as the contract of {@link
* FileObject} is obeyed.
* {@inheritDoc FileObject}
* @implSpec
* This implementation wraps the result of {@link
* #openOutputStream} in a {@link Writer}.
*
* @return a Writer wrapping the result of openOutputStream
* @throws IllegalStateException {@inheritDoc}
@ -149,9 +151,9 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* This implementation returns {@code 0L}. Subclasses can change
* this behavior as long as the contract of {@link FileObject} is
* obeyed.
* {@inheritDoc FileObject}
* @implSpec
* This implementation returns {@code 0L}.
*
* @return {@code 0L}
*/
@ -161,9 +163,9 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* This implementation does nothing. Subclasses can change this
* behavior as long as the contract of {@link FileObject} is
* obeyed.
* {@inheritDoc FileObject}
* @implSpec
* This implementation does nothing.
*
* @return {@code false}
*/
@ -181,6 +183,8 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* {@inheritDoc JavaFileObject}
* @implSpec
* This implementation compares the path of its URI to the given
* simple name. This method returns true if the given kind is
* equal to the kind of this object, and if the path is equal to
@ -190,9 +194,6 @@ public class SimpleJavaFileObject implements JavaFileObject {
* <p>This method calls {@link #getKind} and {@link #toUri} and
* does not access the fields {@link #uri} and {@link #kind}
* directly.
*
* <p>Subclasses can change this behavior as long as the contract
* of {@link JavaFileObject} is obeyed.
*/
@Override
public boolean isNameCompatible(String simpleName, Kind kind) {
@ -203,17 +204,17 @@ public class SimpleJavaFileObject implements JavaFileObject {
}
/**
* This implementation returns {@code null}. Subclasses can
* change this behavior as long as the contract of
* {@link JavaFileObject} is obeyed.
* {@inheritDoc JavaFileObject}
* @implSpec
* This implementation returns {@code null}.
*/
@Override
public NestingKind getNestingKind() { return null; }
/**
* This implementation returns {@code null}. Subclasses can
* change this behavior as long as the contract of
* {@link JavaFileObject} is obeyed.
* {@inheritDoc JavaFileObject}
* @implSpec
* This implementation returns {@code null}.
*/
@Override
public Modifier getAccessLevel() { return null; }