From f59da2802d141661a4d4dbe0d1db7483098799fa Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Fri, 10 Apr 2020 18:10:58 +0200 Subject: update jdt.core to 07329519f5ac8fd8379eab265d25b2c09a24fd96 (before whitespace change Bug 560451 --- .../dom/org/eclipse/jdt/core/dom/ASTNode.java | 48 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java') diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java index 74bb7163b..44e574ea0 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -979,9 +979,18 @@ public abstract class ASTNode { * @since 3.20 */ public static final int TEXT_BLOCK = 102; + + /** + * Node type constant indicating a node of type + * RecordDeclaration. + * @see RecordDeclaration + * @since 3.22 + */ + public static final int RECORD_DECLARATION = 103; + //{ObjectTeams: required OT specific node type constants added - private static final int LAST_JDT = 102; + private static final int LAST_JDT = 103; /** * Node type constant indicating a node of type * MethodSpec. @@ -1224,6 +1233,8 @@ public abstract class ASTNode { return QualifiedName.class; case QUALIFIED_TYPE : return QualifiedType.class; + case RECORD_DECLARATION : + return RecordDeclaration.class; case REQUIRES_DIRECTIVE : return RequiresDirective.class; case RETURN_STATEMENT : @@ -2269,6 +2280,23 @@ public abstract class ASTNode { } } + /** + * Checks that this AST operation is not used when + * building JLS2, JLS3, JLS4, JLS8, JLS9, JLS10, JLS11, JLS12 or JSL13 level ASTs. + *

+ * Use this method to prevent access to new properties that have been added in JLS14 + *

+ * + * @exception UnsupportedOperationException if this operation is used below JLS14 + * @since 3.22 + */ + final void unsupportedBelow14() { + if (this.ast.apiLevel < AST.JLS14_INTERNAL) { + throw new UnsupportedOperationException("Operation only supported in ASTs with level JLS14 and above"); //$NON-NLS-1$ + } + } + + /** * Checks that this AST operation is not used when * building ASTs without previewEnabled flag. @@ -2351,6 +2379,22 @@ public abstract class ASTNode { throw new UnsupportedOperationException("Operation only supported in JLS13 AST"); //$NON-NLS-1$ } } + + /** + * Checks that this AST operation is only used when + * building JLS13 level ASTs. + *

+ * Use this method to prevent access to new properties available only in JLS14. + *

+ * + * @exception UnsupportedOperationException if this operation is not used in JLS14 + * @since 3.20 + */ + final void supportedOnlyIn14() { + if (this.ast.apiLevel != AST.JLS14_INTERNAL) { + throw new UnsupportedOperationException("Operation only supported in JLS14 AST"); //$NON-NLS-1$ + } + } /** * Sets or clears this node's parent node and location. *

-- cgit v1.2.3