diff options
Diffstat (limited to 'javax/tools')
-rw-r--r-- | javax/tools/ForwardingJavaFileObject.java | 21 | ||||
-rw-r--r-- | javax/tools/JavaFileObject.java | 26 | ||||
-rw-r--r-- | javax/tools/SimpleJavaFileObject.java | 27 |
3 files changed, 74 insertions, 0 deletions
diff --git a/javax/tools/ForwardingJavaFileObject.java b/javax/tools/ForwardingJavaFileObject.java index fa058cc0d..2ed9cb359 100644 --- a/javax/tools/ForwardingJavaFileObject.java +++ b/javax/tools/ForwardingJavaFileObject.java @@ -37,6 +37,9 @@ exception statement from your version. */ package javax.tools; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.NestingKind; + /** * Forwards calls to a specified {@link JavaFileObject}. * @@ -78,4 +81,22 @@ public class ForwardingJavaFileObject<F extends JavaFileObject> return ((JavaFileObject) fileObject).isNameCompatible(simpleName, kind); } + /** + * @inheritDoc + */ + @Override + public Modifier getAccessLevel() + { + return ((JavaFileObject) fileObject).getAccessLevel(); + } + + /** + * @inheritDoc + */ + @Override + public NestingKind getNestingKind() + { + return ((JavaFileObject) fileObject).getNestingKind(); + } + } diff --git a/javax/tools/JavaFileObject.java b/javax/tools/JavaFileObject.java index 09bd3417d..e8293316a 100644 --- a/javax/tools/JavaFileObject.java +++ b/javax/tools/JavaFileObject.java @@ -37,6 +37,9 @@ exception statement from your version. */ package javax.tools; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.NestingKind; + /** * Abstraction for tools working with source and class files. * All methods may throw a {@link SecurityException}. All @@ -96,4 +99,27 @@ public interface JavaFileObject */ boolean isNameCompatible(String simpleName, Kind kind); + /** + * Provides a hint about the access level of this class, based + * on its modifiers. If the access level is unknown, or this + * file object does not represent a class file, {@code null} + * is returned. + * + * @return the access level. + */ + Modifier getAccessLevel(); + + /** + * Provides a hint about the nesting level of this class. + * It may return {@link NestingKind#MEMBER} instead of + * {@link NestingKind#LOCAL} or {@link NestingKind#ANONYMOUS} + * if it can not determine the exact type of nesting. If + * the nesting level is completely unknown, or this file + * object does not represent a class file, {@code null} + * is returned. + * + * @return the nesting level. + */ + NestingKind getNestingKind(); + } diff --git a/javax/tools/SimpleJavaFileObject.java b/javax/tools/SimpleJavaFileObject.java index e885798a7..452858f12 100644 --- a/javax/tools/SimpleJavaFileObject.java +++ b/javax/tools/SimpleJavaFileObject.java @@ -47,6 +47,9 @@ import java.io.Writer; import java.net.URI; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.NestingKind; + /** * Provides a simple implementation of many of the * {@link JavaFileObject} methods, thus giving a useful basis @@ -251,4 +254,28 @@ public class SimpleJavaFileObject return uri; } + /** + * This implementation does nothing and always + * returns {@code null}. + * + * @return null. + */ + @Override + public Modifier getAccessLevel() + { + return null; + } + + /** + * This implementation does nothing and always + * returns {@code null}. + * + * @return null. + */ + @Override + public NestingKind getNestingKind() + { + return null; + } + } |