src/share/classes/com/sun/tools/javac/code/Symtab.java

Wed, 02 Mar 2011 21:13:55 -0800

author
jjg
date
Wed, 02 Mar 2011 21:13:55 -0800
changeset 904
4baab658f357
parent 900
938dda0bec17
child 951
de1c65ecfec2
permissions
-rw-r--r--

6639645: Modeling type implementing missing interfaces
Reviewed-by: darcy, mcimadamore

     1 /*
     2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.javac.code;
    28 import java.util.*;
    29 import javax.lang.model.type.TypeVisitor;
    30 import javax.lang.model.element.ElementVisitor;
    32 import com.sun.tools.javac.util.*;
    33 import com.sun.tools.javac.util.List;
    34 import com.sun.tools.javac.code.Symbol.*;
    35 import com.sun.tools.javac.code.Type.*;
    36 import com.sun.tools.javac.jvm.*;
    38 import static com.sun.tools.javac.jvm.ByteCodes.*;
    39 import static com.sun.tools.javac.code.Flags.*;
    41 /** A class that defines all predefined constants and operators
    42  *  as well as special classes such as java.lang.Object, which need
    43  *  to be known to the compiler. All symbols are held in instance
    44  *  fields. This makes it possible to work in multiple concurrent
    45  *  projects, which might use different class files for library classes.
    46  *
    47  *  <p><b>This is NOT part of any supported API.
    48  *  If you write code that depends on this, you do so at your own risk.
    49  *  This code and its internal interfaces are subject to change or
    50  *  deletion without notice.</b>
    51  */
    52 public class Symtab {
    53     /** The context key for the symbol table. */
    54     protected static final Context.Key<Symtab> symtabKey =
    55         new Context.Key<Symtab>();
    57     /** Get the symbol table instance. */
    58     public static Symtab instance(Context context) {
    59         Symtab instance = context.get(symtabKey);
    60         if (instance == null)
    61             instance = new Symtab(context);
    62         return instance;
    63     }
    65     /** Builtin types.
    66      */
    67     public final Type byteType = new Type(TypeTags.BYTE, null);
    68     public final Type charType = new Type(TypeTags.CHAR, null);
    69     public final Type shortType = new Type(TypeTags.SHORT, null);
    70     public final Type intType = new Type(TypeTags.INT, null);
    71     public final Type longType = new Type(TypeTags.LONG, null);
    72     public final Type floatType = new Type(TypeTags.FLOAT, null);
    73     public final Type doubleType = new Type(TypeTags.DOUBLE, null);
    74     public final Type booleanType = new Type(TypeTags.BOOLEAN, null);
    75     public final Type botType = new BottomType();
    76     public final JCNoType voidType = new JCNoType(TypeTags.VOID);
    78     private final Names names;
    79     private final ClassReader reader;
    80     private final Target target;
    82     /** A symbol for the root package.
    83      */
    84     public final PackageSymbol rootPackage;
    86     /** A symbol for the unnamed package.
    87      */
    88     public final PackageSymbol unnamedPackage;
    90     /** A symbol that stands for a missing symbol.
    91      */
    92     public final TypeSymbol noSymbol;
    94     /** The error symbol.
    95      */
    96     public final ClassSymbol errSymbol;
    98     /** The unknown symbol.
    99      */
   100     public final ClassSymbol unknownSymbol;
   102     /** A value for the errType, with a originalType of noType */
   103     public final Type errType;
   105     /** A value for the unknown type. */
   106     public final Type unknownType;
   108     /** The builtin type of all arrays. */
   109     public final ClassSymbol arrayClass;
   110     public final MethodSymbol arrayCloneMethod;
   112     /** VGJ: The (singleton) type of all bound types. */
   113     public final ClassSymbol boundClass;
   115     /** The builtin type of all methods. */
   116     public final ClassSymbol methodClass;
   118     /** Predefined types.
   119      */
   120     public final Type objectType;
   121     public final Type classType;
   122     public final Type classLoaderType;
   123     public final Type stringType;
   124     public final Type stringBufferType;
   125     public final Type stringBuilderType;
   126     public final Type cloneableType;
   127     public final Type serializableType;
   128     public final Type transientMethodHandleType; // transient - 292
   129     public final Type methodHandleType;
   130     public final Type transientPolymorphicSignatureType; // transient - 292
   131     public final Type polymorphicSignatureType;
   132     public final Type throwableType;
   133     public final Type errorType;
   134     public final Type illegalArgumentExceptionType;
   135     public final Type exceptionType;
   136     public final Type runtimeExceptionType;
   137     public final Type classNotFoundExceptionType;
   138     public final Type noClassDefFoundErrorType;
   139     public final Type noSuchFieldErrorType;
   140     public final Type assertionErrorType;
   141     public final Type cloneNotSupportedExceptionType;
   142     public final Type annotationType;
   143     public final TypeSymbol enumSym;
   144     public final Type listType;
   145     public final Type collectionsType;
   146     public final Type comparableType;
   147     public final Type arraysType;
   148     public final Type iterableType;
   149     public final Type iteratorType;
   150     public final Type annotationTargetType;
   151     public final Type overrideType;
   152     public final Type retentionType;
   153     public final Type deprecatedType;
   154     public final Type suppressWarningsType;
   155     public final Type inheritedType;
   156     public final Type proprietaryType;
   157     public final Type systemType;
   158     public final Type autoCloseableType;
   159     public final Type trustMeType;
   161     /** The symbol representing the length field of an array.
   162      */
   163     public final VarSymbol lengthVar;
   165     /** The null check operator. */
   166     public final OperatorSymbol nullcheck;
   168     /** The symbol representing the final finalize method on enums */
   169     public final MethodSymbol enumFinalFinalize;
   171     /** The symbol representing the close method on TWR AutoCloseable type */
   172     public final MethodSymbol autoCloseableClose;
   174     /** The predefined type that belongs to a tag.
   175      */
   176     public final Type[] typeOfTag = new Type[TypeTags.TypeTagCount];
   178     /** The name of the class that belongs to a basix type tag.
   179      */
   180     public final Name[] boxedName = new Name[TypeTags.TypeTagCount];
   182     /** A hashtable containing the encountered top-level and member classes,
   183      *  indexed by flat names. The table does not contain local classes.
   184      *  It should be updated from the outside to reflect classes defined
   185      *  by compiled source files.
   186      */
   187     public final Map<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>();
   189     /** A hashtable containing the encountered packages.
   190      *  the table should be updated from outside to reflect packages defined
   191      *  by compiled source files.
   192      */
   193     public final Map<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>();
   195     public void initType(Type type, ClassSymbol c) {
   196         type.tsym = c;
   197         typeOfTag[type.tag] = type;
   198     }
   200     public void initType(Type type, String name) {
   201         initType(
   202             type,
   203             new ClassSymbol(
   204                 PUBLIC, names.fromString(name), type, rootPackage));
   205     }
   207     public void initType(Type type, String name, String bname) {
   208         initType(type, name);
   209             boxedName[type.tag] = names.fromString("java.lang." + bname);
   210     }
   212     /** The class symbol that owns all predefined symbols.
   213      */
   214     public final ClassSymbol predefClass;
   216     /** Enter a constant into symbol table.
   217      *  @param name   The constant's name.
   218      *  @param type   The constant's type.
   219      */
   220     private VarSymbol enterConstant(String name, Type type) {
   221         VarSymbol c = new VarSymbol(
   222             PUBLIC | STATIC | FINAL,
   223             names.fromString(name),
   224             type,
   225             predefClass);
   226         c.setData(type.constValue());
   227         predefClass.members().enter(c);
   228         return c;
   229     }
   231     /** Enter a binary operation into symbol table.
   232      *  @param name     The name of the operator.
   233      *  @param left     The type of the left operand.
   234      *  @param right    The type of the left operand.
   235      *  @param res      The operation's result type.
   236      *  @param opcode   The operation's bytecode instruction.
   237      */
   238     private void enterBinop(String name,
   239                             Type left, Type right, Type res,
   240                             int opcode) {
   241         predefClass.members().enter(
   242             new OperatorSymbol(
   243                 names.fromString(name),
   244                 new MethodType(List.of(left, right), res,
   245                                List.<Type>nil(), methodClass),
   246                 opcode,
   247                 predefClass));
   248     }
   250     /** Enter a binary operation, as above but with two opcodes,
   251      *  which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2.
   252      *  @param opcode1     First opcode.
   253      *  @param opcode2     Second opcode.
   254      */
   255     private void enterBinop(String name,
   256                             Type left, Type right, Type res,
   257                             int opcode1, int opcode2) {
   258         enterBinop(
   259             name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2);
   260     }
   262     /** Enter a unary operation into symbol table.
   263      *  @param name     The name of the operator.
   264      *  @param arg      The type of the operand.
   265      *  @param res      The operation's result type.
   266      *  @param opcode   The operation's bytecode instruction.
   267      */
   268     private OperatorSymbol enterUnop(String name,
   269                                      Type arg,
   270                                      Type res,
   271                                      int opcode) {
   272         OperatorSymbol sym =
   273             new OperatorSymbol(names.fromString(name),
   274                                new MethodType(List.of(arg),
   275                                               res,
   276                                               List.<Type>nil(),
   277                                               methodClass),
   278                                opcode,
   279                                predefClass);
   280         predefClass.members().enter(sym);
   281         return sym;
   282     }
   284     /** Enter a class into symbol table.
   285      *  @param    The name of the class.
   286      */
   287     private Type enterClass(String s) {
   288         return reader.enterClass(names.fromString(s)).type;
   289     }
   291     public void synthesizeEmptyInterfaceIfMissing(final Type type) {
   292         final Completer completer = type.tsym.completer;
   293         if (completer != null) {
   294             type.tsym.completer = new Completer() {
   295                 public void complete(Symbol sym) throws CompletionFailure {
   296                     try {
   297                         completer.complete(sym);
   298                     } catch (CompletionFailure e) {
   299                         sym.flags_field |= (PUBLIC | INTERFACE);
   300                         ((ClassType) sym.type).supertype_field = objectType;
   301                     }
   302                 }
   303             };
   304         }
   305     }
   307     public void synthesizeBoxTypeIfMissing(final Type type) {
   308         ClassSymbol sym = reader.enterClass(boxedName[type.tag]);
   309         final Completer completer = sym.completer;
   310         if (completer != null) {
   311             sym.completer = new Completer() {
   312                 public void complete(Symbol sym) throws CompletionFailure {
   313                     try {
   314                         completer.complete(sym);
   315                     } catch (CompletionFailure e) {
   316                         sym.flags_field |= PUBLIC;
   317                         ((ClassType) sym.type).supertype_field = objectType;
   318                         Name n = target.boxWithConstructors() ? names.init : names.valueOf;
   319                         MethodSymbol boxMethod =
   320                             new MethodSymbol(PUBLIC | STATIC,
   321                                 n,
   322                                 new MethodType(List.of(type), sym.type,
   323                                     List.<Type>nil(), methodClass),
   324                                 sym);
   325                         sym.members().enter(boxMethod);
   326                         MethodSymbol unboxMethod =
   327                             new MethodSymbol(PUBLIC,
   328                                 type.tsym.name.append(names.Value), // x.intValue()
   329                                 new MethodType(List.<Type>nil(), type,
   330                                     List.<Type>nil(), methodClass),
   331                                 sym);
   332                         sym.members().enter(unboxMethod);
   333                     }
   334                 }
   335             };
   336         }
   338     }
   340     /** Constructor; enters all predefined identifiers and operators
   341      *  into symbol table.
   342      */
   343     protected Symtab(Context context) throws CompletionFailure {
   344         context.put(symtabKey, this);
   346         names = Names.instance(context);
   347         target = Target.instance(context);
   349         // Create the unknown type
   350         unknownType = new Type(TypeTags.UNKNOWN, null) {
   351             @Override
   352             public <R, P> R accept(TypeVisitor<R, P> v, P p) {
   353                 return v.visitUnknown(this, p);
   354             }
   355         };
   357         // create the basic builtin symbols
   358         rootPackage = new PackageSymbol(names.empty, null);
   359         final JavacMessages messages = JavacMessages.instance(context);
   360         unnamedPackage = new PackageSymbol(names.empty, rootPackage) {
   361                 public String toString() {
   362                     return messages.getLocalizedString("compiler.misc.unnamed.package");
   363                 }
   364             };
   365         noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage) {
   366             public <R, P> R accept(ElementVisitor<R, P> v, P p) {
   367                 return v.visitUnknown(this, p);
   368             }
   369         };
   370         noSymbol.kind = Kinds.NIL;
   372         // create the error symbols
   373         errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage);
   374         errType = new ErrorType(errSymbol, Type.noType);
   376         unknownSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.fromString("<any?>"), null, rootPackage);
   377         unknownSymbol.members_field = new Scope.ErrorScope(unknownSymbol);
   378         unknownSymbol.type = unknownType;
   380         // initialize builtin types
   381         initType(byteType, "byte", "Byte");
   382         initType(shortType, "short", "Short");
   383         initType(charType, "char", "Character");
   384         initType(intType, "int", "Integer");
   385         initType(longType, "long", "Long");
   386         initType(floatType, "float", "Float");
   387         initType(doubleType, "double", "Double");
   388         initType(booleanType, "boolean", "Boolean");
   389         initType(voidType, "void", "Void");
   390         initType(botType, "<nulltype>");
   391         initType(errType, errSymbol);
   392         initType(unknownType, unknownSymbol);
   394         // the builtin class of all arrays
   395         arrayClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Array, noSymbol);
   397         // VGJ
   398         boundClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Bound, noSymbol);
   399         boundClass.members_field = new Scope.ErrorScope(boundClass);
   401         // the builtin class of all methods
   402         methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol);
   403         methodClass.members_field = new Scope.ErrorScope(boundClass);
   405         // Create class to hold all predefined constants and operations.
   406         predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
   407         Scope scope = new Scope(predefClass);
   408         predefClass.members_field = scope;
   410         // Enter symbols for basic types.
   411         scope.enter(byteType.tsym);
   412         scope.enter(shortType.tsym);
   413         scope.enter(charType.tsym);
   414         scope.enter(intType.tsym);
   415         scope.enter(longType.tsym);
   416         scope.enter(floatType.tsym);
   417         scope.enter(doubleType.tsym);
   418         scope.enter(booleanType.tsym);
   419         scope.enter(errType.tsym);
   421         // Enter symbol for the errSymbol
   422         scope.enter(errSymbol);
   424         classes.put(predefClass.fullname, predefClass);
   426         reader = ClassReader.instance(context);
   427         reader.init(this);
   429         // Enter predefined classes.
   430         objectType = enterClass("java.lang.Object");
   431         classType = enterClass("java.lang.Class");
   432         stringType = enterClass("java.lang.String");
   433         stringBufferType = enterClass("java.lang.StringBuffer");
   434         stringBuilderType = enterClass("java.lang.StringBuilder");
   435         cloneableType = enterClass("java.lang.Cloneable");
   436         throwableType = enterClass("java.lang.Throwable");
   437         serializableType = enterClass("java.io.Serializable");
   438         transientMethodHandleType = enterClass("java.dyn.MethodHandle"); // transient - 292
   439         methodHandleType = enterClass("java.lang.invoke.MethodHandle");
   440         transientPolymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); // transient - 292
   441         polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature");
   442         errorType = enterClass("java.lang.Error");
   443         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
   444         exceptionType = enterClass("java.lang.Exception");
   445         runtimeExceptionType = enterClass("java.lang.RuntimeException");
   446         classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
   447         noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
   448         noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
   449         assertionErrorType = enterClass("java.lang.AssertionError");
   450         cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
   451         annotationType = enterClass("java.lang.annotation.Annotation");
   452         classLoaderType = enterClass("java.lang.ClassLoader");
   453         enumSym = reader.enterClass(names.java_lang_Enum);
   454         enumFinalFinalize =
   455             new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL,
   456                              names.finalize,
   457                              new MethodType(List.<Type>nil(), voidType,
   458                                             List.<Type>nil(), methodClass),
   459                              enumSym);
   460         listType = enterClass("java.util.List");
   461         collectionsType = enterClass("java.util.Collections");
   462         comparableType = enterClass("java.lang.Comparable");
   463         arraysType = enterClass("java.util.Arrays");
   464         iterableType = target.hasIterable()
   465             ? enterClass("java.lang.Iterable")
   466             : enterClass("java.util.Collection");
   467         iteratorType = enterClass("java.util.Iterator");
   468         annotationTargetType = enterClass("java.lang.annotation.Target");
   469         overrideType = enterClass("java.lang.Override");
   470         retentionType = enterClass("java.lang.annotation.Retention");
   471         deprecatedType = enterClass("java.lang.Deprecated");
   472         suppressWarningsType = enterClass("java.lang.SuppressWarnings");
   473         inheritedType = enterClass("java.lang.annotation.Inherited");
   474         systemType = enterClass("java.lang.System");
   475         autoCloseableType = enterClass("java.lang.AutoCloseable");
   476         autoCloseableClose = new MethodSymbol(PUBLIC,
   477                              names.close,
   478                              new MethodType(List.<Type>nil(), voidType,
   479                                             List.of(exceptionType), methodClass),
   480                              autoCloseableType.tsym);
   481         trustMeType = enterClass("java.lang.SafeVarargs");
   483         synthesizeEmptyInterfaceIfMissing(cloneableType);
   484         synthesizeEmptyInterfaceIfMissing(serializableType);
   485         synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292
   486         synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
   487         synthesizeBoxTypeIfMissing(doubleType);
   488         synthesizeBoxTypeIfMissing(floatType);
   489         synthesizeBoxTypeIfMissing(voidType);
   491         // Enter a synthetic class that is used to mark internal
   492         // proprietary classes in ct.sym.  This class does not have a
   493         // class file.
   494         ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
   495         this.proprietaryType = proprietaryType;
   496         ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
   497         proprietarySymbol.completer = null;
   498         proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
   499         proprietarySymbol.erasure_field = proprietaryType;
   500         proprietarySymbol.members_field = new Scope(proprietarySymbol);
   501         proprietaryType.typarams_field = List.nil();
   502         proprietaryType.allparams_field = List.nil();
   503         proprietaryType.supertype_field = annotationType;
   504         proprietaryType.interfaces_field = List.nil();
   506         // Enter a class for arrays.
   507         // The class implements java.lang.Cloneable and java.io.Serializable.
   508         // It has a final length field and a clone method.
   509         ClassType arrayClassType = (ClassType)arrayClass.type;
   510         arrayClassType.supertype_field = objectType;
   511         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
   512         arrayClass.members_field = new Scope(arrayClass);
   513         lengthVar = new VarSymbol(
   514             PUBLIC | FINAL,
   515             names.length,
   516             intType,
   517             arrayClass);
   518         arrayClass.members().enter(lengthVar);
   519         arrayCloneMethod = new MethodSymbol(
   520             PUBLIC,
   521             names.clone,
   522             new MethodType(List.<Type>nil(), objectType,
   523                            List.<Type>nil(), methodClass),
   524             arrayClass);
   525         arrayClass.members().enter(arrayCloneMethod);
   527         // Enter operators.
   528         enterUnop("+", doubleType, doubleType, nop);
   529         enterUnop("+", floatType, floatType, nop);
   530         enterUnop("+", longType, longType, nop);
   531         enterUnop("+", intType, intType, nop);
   533         enterUnop("-", doubleType, doubleType, dneg);
   534         enterUnop("-", floatType, floatType, fneg);
   535         enterUnop("-", longType, longType, lneg);
   536         enterUnop("-", intType, intType, ineg);
   538         enterUnop("~", longType, longType, lxor);
   539         enterUnop("~", intType, intType, ixor);
   541         enterUnop("++", doubleType, doubleType, dadd);
   542         enterUnop("++", floatType, floatType, fadd);
   543         enterUnop("++", longType, longType, ladd);
   544         enterUnop("++", intType, intType, iadd);
   545         enterUnop("++", charType, charType, iadd);
   546         enterUnop("++", shortType, shortType, iadd);
   547         enterUnop("++", byteType, byteType, iadd);
   549         enterUnop("--", doubleType, doubleType, dsub);
   550         enterUnop("--", floatType, floatType, fsub);
   551         enterUnop("--", longType, longType, lsub);
   552         enterUnop("--", intType, intType, isub);
   553         enterUnop("--", charType, charType, isub);
   554         enterUnop("--", shortType, shortType, isub);
   555         enterUnop("--", byteType, byteType, isub);
   557         enterUnop("!", booleanType, booleanType, bool_not);
   558         nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk);
   560         // string concatenation
   561         enterBinop("+", stringType, objectType, stringType, string_add);
   562         enterBinop("+", objectType, stringType, stringType, string_add);
   563         enterBinop("+", stringType, stringType, stringType, string_add);
   564         enterBinop("+", stringType, intType, stringType, string_add);
   565         enterBinop("+", stringType, longType, stringType, string_add);
   566         enterBinop("+", stringType, floatType, stringType, string_add);
   567         enterBinop("+", stringType, doubleType, stringType, string_add);
   568         enterBinop("+", stringType, booleanType, stringType, string_add);
   569         enterBinop("+", stringType, botType, stringType, string_add);
   570         enterBinop("+", intType, stringType, stringType, string_add);
   571         enterBinop("+", longType, stringType, stringType, string_add);
   572         enterBinop("+", floatType, stringType, stringType, string_add);
   573         enterBinop("+", doubleType, stringType, stringType, string_add);
   574         enterBinop("+", booleanType, stringType, stringType, string_add);
   575         enterBinop("+", botType, stringType, stringType, string_add);
   577         // these errors would otherwise be matched as string concatenation
   578         enterBinop("+", botType, botType, botType, error);
   579         enterBinop("+", botType, intType, botType, error);
   580         enterBinop("+", botType, longType, botType, error);
   581         enterBinop("+", botType, floatType, botType, error);
   582         enterBinop("+", botType, doubleType, botType, error);
   583         enterBinop("+", botType, booleanType, botType, error);
   584         enterBinop("+", botType, objectType, botType, error);
   585         enterBinop("+", intType, botType, botType, error);
   586         enterBinop("+", longType, botType, botType, error);
   587         enterBinop("+", floatType, botType, botType, error);
   588         enterBinop("+", doubleType, botType, botType, error);
   589         enterBinop("+", booleanType, botType, botType, error);
   590         enterBinop("+", objectType, botType, botType, error);
   592         enterBinop("+", doubleType, doubleType, doubleType, dadd);
   593         enterBinop("+", floatType, floatType, floatType, fadd);
   594         enterBinop("+", longType, longType, longType, ladd);
   595         enterBinop("+", intType, intType, intType, iadd);
   597         enterBinop("-", doubleType, doubleType, doubleType, dsub);
   598         enterBinop("-", floatType, floatType, floatType, fsub);
   599         enterBinop("-", longType, longType, longType, lsub);
   600         enterBinop("-", intType, intType, intType, isub);
   602         enterBinop("*", doubleType, doubleType, doubleType, dmul);
   603         enterBinop("*", floatType, floatType, floatType, fmul);
   604         enterBinop("*", longType, longType, longType, lmul);
   605         enterBinop("*", intType, intType, intType, imul);
   607         enterBinop("/", doubleType, doubleType, doubleType, ddiv);
   608         enterBinop("/", floatType, floatType, floatType, fdiv);
   609         enterBinop("/", longType, longType, longType, ldiv);
   610         enterBinop("/", intType, intType, intType, idiv);
   612         enterBinop("%", doubleType, doubleType, doubleType, dmod);
   613         enterBinop("%", floatType, floatType, floatType, fmod);
   614         enterBinop("%", longType, longType, longType, lmod);
   615         enterBinop("%", intType, intType, intType, imod);
   617         enterBinop("&", booleanType, booleanType, booleanType, iand);
   618         enterBinop("&", longType, longType, longType, land);
   619         enterBinop("&", intType, intType, intType, iand);
   621         enterBinop("|", booleanType, booleanType, booleanType, ior);
   622         enterBinop("|", longType, longType, longType, lor);
   623         enterBinop("|", intType, intType, intType, ior);
   625         enterBinop("^", booleanType, booleanType, booleanType, ixor);
   626         enterBinop("^", longType, longType, longType, lxor);
   627         enterBinop("^", intType, intType, intType, ixor);
   629         enterBinop("<<", longType, longType, longType, lshll);
   630         enterBinop("<<", intType, longType, intType, ishll);
   631         enterBinop("<<", longType, intType, longType, lshl);
   632         enterBinop("<<", intType, intType, intType, ishl);
   634         enterBinop(">>", longType, longType, longType, lshrl);
   635         enterBinop(">>", intType, longType, intType, ishrl);
   636         enterBinop(">>", longType, intType, longType, lshr);
   637         enterBinop(">>", intType, intType, intType, ishr);
   639         enterBinop(">>>", longType, longType, longType, lushrl);
   640         enterBinop(">>>", intType, longType, intType, iushrl);
   641         enterBinop(">>>", longType, intType, longType, lushr);
   642         enterBinop(">>>", intType, intType, intType, iushr);
   644         enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt);
   645         enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt);
   646         enterBinop("<", longType, longType, booleanType, lcmp, iflt);
   647         enterBinop("<", intType, intType, booleanType, if_icmplt);
   649         enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt);
   650         enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt);
   651         enterBinop(">", longType, longType, booleanType, lcmp, ifgt);
   652         enterBinop(">", intType, intType, booleanType, if_icmpgt);
   654         enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle);
   655         enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle);
   656         enterBinop("<=", longType, longType, booleanType, lcmp, ifle);
   657         enterBinop("<=", intType, intType, booleanType, if_icmple);
   659         enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge);
   660         enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge);
   661         enterBinop(">=", longType, longType, booleanType, lcmp, ifge);
   662         enterBinop(">=", intType, intType, booleanType, if_icmpge);
   664         enterBinop("==", objectType, objectType, booleanType, if_acmpeq);
   665         enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq);
   666         enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq);
   667         enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq);
   668         enterBinop("==", longType, longType, booleanType, lcmp, ifeq);
   669         enterBinop("==", intType, intType, booleanType, if_icmpeq);
   671         enterBinop("!=", objectType, objectType, booleanType, if_acmpne);
   672         enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne);
   673         enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne);
   674         enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne);
   675         enterBinop("!=", longType, longType, booleanType, lcmp, ifne);
   676         enterBinop("!=", intType, intType, booleanType, if_icmpne);
   678         enterBinop("&&", booleanType, booleanType, booleanType, bool_and);
   679         enterBinop("||", booleanType, booleanType, booleanType, bool_or);
   680     }
   681 }

mercurial