Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java')
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
index 0d16aaf890..3550361b88 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
@@ -759,6 +759,22 @@ public interface IType extends IMember, IAnnotatable {
String[] getSuperInterfaceNames() throws JavaModelException;
/**
+ * Returns the names of types that this sealed type permits to be its sub types.
+ * For a non sealed type, an empty array is returned.
+ * If type declares an explicit permits clause, then the permitted sub-types
+ * are returned in the declared order. If a sealed type does not explicitly
+ * declare permitted sub types, then the implicit permitted types, that is,
+ * the types in the same compilation unit that are sub types of this sealed type
+ * are returned in the order they appear within the compilation unit.
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return names of types that this type permits to be its sub types
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ String[] getPermittedSubtypeNames() throws JavaModelException;
+
+ /**
* Returns the formal type parameter signatures for this type.
* Returns an empty array if this type has no formal type parameters.
* <p>
@@ -915,6 +931,16 @@ public interface IType extends IMember, IAnnotatable {
*/
boolean isRecord() throws JavaModelException;
/**
+ * Returns whether this type is a sealed type.
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return true if this type this type is a sealed type, false otherwise
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ boolean isSealed() throws JavaModelException;
+
+ /**
* Returns the record components declared by this record class, or an empty
* array if this is not a record.
*
@@ -924,7 +950,7 @@ public interface IType extends IMember, IAnnotatable {
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
*/
default IField[] getRecordComponents() throws JavaModelException {
- return null;
+ return new IField[0];
}
/**
* Returns the record component with the specified name

Back to the top