hotspot/test/runtime/classFileParserBug/emptyNameUtf8.jcod
changeset 35218 00aa934a1a20
equal deleted inserted replaced
35217:ce4b5303a813 35218:00aa934a1a20
       
     1 /*
       
     2  * Copyright (c) 2015, 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 
       
    25 // This class has an illegal NameAndType at constant pool #4.  It's illegal because
       
    26 // the Utf8 that it points to at #27 is a zero length string which is not a valid
       
    27 // name.  Loading this class should cause a ClassFormatError exception.
       
    28 class emptyNameUtf8 {
       
    29   0xCAFEBABE;
       
    30   0; // minor version
       
    31   52; // version
       
    32   [29] { // Constant Pool
       
    33     ; // first element is empty
       
    34     Method #6 #15; // #1     at 0x0A
       
    35     Field #16 #17; // #2     at 0x0F
       
    36     String #18; // #3     at 0x14
       
    37     NameAndType #27 #28; // #4     at 0x9F
       
    38     class #21; // #5     at 0x1C
       
    39     class #22; // #6     at 0x1F
       
    40     Utf8 "<init>"; // #7     at 0x22
       
    41     Utf8 "()V"; // #8     at 0x2B
       
    42     Utf8 "Code"; // #9     at 0x2E
       
    43     Utf8 "LineNumberTable"; // #10     at 0x35
       
    44     Utf8 "main"; // #11     at 0x47
       
    45     Utf8 "([Ljava/lang/String;)V"; // #12     at 0x4E
       
    46     Utf8 "SourceFile"; // #13     at 0x67
       
    47     Utf8 "emptyNameUtf8.java"; // #14     at 0x74
       
    48     NameAndType #7 #8; // #15     at 0x81
       
    49     class #23; // #16     at 0x86
       
    50     NameAndType #24 #25; // #17     at 0x89
       
    51     Utf8 "Hello World"; // #18     at 0x8E
       
    52     class #26; // #19     at 0x9C
       
    53     Method #19 #4; // #20     at 0x17
       
    54     Utf8 "emptyNameUtf8"; // #21     at 0xA4
       
    55     Utf8 "java/lang/Object"; // #22     at 0xAC
       
    56     Utf8 "java/lang/System"; // #23     at 0xBF
       
    57     Utf8 "out"; // #24     at 0xD2
       
    58     Utf8 "Ljava/io/PrintStream;"; // #25     at 0xD8
       
    59     Utf8 "java/io/PrintStream"; // #26     at 0xF0
       
    60     Utf8 ""; // #27     at 0x0106
       
    61     Utf8 "()V"; // #28     at 0x0110
       
    62   } // Constant Pool
       
    63 
       
    64   0x0021; // access
       
    65   #5;// this_cpx
       
    66   #6;// super_cpx
       
    67 
       
    68   [0] { // Interfaces
       
    69   } // Interfaces
       
    70 
       
    71   [0] { // fields
       
    72   } // fields
       
    73 
       
    74   [2] { // methods
       
    75     { // Member at 0x0134
       
    76       0x0001; // access
       
    77       #7; // name_cpx
       
    78       #8; // sig_cpx
       
    79       [1] { // Attributes
       
    80         Attr(#9, 29) { // Code at 0x013C
       
    81           1; // max_stack
       
    82           1; // max_locals
       
    83           Bytes[5]{
       
    84             0x2AB70001B1;
       
    85           };
       
    86           [0] { // Traps
       
    87           } // end Traps
       
    88           [1] { // Attributes
       
    89             Attr(#10, 6) { // LineNumberTable at 0x0153
       
    90               [1] { // LineNumberTable
       
    91                 0  2; //  at 0x015F
       
    92               }
       
    93             } // end LineNumberTable
       
    94           } // Attributes
       
    95         } // end Code
       
    96       } // Attributes
       
    97     } // Member
       
    98     ;
       
    99     { // Member at 0x015F
       
   100       0x0009; // access
       
   101       #11; // name_cpx
       
   102       #12; // sig_cpx
       
   103       [1] { // Attributes
       
   104         Attr(#9, 37) { // Code at 0x0167
       
   105           2; // max_stack
       
   106           1; // max_locals
       
   107           Bytes[9]{
       
   108             0xB200021203B60004;
       
   109             0xB1;
       
   110           };
       
   111           [0] { // Traps
       
   112           } // end Traps
       
   113           [1] { // Attributes
       
   114             Attr(#10, 10) { // LineNumberTable at 0x0182
       
   115               [2] { // LineNumberTable
       
   116                 0  4; //  at 0x018E
       
   117                 8  5; //  at 0x0192
       
   118               }
       
   119             } // end LineNumberTable
       
   120           } // Attributes
       
   121         } // end Code
       
   122       } // Attributes
       
   123     } // Member
       
   124   } // methods
       
   125 
       
   126   [1] { // Attributes
       
   127     Attr(#13, 2) { // SourceFile at 0x0194
       
   128       #14;
       
   129     } // end SourceFile
       
   130   } // Attributes
       
   131 } // end class emptyNameUtf8