< prev index next >

src/java.base/share/classes/jdk/internal/classfile/impl/UnboundAttribute.java

Print this page

   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

 495         private static final Utf8Entry NAME = TemporaryConstantPool.INSTANCE.utf8Entry(Attributes.NAME_PERMITTED_SUBCLASSES);
 496 
 497         private final List<ClassEntry> permittedSubclasses;
 498 
 499         public UnboundPermittedSubclassesAttribute(List<ClassEntry> permittedSubclasses) {
 500             super(Attributes.permittedSubclasses());
 501             this.permittedSubclasses = Util.sanitizeU2List(permittedSubclasses);
 502         }
 503 
 504         @Override
 505         public List<ClassEntry> permittedSubclasses() {
 506             return permittedSubclasses;
 507         }
 508 
 509         @Override
 510         public Utf8Entry attributeName() {
 511             return NAME;
 512         }
 513     }
 514 
























 515     public static final class UnboundNestMembersAttribute
 516             extends UnboundAttribute<NestMembersAttribute>
 517             implements NestMembersAttribute {
 518 
 519         private static final Utf8Entry NAME = TemporaryConstantPool.INSTANCE.utf8Entry(Attributes.NAME_NEST_MEMBERS);
 520 
 521         private final List<ClassEntry> memberEntries;
 522 
 523         public UnboundNestMembersAttribute(List<ClassEntry> memberEntries) {
 524             super(Attributes.nestMembers());
 525             this.memberEntries = Util.sanitizeU2List(memberEntries);
 526         }
 527 
 528         @Override
 529         public List<ClassEntry> nestMembers() {
 530             return memberEntries;
 531         }
 532 
 533         @Override
 534         public Utf8Entry attributeName() {

   1 /*
   2  * Copyright (c) 2022, 2026, 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

 495         private static final Utf8Entry NAME = TemporaryConstantPool.INSTANCE.utf8Entry(Attributes.NAME_PERMITTED_SUBCLASSES);
 496 
 497         private final List<ClassEntry> permittedSubclasses;
 498 
 499         public UnboundPermittedSubclassesAttribute(List<ClassEntry> permittedSubclasses) {
 500             super(Attributes.permittedSubclasses());
 501             this.permittedSubclasses = Util.sanitizeU2List(permittedSubclasses);
 502         }
 503 
 504         @Override
 505         public List<ClassEntry> permittedSubclasses() {
 506             return permittedSubclasses;
 507         }
 508 
 509         @Override
 510         public Utf8Entry attributeName() {
 511             return NAME;
 512         }
 513     }
 514 
 515     public static final class UnboundLoadableDescriptorsAttribute
 516             extends UnboundAttribute<LoadableDescriptorsAttribute>
 517             implements LoadableDescriptorsAttribute {
 518 
 519         private static final Utf8Entry NAME = TemporaryConstantPool.INSTANCE.utf8Entry(Attributes.NAME_LOADABLE_DESCRIPTORS);
 520 
 521         private final List<Utf8Entry> loadableDescriptors;
 522 
 523         public UnboundLoadableDescriptorsAttribute(List<Utf8Entry> loadableDescriptors) {
 524             super(Attributes.loadableDescriptors());
 525             this.loadableDescriptors = Util.sanitizeU2List(loadableDescriptors);
 526         }
 527 
 528         @Override
 529         public List<Utf8Entry> loadableDescriptors() {
 530             return loadableDescriptors;
 531         }
 532 
 533         @Override
 534         public Utf8Entry attributeName() {
 535             return NAME;
 536         }
 537     }
 538 
 539     public static final class UnboundNestMembersAttribute
 540             extends UnboundAttribute<NestMembersAttribute>
 541             implements NestMembersAttribute {
 542 
 543         private static final Utf8Entry NAME = TemporaryConstantPool.INSTANCE.utf8Entry(Attributes.NAME_NEST_MEMBERS);
 544 
 545         private final List<ClassEntry> memberEntries;
 546 
 547         public UnboundNestMembersAttribute(List<ClassEntry> memberEntries) {
 548             super(Attributes.nestMembers());
 549             this.memberEntries = Util.sanitizeU2List(memberEntries);
 550         }
 551 
 552         @Override
 553         public List<ClassEntry> nestMembers() {
 554             return memberEntries;
 555         }
 556 
 557         @Override
 558         public Utf8Entry attributeName() {
< prev index next >