1 /*
 2  * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.  Oracle designates this
 8  * particular file as subject to the "Classpath" exception as provided
 9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 package java.lang.classfile;
26 
27 import java.lang.classfile.attribute.*;
28 
29 /**
30  * Marker interface for a member element of a {@link ClassModel}.  Such an
31  * element can appear when traversing a {@link ClassModel} unless otherwise
32  * specified, be supplied to a {@link ClassBuilder}, and be processed by a
33  * {@link ClassTransform}.
34  * <p>
35  * {@link AccessFlags}, and {@link ClassFileVersion} are member elements of a
36  * class that appear exactly once during the traversal of a {@link ClassModel}.
37  * {@link Superclass} and {@link Interfaces} may be absent or appear at most
38  * once.  A {@link ClassBuilder} may provide an alternative superclass if it is
39  * not defined but required.
40  *
41  * @see ClassFileElement##membership Membership Elements
42  * @see MethodElement
43  * @see FieldElement
44  * @see CodeElement
45  * @sealedGraph
46  * @since 24
47  */
48 public sealed interface ClassElement extends ClassFileElement
49         permits AccessFlags, Superclass, Interfaces, ClassFileVersion,
50                 FieldModel, MethodModel,
51                 CustomAttribute, CompilationIDAttribute, DeprecatedAttribute,
52                 EnclosingMethodAttribute, InnerClassesAttribute,
53                 ModuleAttribute, ModuleHashesAttribute, ModuleMainClassAttribute,
54                 ModulePackagesAttribute, ModuleResolutionAttribute, ModuleTargetAttribute,
55                 NestHostAttribute, NestMembersAttribute, PermittedSubclassesAttribute,
56                 RecordAttribute,
57                 RuntimeInvisibleAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute,
58                 RuntimeVisibleAnnotationsAttribute, RuntimeVisibleTypeAnnotationsAttribute,
59                 SignatureAttribute, SourceDebugExtensionAttribute,
60                 SourceFileAttribute, SourceIDAttribute, SyntheticAttribute, UnknownAttribute {
61 }