langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
author rfield
Fri, 15 Feb 2013 18:40:38 -0800
changeset 16300 7cf27559c8df
parent 15361 01f1828683e6
child 16316 1150b1b2f5c2
permissions -rw-r--r--
8004969: Generate $deserializeLambda$ method 8006763: super in method reference used in anonymous class - ClassFormatError is produced 8005632: Inner classes within lambdas cause build failures 8005653: Lambdas containing inner classes referencing external type variables do not correctly parameterize the inner classes Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
15356
cf312dc54c60 8006119: update javac to follow latest spec for repeatable annotations
jjg
parents: 14539
diff changeset
     2
 * Copyright (c) 1999, 2013, 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: 3555
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: 3555
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: 3555
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3555
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3555
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.code;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14057
diff changeset
    30
import javax.lang.model.element.ElementVisitor;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14057
diff changeset
    31
import javax.lang.model.type.TypeVisitor;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14057
diff changeset
    32
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import com.sun.tools.javac.code.Symbol.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
import com.sun.tools.javac.code.Type.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
import com.sun.tools.javac.jvm.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14057
diff changeset
    36
import com.sun.tools.javac.util.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14057
diff changeset
    37
import com.sun.tools.javac.util.List;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14057
diff changeset
    38
import static com.sun.tools.javac.code.Flags.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
import static com.sun.tools.javac.jvm.ByteCodes.*;
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    40
import static com.sun.tools.javac.code.TypeTag.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
/** A class that defines all predefined constants and operators
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 *  as well as special classes such as java.lang.Object, which need
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 *  to be known to the compiler. All symbols are held in instance
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 *  fields. This makes it possible to work in multiple concurrent
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 *  projects, which might use different class files for library classes.
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    48
 *  <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
    49
 *  If you write code that depends on this, you do so at your own risk.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 *  This code and its internal interfaces are subject to change or
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 *  deletion without notice.</b>
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
public class Symtab {
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    /** The context key for the symbol table. */
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    protected static final Context.Key<Symtab> symtabKey =
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        new Context.Key<Symtab>();
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
    /** Get the symbol table instance. */
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    public static Symtab instance(Context context) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
        Symtab instance = context.get(symtabKey);
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        if (instance == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
            instance = new Symtab(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
        return instance;
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    /** Builtin types.
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     */
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    68
    public final Type byteType = new Type(BYTE, null);
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    69
    public final Type charType = new Type(CHAR, null);
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    70
    public final Type shortType = new Type(SHORT, null);
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    71
    public final Type intType = new Type(INT, null);
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    72
    public final Type longType = new Type(LONG, null);
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    73
    public final Type floatType = new Type(FLOAT, null);
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    74
    public final Type doubleType = new Type(DOUBLE, null);
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    75
    public final Type booleanType = new Type(BOOLEAN, null);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    public final Type botType = new BottomType();
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
    77
    public final JCNoType voidType = new JCNoType(VOID);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
1260
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents: 1257
diff changeset
    79
    private final Names names;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    private final ClassReader reader;
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
    81
    private final Target target;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    /** A symbol for the root package.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    public final PackageSymbol rootPackage;
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    /** A symbol for the unnamed package.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    public final PackageSymbol unnamedPackage;
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    /** A symbol that stands for a missing symbol.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    public final TypeSymbol noSymbol;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /** The error symbol.
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    public final ClassSymbol errSymbol;
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
6594
d43f068fba19 6970584: Flow.java should be more error-friendly
mcimadamore
parents: 6148
diff changeset
    99
    /** The unknown symbol.
d43f068fba19 6970584: Flow.java should be more error-friendly
mcimadamore
parents: 6148
diff changeset
   100
     */
d43f068fba19 6970584: Flow.java should be more error-friendly
mcimadamore
parents: 6148
diff changeset
   101
    public final ClassSymbol unknownSymbol;
d43f068fba19 6970584: Flow.java should be more error-friendly
mcimadamore
parents: 6148
diff changeset
   102
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 1037
diff changeset
   103
    /** A value for the errType, with a originalType of noType */
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    public final Type errType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    /** A value for the unknown type. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    public final Type unknownType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    /** The builtin type of all arrays. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    public final ClassSymbol arrayClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
    public final MethodSymbol arrayCloneMethod;
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    /** VGJ: The (singleton) type of all bound types. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    public final ClassSymbol boundClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    /** The builtin type of all methods. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    public final ClassSymbol methodClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    /** Predefined types.
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    public final Type objectType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    public final Type classType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    public final Type classLoaderType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
    public final Type stringType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    public final Type stringBufferType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    public final Type stringBuilderType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    public final Type cloneableType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    public final Type serializableType;
16300
7cf27559c8df 8004969: Generate $deserializeLambda$ method
rfield
parents: 15361
diff changeset
   129
    public final Type serializedLambdaType;
2723
b659ca23d5f5 6829189: Java programming with JSR 292 needs language support
jrose
parents: 1471
diff changeset
   130
    public final Type methodHandleType;
14365
20f388573215 8000694: Add generation of lambda implementation code: invokedynamic call, lambda method, adaptor methods
rfield
parents: 14359
diff changeset
   131
    public final Type methodHandleLookupType;
14046
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
   132
    public final Type methodTypeType;
12213
516b112d6c68 7150368: javac should include basic ability to generate native headers
jjg
parents: 9082
diff changeset
   133
    public final Type nativeHeaderType;
14539
507556c4e622 8003412: javac needs to understand java.lang.annotation.Native
jjg
parents: 14365
diff changeset
   134
    public final Type nativeHeaderType_old;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    public final Type throwableType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    public final Type errorType;
9076
45c73da050e9 7027157: Project Coin: javac warnings for AutoCloseable.close throwing InterruptedException
mcimadamore
parents: 8621
diff changeset
   137
    public final Type interruptedExceptionType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    public final Type illegalArgumentExceptionType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    public final Type exceptionType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    public final Type runtimeExceptionType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    public final Type classNotFoundExceptionType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    public final Type noClassDefFoundErrorType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    public final Type noSuchFieldErrorType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
    public final Type assertionErrorType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    public final Type cloneNotSupportedExceptionType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    public final Type annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    public final TypeSymbol enumSym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    public final Type listType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
    public final Type collectionsType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    public final Type comparableType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    public final Type arraysType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
    public final Type iterableType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    public final Type iteratorType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    public final Type annotationTargetType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    public final Type overrideType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    public final Type retentionType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    public final Type deprecatedType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    public final Type suppressWarningsType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    public final Type inheritedType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
    public final Type proprietaryType;
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   161
    public final Type systemType;
6148
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   162
    public final Type autoCloseableType;
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 6709
diff changeset
   163
    public final Type trustMeType;
14365
20f388573215 8000694: Add generation of lambda implementation code: invokedynamic call, lambda method, adaptor methods
rfield
parents: 14359
diff changeset
   164
    public final Type lambdaMetafactory;
15356
cf312dc54c60 8006119: update javac to follow latest spec for repeatable annotations
jjg
parents: 14539
diff changeset
   165
    public final Type repeatableType;
13689
4d519199a6aa 7151010: Add compiler support for repeating annotations
jfranck
parents: 12335
diff changeset
   166
    public final Type documentedType;
4d519199a6aa 7151010: Add compiler support for repeating annotations
jfranck
parents: 12335
diff changeset
   167
    public final Type elementTypeType;
15361
01f1828683e6 8005299: Add FunctionalInterface checking to javac
mcimadamore
parents: 15356
diff changeset
   168
    public final Type functionalInterfaceType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    /** The symbol representing the length field of an array.
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    public final VarSymbol lengthVar;
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
    /** The null check operator. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    public final OperatorSymbol nullcheck;
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
    /** The symbol representing the final finalize method on enums */
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
    public final MethodSymbol enumFinalFinalize;
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
6148
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   180
    /** The symbol representing the close method on TWR AutoCloseable type */
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   181
    public final MethodSymbol autoCloseableClose;
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   182
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
    /** The predefined type that belongs to a tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     */
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
   185
    public final Type[] typeOfTag = new Type[TypeTag.getTypeTagCount()];
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    /** The name of the class that belongs to a basix type tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     */
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
   189
    public final Name[] boxedName = new Name[TypeTag.getTypeTagCount()];
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
14057
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   191
    /** A set containing all operator names.
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   192
     */
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   193
    public final Set<Name> operatorNames = new HashSet<Name>();
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   194
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    /** A hashtable containing the encountered top-level and member classes,
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     *  indexed by flat names. The table does not contain local classes.
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
     *  It should be updated from the outside to reflect classes defined
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
     *  by compiled source files.
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
    public final Map<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>();
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
    /** A hashtable containing the encountered packages.
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     *  the table should be updated from outside to reflect packages defined
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     *  by compiled source files.
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    public final Map<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>();
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    public void initType(Type type, ClassSymbol c) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
        type.tsym = c;
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
   210
        typeOfTag[type.tag.ordinal()] = type;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    public void initType(Type type, String name) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
        initType(
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
            type,
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
            new ClassSymbol(
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
                PUBLIC, names.fromString(name), type, rootPackage));
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
    public void initType(Type type, String name, String bname) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
        initType(type, name);
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
   222
            boxedName[type.tag.ordinal()] = names.fromString("java.lang." + bname);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    /** The class symbol that owns all predefined symbols.
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
    public final ClassSymbol predefClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    /** Enter a constant into symbol table.
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     *  @param name   The constant's name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
     *  @param type   The constant's type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
    private VarSymbol enterConstant(String name, Type type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
        VarSymbol c = new VarSymbol(
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
            PUBLIC | STATIC | FINAL,
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
            names.fromString(name),
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
            type,
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
            predefClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        c.setData(type.constValue());
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        predefClass.members().enter(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
        return c;
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
    /** Enter a binary operation into symbol table.
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
     *  @param name     The name of the operator.
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
     *  @param left     The type of the left operand.
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
     *  @param right    The type of the left operand.
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     *  @param res      The operation's result type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     *  @param opcode   The operation's bytecode instruction.
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    private void enterBinop(String name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
                            Type left, Type right, Type res,
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
                            int opcode) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
        predefClass.members().enter(
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
            new OperatorSymbol(
14057
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   256
                makeOperatorName(name),
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
                new MethodType(List.of(left, right), res,
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
                               List.<Type>nil(), methodClass),
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
                opcode,
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
                predefClass));
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
    /** Enter a binary operation, as above but with two opcodes,
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 13689
diff changeset
   264
     *  which get encoded as
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 13689
diff changeset
   265
     *  {@code (opcode1 << ByteCodeTags.preShift) + opcode2 }.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
     *  @param opcode1     First opcode.
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
     *  @param opcode2     Second opcode.
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
    private void enterBinop(String name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
                            Type left, Type right, Type res,
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
                            int opcode1, int opcode2) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
        enterBinop(
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
            name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    /** Enter a unary operation into symbol table.
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
     *  @param name     The name of the operator.
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
     *  @param arg      The type of the operand.
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
     *  @param res      The operation's result type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     *  @param opcode   The operation's bytecode instruction.
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    private OperatorSymbol enterUnop(String name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
                                     Type arg,
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
                                     Type res,
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
                                     int opcode) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
        OperatorSymbol sym =
14057
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   287
            new OperatorSymbol(makeOperatorName(name),
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
                               new MethodType(List.of(arg),
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
                                              res,
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
                                              List.<Type>nil(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
                                              methodClass),
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
                               opcode,
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
                               predefClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
        predefClass.members().enter(sym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
        return sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
14057
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   298
    /**
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   299
     * Create a new operator name from corresponding String representation
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   300
     * and add the name to the set of known operator names.
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   301
     */
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   302
    private Name makeOperatorName(String name) {
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   303
        Name opName = names.fromString(name);
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   304
        operatorNames.add(opName);
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   305
        return opName;
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   306
    }
b4b0377b8dba 7177387: Add target-typing support in method context
mcimadamore
parents: 14046
diff changeset
   307
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
    /** Enter a class into symbol table.
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   309
     *  @param s The name of the class.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
    private Type enterClass(String s) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        return reader.enterClass(names.fromString(s)).type;
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   315
    public void synthesizeEmptyInterfaceIfMissing(final Type type) {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   316
        final Completer completer = type.tsym.completer;
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   317
        if (completer != null) {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   318
            type.tsym.completer = new Completer() {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   319
                public void complete(Symbol sym) throws CompletionFailure {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   320
                    try {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   321
                        completer.complete(sym);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   322
                    } catch (CompletionFailure e) {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   323
                        sym.flags_field |= (PUBLIC | INTERFACE);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   324
                        ((ClassType) sym.type).supertype_field = objectType;
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   325
                    }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   326
                }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   327
            };
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   328
        }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   329
    }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   330
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   331
    public void synthesizeBoxTypeIfMissing(final Type type) {
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
   332
        ClassSymbol sym = reader.enterClass(boxedName[type.tag.ordinal()]);
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   333
        final Completer completer = sym.completer;
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   334
        if (completer != null) {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   335
            sym.completer = new Completer() {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   336
                public void complete(Symbol sym) throws CompletionFailure {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   337
                    try {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   338
                        completer.complete(sym);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   339
                    } catch (CompletionFailure e) {
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   340
                        sym.flags_field |= PUBLIC;
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   341
                        ((ClassType) sym.type).supertype_field = objectType;
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   342
                        Name n = target.boxWithConstructors() ? names.init : names.valueOf;
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   343
                        MethodSymbol boxMethod =
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   344
                            new MethodSymbol(PUBLIC | STATIC,
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   345
                                n,
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   346
                                new MethodType(List.of(type), sym.type,
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   347
                                    List.<Type>nil(), methodClass),
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   348
                                sym);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   349
                        sym.members().enter(boxMethod);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   350
                        MethodSymbol unboxMethod =
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   351
                            new MethodSymbol(PUBLIC,
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   352
                                type.tsym.name.append(names.Value), // x.intValue()
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   353
                                new MethodType(List.<Type>nil(), type,
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   354
                                    List.<Type>nil(), methodClass),
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   355
                                sym);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   356
                        sym.members().enter(unboxMethod);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   357
                    }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   358
                }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   359
            };
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   360
        }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   361
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   362
    }
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   363
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
    /** Constructor; enters all predefined identifiers and operators
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
     *  into symbol table.
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
    protected Symtab(Context context) throws CompletionFailure {
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
        context.put(symtabKey, this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
1260
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents: 1257
diff changeset
   370
        names = Names.instance(context);
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   371
        target = Target.instance(context);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
        // Create the unknown type
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 14259
diff changeset
   374
        unknownType = new Type(UNKNOWN, null) {
8621
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   375
            @Override
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   376
            public <R, P> R accept(TypeVisitor<R, P> v, P p) {
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   377
                return v.visitUnknown(this, p);
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   378
            }
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   379
        };
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
        // create the basic builtin symbols
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
        rootPackage = new PackageSymbol(names.empty, null);
1471
57506cdfb7b4 6406133: JCDiagnostic.getMessage ignores locale argument
mcimadamore
parents: 1264
diff changeset
   383
        final JavacMessages messages = JavacMessages.instance(context);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
        unnamedPackage = new PackageSymbol(names.empty, rootPackage) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
                public String toString() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
                    return messages.getLocalizedString("compiler.misc.unnamed.package");
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
            };
8621
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   389
        noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage) {
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   390
            public <R, P> R accept(ElementVisitor<R, P> v, P p) {
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   391
                return v.visitUnknown(this, p);
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   392
            }
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   393
        };
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
        noSymbol.kind = Kinds.NIL;
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
        // create the error symbols
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
        errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage);
8621
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   398
        errType = new ErrorType(errSymbol, Type.noType);
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   399
6594
d43f068fba19 6970584: Flow.java should be more error-friendly
mcimadamore
parents: 6148
diff changeset
   400
        unknownSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.fromString("<any?>"), null, rootPackage);
8621
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   401
        unknownSymbol.members_field = new Scope.ErrorScope(unknownSymbol);
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   402
        unknownSymbol.type = unknownType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
        // initialize builtin types
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
        initType(byteType, "byte", "Byte");
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
        initType(shortType, "short", "Short");
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
        initType(charType, "char", "Character");
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
        initType(intType, "int", "Integer");
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
        initType(longType, "long", "Long");
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
        initType(floatType, "float", "Float");
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
        initType(doubleType, "double", "Double");
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
        initType(booleanType, "boolean", "Boolean");
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
        initType(voidType, "void", "Void");
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
        initType(botType, "<nulltype>");
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
        initType(errType, errSymbol);
6594
d43f068fba19 6970584: Flow.java should be more error-friendly
mcimadamore
parents: 6148
diff changeset
   416
        initType(unknownType, unknownSymbol);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
        // the builtin class of all arrays
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
        arrayClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Array, noSymbol);
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
        // VGJ
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
        boundClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Bound, noSymbol);
8621
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   423
        boundClass.members_field = new Scope.ErrorScope(boundClass);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
        // the builtin class of all methods
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
        methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol);
8621
ce0bce60cffc 7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents: 8242
diff changeset
   427
        methodClass.members_field = new Scope.ErrorScope(boundClass);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
        // Create class to hold all predefined constants and operations.
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
        predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
8242
3873b4aaf4a8 7007615: java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
mcimadamore
parents: 8241
diff changeset
   431
        Scope scope = new Scope(predefClass);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
        predefClass.members_field = scope;
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
        // Enter symbols for basic types.
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
        scope.enter(byteType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
        scope.enter(shortType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
        scope.enter(charType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
        scope.enter(intType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
        scope.enter(longType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
        scope.enter(floatType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
        scope.enter(doubleType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
        scope.enter(booleanType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
        scope.enter(errType.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 1037
diff changeset
   445
        // Enter symbol for the errSymbol
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 1037
diff changeset
   446
        scope.enter(errSymbol);
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 1037
diff changeset
   447
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
        classes.put(predefClass.fullname, predefClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
        reader = ClassReader.instance(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
        reader.init(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
        // Enter predefined classes.
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
        objectType = enterClass("java.lang.Object");
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
        classType = enterClass("java.lang.Class");
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
        stringType = enterClass("java.lang.String");
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
        stringBufferType = enterClass("java.lang.StringBuffer");
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
        stringBuilderType = enterClass("java.lang.StringBuilder");
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
        cloneableType = enterClass("java.lang.Cloneable");
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
        throwableType = enterClass("java.lang.Throwable");
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
        serializableType = enterClass("java.io.Serializable");
16300
7cf27559c8df 8004969: Generate $deserializeLambda$ method
rfield
parents: 15361
diff changeset
   462
        serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda");
8241
4161b56e0d20 7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents: 8036
diff changeset
   463
        methodHandleType = enterClass("java.lang.invoke.MethodHandle");
14365
20f388573215 8000694: Add generation of lambda implementation code: invokedynamic call, lambda method, adaptor methods
rfield
parents: 14359
diff changeset
   464
        methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
14046
8ef5d5b19998 7194586: Add back-end support for invokedynamic
mcimadamore
parents: 13844
diff changeset
   465
        methodTypeType = enterClass("java.lang.invoke.MethodType");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
        errorType = enterClass("java.lang.Error");
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
        illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
9076
45c73da050e9 7027157: Project Coin: javac warnings for AutoCloseable.close throwing InterruptedException
mcimadamore
parents: 8621
diff changeset
   468
        interruptedExceptionType = enterClass("java.lang.InterruptedException");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
        exceptionType = enterClass("java.lang.Exception");
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
        runtimeExceptionType = enterClass("java.lang.RuntimeException");
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
        classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
        noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
        noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
        assertionErrorType = enterClass("java.lang.AssertionError");
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
        cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
        annotationType = enterClass("java.lang.annotation.Annotation");
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
        classLoaderType = enterClass("java.lang.ClassLoader");
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
        enumSym = reader.enterClass(names.java_lang_Enum);
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
        enumFinalFinalize =
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
            new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL,
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
                             names.finalize,
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
                             new MethodType(List.<Type>nil(), voidType,
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
                                            List.<Type>nil(), methodClass),
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
                             enumSym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
        listType = enterClass("java.util.List");
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
        collectionsType = enterClass("java.util.Collections");
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
        comparableType = enterClass("java.lang.Comparable");
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
        arraysType = enterClass("java.util.Arrays");
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   489
        iterableType = target.hasIterable()
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
            ? enterClass("java.lang.Iterable")
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
            : enterClass("java.util.Collection");
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
        iteratorType = enterClass("java.util.Iterator");
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
        annotationTargetType = enterClass("java.lang.annotation.Target");
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
        overrideType = enterClass("java.lang.Override");
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
        retentionType = enterClass("java.lang.annotation.Retention");
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
        deprecatedType = enterClass("java.lang.Deprecated");
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
        suppressWarningsType = enterClass("java.lang.SuppressWarnings");
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
        inheritedType = enterClass("java.lang.annotation.Inherited");
15356
cf312dc54c60 8006119: update javac to follow latest spec for repeatable annotations
jjg
parents: 14539
diff changeset
   499
        repeatableType = enterClass("java.lang.annotation.Repeatable");
13689
4d519199a6aa 7151010: Add compiler support for repeating annotations
jfranck
parents: 12335
diff changeset
   500
        documentedType = enterClass("java.lang.annotation.Documented");
4d519199a6aa 7151010: Add compiler support for repeating annotations
jfranck
parents: 12335
diff changeset
   501
        elementTypeType = enterClass("java.lang.annotation.ElementType");
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   502
        systemType = enterClass("java.lang.System");
6148
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   503
        autoCloseableType = enterClass("java.lang.AutoCloseable");
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   504
        autoCloseableClose = new MethodSymbol(PUBLIC,
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   505
                             names.close,
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   506
                             new MethodType(List.<Type>nil(), voidType,
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   507
                                            List.of(exceptionType), methodClass),
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5857
diff changeset
   508
                             autoCloseableType.tsym);
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 6709
diff changeset
   509
        trustMeType = enterClass("java.lang.SafeVarargs");
14539
507556c4e622 8003412: javac needs to understand java.lang.annotation.Native
jjg
parents: 14365
diff changeset
   510
        nativeHeaderType = enterClass("java.lang.annotation.Native");
507556c4e622 8003412: javac needs to understand java.lang.annotation.Native
jjg
parents: 14365
diff changeset
   511
        nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
14365
20f388573215 8000694: Add generation of lambda implementation code: invokedynamic call, lambda method, adaptor methods
rfield
parents: 14359
diff changeset
   512
        lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
15361
01f1828683e6 8005299: Add FunctionalInterface checking to javac
mcimadamore
parents: 15356
diff changeset
   513
        functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   514
9076
45c73da050e9 7027157: Project Coin: javac warnings for AutoCloseable.close throwing InterruptedException
mcimadamore
parents: 8621
diff changeset
   515
        synthesizeEmptyInterfaceIfMissing(autoCloseableType);
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   516
        synthesizeEmptyInterfaceIfMissing(cloneableType);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   517
        synthesizeEmptyInterfaceIfMissing(serializableType);
14365
20f388573215 8000694: Add generation of lambda implementation code: invokedynamic call, lambda method, adaptor methods
rfield
parents: 14359
diff changeset
   518
        synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
16300
7cf27559c8df 8004969: Generate $deserializeLambda$ method
rfield
parents: 15361
diff changeset
   519
        synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
1037
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   520
        synthesizeBoxTypeIfMissing(doubleType);
c6b315a34dc6 6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents: 10
diff changeset
   521
        synthesizeBoxTypeIfMissing(floatType);
3555
a6fd77fe81df 6390045: Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
mcimadamore
parents: 2723
diff changeset
   522
        synthesizeBoxTypeIfMissing(voidType);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
5848
c5a4ce47e780 6960407: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5847
diff changeset
   524
        // Enter a synthetic class that is used to mark internal
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   525
        // proprietary classes in ct.sym.  This class does not have a
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
        // class file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
        ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
        this.proprietaryType = proprietaryType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   529
        ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   530
        proprietarySymbol.completer = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   531
        proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
        proprietarySymbol.erasure_field = proprietaryType;
8242
3873b4aaf4a8 7007615: java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
mcimadamore
parents: 8241
diff changeset
   533
        proprietarySymbol.members_field = new Scope(proprietarySymbol);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
        proprietaryType.typarams_field = List.nil();
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
        proprietaryType.allparams_field = List.nil();
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
        proprietaryType.supertype_field = annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   537
        proprietaryType.interfaces_field = List.nil();
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
        // Enter a class for arrays.
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
        // The class implements java.lang.Cloneable and java.io.Serializable.
06bc494ca11e Initial load
duke
parents:
diff changeset
   541
        // It has a final length field and a clone method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   542
        ClassType arrayClassType = (ClassType)arrayClass.type;
06bc494ca11e Initial load
duke
parents:
diff changeset
   543
        arrayClassType.supertype_field = objectType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
        arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
8242
3873b4aaf4a8 7007615: java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
mcimadamore
parents: 8241
diff changeset
   545
        arrayClass.members_field = new Scope(arrayClass);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   546
        lengthVar = new VarSymbol(
06bc494ca11e Initial load
duke
parents:
diff changeset
   547
            PUBLIC | FINAL,
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
            names.length,
06bc494ca11e Initial load
duke
parents:
diff changeset
   549
            intType,
06bc494ca11e Initial load
duke
parents:
diff changeset
   550
            arrayClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   551
        arrayClass.members().enter(lengthVar);
06bc494ca11e Initial load
duke
parents:
diff changeset
   552
        arrayCloneMethod = new MethodSymbol(
06bc494ca11e Initial load
duke
parents:
diff changeset
   553
            PUBLIC,
06bc494ca11e Initial load
duke
parents:
diff changeset
   554
            names.clone,
06bc494ca11e Initial load
duke
parents:
diff changeset
   555
            new MethodType(List.<Type>nil(), objectType,
06bc494ca11e Initial load
duke
parents:
diff changeset
   556
                           List.<Type>nil(), methodClass),
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
            arrayClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   558
        arrayClass.members().enter(arrayCloneMethod);
06bc494ca11e Initial load
duke
parents:
diff changeset
   559
06bc494ca11e Initial load
duke
parents:
diff changeset
   560
        // Enter operators.
06bc494ca11e Initial load
duke
parents:
diff changeset
   561
        enterUnop("+", doubleType, doubleType, nop);
06bc494ca11e Initial load
duke
parents:
diff changeset
   562
        enterUnop("+", floatType, floatType, nop);
06bc494ca11e Initial load
duke
parents:
diff changeset
   563
        enterUnop("+", longType, longType, nop);
06bc494ca11e Initial load
duke
parents:
diff changeset
   564
        enterUnop("+", intType, intType, nop);
06bc494ca11e Initial load
duke
parents:
diff changeset
   565
06bc494ca11e Initial load
duke
parents:
diff changeset
   566
        enterUnop("-", doubleType, doubleType, dneg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
        enterUnop("-", floatType, floatType, fneg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
        enterUnop("-", longType, longType, lneg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
        enterUnop("-", intType, intType, ineg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   570
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
        enterUnop("~", longType, longType, lxor);
06bc494ca11e Initial load
duke
parents:
diff changeset
   572
        enterUnop("~", intType, intType, ixor);
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
        enterUnop("++", doubleType, doubleType, dadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
        enterUnop("++", floatType, floatType, fadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   576
        enterUnop("++", longType, longType, ladd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
        enterUnop("++", intType, intType, iadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
        enterUnop("++", charType, charType, iadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   579
        enterUnop("++", shortType, shortType, iadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
        enterUnop("++", byteType, byteType, iadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
        enterUnop("--", doubleType, doubleType, dsub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
        enterUnop("--", floatType, floatType, fsub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
        enterUnop("--", longType, longType, lsub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   585
        enterUnop("--", intType, intType, isub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   586
        enterUnop("--", charType, charType, isub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   587
        enterUnop("--", shortType, shortType, isub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
        enterUnop("--", byteType, byteType, isub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
        enterUnop("!", booleanType, booleanType, bool_not);
06bc494ca11e Initial load
duke
parents:
diff changeset
   591
        nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk);
06bc494ca11e Initial load
duke
parents:
diff changeset
   592
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
        // string concatenation
06bc494ca11e Initial load
duke
parents:
diff changeset
   594
        enterBinop("+", stringType, objectType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   595
        enterBinop("+", objectType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   596
        enterBinop("+", stringType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
        enterBinop("+", stringType, intType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
        enterBinop("+", stringType, longType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   599
        enterBinop("+", stringType, floatType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   600
        enterBinop("+", stringType, doubleType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   601
        enterBinop("+", stringType, booleanType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   602
        enterBinop("+", stringType, botType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   603
        enterBinop("+", intType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   604
        enterBinop("+", longType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   605
        enterBinop("+", floatType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   606
        enterBinop("+", doubleType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   607
        enterBinop("+", booleanType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   608
        enterBinop("+", botType, stringType, stringType, string_add);
06bc494ca11e Initial load
duke
parents:
diff changeset
   609
06bc494ca11e Initial load
duke
parents:
diff changeset
   610
        // these errors would otherwise be matched as string concatenation
06bc494ca11e Initial load
duke
parents:
diff changeset
   611
        enterBinop("+", botType, botType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   612
        enterBinop("+", botType, intType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   613
        enterBinop("+", botType, longType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   614
        enterBinop("+", botType, floatType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   615
        enterBinop("+", botType, doubleType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   616
        enterBinop("+", botType, booleanType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   617
        enterBinop("+", botType, objectType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   618
        enterBinop("+", intType, botType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   619
        enterBinop("+", longType, botType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   620
        enterBinop("+", floatType, botType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   621
        enterBinop("+", doubleType, botType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   622
        enterBinop("+", booleanType, botType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   623
        enterBinop("+", objectType, botType, botType, error);
06bc494ca11e Initial load
duke
parents:
diff changeset
   624
06bc494ca11e Initial load
duke
parents:
diff changeset
   625
        enterBinop("+", doubleType, doubleType, doubleType, dadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   626
        enterBinop("+", floatType, floatType, floatType, fadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   627
        enterBinop("+", longType, longType, longType, ladd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   628
        enterBinop("+", intType, intType, intType, iadd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   629
06bc494ca11e Initial load
duke
parents:
diff changeset
   630
        enterBinop("-", doubleType, doubleType, doubleType, dsub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   631
        enterBinop("-", floatType, floatType, floatType, fsub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   632
        enterBinop("-", longType, longType, longType, lsub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   633
        enterBinop("-", intType, intType, intType, isub);
06bc494ca11e Initial load
duke
parents:
diff changeset
   634
06bc494ca11e Initial load
duke
parents:
diff changeset
   635
        enterBinop("*", doubleType, doubleType, doubleType, dmul);
06bc494ca11e Initial load
duke
parents:
diff changeset
   636
        enterBinop("*", floatType, floatType, floatType, fmul);
06bc494ca11e Initial load
duke
parents:
diff changeset
   637
        enterBinop("*", longType, longType, longType, lmul);
06bc494ca11e Initial load
duke
parents:
diff changeset
   638
        enterBinop("*", intType, intType, intType, imul);
06bc494ca11e Initial load
duke
parents:
diff changeset
   639
06bc494ca11e Initial load
duke
parents:
diff changeset
   640
        enterBinop("/", doubleType, doubleType, doubleType, ddiv);
06bc494ca11e Initial load
duke
parents:
diff changeset
   641
        enterBinop("/", floatType, floatType, floatType, fdiv);
06bc494ca11e Initial load
duke
parents:
diff changeset
   642
        enterBinop("/", longType, longType, longType, ldiv);
06bc494ca11e Initial load
duke
parents:
diff changeset
   643
        enterBinop("/", intType, intType, intType, idiv);
06bc494ca11e Initial load
duke
parents:
diff changeset
   644
06bc494ca11e Initial load
duke
parents:
diff changeset
   645
        enterBinop("%", doubleType, doubleType, doubleType, dmod);
06bc494ca11e Initial load
duke
parents:
diff changeset
   646
        enterBinop("%", floatType, floatType, floatType, fmod);
06bc494ca11e Initial load
duke
parents:
diff changeset
   647
        enterBinop("%", longType, longType, longType, lmod);
06bc494ca11e Initial load
duke
parents:
diff changeset
   648
        enterBinop("%", intType, intType, intType, imod);
06bc494ca11e Initial load
duke
parents:
diff changeset
   649
06bc494ca11e Initial load
duke
parents:
diff changeset
   650
        enterBinop("&", booleanType, booleanType, booleanType, iand);
06bc494ca11e Initial load
duke
parents:
diff changeset
   651
        enterBinop("&", longType, longType, longType, land);
06bc494ca11e Initial load
duke
parents:
diff changeset
   652
        enterBinop("&", intType, intType, intType, iand);
06bc494ca11e Initial load
duke
parents:
diff changeset
   653
06bc494ca11e Initial load
duke
parents:
diff changeset
   654
        enterBinop("|", booleanType, booleanType, booleanType, ior);
06bc494ca11e Initial load
duke
parents:
diff changeset
   655
        enterBinop("|", longType, longType, longType, lor);
06bc494ca11e Initial load
duke
parents:
diff changeset
   656
        enterBinop("|", intType, intType, intType, ior);
06bc494ca11e Initial load
duke
parents:
diff changeset
   657
06bc494ca11e Initial load
duke
parents:
diff changeset
   658
        enterBinop("^", booleanType, booleanType, booleanType, ixor);
06bc494ca11e Initial load
duke
parents:
diff changeset
   659
        enterBinop("^", longType, longType, longType, lxor);
06bc494ca11e Initial load
duke
parents:
diff changeset
   660
        enterBinop("^", intType, intType, intType, ixor);
06bc494ca11e Initial load
duke
parents:
diff changeset
   661
06bc494ca11e Initial load
duke
parents:
diff changeset
   662
        enterBinop("<<", longType, longType, longType, lshll);
06bc494ca11e Initial load
duke
parents:
diff changeset
   663
        enterBinop("<<", intType, longType, intType, ishll);
06bc494ca11e Initial load
duke
parents:
diff changeset
   664
        enterBinop("<<", longType, intType, longType, lshl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   665
        enterBinop("<<", intType, intType, intType, ishl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   666
06bc494ca11e Initial load
duke
parents:
diff changeset
   667
        enterBinop(">>", longType, longType, longType, lshrl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   668
        enterBinop(">>", intType, longType, intType, ishrl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
        enterBinop(">>", longType, intType, longType, lshr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   670
        enterBinop(">>", intType, intType, intType, ishr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   671
06bc494ca11e Initial load
duke
parents:
diff changeset
   672
        enterBinop(">>>", longType, longType, longType, lushrl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   673
        enterBinop(">>>", intType, longType, intType, iushrl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   674
        enterBinop(">>>", longType, intType, longType, lushr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   675
        enterBinop(">>>", intType, intType, intType, iushr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   676
06bc494ca11e Initial load
duke
parents:
diff changeset
   677
        enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   678
        enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   679
        enterBinop("<", longType, longType, booleanType, lcmp, iflt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   680
        enterBinop("<", intType, intType, booleanType, if_icmplt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   681
06bc494ca11e Initial load
duke
parents:
diff changeset
   682
        enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   683
        enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   684
        enterBinop(">", longType, longType, booleanType, lcmp, ifgt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   685
        enterBinop(">", intType, intType, booleanType, if_icmpgt);
06bc494ca11e Initial load
duke
parents:
diff changeset
   686
06bc494ca11e Initial load
duke
parents:
diff changeset
   687
        enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle);
06bc494ca11e Initial load
duke
parents:
diff changeset
   688
        enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle);
06bc494ca11e Initial load
duke
parents:
diff changeset
   689
        enterBinop("<=", longType, longType, booleanType, lcmp, ifle);
06bc494ca11e Initial load
duke
parents:
diff changeset
   690
        enterBinop("<=", intType, intType, booleanType, if_icmple);
06bc494ca11e Initial load
duke
parents:
diff changeset
   691
06bc494ca11e Initial load
duke
parents:
diff changeset
   692
        enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge);
06bc494ca11e Initial load
duke
parents:
diff changeset
   693
        enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge);
06bc494ca11e Initial load
duke
parents:
diff changeset
   694
        enterBinop(">=", longType, longType, booleanType, lcmp, ifge);
06bc494ca11e Initial load
duke
parents:
diff changeset
   695
        enterBinop(">=", intType, intType, booleanType, if_icmpge);
06bc494ca11e Initial load
duke
parents:
diff changeset
   696
06bc494ca11e Initial load
duke
parents:
diff changeset
   697
        enterBinop("==", objectType, objectType, booleanType, if_acmpeq);
06bc494ca11e Initial load
duke
parents:
diff changeset
   698
        enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq);
06bc494ca11e Initial load
duke
parents:
diff changeset
   699
        enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq);
06bc494ca11e Initial load
duke
parents:
diff changeset
   700
        enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq);
06bc494ca11e Initial load
duke
parents:
diff changeset
   701
        enterBinop("==", longType, longType, booleanType, lcmp, ifeq);
06bc494ca11e Initial load
duke
parents:
diff changeset
   702
        enterBinop("==", intType, intType, booleanType, if_icmpeq);
06bc494ca11e Initial load
duke
parents:
diff changeset
   703
06bc494ca11e Initial load
duke
parents:
diff changeset
   704
        enterBinop("!=", objectType, objectType, booleanType, if_acmpne);
06bc494ca11e Initial load
duke
parents:
diff changeset
   705
        enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne);
06bc494ca11e Initial load
duke
parents:
diff changeset
   706
        enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne);
06bc494ca11e Initial load
duke
parents:
diff changeset
   707
        enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne);
06bc494ca11e Initial load
duke
parents:
diff changeset
   708
        enterBinop("!=", longType, longType, booleanType, lcmp, ifne);
06bc494ca11e Initial load
duke
parents:
diff changeset
   709
        enterBinop("!=", intType, intType, booleanType, if_icmpne);
06bc494ca11e Initial load
duke
parents:
diff changeset
   710
06bc494ca11e Initial load
duke
parents:
diff changeset
   711
        enterBinop("&&", booleanType, booleanType, booleanType, bool_and);
06bc494ca11e Initial load
duke
parents:
diff changeset
   712
        enterBinop("||", booleanType, booleanType, booleanType, bool_or);
06bc494ca11e Initial load
duke
parents:
diff changeset
   713
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   714
}