8172810: ModuleElement should declare and provide appropriate modifiers
Reviewed-by: darcy
This commit is contained in:
parent
28110a1e7e
commit
ea2592fd1d
langtools/src
java.compiler/share/classes/javax/lang/model/element
jdk.compiler/share/classes/com/sun/tools/javac
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -62,6 +62,15 @@ public interface ModuleElement extends Element, QualifiedNameable {
|
|||||||
@Override
|
@Override
|
||||||
List<? extends Element> getEnclosedElements();
|
List<? extends Element> getEnclosedElements();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} if this is an open module and {@code
|
||||||
|
* false} otherwise.
|
||||||
|
*
|
||||||
|
* @return {@code true} if this is an open module and {@code
|
||||||
|
* false} otherwise
|
||||||
|
*/ // TODO: add @jls to unnamed module section
|
||||||
|
boolean isOpen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if this is an unnamed module and {@code
|
* Returns {@code true} if this is an unnamed module and {@code
|
||||||
* false} otherwise.
|
* false} otherwise.
|
||||||
|
@ -947,6 +947,11 @@ public abstract class Symbol extends AnnoConstruct implements Element {
|
|||||||
this.type = new ModuleType(this);
|
this.type = new ModuleType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||||
|
public boolean isOpen() {
|
||||||
|
return flags.contains(ModuleFlags.OPEN);
|
||||||
|
}
|
||||||
|
|
||||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||||
public boolean isUnnamed() {
|
public boolean isUnnamed() {
|
||||||
return name.isEmpty() && owner == null;
|
return name.isEmpty() && owner == null;
|
||||||
|
@ -306,9 +306,9 @@ public class PrintingProcessor extends AbstractProcessor {
|
|||||||
defaultAction(e, false);
|
defaultAction(e, false);
|
||||||
|
|
||||||
if (!e.isUnnamed()) {
|
if (!e.isUnnamed()) {
|
||||||
// TODO: openness of the module not currently exposed
|
if (e.isOpen()) {
|
||||||
// by the language model API, but should be printed
|
writer.print("open ");
|
||||||
// here once available.
|
}
|
||||||
writer.println("module " + e.getQualifiedName() + " {");
|
writer.println("module " + e.getQualifiedName() + " {");
|
||||||
indentation++;
|
indentation++;
|
||||||
for (ModuleElement.Directive directive : e.getDirectives()) {
|
for (ModuleElement.Directive directive : e.getDirectives()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user