langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java
author jjg
Tue, 10 May 2016 15:36:21 -0700
changeset 37940 ead113a2f92e
parent 36526 3b41f1c69604
child 42407 f3702cff2933
permissions -rw-r--r--
8150011: Update javac to generate V53.0 class files Reviewed-by: darcy Contributed-by: vicente.romero@oracle.com, jonathan.gibbons@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
37940
ead113a2f92e 8150011: Update javac to generate V53.0 class files
jjg
parents: 36526
diff changeset
     2
 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2513
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2513
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2513
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2513
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2513
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.javac.jvm;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
2513
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
    28
import com.sun.tools.javac.code.Type;
14949
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
    29
import com.sun.tools.javac.code.Types;
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
    30
import com.sun.tools.javac.code.Types.UniqueType;
2513
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
    31
import com.sun.tools.javac.util.Name;
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
    32
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
/** A JVM class file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 *  <p>Generic Java classfiles have one additional attribute for classes,
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 *  methods and fields:
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *  <pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 *   "Signature" (u4 attr-length, u2 signature-index)
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 *  </pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 *  <p>A signature gives the full Java type of a method or field. When
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 *  used as a class attribute, it indicates type parameters, followed
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 *  by supertype, followed by all interfaces.
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 *  <pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 *     methodOrFieldSignature ::= type
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 *     classSignature         ::= [ typeparams ] supertype { interfacetype }
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 *  </pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 *  <p>The type syntax in signatures is extended as follows:
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 8042
diff changeset
    50
 *  <pre>{@literal
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 *     type       ::= ... | classtype | methodtype | typevar
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 *     classtype  ::= classsig { '.' classsig }
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 *     classig    ::= 'L' name [typeargs] ';'
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 *     methodtype ::= [ typeparams ] '(' { type } ')' type
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 *     typevar    ::= 'T' name ';'
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 *     typeargs   ::= '<' type { type } '>'
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 *     typeparams ::= '<' typeparam { typeparam } '>'
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 *     typeparam  ::= name ':' type
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 8042
diff changeset
    59
 *  }</pre>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 *  <p>This class defines constants used in class files as well
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 *  as routines to convert between internal ``.'' and external ``/''
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 *  separators in class names.
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    64
 *  <p><b>This is NOT part of any supported API.
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    65
 *  If you write code that depends on this, you do so at your own risk.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
 *  This code and its internal interfaces are subject to change or
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
 *  deletion without notice.</b> */
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
public class ClassFile {
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    public final static int JAVA_MAGIC = 0xCAFEBABE;
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    // see Target
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    public final static int CONSTANT_Utf8 = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    public final static int CONSTANT_Unicode = 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    public final static int CONSTANT_Integer = 3;
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    public final static int CONSTANT_Float = 4;
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    public final static int CONSTANT_Long = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    public final static int CONSTANT_Double = 6;
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    public final static int CONSTANT_Class = 7;
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    public final static int CONSTANT_String = 8;
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    public final static int CONSTANT_Fieldref = 9;
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    public final static int CONSTANT_Methodref = 10;
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    public final static int CONSTANT_InterfaceMethodref = 11;
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    public final static int CONSTANT_NameandType = 12;
8042
d534dd80da9f 6982999: tools must support -target 7 bytecodes
ksrini
parents: 5847
diff changeset
    85
    public final static int CONSTANT_MethodHandle = 15;
d534dd80da9f 6982999: tools must support -target 7 bytecodes
ksrini
parents: 5847
diff changeset
    86
    public final static int CONSTANT_MethodType = 16;
d534dd80da9f 6982999: tools must support -target 7 bytecodes
ksrini
parents: 5847
diff changeset
    87
    public final static int CONSTANT_InvokeDynamic = 18;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
14046
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    89
    public final static int REF_getField = 1;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    90
    public final static int REF_getStatic = 2;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    91
    public final static int REF_putField = 3;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    92
    public final static int REF_putStatic = 4;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    93
    public final static int REF_invokeVirtual = 5;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    94
    public final static int REF_invokeStatic = 6;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    95
    public final static int REF_invokeSpecial = 7;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    96
    public final static int REF_newInvokeSpecial = 8;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    97
    public final static int REF_invokeInterface = 9;
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
    98
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    public final static int MAX_PARAMETERS = 0xff;
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    public final static int MAX_DIMENSIONS = 0xff;
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    public final static int MAX_CODE = 0xffff;
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    public final static int MAX_LOCALS = 0xffff;
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    public final static int MAX_STACK = 0xffff;
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
2513
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   105
    public enum Version {
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   106
        V45_3(45, 3), // base level for all attributes
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   107
        V49(49, 0),   // JDK 1.5: enum, generics, annotations
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   108
        V50(50, 0),   // JDK 1.6: stackmaps
14550
284da8fb4eaf 8003655: Add javac.jvm.ClassFile.V52
jjg
parents: 14046
diff changeset
   109
        V51(51, 0),   // JDK 1.7
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   110
        V52(52, 0),   // JDK 1.8: lambda, type annos, param names
37940
ead113a2f92e 8150011: Update javac to generate V53.0 class files
jjg
parents: 36526
diff changeset
   111
        V53(53, 0);   // JDK 1.9: modules, indy string concat
2513
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   112
        Version(int major, int minor) {
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   113
            this.major = major;
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   114
            this.minor = minor;
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   115
        }
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   116
        public final int major, minor;
24606
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   117
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   118
        private static final Version MIN = values()[0];
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   119
        /** Return the least version supported, MIN */
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   120
        public static Version MIN() { return MIN; }
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   121
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   122
        private static final Version MAX = values()[values().length-1];
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   123
        /** Return the largest version supported, MAX */
12c0ca21f8dc 8042406: javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
ntoda
parents: 14949
diff changeset
   124
        public static Version MAX() { return MAX; }
2513
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   125
    }
1cbbf23b22f9 6817950: refactor ClassReader to improve attribute handling
jjg
parents: 1264
diff changeset
   126
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
/************************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
 * String Translation Routines
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
 ***********************************************************************/
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    /** Return internal representation of buf[offset..offset+len-1],
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     *  converting '/' to '.'.
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    public static byte[] internalize(byte[] buf, int offset, int len) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        byte[] translated = new byte[len];
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        for (int j = 0; j < len; j++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
            byte b = buf[offset + j];
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
            if (b == '/') translated[j] = (byte) '.';
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
            else translated[j] = b;
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        return translated;
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    /** Return internal representation of given name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     *  converting '/' to '.'.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    public static byte[] internalize(Name name) {
1260
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents: 10
diff changeset
   149
        return internalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
    /** Return external representation of buf[offset..offset+len-1],
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     *  converting '.' to '/'.
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    public static byte[] externalize(byte[] buf, int offset, int len) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        byte[] translated = new byte[len];
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        for (int j = 0; j < len; j++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
            byte b = buf[offset + j];
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
            if (b == '.') translated[j] = (byte) '/';
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            else translated[j] = b;
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        return translated;
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    /** Return external representation of given name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     *  converting '/' to '.'.
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
    public static byte[] externalize(Name name) {
1260
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents: 10
diff changeset
   169
        return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
/************************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
 * Name-and-type
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
 ***********************************************************************/
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    /** A class for the name-and-type signature of a method or field.
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
    public static class NameAndType {
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
        Name name;
14949
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   180
        UniqueType uniqueType;
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   181
        Types types;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
14949
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   183
        NameAndType(Name name, Type type, Types types) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
            this.name = name;
14949
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   185
            this.uniqueType = new UniqueType(type, types);
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   186
            this.types = types;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
14949
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   189
        void setType(Type type) {
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   190
            this.uniqueType = new UniqueType(type, types);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
14949
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   193
        @Override
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   194
        public boolean equals(Object other) {
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   195
            return (other instanceof NameAndType &&
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   196
                    name == ((NameAndType) other).name &&
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   197
                        uniqueType.equals(((NameAndType) other).uniqueType));
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   198
        }
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   199
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   200
        @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
        public int hashCode() {
14949
45f43822bbde 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
vromero
parents: 14550
diff changeset
   202
            return name.hashCode() * uniqueType.hashCode();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
}