< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java

Print this page
*** 31,10 ***
--- 31,11 ---
  import java.util.Locale;
  import java.util.Map;
  import java.util.Optional;
  import java.util.Set;
  import java.util.WeakHashMap;
+ import java.util.function.BiFunction;
  import java.util.function.BiPredicate;
  import java.util.function.Function;
  import java.util.function.Predicate;
  import java.util.stream.Collector;
  

*** 47,11 ***
  import com.sun.tools.javac.code.TypeMetadata.Annotations;
  import com.sun.tools.javac.comp.AttrContext;
  import com.sun.tools.javac.comp.Check;
  import com.sun.tools.javac.comp.Enter;
  import com.sun.tools.javac.comp.Env;
- import com.sun.tools.javac.comp.LambdaToMethod;
  import com.sun.tools.javac.jvm.ClassFile;
  import com.sun.tools.javac.util.*;
  
  import static com.sun.tools.javac.code.BoundKind.*;
  import static com.sun.tools.javac.code.Flags.*;
--- 48,10 ---

*** 120,11 ***
          chk = Check.instance(context);
          enter = Enter.instance(context);
          capturedName = names.fromString("<captured wildcard>");
          messages = JavacMessages.instance(context);
          diags = JCDiagnostic.Factory.instance(context);
!         noWarnings = new Warner(null);
          Options options = Options.instance(context);
          dumpStacktraceOnError = options.isSet("dev") || options.isSet(DOE);
      }
      // </editor-fold>
  
--- 120,16 ---
          chk = Check.instance(context);
          enter = Enter.instance(context);
          capturedName = names.fromString("<captured wildcard>");
          messages = JavacMessages.instance(context);
          diags = JCDiagnostic.Factory.instance(context);
!         noWarnings = new Warner(null) {
+             @Override
+             public String toString() {
+                 return "NO_WARNINGS";
+             }
+         };
          Options options = Options.instance(context);
          dumpStacktraceOnError = options.isSet("dev") || options.isSet(DOE);
      }
      // </editor-fold>
  

*** 2128,14 ***
       *
       * @param t The component type of the ArrayType
       * @return the ArrayType for the given component
       */
      public ArrayType makeArrayType(Type t) {
          if (t.hasTag(VOID) || t.hasTag(PACKAGE)) {
              Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString());
          }
!         return new ArrayType(t, syms.arrayClass);
      }
      // </editor-fold>
  
      // <editor-fold defaultstate="collapsed" desc="asSuper">
      /**
--- 2133,22 ---
       *
       * @param t The component type of the ArrayType
       * @return the ArrayType for the given component
       */
      public ArrayType makeArrayType(Type t) {
+         return makeArrayType(t, 1);
+     }
+ 
+     public ArrayType makeArrayType(Type t, int dimensions) {
          if (t.hasTag(VOID) || t.hasTag(PACKAGE)) {
              Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString());
          }
!         ArrayType result = new ArrayType(t, syms.arrayClass);
+         for (int i = 1; i < dimensions; i++) {
+             result = new ArrayType(result, syms.arrayClass);
+         }
+         return result;
      }
      // </editor-fold>
  
      // <editor-fold defaultstate="collapsed" desc="asSuper">
      /**

*** 3897,11 ***
              }
              Assert.check(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
              // There is no spec detailing how type annotations are to
              // be inherited.  So set it to noAnnotations for now
              return new ClassType(class1.getEnclosingType(), merged.toList(),
!                                  class1.tsym);
          }
  
      /**
       * Return the minimum type of a closure, a compound type if no
       * unique minimum exists.
--- 3910,11 ---
              }
              Assert.check(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
              // There is no spec detailing how type annotations are to
              // be inherited.  So set it to noAnnotations for now
              return new ClassType(class1.getEnclosingType(), merged.toList(),
!                                  class1.tsym, List.nil());
          }
  
      /**
       * Return the minimum type of a closure, a compound type if no
       * unique minimum exists.

*** 4879,14 ***
       * A wrapper for a type that allows use in sets.
       */
      public static class UniqueType {
          public final Type type;
          final Types types;
  
!         public UniqueType(Type type, Types types) {
              this.type = type;
              this.types = types;
          }
  
          public int hashCode() {
              return types.hashCode(type);
          }
--- 4892,20 ---
       * A wrapper for a type that allows use in sets.
       */
      public static class UniqueType {
          public final Type type;
          final Types types;
+         private boolean encodeTypeSig;
  
!         public UniqueType(Type type, Types types, boolean encodeTypeSig) {
              this.type = type;
              this.types = types;
+             this.encodeTypeSig = encodeTypeSig;
+         }
+ 
+         public UniqueType(Type type, Types types) {
+             this(type, types, true);
          }
  
          public int hashCode() {
              return types.hashCode(type);
          }

*** 4894,10 ***
--- 4913,14 ---
          public boolean equals(Object obj) {
              return (obj instanceof UniqueType uniqueType) &&
                      types.isSameType(type, uniqueType.type);
          }
  
+         public boolean encodeTypeSig() {
+             return encodeTypeSig;
+         }
+ 
          public String toString() {
              return type.toString();
          }
  
      }
< prev index next >