8172810: ModuleElement should declare and provide appropriate modifiers
Reviewed-by: darcy
This commit is contained in:
parent
28110a1e7e
commit
ea2592fd1d
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -62,6 +62,15 @@ public interface ModuleElement extends Element, QualifiedNameable {
|
||||
@Override
|
||||
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
|
||||
* false} otherwise.
|
||||
|
@ -947,6 +947,11 @@ public abstract class Symbol extends AnnoConstruct implements Element {
|
||||
this.type = new ModuleType(this);
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public boolean isOpen() {
|
||||
return flags.contains(ModuleFlags.OPEN);
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public boolean isUnnamed() {
|
||||
return name.isEmpty() && owner == null;
|
||||
|
@ -306,9 +306,9 @@ public class PrintingProcessor extends AbstractProcessor {
|
||||
defaultAction(e, false);
|
||||
|
||||
if (!e.isUnnamed()) {
|
||||
// TODO: openness of the module not currently exposed
|
||||
// by the language model API, but should be printed
|
||||
// here once available.
|
||||
if (e.isOpen()) {
|
||||
writer.print("open ");
|
||||
}
|
||||
writer.println("module " + e.getQualifiedName() + " {");
|
||||
indentation++;
|
||||
for (ModuleElement.Directive directive : e.getDirectives()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user