Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/tools/ForwardingJavaFileManager.java
38900 views
1
/*
2
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.tools;
27
28
import java.io.IOException;
29
import java.util.Iterator;
30
import java.util.Set;
31
import javax.tools.JavaFileObject.Kind;
32
33
/**
34
* Forwards calls to a given file manager. Subclasses of this class
35
* might override some of these methods and might also provide
36
* additional fields and methods.
37
*
38
* @param <M> the kind of file manager forwarded to by this object
39
* @author Peter von der Ah&eacute;
40
* @since 1.6
41
*/
42
public class ForwardingJavaFileManager<M extends JavaFileManager> implements JavaFileManager {
43
44
/**
45
* The file manager which all methods are delegated to.
46
*/
47
protected final M fileManager;
48
49
/**
50
* Creates a new instance of ForwardingJavaFileManager.
51
* @param fileManager delegate to this file manager
52
*/
53
protected ForwardingJavaFileManager(M fileManager) {
54
fileManager.getClass(); // null check
55
this.fileManager = fileManager;
56
}
57
58
/**
59
* @throws SecurityException {@inheritDoc}
60
* @throws IllegalStateException {@inheritDoc}
61
*/
62
public ClassLoader getClassLoader(Location location) {
63
return fileManager.getClassLoader(location);
64
}
65
66
/**
67
* @throws IOException {@inheritDoc}
68
* @throws IllegalStateException {@inheritDoc}
69
*/
70
public Iterable<JavaFileObject> list(Location location,
71
String packageName,
72
Set<Kind> kinds,
73
boolean recurse)
74
throws IOException
75
{
76
return fileManager.list(location, packageName, kinds, recurse);
77
}
78
79
/**
80
* @throws IllegalStateException {@inheritDoc}
81
*/
82
public String inferBinaryName(Location location, JavaFileObject file) {
83
return fileManager.inferBinaryName(location, file);
84
}
85
86
/**
87
* @throws IllegalArgumentException {@inheritDoc}
88
*/
89
public boolean isSameFile(FileObject a, FileObject b) {
90
return fileManager.isSameFile(a, b);
91
}
92
93
/**
94
* @throws IllegalArgumentException {@inheritDoc}
95
* @throws IllegalStateException {@inheritDoc}
96
*/
97
public boolean handleOption(String current, Iterator<String> remaining) {
98
return fileManager.handleOption(current, remaining);
99
}
100
101
public boolean hasLocation(Location location) {
102
return fileManager.hasLocation(location);
103
}
104
105
public int isSupportedOption(String option) {
106
return fileManager.isSupportedOption(option);
107
}
108
109
/**
110
* @throws IllegalArgumentException {@inheritDoc}
111
* @throws IllegalStateException {@inheritDoc}
112
*/
113
public JavaFileObject getJavaFileForInput(Location location,
114
String className,
115
Kind kind)
116
throws IOException
117
{
118
return fileManager.getJavaFileForInput(location, className, kind);
119
}
120
121
/**
122
* @throws IllegalArgumentException {@inheritDoc}
123
* @throws IllegalStateException {@inheritDoc}
124
*/
125
public JavaFileObject getJavaFileForOutput(Location location,
126
String className,
127
Kind kind,
128
FileObject sibling)
129
throws IOException
130
{
131
return fileManager.getJavaFileForOutput(location, className, kind, sibling);
132
}
133
134
/**
135
* @throws IllegalArgumentException {@inheritDoc}
136
* @throws IllegalStateException {@inheritDoc}
137
*/
138
public FileObject getFileForInput(Location location,
139
String packageName,
140
String relativeName)
141
throws IOException
142
{
143
return fileManager.getFileForInput(location, packageName, relativeName);
144
}
145
146
/**
147
* @throws IllegalArgumentException {@inheritDoc}
148
* @throws IllegalStateException {@inheritDoc}
149
*/
150
public FileObject getFileForOutput(Location location,
151
String packageName,
152
String relativeName,
153
FileObject sibling)
154
throws IOException
155
{
156
return fileManager.getFileForOutput(location, packageName, relativeName, sibling);
157
}
158
159
public void flush() throws IOException {
160
fileManager.flush();
161
}
162
163
public void close() throws IOException {
164
fileManager.close();
165
}
166
}
167
168