Skip to content

Commit 3930709

Browse files
8068925: Add @OverRide in javax.tools classes
Reviewed-by: darcy, iris
1 parent fc76687 commit 3930709

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

src/java.compiler/share/classes/javax/tools/DiagnosticCollector.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public final class DiagnosticCollector<S> implements DiagnosticListener<S> {
4747
*/
4848
public DiagnosticCollector() {}
4949

50+
@Override
5051
public void report(Diagnostic<? extends S> diagnostic) {
5152
Objects.requireNonNull(diagnostic);
5253
diagnostics.add(diagnostic);

src/java.compiler/share/classes/javax/tools/DocumentationTool.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ enum Location implements JavaFileManager.Location {
191191
*/
192192
SNIPPET_PATH;
193193

194+
@Override
194195
public String getName() { return name(); }
195196

197+
@Override
196198
public boolean isOutputLocation() {
197199
switch (this) {
198200
case DOCUMENTATION_OUTPUT:

src/java.compiler/share/classes/javax/tools/JavaCompiler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
* JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
169169
* StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
170170
* JavaFileManager fileManager = new ForwardingJavaFileManager(stdFileManager) {
171+
* @Override
171172
* public void flush() throws IOException {
172173
* logger.entering(StandardJavaFileManager.class.getName(), "flush");
173174
* super.flush();

src/java.compiler/share/classes/javax/tools/SimpleJavaFileObject.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ protected SimpleJavaFileObject(URI uri, Kind kind) {
6868
this.kind = kind;
6969
}
7070

71+
@Override
7172
public URI toUri() {
7273
return uri;
7374
}
7475

76+
@Override
7577
public String getName() {
7678
return toUri().getPath();
7779
}
@@ -82,6 +84,7 @@ public String getName() {
8284
* behavior as long as the contract of {@link FileObject} is
8385
* obeyed.
8486
*/
87+
@Override
8588
public InputStream openInputStream() throws IOException {
8689
throw new UnsupportedOperationException();
8790
}
@@ -92,6 +95,7 @@ public InputStream openInputStream() throws IOException {
9295
* behavior as long as the contract of {@link FileObject} is
9396
* obeyed.
9497
*/
98+
@Override
9599
public OutputStream openOutputStream() throws IOException {
96100
throw new UnsupportedOperationException();
97101
}
@@ -107,14 +111,13 @@ public OutputStream openOutputStream() throws IOException {
107111
* @throws UnsupportedOperationException {@inheritDoc}
108112
* @throws IOException {@inheritDoc}
109113
*/
114+
@Override
110115
public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
111116
CharSequence charContent = getCharContent(ignoreEncodingErrors);
112117
if (charContent == null)
113118
throw new UnsupportedOperationException();
114-
if (charContent instanceof CharBuffer) {
115-
CharBuffer buffer = (CharBuffer)charContent;
116-
if (buffer.hasArray())
117-
return new CharArrayReader(buffer.array());
119+
if (charContent instanceof CharBuffer buffer && buffer.hasArray()) {
120+
return new CharArrayReader(buffer.array());
118121
}
119122
return new StringReader(charContent.toString());
120123
}
@@ -125,6 +128,7 @@ public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
125128
* behavior as long as the contract of {@link FileObject} is
126129
* obeyed.
127130
*/
131+
@Override
128132
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
129133
throw new UnsupportedOperationException();
130134
}
@@ -139,6 +143,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept
139143
* @throws UnsupportedOperationException {@inheritDoc}
140144
* @throws IOException {@inheritDoc}
141145
*/
146+
@Override
142147
public Writer openWriter() throws IOException {
143148
return new OutputStreamWriter(openOutputStream());
144149
}
@@ -150,6 +155,7 @@ public Writer openWriter() throws IOException {
150155
*
151156
* @return {@code 0L}
152157
*/
158+
@Override
153159
public long getLastModified() {
154160
return 0L;
155161
}
@@ -161,13 +167,15 @@ public long getLastModified() {
161167
*
162168
* @return {@code false}
163169
*/
170+
@Override
164171
public boolean delete() {
165172
return false;
166173
}
167174

168175
/**
169176
* @return {@code this.kind}
170177
*/
178+
@Override
171179
public Kind getKind() {
172180
return kind;
173181
}
@@ -186,6 +194,7 @@ public Kind getKind() {
186194
* <p>Subclasses can change this behavior as long as the contract
187195
* of {@link JavaFileObject} is obeyed.
188196
*/
197+
@Override
189198
public boolean isNameCompatible(String simpleName, Kind kind) {
190199
String baseName = simpleName + kind.extension;
191200
return kind.equals(getKind())
@@ -198,13 +207,15 @@ public boolean isNameCompatible(String simpleName, Kind kind) {
198207
* change this behavior as long as the contract of
199208
* {@link JavaFileObject} is obeyed.
200209
*/
210+
@Override
201211
public NestingKind getNestingKind() { return null; }
202212

203213
/**
204214
* This implementation returns {@code null}. Subclasses can
205215
* change this behavior as long as the contract of
206216
* {@link JavaFileObject} is obeyed.
207217
*/
218+
@Override
208219
public Modifier getAccessLevel() { return null; }
209220

210221
@Override

0 commit comments

Comments
 (0)