test/langtools/tools/javac/classfiles/attributes/ConstantValue/HasBrokenConstantValue.jcod
changeset 57725 ffc34eaf7b49
equal deleted inserted replaced
57724:447d48371b41 57725:ffc34eaf7b49
       
     1 /*
       
     2  * Copyright (c) 2019, 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 // ConstantValue attribute on a field that has wrong type (j.l.Object):
       
    25 
       
    26 class HasBrokenConstantValue {
       
    27   0xCAFEBABE;
       
    28   0; // minor version
       
    29   55; // version
       
    30   [] { // Constant Pool
       
    31     ; // first element is empty
       
    32     Method #3 #14; // #1
       
    33     class #15; // #2
       
    34     class #16; // #3
       
    35     Utf8 "VALUE"; // #4
       
    36     Utf8 "Ljava/lang/Object;"; // #5
       
    37     Utf8 "ConstantValue"; // #6
       
    38     String #17; // #7
       
    39     Utf8 "<init>"; // #8
       
    40     Utf8 "()V"; // #9
       
    41     Utf8 "Code"; // #10
       
    42     Utf8 "LineNumberTable"; // #11
       
    43     Utf8 "SourceFile"; // #12
       
    44     Utf8 "HasBrokenConstantValue.java"; // #13
       
    45     NameAndType #8 #9; // #14
       
    46     Utf8 "HasBrokenConstantValue"; // #15
       
    47     Utf8 "java/lang/Object"; // #16
       
    48     Utf8 ""; // #17
       
    49   } // Constant Pool
       
    50 
       
    51   0x0021; // access
       
    52   #2;// this_cpx
       
    53   #3;// super_cpx
       
    54 
       
    55   [] { // Interfaces
       
    56   } // Interfaces
       
    57 
       
    58   [] { // fields
       
    59     { // Member
       
    60       0x0019; // access
       
    61       #4; // name_cpx
       
    62       #5; // sig_cpx
       
    63       [] { // Attributes
       
    64         Attr(#6) { // ConstantValue
       
    65           #7;
       
    66         } // end ConstantValue
       
    67       } // Attributes
       
    68     } // Member
       
    69   } // fields
       
    70 
       
    71   [] { // methods
       
    72     { // Member
       
    73       0x0001; // access
       
    74       #8; // name_cpx
       
    75       #9; // sig_cpx
       
    76       [] { // Attributes
       
    77         Attr(#10) { // Code
       
    78           1; // max_stack
       
    79           1; // max_locals
       
    80           Bytes[]{
       
    81             0x2AB70001B1;
       
    82           }
       
    83           [] { // Traps
       
    84           } // end Traps
       
    85           [] { // Attributes
       
    86             Attr(#11) { // LineNumberTable
       
    87               [] { // LineNumberTable
       
    88                 0  1;
       
    89               }
       
    90             } // end LineNumberTable
       
    91           } // Attributes
       
    92         } // end Code
       
    93       } // Attributes
       
    94     } // Member
       
    95   } // methods
       
    96 
       
    97   [] { // Attributes
       
    98     Attr(#12) { // SourceFile
       
    99       #13;
       
   100     } // end SourceFile
       
   101   } // Attributes
       
   102 } // end class HasBrokenConstantValue