Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.compiler/share/classes/javax/tools/JavaFileObject.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 javax.lang.model.element.NestingKind;
29
import javax.lang.model.element.Modifier;
30
import java.util.Objects;
31
32
/**
33
* File abstraction for tools operating on Java programming language
34
* source and class files.
35
*
36
* <p>All methods in this interface might throw a SecurityException if
37
* a security exception occurs.
38
*
39
* <p>Unless explicitly allowed, all methods in this interface might
40
* throw a NullPointerException if given a {@code null} argument.
41
*
42
* @author Peter von der Ah&eacute;
43
* @author Jonathan Gibbons
44
* @see JavaFileManager
45
* @since 1.6
46
*/
47
public interface JavaFileObject extends FileObject {
48
49
/**
50
* Kinds of JavaFileObjects.
51
*/
52
enum Kind {
53
/**
54
* Source files written in the Java programming language. For
55
* example, regular files ending with {@code .java}.
56
*/
57
SOURCE(".java"),
58
59
/**
60
* Class files for the Java Virtual Machine. For example,
61
* regular files ending with {@code .class}.
62
*/
63
CLASS(".class"),
64
65
/**
66
* HTML files. For example, regular files ending with {@code .html}.
67
*/
68
HTML(".html"),
69
70
/**
71
* Any other kind.
72
*/
73
OTHER("");
74
/**
75
* The extension which (by convention) is normally used for
76
* this kind of file object. If no convention exists, the
77
* empty string ({@code ""}) is used.
78
*/
79
public final String extension;
80
Kind(String extension) {
81
this.extension = Objects.requireNonNull(extension);
82
}
83
}
84
85
/**
86
* Returns the kind of this file object.
87
*
88
* @return the kind
89
*/
90
Kind getKind();
91
92
/**
93
* Checks if this file object is compatible with the specified
94
* simple name and kind. A simple name is a single identifier
95
* (not qualified) as defined in
96
* <cite>The Java Language Specification</cite>, section {@jls 6.2}.
97
*
98
* @param simpleName a simple name of a class
99
* @param kind a kind
100
* @return {@code true} if this file object is compatible; {@code false}
101
* otherwise
102
*/
103
boolean isNameCompatible(String simpleName, Kind kind);
104
105
/**
106
* Provides a hint about the nesting level of the class
107
* represented by this file object. This method may return
108
* {@link NestingKind#MEMBER} to mean
109
* {@link NestingKind#LOCAL} or {@link NestingKind#ANONYMOUS}.
110
* If the nesting level is not known or this file object does not
111
* represent a class file this method returns {@code null}.
112
*
113
* @return the nesting kind, or {@code null} if the nesting kind
114
* is not known
115
*/
116
NestingKind getNestingKind();
117
118
/**
119
* Provides a hint about the access level of the class represented
120
* by this file object. If the access level is not known or
121
* this file object does not represent a class file this method
122
* returns {@code null}.
123
*
124
* @return the access level
125
*/
126
Modifier getAccessLevel();
127
128
}
129
130