1 /*
   2  * Copyright (c) 2020, 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.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 // This sealed class cannot be a java file because its permits clause names
  25 // a class in another package causing javac to issue a compilation error.
  26 //
  27 // package Pkg;
  28 //
  29 // sealed public interface SealedInterface permits Permitted, otherPkg.WrongPackage { }
  30 
  31 class Pkg/SealedInterface {
  32   0xCAFEBABE;
  33   65535; // minor version
  34   59; // version
  35   [12] { // Constant Pool
  36     ; // first element is empty
  37     class #2; // #1     at 0x0A
  38     Utf8 "Pkg/SealedInterface"; // #2     at 0x0D
  39     class #4; // #3     at 0x23
  40     Utf8 "java/lang/Object"; // #4     at 0x26
  41     Utf8 "SourceFile"; // #5     at 0x39
  42     Utf8 "SealedInterface.java"; // #6     at 0x46
  43     Utf8 "PermittedSubclasses"; // #7     at 0x5D
  44     class #9; // #8     at 0x71
  45     Utf8 "Pkg/Permitted"; // #9     at 0x74
  46     class #11; // #10     at 0x84
  47     Utf8 "otherPkg/WrongPackage"; // #11     at 0x87
  48   } // Constant Pool
  49 
  50   0x0601; // access [ ACC_PUBLIC ACC_INTERFACE ]
  51   #1;// this_cpx
  52   #3;// super_cpx
  53 
  54   [0] { // Interfaces
  55   } // Interfaces
  56 
  57   [0] { // fields
  58   } // fields
  59 
  60   [0] { // methods
  61   } // methods
  62 
  63   [2] { // Attributes
  64     Attr(#5, 2) { // SourceFile at 0xAD
  65       #6;
  66     } // end SourceFile
  67     ;
  68     Attr(#7, 6) { // PermittedSubtclasses at 0xB5
  69       0x00020008000A;
  70     } // end PermittedSubclasses
  71   } // Attributes
  72 } // end class Pkg/SealedInterface