1 /*
   2  * Copyright (c) 2017, 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 // Modify NestMembers attribute to include reference to the currnet class
  25 
  26 class HostWithSelfMember {
  27   0xCAFEBABE;
  28   0; // minor version
  29   53; // version
  30   [] { // Constant Pool
  31     ; // first element is empty
  32     Method #3 #14; // #1
  33     class #15; // #2
  34     class #16; // #3
  35     class #17; // #4
  36     Utf8 "Member"; // #5
  37     Utf8 "InnerClasses"; // #6
  38     Utf8 "<init>"; // #7
  39     Utf8 "()V"; // #8
  40     Utf8 "Code"; // #9
  41     Utf8 "LineNumberTable"; // #10
  42     Utf8 "SourceFile"; // #11
  43     Utf8 "Hosts.java"; // #12
  44     Utf8 "NestMembers"; // #13
  45     NameAndType #7 #8; // #14
  46     Utf8 "HostWithSelfMember"; // #15
  47     Utf8 "java/lang/Object"; // #16
  48     Utf8 "HostWithSelfMember$Member"; // #17
  49   } // Constant Pool
  50 
  51   0x0020; // access
  52   #2;// this_cpx
  53   #3;// super_cpx
  54 
  55   [] { // Interfaces
  56   } // Interfaces
  57 
  58   [] { // fields
  59   } // fields
  60 
  61   [] { // methods
  62     { // Member
  63       0x0000; // access
  64       #7; // name_cpx
  65       #8; // sig_cpx
  66       [] { // Attributes
  67         Attr(#9) { // Code
  68           1; // max_stack
  69           1; // max_locals
  70           Bytes[]{
  71             0x2AB70001B1;
  72           };
  73           [] { // Traps
  74           } // end Traps
  75           [] { // Attributes
  76             Attr(#10) { // LineNumberTable
  77               [] { // LineNumberTable
  78                 0  55;
  79               }
  80             } // end LineNumberTable
  81           } // Attributes
  82         } // end Code
  83       } // Attributes
  84     } // Member
  85   } // methods
  86 
  87   [] { // Attributes
  88     Attr(#11) { // SourceFile
  89       #12;
  90     } // end SourceFile
  91     ;
  92     Attr(#13) { // NestMembers
  93       0x000200040002; // modified - added self
  94     } // end NestMembers
  95     ;
  96     Attr(#6) { // InnerClasses
  97       [] { // InnerClasses
  98         #4 #2 #5 8;
  99       }
 100     } // end InnerClasses
 101   } // Attributes
 102 } // end class HostWithSelfMember