Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.compiler/share/classes/javax/tools/ForwardingJavaFileManager.java
41152 views
1
/*
2
* Copyright (c) 2005, 2020, 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.Objects;
31
import java.util.ServiceLoader;
32
import java.util.Set;
33
import javax.tools.JavaFileObject.Kind;
34
35
/**
36
* Forwards calls to a given file manager. Subclasses of this class
37
* might override some of these methods and might also provide
38
* additional fields and methods.
39
*
40
* @param <M> the kind of file manager forwarded to by this object
41
* @author Peter von der Ah&eacute;
42
* @since 1.6
43
*/
44
public class ForwardingJavaFileManager<M extends JavaFileManager> implements JavaFileManager {
45
46
/**
47
* The file manager which all methods are delegated to.
48
*/
49
protected final M fileManager;
50
51
/**
52
* Creates a new instance of {@code ForwardingJavaFileManager}.
53
* @param fileManager delegate to this file manager
54
*/
55
protected ForwardingJavaFileManager(M fileManager) {
56
this.fileManager = Objects.requireNonNull(fileManager);
57
}
58
59
/**
60
* @throws SecurityException {@inheritDoc}
61
* @throws IllegalStateException {@inheritDoc}
62
*/
63
@Override
64
public ClassLoader getClassLoader(Location location) {
65
return fileManager.getClassLoader(location);
66
}
67
68
/**
69
* @throws IOException {@inheritDoc}
70
* @throws IllegalStateException {@inheritDoc}
71
*/
72
@Override
73
public Iterable<JavaFileObject> list(Location location,
74
String packageName,
75
Set<Kind> kinds,
76
boolean recurse)
77
throws IOException
78
{
79
return fileManager.list(location, packageName, kinds, recurse);
80
}
81
82
/**
83
* @throws IllegalStateException {@inheritDoc}
84
*/
85
@Override
86
public String inferBinaryName(Location location, JavaFileObject file) {
87
return fileManager.inferBinaryName(location, file);
88
}
89
90
/**
91
* @throws IllegalArgumentException {@inheritDoc}
92
*/
93
@Override
94
public boolean isSameFile(FileObject a, FileObject b) {
95
return fileManager.isSameFile(a, b);
96
}
97
98
/**
99
* @throws IllegalArgumentException {@inheritDoc}
100
* @throws IllegalStateException {@inheritDoc}
101
*/
102
@Override
103
public boolean handleOption(String current, Iterator<String> remaining) {
104
return fileManager.handleOption(current, remaining);
105
}
106
107
@Override
108
public boolean hasLocation(Location location) {
109
return fileManager.hasLocation(location);
110
}
111
112
@Override
113
public int isSupportedOption(String option) {
114
return fileManager.isSupportedOption(option);
115
}
116
117
/**
118
* @throws IllegalArgumentException {@inheritDoc}
119
* @throws IllegalStateException {@inheritDoc}
120
*/
121
@Override
122
public JavaFileObject getJavaFileForInput(Location location,
123
String className,
124
Kind kind)
125
throws IOException
126
{
127
return fileManager.getJavaFileForInput(location, className, kind);
128
}
129
130
/**
131
* @throws IllegalArgumentException {@inheritDoc}
132
* @throws IllegalStateException {@inheritDoc}
133
*/
134
@Override
135
public JavaFileObject getJavaFileForOutput(Location location,
136
String className,
137
Kind kind,
138
FileObject sibling)
139
throws IOException
140
{
141
return fileManager.getJavaFileForOutput(location, className, kind, sibling);
142
}
143
144
/**
145
* @throws IllegalArgumentException {@inheritDoc}
146
* @throws IllegalStateException {@inheritDoc}
147
*/
148
@Override
149
public FileObject getFileForInput(Location location,
150
String packageName,
151
String relativeName)
152
throws IOException
153
{
154
return fileManager.getFileForInput(location, packageName, relativeName);
155
}
156
157
/**
158
* @throws IllegalArgumentException {@inheritDoc}
159
* @throws IllegalStateException {@inheritDoc}
160
*/
161
@Override
162
public FileObject getFileForOutput(Location location,
163
String packageName,
164
String relativeName,
165
FileObject sibling)
166
throws IOException
167
{
168
return fileManager.getFileForOutput(location, packageName, relativeName, sibling);
169
}
170
171
@Override
172
public void flush() throws IOException {
173
fileManager.flush();
174
}
175
176
@Override
177
public void close() throws IOException {
178
fileManager.close();
179
}
180
181
/**
182
* @since 9
183
*/
184
@Override
185
public Location getLocationForModule(Location location, String moduleName) throws IOException {
186
return fileManager.getLocationForModule(location, moduleName);
187
}
188
189
/**
190
* @since 9
191
*/
192
@Override
193
public Location getLocationForModule(Location location, JavaFileObject fo) throws IOException {
194
return fileManager.getLocationForModule(location, fo);
195
}
196
197
/**
198
* @since 9
199
*/
200
@Override
201
public <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws IOException {
202
return fileManager.getServiceLoader(location, service);
203
}
204
205
/**
206
* @since 9
207
*/
208
@Override
209
public String inferModuleName(Location location) throws IOException {
210
return fileManager.inferModuleName(location);
211
}
212
213
/**
214
* @since 9
215
*/
216
@Override
217
public Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
218
return fileManager.listLocationsForModules(location);
219
}
220
221
/**
222
* @since 9
223
*/
224
@Override
225
public boolean contains(Location location, FileObject fo) throws IOException {
226
return fileManager.contains(location, fo);
227
}
228
}
229
230