Merge jdk8-b78

Sun, 17 Feb 2013 16:44:55 -0500

author
dholmes
date
Sun, 17 Feb 2013 16:44:55 -0500
changeset 1571
af8417e590f4
parent 1570
f91144b7da75
parent 1567
a3aa32fe4536
child 1572
56dfafbb9e1a
child 1603
6118072811e5

Merge

src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Flags.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Attr.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Check.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java file | annotate | diff | comparison | revisions
test/tools/javac/lambda/TargetType20.out file | annotate | diff | comparison | revisions
test/tools/javac/lambda/TargetType50.out file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Mon Feb 04 18:08:53 2013 -0500
     1.2 +++ b/.hgtags	Sun Feb 17 16:44:55 2013 -0500
     1.3 @@ -196,3 +196,6 @@
     1.4  6f0986ed9b7e11d6eb06618f27e20b18f19fb797 jdk8-b72
     1.5  8d0baee36c7184d55c80354b45704c37d6b7ac79 jdk8-b73
     1.6  56c97aff46bb577b8668874154c24115a7e8a3e8 jdk8-b74
     1.7 +c2e11e2ec4a3682513e566849e5562f31ded8c65 jdk8-b75
     1.8 +e81839b3233792415daaab051698edc6067f1a16 jdk8-b76
     1.9 +89c66415168925dffe492356ff893ff248bb5603 jdk8-b77
     2.1 --- a/make/Makefile-classic	Mon Feb 04 18:08:53 2013 -0500
     2.2 +++ b/make/Makefile-classic	Sun Feb 17 16:44:55 2013 -0500
     2.3 @@ -241,6 +241,7 @@
     2.4  	javax/annotation/processing \
     2.5  	javax/lang/model \
     2.6  	javax/tools \
     2.7 +        jdk/ \
     2.8  	com/sun/source \
     2.9  	com/sun/tools/javac 
    2.10  
     3.1 --- a/make/build.properties	Mon Feb 04 18:08:53 2013 -0500
     3.2 +++ b/make/build.properties	Sun Feb 17 16:44:55 2013 -0500
     3.3 @@ -116,6 +116,7 @@
     3.4          javax/annotation/processing/ \
     3.5          javax/lang/model/ \
     3.6          javax/tools/ \
     3.7 +        jdk/ \
     3.8          com/sun/source/ \
     3.9          com/sun/tools/javac/ \
    3.10          com/sun/tools/doclint/
     4.1 --- a/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Mon Feb 04 18:08:53 2013 -0500
     4.2 +++ b/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Sun Feb 17 16:44:55 2013 -0500
     4.3 @@ -56,7 +56,7 @@
     4.4      public static final int ACC_SYNTHETIC     = 0x1000; // class, inner, field, method
     4.5      public static final int ACC_ANNOTATION    = 0x2000; // class, inner
     4.6      public static final int ACC_ENUM          = 0x4000; // class, inner, field
     4.7 -    public static final int ACC_MODULE        = 0x8000; // class, inner, field, method
     4.8 +    public static final int ACC_MANDATED      = 0x8000; // class, inner, field, method
     4.9  
    4.10      public static enum Kind { Class, InnerClass, Field, Method};
    4.11  
    4.12 @@ -81,12 +81,12 @@
    4.13      }
    4.14  
    4.15      private static final int[] classModifiers = {
    4.16 -        ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT, ACC_MODULE
    4.17 +        ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT
    4.18      };
    4.19  
    4.20      private static final int[] classFlags = {
    4.21          ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_INTERFACE, ACC_ABSTRACT,
    4.22 -        ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM, ACC_MODULE
    4.23 +        ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
    4.24      };
    4.25  
    4.26      public Set<String> getClassModifiers() {
    4.27 @@ -100,12 +100,12 @@
    4.28  
    4.29      private static final int[] innerClassModifiers = {
    4.30          ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
    4.31 -        ACC_ABSTRACT, ACC_MODULE
    4.32 +        ACC_ABSTRACT
    4.33      };
    4.34  
    4.35      private static final int[] innerClassFlags = {
    4.36          ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_SUPER,
    4.37 -        ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM, ACC_MODULE
    4.38 +        ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
    4.39      };
    4.40  
    4.41      public Set<String> getInnerClassModifiers() {
    4.42 @@ -119,12 +119,12 @@
    4.43  
    4.44      private static final int[] fieldModifiers = {
    4.45          ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
    4.46 -        ACC_VOLATILE, ACC_TRANSIENT, ACC_MODULE
    4.47 +        ACC_VOLATILE, ACC_TRANSIENT
    4.48      };
    4.49  
    4.50      private static final int[] fieldFlags = {
    4.51          ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
    4.52 -        ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM, ACC_MODULE
    4.53 +        ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM
    4.54      };
    4.55  
    4.56      public Set<String> getFieldModifiers() {
    4.57 @@ -137,13 +137,13 @@
    4.58  
    4.59      private static final int[] methodModifiers = {
    4.60          ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
    4.61 -        ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT, ACC_MODULE
    4.62 +        ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT
    4.63      };
    4.64  
    4.65      private static final int[] methodFlags = {
    4.66          ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
    4.67          ACC_SYNCHRONIZED, ACC_BRIDGE, ACC_VARARGS, ACC_NATIVE, ACC_ABSTRACT,
    4.68 -        ACC_STRICT, ACC_SYNTHETIC, ACC_MODULE
    4.69 +        ACC_STRICT, ACC_SYNTHETIC
    4.70      };
    4.71  
    4.72      public Set<String> getMethodModifiers() {
    4.73 @@ -208,8 +208,8 @@
    4.74                  return "abstract";
    4.75              case ACC_STRICT:
    4.76                  return "strictfp";
    4.77 -            case ACC_MODULE:
    4.78 -                return "module";
    4.79 +            case ACC_MANDATED:
    4.80 +                return "mandated";
    4.81              default:
    4.82                  return null;
    4.83          }
    4.84 @@ -247,8 +247,8 @@
    4.85              return "ACC_ANNOTATION";
    4.86          case ACC_ENUM:
    4.87              return "ACC_ENUM";
    4.88 -        case ACC_MODULE:
    4.89 -            return "ACC_MODULE";
    4.90 +        case ACC_MANDATED:
    4.91 +            return "ACC_MANDATED";
    4.92          default:
    4.93              return null;
    4.94          }
     5.1 --- a/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Mon Feb 04 18:08:53 2013 -0500
     5.2 +++ b/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Sun Feb 17 16:44:55 2013 -0500
     5.3 @@ -727,12 +727,13 @@
     5.4          private void write(TypeAnnotation.Position p, ClassOutputStream out) {
     5.5              out.writeByte(p.type.targetTypeValue());
     5.6              switch (p.type) {
     5.7 -            // type cast
     5.8 -            case CAST:
     5.9              // instanceof
    5.10              case INSTANCEOF:
    5.11              // new expression
    5.12              case NEW:
    5.13 +            // constructor/method reference receiver
    5.14 +            case CONSTRUCTOR_REFERENCE:
    5.15 +            case METHOD_REFERENCE:
    5.16                  out.writeShort(p.offset);
    5.17                  break;
    5.18              // local variable
    5.19 @@ -779,9 +780,12 @@
    5.20              case METHOD_FORMAL_PARAMETER:
    5.21                  out.writeByte(p.parameter_index);
    5.22                  break;
    5.23 +            // type cast
    5.24 +            case CAST:
    5.25              // method/constructor/reference type argument
    5.26              case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
    5.27              case METHOD_INVOCATION_TYPE_ARGUMENT:
    5.28 +            case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
    5.29              case METHOD_REFERENCE_TYPE_ARGUMENT:
    5.30                  out.writeShort(p.offset);
    5.31                  out.writeByte(p.type_index);
    5.32 @@ -790,10 +794,6 @@
    5.33              case METHOD_RETURN:
    5.34              case FIELD:
    5.35                  break;
    5.36 -            // lambda formal parameter
    5.37 -            case LAMBDA_FORMAL_PARAMETER:
    5.38 -                out.writeByte(p.parameter_index);
    5.39 -                break;
    5.40              case UNKNOWN:
    5.41                  throw new AssertionError("ClassWriter: UNKNOWN target type should never occur!");
    5.42              default:
     6.1 --- a/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Mon Feb 04 18:08:53 2013 -0500
     6.2 +++ b/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Sun Feb 17 16:44:55 2013 -0500
     6.3 @@ -86,12 +86,13 @@
     6.4          position.type = type;
     6.5  
     6.6          switch (type) {
     6.7 -        // type cast
     6.8 -        case CAST:
     6.9          // instanceof
    6.10          case INSTANCEOF:
    6.11          // new expression
    6.12          case NEW:
    6.13 +        // constructor/method reference receiver
    6.14 +        case CONSTRUCTOR_REFERENCE:
    6.15 +        case METHOD_REFERENCE:
    6.16              position.offset = cr.readUnsignedShort();
    6.17              break;
    6.18          // local variable
    6.19 @@ -142,9 +143,12 @@
    6.20          case METHOD_FORMAL_PARAMETER:
    6.21              position.parameter_index = cr.readUnsignedByte();
    6.22              break;
    6.23 +        // type cast
    6.24 +        case CAST:
    6.25          // method/constructor/reference type argument
    6.26          case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
    6.27          case METHOD_INVOCATION_TYPE_ARGUMENT:
    6.28 +        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
    6.29          case METHOD_REFERENCE_TYPE_ARGUMENT:
    6.30              position.offset = cr.readUnsignedShort();
    6.31              position.type_index = cr.readUnsignedByte();
    6.32 @@ -153,10 +157,6 @@
    6.33          case METHOD_RETURN:
    6.34          case FIELD:
    6.35              break;
    6.36 -        // lambda formal parameter
    6.37 -        case LAMBDA_FORMAL_PARAMETER:
    6.38 -            position.parameter_index = cr.readUnsignedByte();
    6.39 -            break;
    6.40          case UNKNOWN:
    6.41              throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
    6.42          default:
    6.43 @@ -177,13 +177,14 @@
    6.44          int n = 0;
    6.45          n += 1; // TargetType tag is a byte
    6.46          switch (pos.type) {
    6.47 -        // type cast
    6.48 -        case CAST:
    6.49          // instanceof
    6.50          case INSTANCEOF:
    6.51          // new expression
    6.52          case NEW:
    6.53 -            n += 2;
    6.54 +        // constructor/method reference receiver
    6.55 +        case CONSTRUCTOR_REFERENCE:
    6.56 +        case METHOD_REFERENCE:
    6.57 +            n += 2; // offset
    6.58              break;
    6.59          // local variable
    6.60          case LOCAL_VARIABLE:
    6.61 @@ -192,7 +193,7 @@
    6.62              n += 2; // table_length;
    6.63              int table_length = pos.lvarOffset.length;
    6.64              n += 2 * table_length; // offset
    6.65 -            n += 2 * table_length; // length;
    6.66 +            n += 2 * table_length; // length
    6.67              n += 2 * table_length; // index
    6.68              break;
    6.69          // exception parameter
    6.70 @@ -206,7 +207,7 @@
    6.71          // type parameter
    6.72          case CLASS_TYPE_PARAMETER:
    6.73          case METHOD_TYPE_PARAMETER:
    6.74 -            n += 1; // parameter_index;
    6.75 +            n += 1; // parameter_index
    6.76              break;
    6.77          // type parameter bound
    6.78          case CLASS_TYPE_PARAMETER_BOUND:
    6.79 @@ -226,9 +227,12 @@
    6.80          case METHOD_FORMAL_PARAMETER:
    6.81              n += 1; // parameter_index
    6.82              break;
    6.83 +        // type cast
    6.84 +        case CAST:
    6.85          // method/constructor/reference type argument
    6.86          case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
    6.87          case METHOD_INVOCATION_TYPE_ARGUMENT:
    6.88 +        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
    6.89          case METHOD_REFERENCE_TYPE_ARGUMENT:
    6.90              n += 2; // offset
    6.91              n += 1; // type index
    6.92 @@ -237,10 +241,6 @@
    6.93          case METHOD_RETURN:
    6.94          case FIELD:
    6.95              break;
    6.96 -        // lambda formal parameter
    6.97 -        case LAMBDA_FORMAL_PARAMETER:
    6.98 -            n += 1; // parameter_index
    6.99 -            break;
   6.100          case UNKNOWN:
   6.101              throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
   6.102          default:
   6.103 @@ -377,12 +377,13 @@
   6.104              sb.append(type);
   6.105  
   6.106              switch (type) {
   6.107 -            // type cast
   6.108 -            case CAST:
   6.109              // instanceof
   6.110              case INSTANCEOF:
   6.111              // new expression
   6.112              case NEW:
   6.113 +            // constructor/method reference receiver
   6.114 +            case CONSTRUCTOR_REFERENCE:
   6.115 +            case METHOD_REFERENCE:
   6.116                  sb.append(", offset = ");
   6.117                  sb.append(offset);
   6.118                  break;
   6.119 @@ -444,9 +445,12 @@
   6.120                  sb.append(", param_index = ");
   6.121                  sb.append(parameter_index);
   6.122                  break;
   6.123 +            // type cast
   6.124 +            case CAST:
   6.125              // method/constructor/reference type argument
   6.126              case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
   6.127              case METHOD_INVOCATION_TYPE_ARGUMENT:
   6.128 +            case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
   6.129              case METHOD_REFERENCE_TYPE_ARGUMENT:
   6.130                  sb.append(", offset = ");
   6.131                  sb.append(offset);
   6.132 @@ -457,12 +461,6 @@
   6.133              case METHOD_RETURN:
   6.134              case FIELD:
   6.135                  break;
   6.136 -            // lambda formal parameter
   6.137 -            case LAMBDA_FORMAL_PARAMETER:
   6.138 -                // TODO: also needs an offset?
   6.139 -                sb.append(", param_index = ");
   6.140 -                sb.append(parameter_index);
   6.141 -                break;
   6.142              case UNKNOWN:
   6.143                  sb.append(", position UNKNOWN!");
   6.144                  break;
   6.145 @@ -564,34 +562,37 @@
   6.146          /** For annotations on an exception parameter. */
   6.147          EXCEPTION_PARAMETER(0x42, true),
   6.148  
   6.149 -        /** For annotations on a typecast. */
   6.150 -        CAST(0x43, true),
   6.151 -
   6.152          /** For annotations on a type test. */
   6.153 -        INSTANCEOF(0x44, true),
   6.154 +        INSTANCEOF(0x43, true),
   6.155  
   6.156          /** For annotations on an object creation expression. */
   6.157 -        NEW(0x45, true),
   6.158 +        NEW(0x44, true),
   6.159 +
   6.160 +        /** For annotations on a constructor reference receiver. */
   6.161 +        CONSTRUCTOR_REFERENCE(0x45, true),
   6.162 +
   6.163 +        /** For annotations on a method reference receiver. */
   6.164 +        METHOD_REFERENCE(0x46, true),
   6.165 +
   6.166 +        /** For annotations on a typecast. */
   6.167 +        CAST(0x47, true),
   6.168  
   6.169          /** For annotations on a type argument of an object creation expression. */
   6.170 -        CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x46, true),
   6.171 +        CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
   6.172  
   6.173          /** For annotations on a type argument of a method call. */
   6.174 -        METHOD_INVOCATION_TYPE_ARGUMENT(0x47, true),
   6.175 +        METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
   6.176  
   6.177 -        /** For annotations on a lambda parameter type. */
   6.178 -        LAMBDA_FORMAL_PARAMETER(0x48, true),
   6.179 -
   6.180 -        /** For annotations on a method reference. */
   6.181 -        METHOD_REFERENCE(0x49, true),
   6.182 +        /** For annotations on a type argument of a constructor reference. */
   6.183 +        CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
   6.184  
   6.185          /** For annotations on a type argument of a method reference. */
   6.186 -        METHOD_REFERENCE_TYPE_ARGUMENT(0x50, true),
   6.187 +        METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
   6.188  
   6.189          /** For annotations with an unknown target. */
   6.190          UNKNOWN(0xFF);
   6.191  
   6.192 -        private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x50;
   6.193 +        private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
   6.194  
   6.195          private final int targetTypeValue;
   6.196          private final boolean isLocal;
     7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Mon Feb 04 18:08:53 2013 -0500
     7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Sun Feb 17 16:44:55 2013 -0500
     7.3 @@ -237,10 +237,7 @@
     7.4      protected void addOverviewComment(Content htmltree) {
     7.5          if (root.inlineTags().length > 0) {
     7.6              htmltree.addContent(getMarkerAnchor("overview_description"));
     7.7 -            HtmlTree div = new HtmlTree(HtmlTag.DIV);
     7.8 -            div.addStyle(HtmlStyle.subTitle);
     7.9 -            addInlineComment(root, div);
    7.10 -            htmltree.addContent(div);
    7.11 +            addInlineComment(root, htmltree);
    7.12          }
    7.13      }
    7.14  
    7.15 @@ -252,7 +249,7 @@
    7.16       */
    7.17      protected void addOverview(Content body) throws IOException {
    7.18          HtmlTree div = new HtmlTree(HtmlTag.DIV);
    7.19 -        div.addStyle(HtmlStyle.footer);
    7.20 +        div.addStyle(HtmlStyle.contentContainer);
    7.21          addOverviewComment(div);
    7.22          addTagsInfo(root, div);
    7.23          body.addContent(div);
     8.1 --- a/src/share/classes/com/sun/tools/doclint/Checker.java	Mon Feb 04 18:08:53 2013 -0500
     8.2 +++ b/src/share/classes/com/sun/tools/doclint/Checker.java	Sun Feb 17 16:44:55 2013 -0500
     8.3 @@ -245,12 +245,19 @@
     8.4          if (t == null) {
     8.5              env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
     8.6          } else {
     8.7 +            boolean done = false;
     8.8              for (TagStackItem tsi: tagStack) {
     8.9                  if (tsi.tag.accepts(t)) {
    8.10                      while (tagStack.peek() != tsi) tagStack.pop();
    8.11 +                    done = true;
    8.12                      break;
    8.13 -                } else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL)
    8.14 +                } else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL) {
    8.15 +                    done = true;
    8.16                      break;
    8.17 +                }
    8.18 +            }
    8.19 +            if (!done && HtmlTag.BODY.accepts(t)) {
    8.20 +                tagStack.clear();
    8.21              }
    8.22  
    8.23              checkStructure(tree, t);
     9.1 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Mon Feb 04 18:08:53 2013 -0500
     9.2 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Sun Feb 17 16:44:55 2013 -0500
     9.3 @@ -74,6 +74,7 @@
     9.4          if ((mask&DEPRECATED) != 0) flags.add(Flag.DEPRECATED);
     9.5          if ((mask&HASINIT) != 0) flags.add(Flag.HASINIT);
     9.6          if ((mask&ENUM) != 0) flags.add(Flag.ENUM);
     9.7 +        if ((mask&MANDATED) != 0) flags.add(Flag.MANDATED);
     9.8          if ((mask&IPROXY) != 0) flags.add(Flag.IPROXY);
     9.9          if ((mask&NOOUTERTHIS) != 0) flags.add(Flag.NOOUTERTHIS);
    9.10          if ((mask&EXISTS) != 0) flags.add(Flag.EXISTS);
    9.11 @@ -114,6 +115,9 @@
    9.12       *  classfile v49.0. */
    9.13      public static final int ENUM         = 1<<14;
    9.14  
    9.15 +    /** Added in SE8, represents constructs implicitly declared in source. */
    9.16 +    public static final int MANDATED     = 1<<15;
    9.17 +
    9.18      public static final int StandardFlags = 0x0fff;
    9.19      public static final int ModifierFlags = StandardFlags & ~INTERFACE;
    9.20  
    9.21 @@ -347,6 +351,7 @@
    9.22          DEPRECATED("deprecated"),
    9.23          HASINIT("hasinit"),
    9.24          ENUM("enum"),
    9.25 +        MANDATED("mandated"),
    9.26          IPROXY("iproxy"),
    9.27          NOOUTERTHIS("noouterthis"),
    9.28          EXISTS("exists"),
    10.1 --- a/src/share/classes/com/sun/tools/javac/code/Source.java	Mon Feb 04 18:08:53 2013 -0500
    10.2 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Sun Feb 17 16:44:55 2013 -0500
    10.3 @@ -221,7 +221,7 @@
    10.4      public boolean allowIntersectionTypesInCast() {
    10.5          return compareTo(JDK1_8) >= 0;
    10.6      }
    10.7 -    public boolean allowEarlyReturnConstraints() {
    10.8 +    public boolean allowGraphInference() {
    10.9          return compareTo(JDK1_8) >= 0;
   10.10      }
   10.11      public boolean allowStructuralMostSpecific() {
    11.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Feb 04 18:08:53 2013 -0500
    11.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Sun Feb 17 16:44:55 2013 -0500
    11.3 @@ -217,6 +217,14 @@
    11.4          return (flags() & INTERFACE) != 0;
    11.5      }
    11.6  
    11.7 +    public boolean isPrivate() {
    11.8 +        return (flags_field & Flags.AccessFlags) == PRIVATE;
    11.9 +    }
   11.10 +
   11.11 +    public boolean isEnum() {
   11.12 +        return (flags() & ENUM) != 0;
   11.13 +    }
   11.14 +
   11.15      /** Is this symbol declared (directly or indirectly) local
   11.16       *  to a method or variable initializer?
   11.17       *  Also includes fields of inner classes which are in
   11.18 @@ -479,7 +487,7 @@
   11.19      }
   11.20  
   11.21      // This method is part of the javax.lang.model API, do not use this in javac code.
   11.22 -    public <A extends java.lang.annotation.Annotation> A[] getAnnotations(Class<A> annoType) {
   11.23 +    public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) {
   11.24          return JavacElements.getAnnotations(this, annoType);
   11.25      }
   11.26  
   11.27 @@ -496,9 +504,9 @@
   11.28          return l.toList();
   11.29      }
   11.30  
   11.31 -    public static class DelegatedSymbol extends Symbol {
   11.32 -        protected Symbol other;
   11.33 -        public DelegatedSymbol(Symbol other) {
   11.34 +    public static class DelegatedSymbol<T extends Symbol> extends Symbol {
   11.35 +        protected T other;
   11.36 +        public DelegatedSymbol(T other) {
   11.37              super(other.kind, other.flags_field, other.name, other.type, other.owner);
   11.38              this.other = other;
   11.39          }
   11.40 @@ -532,6 +540,10 @@
   11.41          public <R, P> R accept(Symbol.Visitor<R, P> v, P p) {
   11.42              return v.visitSymbol(other, p);
   11.43          }
   11.44 +
   11.45 +        public T getUnderlyingSymbol() {
   11.46 +            return other;
   11.47 +        }
   11.48      }
   11.49  
   11.50      /** A class for type symbols. Type variables are represented by instances
   11.51 @@ -1078,6 +1090,9 @@
   11.52          /** The code of the method. */
   11.53          public Code code = null;
   11.54  
   11.55 +        /** The extra (synthetic/mandated) parameters of the method. */
   11.56 +        public List<VarSymbol> extraParams = List.nil();
   11.57 +
   11.58          /** The parameters of the method. */
   11.59          public List<VarSymbol> params = null;
   11.60  
    12.1 --- a/src/share/classes/com/sun/tools/javac/code/TargetType.java	Mon Feb 04 18:08:53 2013 -0500
    12.2 +++ b/src/share/classes/com/sun/tools/javac/code/TargetType.java	Sun Feb 17 16:44:55 2013 -0500
    12.3 @@ -82,34 +82,37 @@
    12.4      /** For annotations on an exception parameter. */
    12.5      EXCEPTION_PARAMETER(0x42, true),
    12.6  
    12.7 -    /** For annotations on a typecast. */
    12.8 -    CAST(0x43, true),
    12.9 -
   12.10      /** For annotations on a type test. */
   12.11 -    INSTANCEOF(0x44, true),
   12.12 +    INSTANCEOF(0x43, true),
   12.13  
   12.14      /** For annotations on an object creation expression. */
   12.15 -    NEW(0x45, true),
   12.16 +    NEW(0x44, true),
   12.17 +
   12.18 +    /** For annotations on a constructor reference receiver. */
   12.19 +    CONSTRUCTOR_REFERENCE(0x45, true),
   12.20 +
   12.21 +    /** For annotations on a method reference receiver. */
   12.22 +    METHOD_REFERENCE(0x46, true),
   12.23 +
   12.24 +    /** For annotations on a typecast. */
   12.25 +    CAST(0x47, true),
   12.26  
   12.27      /** For annotations on a type argument of an object creation expression. */
   12.28 -    CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x46, true),
   12.29 +    CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
   12.30  
   12.31      /** For annotations on a type argument of a method call. */
   12.32 -    METHOD_INVOCATION_TYPE_ARGUMENT(0x47, true),
   12.33 +    METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
   12.34  
   12.35 -    /** For annotations on a lambda parameter type. */
   12.36 -    LAMBDA_FORMAL_PARAMETER(0x48, true),
   12.37 -
   12.38 -    /** For annotations on a method reference. */
   12.39 -    METHOD_REFERENCE(0x49, true),
   12.40 +    /** For annotations on a type argument of a constructor reference. */
   12.41 +    CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
   12.42  
   12.43      /** For annotations on a type argument of a method reference. */
   12.44 -    METHOD_REFERENCE_TYPE_ARGUMENT(0x50, true),
   12.45 +    METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
   12.46  
   12.47      /** For annotations with an unknown target. */
   12.48      UNKNOWN(0xFF);
   12.49  
   12.50 -    private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x92;
   12.51 +    private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
   12.52  
   12.53      private final int targetTypeValue;
   12.54      private final boolean isLocal;
    13.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java	Mon Feb 04 18:08:53 2013 -0500
    13.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Sun Feb 17 16:44:55 2013 -0500
    13.3 @@ -1309,6 +1309,9 @@
    13.4          /** inference variable's inferred type (set from Infer.java) */
    13.5          public Type inst = null;
    13.6  
    13.7 +        /** number of declared (upper) bounds */
    13.8 +        public int declaredCount;
    13.9 +
   13.10          /** inference variable's change listener */
   13.11          public UndetVarListener listener = null;
   13.12  
   13.13 @@ -1318,13 +1321,11 @@
   13.14          }
   13.15  
   13.16          public UndetVar(TypeVar origin, Types types) {
   13.17 -            this(origin, types, true);
   13.18 -        }
   13.19 -
   13.20 -        public UndetVar(TypeVar origin, Types types, boolean includeBounds) {
   13.21              super(UNDETVAR, origin);
   13.22              bounds = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class);
   13.23 -            bounds.put(InferenceBound.UPPER, includeBounds ? types.getBounds(origin) : List.<Type>nil());
   13.24 +            List<Type> declaredBounds = types.getBounds(origin);
   13.25 +            declaredCount = declaredBounds.length();
   13.26 +            bounds.put(InferenceBound.UPPER, declaredBounds);
   13.27              bounds.put(InferenceBound.LOWER, List.<Type>nil());
   13.28              bounds.put(InferenceBound.EQ, List.<Type>nil());
   13.29          }
   13.30 @@ -1340,38 +1341,89 @@
   13.31          }
   13.32  
   13.33          /** get all bounds of a given kind */
   13.34 -        public List<Type> getBounds(InferenceBound ib) {
   13.35 -            return bounds.get(ib);
   13.36 +        public List<Type> getBounds(InferenceBound... ibs) {
   13.37 +            ListBuffer<Type> buf = ListBuffer.lb();
   13.38 +            for (InferenceBound ib : ibs) {
   13.39 +                buf.appendList(bounds.get(ib));
   13.40 +            }
   13.41 +            return buf.toList();
   13.42 +        }
   13.43 +
   13.44 +        /** get the list of declared (upper) bounds */
   13.45 +        public List<Type> getDeclaredBounds() {
   13.46 +            ListBuffer<Type> buf = ListBuffer.lb();
   13.47 +            int count = 0;
   13.48 +            for (Type b : getBounds(InferenceBound.UPPER)) {
   13.49 +                if (count++ == declaredCount) break;
   13.50 +                buf.append(b);
   13.51 +            }
   13.52 +            return buf.toList();
   13.53          }
   13.54  
   13.55          /** add a bound of a given kind - this might trigger listener notification */
   13.56          public void addBound(InferenceBound ib, Type bound, Types types) {
   13.57 +            Type bound2 = toTypeVarMap.apply(bound);
   13.58              List<Type> prevBounds = bounds.get(ib);
   13.59              for (Type b : prevBounds) {
   13.60 -                if (types.isSameType(b, bound)) {
   13.61 -                    return;
   13.62 -                }
   13.63 +                //check for redundancy - use strict version of isSameType on tvars
   13.64 +                //(as the standard version will lead to false positives w.r.t. clones ivars)
   13.65 +                if (types.isSameType(b, bound2, true)) return;
   13.66              }
   13.67 -            bounds.put(ib, prevBounds.prepend(bound));
   13.68 +            bounds.put(ib, prevBounds.prepend(bound2));
   13.69              notifyChange(EnumSet.of(ib));
   13.70          }
   13.71 +        //where
   13.72 +            Type.Mapping toTypeVarMap = new Mapping("toTypeVarMap") {
   13.73 +                @Override
   13.74 +                public Type apply(Type t) {
   13.75 +                    if (t.hasTag(UNDETVAR)) {
   13.76 +                        UndetVar uv = (UndetVar)t;
   13.77 +                        return uv.qtype;
   13.78 +                    } else {
   13.79 +                        return t.map(this);
   13.80 +                    }
   13.81 +                }
   13.82 +            };
   13.83  
   13.84          /** replace types in all bounds - this might trigger listener notification */
   13.85          public void substBounds(List<Type> from, List<Type> to, Types types) {
   13.86 -            EnumSet<InferenceBound> changed = EnumSet.noneOf(InferenceBound.class);
   13.87 -            Map<InferenceBound, List<Type>> bounds2 = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class);
   13.88 -            for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
   13.89 -                InferenceBound ib = _entry.getKey();
   13.90 -                List<Type> prevBounds = _entry.getValue();
   13.91 -                List<Type> newBounds = types.subst(prevBounds, from, to);
   13.92 -                bounds2.put(ib, newBounds);
   13.93 -                if (prevBounds != newBounds) {
   13.94 -                    changed.add(ib);
   13.95 +            List<Type> instVars = from.diff(to);
   13.96 +            //if set of instantiated ivars is empty, there's nothing to do!
   13.97 +            if (instVars.isEmpty()) return;
   13.98 +            final EnumSet<InferenceBound> boundsChanged = EnumSet.noneOf(InferenceBound.class);
   13.99 +            UndetVarListener prevListener = listener;
  13.100 +            try {
  13.101 +                //setup new listener for keeping track of changed bounds
  13.102 +                listener = new UndetVarListener() {
  13.103 +                    public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
  13.104 +                        boundsChanged.addAll(ibs);
  13.105 +                    }
  13.106 +                };
  13.107 +                for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
  13.108 +                    InferenceBound ib = _entry.getKey();
  13.109 +                    List<Type> prevBounds = _entry.getValue();
  13.110 +                    ListBuffer<Type> newBounds = ListBuffer.lb();
  13.111 +                    ListBuffer<Type> deps = ListBuffer.lb();
  13.112 +                    //step 1 - re-add bounds that are not dependent on ivars
  13.113 +                    for (Type t : prevBounds) {
  13.114 +                        if (!t.containsAny(instVars)) {
  13.115 +                            newBounds.append(t);
  13.116 +                        } else {
  13.117 +                            deps.append(t);
  13.118 +                        }
  13.119 +                    }
  13.120 +                    //step 2 - replace bounds
  13.121 +                    bounds.put(ib, newBounds.toList());
  13.122 +                    //step 3 - for each dependency, add new replaced bound
  13.123 +                    for (Type dep : deps) {
  13.124 +                        addBound(ib, types.subst(dep, from, to), types);
  13.125 +                    }
  13.126                  }
  13.127 -            }
  13.128 -            if (!changed.isEmpty()) {
  13.129 -                bounds = bounds2;
  13.130 -                notifyChange(changed);
  13.131 +            } finally {
  13.132 +                listener = prevListener;
  13.133 +                if (!boundsChanged.isEmpty()) {
  13.134 +                    notifyChange(boundsChanged);
  13.135 +                }
  13.136              }
  13.137          }
  13.138  
    14.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Mon Feb 04 18:08:53 2013 -0500
    14.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Sun Feb 17 16:44:55 2013 -0500
    14.3 @@ -126,7 +126,8 @@
    14.4      // Tree position.
    14.5      public int pos = -1;
    14.6  
    14.7 -    // For typecasts, type tests, new (and locals, as start_pc).
    14.8 +    // For type casts, type tests, new, locals (as start_pc),
    14.9 +    // and method and constructor reference type arguments.
   14.10      public boolean isValidOffset = false;
   14.11      public int offset = -1;
   14.12  
   14.13 @@ -156,12 +157,13 @@
   14.14          sb.append(type);
   14.15  
   14.16          switch (type) {
   14.17 -        // type cast
   14.18 -        case CAST:
   14.19          // instanceof
   14.20          case INSTANCEOF:
   14.21          // new expression
   14.22          case NEW:
   14.23 +        // constructor/method reference receiver
   14.24 +        case CONSTRUCTOR_REFERENCE:
   14.25 +        case METHOD_REFERENCE:
   14.26              sb.append(", offset = ");
   14.27              sb.append(offset);
   14.28              break;
   14.29 @@ -223,9 +225,12 @@
   14.30              sb.append(", param_index = ");
   14.31              sb.append(parameter_index);
   14.32              break;
   14.33 +        // type cast
   14.34 +        case CAST:
   14.35          // method/constructor/reference type argument
   14.36          case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
   14.37          case METHOD_INVOCATION_TYPE_ARGUMENT:
   14.38 +        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
   14.39          case METHOD_REFERENCE_TYPE_ARGUMENT:
   14.40              sb.append(", offset = ");
   14.41              sb.append(offset);
   14.42 @@ -236,12 +241,6 @@
   14.43          case METHOD_RETURN:
   14.44          case FIELD:
   14.45              break;
   14.46 -        // lambda formal parameter
   14.47 -        case LAMBDA_FORMAL_PARAMETER:
   14.48 -            // TODO: also needs an offset?
   14.49 -            sb.append(", param_index = ");
   14.50 -            sb.append(parameter_index);
   14.51 -            break;
   14.52          case UNKNOWN:
   14.53              sb.append(", position UNKNOWN!");
   14.54              break;
    15.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Mon Feb 04 18:08:53 2013 -0500
    15.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Sun Feb 17 16:44:55 2013 -0500
    15.3 @@ -217,6 +217,9 @@
    15.4          // Such an annotation is _not_ part of an JCAnnotatedType tree and we therefore
    15.5          // need to set its position explicitly.
    15.6          // The method returns a copy of type that contains these annotations.
    15.7 +        //
    15.8 +        // As a side effect the method sets the type annotation position of "annotations".
    15.9 +        // Note that it is assumed that all annotations share the same position.
   15.10          private static Type typeWithAnnotations(final JCTree typetree, final Type type,
   15.11                  final List<Attribute.TypeCompound> annotations, Log log) {
   15.12              // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s)%n",
   15.13 @@ -267,7 +270,9 @@
   15.14                  }
   15.15                  Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, log);
   15.16                  tomodify.elemtype = arelemType;
   15.17 -                for (Attribute.TypeCompound a : annotations) {
   15.18 +                {
   15.19 +                    // All annotations share the same position; modify the first one.
   15.20 +                    Attribute.TypeCompound a = annotations.get(0);
   15.21                      TypeAnnotationPosition p = a.position;
   15.22                      p.location = p.location.prependList(depth.toList());
   15.23                  }
   15.24 @@ -345,10 +350,10 @@
   15.25                  if (depth.nonEmpty()) {
   15.26                      // Only need to change the annotation positions
   15.27                      // if they are on an enclosed type.
   15.28 -                    for (Attribute.TypeCompound a : annotations) {
   15.29 -                        TypeAnnotationPosition p = a.position;
   15.30 -                        p.location = p.location.appendList(depth.toList());
   15.31 -                    }
   15.32 +                    // All annotations share the same position; modify the first one.
   15.33 +                    Attribute.TypeCompound a = annotations.get(0);
   15.34 +                    TypeAnnotationPosition p = a.position;
   15.35 +                    p.location = p.location.appendList(depth.toList());
   15.36                  }
   15.37  
   15.38                  Type ret = typeWithAnnotations(type, enclTy, annotations);
   15.39 @@ -463,8 +468,7 @@
   15.40  
   15.41                  @Override
   15.42                  public Type visitType(Type t, List<TypeCompound> s) {
   15.43 -                    // Error?
   15.44 -                    return t;
   15.45 +                    return new AnnotatedType(s, t);
   15.46                  }
   15.47              };
   15.48  
   15.49 @@ -575,6 +579,10 @@
   15.50              System.out.println("Resolving tree: " + tree + " kind: " + tree.getKind());
   15.51              System.out.println("    Framing tree: " + frame + " kind: " + frame.getKind());
   15.52              */
   15.53 +
   15.54 +            // Note that p.offset is set in
   15.55 +            // com.sun.tools.javac.jvm.Gen.setTypeAnnotationPositions(int)
   15.56 +
   15.57              switch (frame.getKind()) {
   15.58                  case TYPE_CAST:
   15.59                      p.type = TargetType.CAST;
   15.60 @@ -659,6 +667,45 @@
   15.61                      return;
   15.62                  }
   15.63  
   15.64 +                case MEMBER_REFERENCE: {
   15.65 +                    JCMemberReference mrframe = (JCMemberReference) frame;
   15.66 +
   15.67 +                    if (mrframe.expr == tree) {
   15.68 +                        switch (mrframe.mode) {
   15.69 +                        case INVOKE:
   15.70 +                            p.type = TargetType.METHOD_REFERENCE;
   15.71 +                            break;
   15.72 +                        case NEW:
   15.73 +                            p.type = TargetType.CONSTRUCTOR_REFERENCE;
   15.74 +                            break;
   15.75 +                        default:
   15.76 +                            Assert.error("Unknown method reference mode " + mrframe.mode +
   15.77 +                                    " for tree " + tree + " within frame " + frame);
   15.78 +                        }
   15.79 +                        p.pos = frame.pos;
   15.80 +                    } else if (mrframe.typeargs != null &&
   15.81 +                            mrframe.typeargs.contains(tree)) {
   15.82 +                        int arg = mrframe.typeargs.indexOf(tree);
   15.83 +                        p.type_index = arg;
   15.84 +                        switch (mrframe.mode) {
   15.85 +                        case INVOKE:
   15.86 +                            p.type = TargetType.METHOD_REFERENCE_TYPE_ARGUMENT;
   15.87 +                            break;
   15.88 +                        case NEW:
   15.89 +                            p.type = TargetType.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT;
   15.90 +                            break;
   15.91 +                        default:
   15.92 +                            Assert.error("Unknown method reference mode " + mrframe.mode +
   15.93 +                                    " for tree " + tree + " within frame " + frame);
   15.94 +                        }
   15.95 +                        p.pos = frame.pos;
   15.96 +                    } else {
   15.97 +                        Assert.error("Could not determine type argument position of tree " + tree +
   15.98 +                                " within frame " + frame);
   15.99 +                    }
  15.100 +                    return;
  15.101 +                }
  15.102 +
  15.103                  case ARRAY_TYPE: {
  15.104                      ListBuffer<TypePathEntry> index = ListBuffer.lb();
  15.105                      index = index.append(TypePathEntry.ARRAY);
  15.106 @@ -766,6 +813,14 @@
  15.107                      return;
  15.108                  }
  15.109  
  15.110 +                case INTERSECTION_TYPE: {
  15.111 +                    JCTypeIntersection isect = (JCTypeIntersection)frame;
  15.112 +                    p.type_index = isect.bounds.indexOf(tree);
  15.113 +                    List<JCTree> newPath = path.tail;
  15.114 +                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
  15.115 +                    return;
  15.116 +                }
  15.117 +
  15.118                  case METHOD_INVOCATION: {
  15.119                      JCMethodInvocation invocation = (JCMethodInvocation)frame;
  15.120                      if (!invocation.typeargs.contains(tree)) {
  15.121 @@ -911,6 +966,8 @@
  15.122          public void visitVarDef(final JCVariableDecl tree) {
  15.123              if (tree.sym == null) {
  15.124                  // Something is wrong already. Quietly ignore.
  15.125 +            } else if (tree.sym.getKind() == ElementKind.PARAMETER) {
  15.126 +                // Parameters are handled in visitMethodDef above.
  15.127              } else if (tree.sym.getKind() == ElementKind.FIELD) {
  15.128                  if (sigOnly) {
  15.129                      TypeAnnotationPosition pos = new TypeAnnotationPosition();
  15.130 @@ -924,7 +981,6 @@
  15.131                  pos.pos = tree.pos;
  15.132                  separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
  15.133              } else if (tree.sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
  15.134 -                // System.out.println("Found exception param: " + tree);
  15.135                  TypeAnnotationPosition pos = new TypeAnnotationPosition();
  15.136                  pos.type = TargetType.EXCEPTION_PARAMETER;
  15.137                  pos.pos = tree.pos;
  15.138 @@ -934,9 +990,11 @@
  15.139                  pos.type = TargetType.RESOURCE_VARIABLE;
  15.140                  pos.pos = tree.pos;
  15.141                  separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
  15.142 +            } else if (tree.sym.getKind() == ElementKind.ENUM_CONSTANT) {
  15.143 +                // No type annotations can occur here.
  15.144              } else {
  15.145                  // There is nothing else in a variable declaration that needs separation.
  15.146 -                // System.out.println("We found a: " + tree);
  15.147 +                Assert.error("Unhandled variable kind: " + tree + " of kind: " + tree.sym.getKind());
  15.148              }
  15.149  
  15.150              push(tree);
    16.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Feb 04 18:08:53 2013 -0500
    16.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Sun Feb 17 16:44:55 2013 -0500
    16.3 @@ -976,9 +976,12 @@
    16.4       * lists are of different length, return false.
    16.5       */
    16.6      public boolean isSameTypes(List<Type> ts, List<Type> ss) {
    16.7 +        return isSameTypes(ts, ss, false);
    16.8 +    }
    16.9 +    public boolean isSameTypes(List<Type> ts, List<Type> ss, boolean strict) {
   16.10          while (ts.tail != null && ss.tail != null
   16.11                 /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ &&
   16.12 -               isSameType(ts.head, ss.head)) {
   16.13 +               isSameType(ts.head, ss.head, strict)) {
   16.14              ts = ts.tail;
   16.15              ss = ss.tail;
   16.16          }
   16.17 @@ -990,10 +993,15 @@
   16.18       * Is t the same type as s?
   16.19       */
   16.20      public boolean isSameType(Type t, Type s) {
   16.21 -        return isSameType.visit(t, s);
   16.22 +        return isSameType(t, s, false);
   16.23 +    }
   16.24 +    public boolean isSameType(Type t, Type s, boolean strict) {
   16.25 +        return strict ?
   16.26 +                isSameTypeStrict.visit(t, s) :
   16.27 +                isSameTypeLoose.visit(t, s);
   16.28      }
   16.29      // where
   16.30 -        private TypeRelation isSameType = new TypeRelation() {
   16.31 +        abstract class SameTypeVisitor extends TypeRelation {
   16.32  
   16.33              public Boolean visitType(Type t, Type s) {
   16.34                  if (t == s)
   16.35 @@ -1010,8 +1018,7 @@
   16.36                      if (s.tag == TYPEVAR) {
   16.37                          //type-substitution does not preserve type-var types
   16.38                          //check that type var symbols and bounds are indeed the same
   16.39 -                        return t.tsym == s.tsym &&
   16.40 -                                visit(t.getUpperBound(), s.getUpperBound());
   16.41 +                        return sameTypeVars((TypeVar)t, (TypeVar)s);
   16.42                      }
   16.43                      else {
   16.44                          //special case for s == ? super X, where upper(s) = u
   16.45 @@ -1026,6 +1033,8 @@
   16.46                  }
   16.47              }
   16.48  
   16.49 +            abstract boolean sameTypeVars(TypeVar tv1, TypeVar tv2);
   16.50 +
   16.51              @Override
   16.52              public Boolean visitWildcardType(WildcardType t, Type s) {
   16.53                  if (s.isPartial())
   16.54 @@ -1060,9 +1069,11 @@
   16.55                  }
   16.56                  return t.tsym == s.tsym
   16.57                      && visit(t.getEnclosingType(), s.getEnclosingType())
   16.58 -                    && containsTypeEquivalent(t.getTypeArguments(), s.getTypeArguments());
   16.59 +                    && containsTypes(t.getTypeArguments(), s.getTypeArguments());
   16.60              }
   16.61  
   16.62 +            abstract protected boolean containsTypes(List<Type> ts1, List<Type> ts2);
   16.63 +
   16.64              @Override
   16.65              public Boolean visitArrayType(ArrayType t, Type s) {
   16.66                  if (t == s)
   16.67 @@ -1115,6 +1126,36 @@
   16.68              public Boolean visitErrorType(ErrorType t, Type s) {
   16.69                  return true;
   16.70              }
   16.71 +        }
   16.72 +
   16.73 +        /**
   16.74 +         * Standard type-equality relation - type variables are considered
   16.75 +         * equals if they share the same type symbol.
   16.76 +         */
   16.77 +        TypeRelation isSameTypeLoose = new SameTypeVisitor() {
   16.78 +            @Override
   16.79 +            boolean sameTypeVars(TypeVar tv1, TypeVar tv2) {
   16.80 +                return tv1.tsym == tv2.tsym && visit(tv1.getUpperBound(), tv2.getUpperBound());
   16.81 +            }
   16.82 +            @Override
   16.83 +            protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
   16.84 +                return containsTypeEquivalent(ts1, ts2);
   16.85 +            }
   16.86 +        };
   16.87 +
   16.88 +        /**
   16.89 +         * Strict type-equality relation - type variables are considered
   16.90 +         * equals if they share the same object identity.
   16.91 +         */
   16.92 +        TypeRelation isSameTypeStrict = new SameTypeVisitor() {
   16.93 +            @Override
   16.94 +            boolean sameTypeVars(TypeVar tv1, TypeVar tv2) {
   16.95 +                return tv1 == tv2;
   16.96 +            }
   16.97 +            @Override
   16.98 +            protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
   16.99 +                return isSameTypes(ts1, ts2, true);
  16.100 +            }
  16.101          };
  16.102      // </editor-fold>
  16.103  
  16.104 @@ -2027,7 +2068,15 @@
  16.105  
  16.106              @Override
  16.107              public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) {
  16.108 -                return new AnnotatedType(t.typeAnnotations, erasure(t.underlyingType, recurse));
  16.109 +                Type erased = erasure(t.underlyingType, recurse);
  16.110 +                if (erased.getKind() == TypeKind.ANNOTATED) {
  16.111 +                    // This can only happen when the underlying type is a
  16.112 +                    // type variable and the upper bound of it is annotated.
  16.113 +                    // The annotation on the type variable overrides the one
  16.114 +                    // on the bound.
  16.115 +                    erased = ((AnnotatedType)erased).underlyingType;
  16.116 +                }
  16.117 +                return new AnnotatedType(t.typeAnnotations, erased);
  16.118              }
  16.119          };
  16.120  
    17.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Feb 04 18:08:53 2013 -0500
    17.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Sun Feb 17 16:44:55 2013 -0500
    17.3 @@ -43,7 +43,7 @@
    17.4  import com.sun.tools.javac.comp.Check.CheckContext;
    17.5  import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
    17.6  import com.sun.tools.javac.comp.Infer.InferenceContext;
    17.7 -import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
    17.8 +import com.sun.tools.javac.comp.Infer.FreeTypeListener;
    17.9  import com.sun.tools.javac.jvm.*;
   17.10  import com.sun.tools.javac.tree.*;
   17.11  import com.sun.tools.javac.tree.JCTree.*;
   17.12 @@ -244,8 +244,8 @@
   17.13                      @Override
   17.14                      public void typesInferred(InferenceContext inferenceContext) {
   17.15                          ResultInfo pendingResult =
   17.16 -                                    resultInfo.dup(inferenceContext.asInstType(resultInfo.pt, types));
   17.17 -                        check(tree, inferenceContext.asInstType(found, types), ownkind, pendingResult);
   17.18 +                                    resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
   17.19 +                        check(tree, inferenceContext.asInstType(found), ownkind, pendingResult);
   17.20                      }
   17.21                  });
   17.22                  return tree.type = resultInfo.pt;
   17.23 @@ -766,6 +766,8 @@
   17.24          JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
   17.25  
   17.26          try {
   17.27 +            memberEnter.typeAnnotate(initializer, env, env.info.enclVar);
   17.28 +            annotate.flush();
   17.29              Type itype = attribExpr(initializer, env, type);
   17.30              if (itype.constValue() != null)
   17.31                  return coerce(itype, type).constValue();
   17.32 @@ -1099,8 +1101,9 @@
   17.33              Env<AttrContext> localEnv =
   17.34                  env.dup(tree, env.info.dup(env.info.scope.dupUnshared()));
   17.35              localEnv.info.scope.owner =
   17.36 -                new MethodSymbol(tree.flags | BLOCK, names.empty, null,
   17.37 -                                 env.info.scope.owner);
   17.38 +                new MethodSymbol(tree.flags | BLOCK |
   17.39 +                    env.info.scope.owner.flags() & STRICTFP, names.empty, null,
   17.40 +                    env.info.scope.owner);
   17.41              if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++;
   17.42  
   17.43              // Attribute all type annotations in the block
   17.44 @@ -2415,7 +2418,7 @@
   17.45                  inferenceContext.addFreeTypeListener(ts, new FreeTypeListener() {
   17.46                      @Override
   17.47                      public void typesInferred(InferenceContext inferenceContext) {
   17.48 -                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts, types));
   17.49 +                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts));
   17.50                      }
   17.51                  });
   17.52              } else {
   17.53 @@ -2440,7 +2443,7 @@
   17.54              @Override
   17.55              public boolean compatible(Type found, Type req, Warner warn) {
   17.56                  //return type must be compatible in both current context and assignment context
   17.57 -                return chk.basicHandler.compatible(found, inferenceContext().asFree(req, types), warn);
   17.58 +                return chk.basicHandler.compatible(found, inferenceContext().asFree(req), warn);
   17.59              }
   17.60  
   17.61              @Override
   17.62 @@ -2475,7 +2478,7 @@
   17.63          * descriptor.
   17.64          */
   17.65          private void checkLambdaCompatible(JCLambda tree, Type descriptor, CheckContext checkContext, boolean speculativeAttr) {
   17.66 -            Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType(), types);
   17.67 +            Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
   17.68  
   17.69              //return values have already been checked - but if lambda has no return
   17.70              //values, we must ensure that void/value compatibility is correct;
   17.71 @@ -2487,13 +2490,13 @@
   17.72                          diags.fragment("missing.ret.val", returnType)));
   17.73              }
   17.74  
   17.75 -            List<Type> argTypes = checkContext.inferenceContext().asFree(descriptor.getParameterTypes(), types);
   17.76 +            List<Type> argTypes = checkContext.inferenceContext().asFree(descriptor.getParameterTypes());
   17.77              if (!types.isSameTypes(argTypes, TreeInfo.types(tree.params))) {
   17.78                  checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
   17.79              }
   17.80  
   17.81              if (!speculativeAttr) {
   17.82 -                List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes(), types);
   17.83 +                List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
   17.84                  if (chk.unhandled(tree.inferredThrownTypes == null ? List.<Type>nil() : tree.inferredThrownTypes, thrownTypes).nonEmpty()) {
   17.85                      log.error(tree, "incompatible.thrown.types.in.lambda", tree.inferredThrownTypes);
   17.86                  }
   17.87 @@ -2538,7 +2541,7 @@
   17.88  
   17.89              if (exprType.isErroneous()) {
   17.90                  //if the qualifier expression contains problems,
   17.91 -                //give up atttribution of method reference
   17.92 +                //give up attribution of method reference
   17.93                  result = that.type = exprType;
   17.94                  return;
   17.95              }
   17.96 @@ -2680,7 +2683,7 @@
   17.97  
   17.98      @SuppressWarnings("fallthrough")
   17.99      void checkReferenceCompatible(JCMemberReference tree, Type descriptor, Type refType, CheckContext checkContext, boolean speculativeAttr) {
  17.100 -        Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType(), types);
  17.101 +        Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
  17.102  
  17.103          Type resType;
  17.104          switch (tree.getMode()) {
  17.105 @@ -2712,7 +2715,7 @@
  17.106          }
  17.107  
  17.108          if (!speculativeAttr) {
  17.109 -            List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes(), types);
  17.110 +            List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
  17.111              if (chk.unhandled(refType.getThrownTypes(), thrownTypes).nonEmpty()) {
  17.112                  log.error(tree, "incompatible.thrown.types.in.mref", refType.getThrownTypes());
  17.113              }
  17.114 @@ -2728,7 +2731,7 @@
  17.115          if (inferenceContext.free(descriptorType)) {
  17.116              inferenceContext.addFreeTypeListener(List.of(pt, descriptorType), new FreeTypeListener() {
  17.117                  public void typesInferred(InferenceContext inferenceContext) {
  17.118 -                    setFunctionalInfo(fExpr, pt, inferenceContext.asInstType(descriptorType, types), inferenceContext);
  17.119 +                    setFunctionalInfo(fExpr, pt, inferenceContext.asInstType(descriptorType), inferenceContext);
  17.120                  }
  17.121              });
  17.122          } else {
  17.123 @@ -4152,7 +4155,9 @@
  17.124          }
  17.125  
  17.126      private Type capture(Type type) {
  17.127 -        return types.capture(type);
  17.128 +        //do not capture free types
  17.129 +        return resultInfo.checkContext.inferenceContext().free(type) ?
  17.130 +                type : types.capture(type);
  17.131      }
  17.132  
  17.133      private void validateTypeAnnotations(JCTree tree) {
    18.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Feb 04 18:08:53 2013 -0500
    18.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Sun Feb 17 16:44:55 2013 -0500
    18.3 @@ -42,7 +42,7 @@
    18.4  import com.sun.tools.javac.code.Symbol.*;
    18.5  import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
    18.6  import com.sun.tools.javac.comp.Infer.InferenceContext;
    18.7 -import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
    18.8 +import com.sun.tools.javac.comp.Infer.FreeTypeListener;
    18.9  import com.sun.tools.javac.tree.JCTree.*;
   18.10  import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
   18.11  
   18.12 @@ -533,7 +533,7 @@
   18.13              inferenceContext.addFreeTypeListener(List.of(req), new FreeTypeListener() {
   18.14                  @Override
   18.15                  public void typesInferred(InferenceContext inferenceContext) {
   18.16 -                    checkType(pos, found, inferenceContext.asInstType(req, types), checkContext);
   18.17 +                    checkType(pos, found, inferenceContext.asInstType(req), checkContext);
   18.18                  }
   18.19              });
   18.20          }
   18.21 @@ -1026,7 +1026,7 @@
   18.22          };
   18.23  
   18.24      /** Check that given modifiers are legal for given symbol and
   18.25 -     *  return modifiers together with any implicit modififiers for that symbol.
   18.26 +     *  return modifiers together with any implicit modifiers for that symbol.
   18.27       *  Warning: we can't use flags() here since this method
   18.28       *  is called during class enter, when flags() would cause a premature
   18.29       *  completion.
   18.30 @@ -1072,7 +1072,7 @@
   18.31              }
   18.32              // Imply STRICTFP if owner has STRICTFP set.
   18.33              if (((flags|implicit) & Flags.ABSTRACT) == 0)
   18.34 -              implicit |= sym.owner.flags_field & STRICTFP;
   18.35 +                implicit |= sym.owner.flags_field & STRICTFP;
   18.36              break;
   18.37          case TYP:
   18.38              if (sym.isLocal()) {
    19.1 --- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Mon Feb 04 18:08:53 2013 -0500
    19.2 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Sun Feb 17 16:44:55 2013 -0500
    19.3 @@ -234,7 +234,7 @@
    19.4                      dt.speculativeCache.put(deferredAttrContext.msym, speculativeTree, deferredAttrContext.phase);
    19.5                      return speculativeTree.type;
    19.6                  case CHECK:
    19.7 -                    Assert.check(dt.mode == AttrMode.SPECULATIVE);
    19.8 +                    Assert.check(dt.mode != null);
    19.9                      return attr.attribTree(dt.tree, dt.env, resultInfo);
   19.10              }
   19.11              Assert.error();
   19.12 @@ -242,6 +242,13 @@
   19.13          }
   19.14      };
   19.15  
   19.16 +    DeferredTypeCompleter dummyCompleter = new DeferredTypeCompleter() {
   19.17 +        public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
   19.18 +            Assert.check(deferredAttrContext.mode == AttrMode.CHECK);
   19.19 +            return dt.tree.type = Type.noType;
   19.20 +        }
   19.21 +    };
   19.22 +
   19.23      /**
   19.24       * The 'mode' in which the deferred type is to be type-checked
   19.25       */
   19.26 @@ -332,13 +339,22 @@
   19.27          /** inference context */
   19.28          final InferenceContext inferenceContext;
   19.29  
   19.30 +        /** parent deferred context */
   19.31 +        final DeferredAttrContext parent;
   19.32 +
   19.33 +        /** Warner object to report warnings */
   19.34 +        final Warner warn;
   19.35 +
   19.36          /** list of deferred attribution nodes to be processed */
   19.37          ArrayList<DeferredAttrNode> deferredAttrNodes = new ArrayList<DeferredAttrNode>();
   19.38  
   19.39 -        DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase, InferenceContext inferenceContext) {
   19.40 +        DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase,
   19.41 +                InferenceContext inferenceContext, DeferredAttrContext parent, Warner warn) {
   19.42              this.mode = mode;
   19.43              this.msym = msym;
   19.44              this.phase = phase;
   19.45 +            this.parent = parent;
   19.46 +            this.warn = warn;
   19.47              this.inferenceContext = inferenceContext;
   19.48          }
   19.49  
   19.50 @@ -363,7 +379,7 @@
   19.51                  //scan a defensive copy of the node list - this is because a deferred
   19.52                  //attribution round can add new nodes to the list
   19.53                  for (DeferredAttrNode deferredAttrNode : List.from(deferredAttrNodes)) {
   19.54 -                    if (!deferredAttrNode.process()) {
   19.55 +                    if (!deferredAttrNode.process(this)) {
   19.56                          stuckVars.addAll(deferredAttrNode.stuckVars);
   19.57                      } else {
   19.58                          deferredAttrNodes.remove(deferredAttrNode);
   19.59 @@ -373,123 +389,133 @@
   19.60                  if (!progress) {
   19.61                      //remove all variables that have already been instantiated
   19.62                      //from the list of stuck variables
   19.63 -                    inferenceContext.solveAny(inferenceContext.freeVarsIn(List.from(stuckVars)), types, infer);
   19.64 -                    inferenceContext.notifyChange(types);
   19.65 +                    inferenceContext.solveAny(List.from(stuckVars), warn);
   19.66 +                    inferenceContext.notifyChange();
   19.67                  }
   19.68              }
   19.69          }
   19.70 +    }
   19.71 +
   19.72 +    /**
   19.73 +     * Class representing a deferred attribution node. It keeps track of
   19.74 +     * a deferred type, along with the expected target type information.
   19.75 +     */
   19.76 +    class DeferredAttrNode implements Infer.FreeTypeListener {
   19.77 +
   19.78 +        /** underlying deferred type */
   19.79 +        DeferredType dt;
   19.80 +
   19.81 +        /** underlying target type information */
   19.82 +        ResultInfo resultInfo;
   19.83 +
   19.84 +        /** list of uninferred inference variables causing this node to be stuck */
   19.85 +        List<Type> stuckVars;
   19.86 +
   19.87 +        DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, List<Type> stuckVars) {
   19.88 +            this.dt = dt;
   19.89 +            this.resultInfo = resultInfo;
   19.90 +            this.stuckVars = stuckVars;
   19.91 +            if (!stuckVars.isEmpty()) {
   19.92 +                resultInfo.checkContext.inferenceContext().addFreeTypeListener(stuckVars, this);
   19.93 +            }
   19.94 +        }
   19.95 +
   19.96 +        @Override
   19.97 +        public void typesInferred(InferenceContext inferenceContext) {
   19.98 +            stuckVars = List.nil();
   19.99 +            resultInfo = resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
  19.100 +        }
  19.101 +
  19.102 +        /**
  19.103 +         * Process a deferred attribution node.
  19.104 +         * Invariant: a stuck node cannot be processed.
  19.105 +         */
  19.106 +        @SuppressWarnings("fallthrough")
  19.107 +        boolean process(DeferredAttrContext deferredAttrContext) {
  19.108 +            switch (deferredAttrContext.mode) {
  19.109 +                case SPECULATIVE:
  19.110 +                    dt.check(resultInfo, List.<Type>nil(), new StructuralStuckChecker());
  19.111 +                    return true;
  19.112 +                case CHECK:
  19.113 +                    if (stuckVars.nonEmpty()) {
  19.114 +                        //stuck expression - see if we can propagate
  19.115 +                        if (deferredAttrContext.parent != emptyDeferredAttrContext &&
  19.116 +                                Type.containsAny(deferredAttrContext.parent.inferenceContext.inferencevars, List.from(stuckVars))) {
  19.117 +                            deferredAttrContext.parent.deferredAttrNodes.add(this);
  19.118 +                            dt.check(resultInfo, List.<Type>nil(), dummyCompleter);
  19.119 +                            return true;
  19.120 +                        } else {
  19.121 +                            return false;
  19.122 +                        }
  19.123 +                    } else {
  19.124 +                        dt.check(resultInfo, stuckVars, basicCompleter);
  19.125 +                        return true;
  19.126 +                    }
  19.127 +                default:
  19.128 +                    throw new AssertionError("Bad mode");
  19.129 +            }
  19.130 +        }
  19.131  
  19.132          /**
  19.133 -         * Class representing a deferred attribution node. It keeps track of
  19.134 -         * a deferred type, along with the expected target type information.
  19.135 +         * Structural checker for stuck expressions
  19.136           */
  19.137 -        class DeferredAttrNode implements Infer.InferenceContext.FreeTypeListener {
  19.138 +        class StructuralStuckChecker extends TreeScanner implements DeferredTypeCompleter {
  19.139  
  19.140 -            /** underlying deferred type */
  19.141 -            DeferredType dt;
  19.142 +            ResultInfo resultInfo;
  19.143 +            InferenceContext inferenceContext;
  19.144  
  19.145 -            /** underlying target type information */
  19.146 -            ResultInfo resultInfo;
  19.147 +            public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
  19.148 +                this.resultInfo = resultInfo;
  19.149 +                this.inferenceContext = deferredAttrContext.inferenceContext;
  19.150 +                dt.tree.accept(this);
  19.151 +                dt.speculativeCache.put(deferredAttrContext.msym, stuckTree, deferredAttrContext.phase);
  19.152 +                return Type.noType;
  19.153 +            }
  19.154  
  19.155 -            /** list of uninferred inference variables causing this node to be stuck */
  19.156 -            List<Type> stuckVars;
  19.157 -
  19.158 -            DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, List<Type> stuckVars) {
  19.159 -                this.dt = dt;
  19.160 -                this.resultInfo = resultInfo;
  19.161 -                this.stuckVars = stuckVars;
  19.162 -                if (!stuckVars.isEmpty()) {
  19.163 -                    resultInfo.checkContext.inferenceContext().addFreeTypeListener(stuckVars, this);
  19.164 +            @Override
  19.165 +            public void visitLambda(JCLambda tree) {
  19.166 +                Check.CheckContext checkContext = resultInfo.checkContext;
  19.167 +                Type pt = resultInfo.pt;
  19.168 +                if (inferenceContext.inferencevars.contains(pt)) {
  19.169 +                    //ok
  19.170 +                    return;
  19.171 +                } else {
  19.172 +                    //must be a functional descriptor
  19.173 +                    try {
  19.174 +                        Type desc = types.findDescriptorType(pt);
  19.175 +                        if (desc.getParameterTypes().length() != tree.params.length()) {
  19.176 +                            checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
  19.177 +                        }
  19.178 +                    } catch (Types.FunctionDescriptorLookupError ex) {
  19.179 +                        checkContext.report(null, ex.getDiagnostic());
  19.180 +                    }
  19.181                  }
  19.182              }
  19.183  
  19.184              @Override
  19.185 -            public void typesInferred(InferenceContext inferenceContext) {
  19.186 -                stuckVars = List.nil();
  19.187 -                resultInfo = resultInfo.dup(inferenceContext.asInstType(resultInfo.pt, types));
  19.188 +            public void visitNewClass(JCNewClass tree) {
  19.189 +                //do nothing
  19.190              }
  19.191  
  19.192 -            /**
  19.193 -             * Process a deferred attribution node.
  19.194 -             * Invariant: a stuck node cannot be processed.
  19.195 -             */
  19.196 -            @SuppressWarnings("fallthrough")
  19.197 -            boolean process() {
  19.198 -                switch (mode) {
  19.199 -                    case SPECULATIVE:
  19.200 -                        dt.check(resultInfo, List.<Type>nil(), new StructuralStuckChecker());
  19.201 -                        return true;
  19.202 -                    case CHECK:
  19.203 -                        if (stuckVars.nonEmpty()) {
  19.204 -                            return false;
  19.205 -                        } else {
  19.206 -                            dt.check(resultInfo, stuckVars, basicCompleter);
  19.207 -                            return true;
  19.208 -                        }
  19.209 -                    default:
  19.210 -                        throw new AssertionError("Bad mode");
  19.211 -                }
  19.212 +            @Override
  19.213 +            public void visitApply(JCMethodInvocation tree) {
  19.214 +                //do nothing
  19.215              }
  19.216  
  19.217 -            /**
  19.218 -             * Structural checker for stuck expressions
  19.219 -             */
  19.220 -            class StructuralStuckChecker extends TreeScanner implements DeferredTypeCompleter {
  19.221 -
  19.222 -                ResultInfo resultInfo;
  19.223 -
  19.224 -                public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
  19.225 -                    this.resultInfo = resultInfo;
  19.226 -                    dt.tree.accept(this);
  19.227 -                    dt.speculativeCache.put(msym, stuckTree, phase);
  19.228 -                    return Type.noType;
  19.229 -                }
  19.230 -
  19.231 -                @Override
  19.232 -                public void visitLambda(JCLambda tree) {
  19.233 -                    Check.CheckContext checkContext = resultInfo.checkContext;
  19.234 -                    Type pt = resultInfo.pt;
  19.235 -                    if (inferenceContext.inferencevars.contains(pt)) {
  19.236 -                        //ok
  19.237 -                        return;
  19.238 -                    } else {
  19.239 -                        //must be a functional descriptor
  19.240 -                        try {
  19.241 -                            Type desc = types.findDescriptorType(pt);
  19.242 -                            if (desc.getParameterTypes().length() != tree.params.length()) {
  19.243 -                                checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
  19.244 -                            }
  19.245 -                        } catch (Types.FunctionDescriptorLookupError ex) {
  19.246 -                            checkContext.report(null, ex.getDiagnostic());
  19.247 -                        }
  19.248 -                    }
  19.249 -                }
  19.250 -
  19.251 -                @Override
  19.252 -                public void visitNewClass(JCNewClass tree) {
  19.253 -                    //do nothing
  19.254 -                }
  19.255 -
  19.256 -                @Override
  19.257 -                public void visitApply(JCMethodInvocation tree) {
  19.258 -                    //do nothing
  19.259 -                }
  19.260 -
  19.261 -                @Override
  19.262 -                public void visitReference(JCMemberReference tree) {
  19.263 -                    Check.CheckContext checkContext = resultInfo.checkContext;
  19.264 -                    Type pt = resultInfo.pt;
  19.265 -                    if (inferenceContext.inferencevars.contains(pt)) {
  19.266 -                        //ok
  19.267 -                        return;
  19.268 -                    } else {
  19.269 -                        try {
  19.270 -                            //TODO: we should speculative determine if there's a match
  19.271 -                            //based on arity - if yes, method is applicable.
  19.272 -                            types.findDescriptorType(pt);
  19.273 -                        } catch (Types.FunctionDescriptorLookupError ex) {
  19.274 -                            checkContext.report(null, ex.getDiagnostic());
  19.275 -                        }
  19.276 +            @Override
  19.277 +            public void visitReference(JCMemberReference tree) {
  19.278 +                Check.CheckContext checkContext = resultInfo.checkContext;
  19.279 +                Type pt = resultInfo.pt;
  19.280 +                if (inferenceContext.inferencevars.contains(pt)) {
  19.281 +                    //ok
  19.282 +                    return;
  19.283 +                } else {
  19.284 +                    try {
  19.285 +                        //TODO: we should speculative determine if there's a match
  19.286 +                        //based on arity - if yes, method is applicable.
  19.287 +                        types.findDescriptorType(pt);
  19.288 +                    } catch (Types.FunctionDescriptorLookupError ex) {
  19.289 +                        checkContext.report(null, ex.getDiagnostic());
  19.290                      }
  19.291                  }
  19.292              }
  19.293 @@ -498,7 +524,7 @@
  19.294  
  19.295      /** an empty deferred attribution context - all methods throw exceptions */
  19.296      final DeferredAttrContext emptyDeferredAttrContext =
  19.297 -            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null) {
  19.298 +            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null, null, null) {
  19.299                  @Override
  19.300                  void addDeferredAttrNode(DeferredType dt, ResultInfo ri, List<Type> stuckVars) {
  19.301                      Assert.error("Empty deferred context!");
  19.302 @@ -521,7 +547,8 @@
  19.303  
  19.304          protected DeferredTypeMap(AttrMode mode, Symbol msym, MethodResolutionPhase phase) {
  19.305              super(String.format("deferredTypeMap[%s]", mode));
  19.306 -            this.deferredAttrContext = new DeferredAttrContext(mode, msym, phase, infer.emptyContext);
  19.307 +            this.deferredAttrContext = new DeferredAttrContext(mode, msym, phase,
  19.308 +                    infer.emptyContext, emptyDeferredAttrContext, types.noWarnings);
  19.309          }
  19.310  
  19.311          protected boolean validState(DeferredType dt) {
    20.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Feb 04 18:08:53 2013 -0500
    20.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Sun Feb 17 16:44:55 2013 -0500
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -25,22 +25,30 @@
   20.11  
   20.12  package com.sun.tools.javac.comp;
   20.13  
   20.14 -import com.sun.tools.javac.code.*;
   20.15 -import com.sun.tools.javac.code.Symbol.*;
   20.16 -import com.sun.tools.javac.code.Type.*;
   20.17 -import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
   20.18 -import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
   20.19 -import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
   20.20 -import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
   20.21  import com.sun.tools.javac.tree.JCTree;
   20.22  import com.sun.tools.javac.tree.JCTree.JCTypeCast;
   20.23  import com.sun.tools.javac.tree.TreeInfo;
   20.24  import com.sun.tools.javac.util.*;
   20.25 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
   20.26  import com.sun.tools.javac.util.List;
   20.27 -import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
   20.28 +import com.sun.tools.javac.code.*;
   20.29 +import com.sun.tools.javac.code.Type.*;
   20.30 +import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
   20.31 +import com.sun.tools.javac.code.Symbol.*;
   20.32 +import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
   20.33 +import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph;
   20.34 +import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph.Node;
   20.35 +import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
   20.36 +import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
   20.37  
   20.38  import java.util.HashMap;
   20.39  import java.util.Map;
   20.40 +import java.util.Set;
   20.41 +
   20.42 +import java.util.ArrayList;
   20.43 +import java.util.Collections;
   20.44 +import java.util.EnumSet;
   20.45 +import java.util.HashSet;
   20.46  
   20.47  import static com.sun.tools.javac.code.TypeTag.*;
   20.48  
   20.49 @@ -55,19 +63,15 @@
   20.50      protected static final Context.Key<Infer> inferKey =
   20.51          new Context.Key<Infer>();
   20.52  
   20.53 -    /** A value for prototypes that admit any type, including polymorphic ones. */
   20.54 -    public static final Type anyPoly = new Type(NONE, null);
   20.55 -
   20.56 +    Resolve rs;
   20.57 +    Check chk;
   20.58      Symtab syms;
   20.59      Types types;
   20.60 -    Check chk;
   20.61 -    Resolve rs;
   20.62 -    DeferredAttr deferredAttr;
   20.63 +    JCDiagnostic.Factory diags;
   20.64      Log log;
   20.65 -    JCDiagnostic.Factory diags;
   20.66  
   20.67 -    /** Should we inject return-type constraints earlier? */
   20.68 -    boolean allowEarlyReturnConstraints;
   20.69 +    /** should the graph solver be used? */
   20.70 +    boolean allowGraphInference;
   20.71  
   20.72      public static Infer instance(Context context) {
   20.73          Infer instance = context.get(inferKey);
   20.74 @@ -78,17 +82,22 @@
   20.75  
   20.76      protected Infer(Context context) {
   20.77          context.put(inferKey, this);
   20.78 +
   20.79 +        rs = Resolve.instance(context);
   20.80 +        chk = Check.instance(context);
   20.81          syms = Symtab.instance(context);
   20.82          types = Types.instance(context);
   20.83 -        rs = Resolve.instance(context);
   20.84 -        deferredAttr = DeferredAttr.instance(context);
   20.85 +        diags = JCDiagnostic.Factory.instance(context);
   20.86          log = Log.instance(context);
   20.87 -        chk = Check.instance(context);
   20.88 -        diags = JCDiagnostic.Factory.instance(context);
   20.89          inferenceException = new InferenceException(diags);
   20.90 -        allowEarlyReturnConstraints = Source.instance(context).allowEarlyReturnConstraints();
   20.91 +        Options options = Options.instance(context);
   20.92 +        allowGraphInference = Source.instance(context).allowGraphInference()
   20.93 +                && options.isUnset("useLegacyInference");
   20.94      }
   20.95  
   20.96 +    /** A value for prototypes that admit any type, including polymorphic ones. */
   20.97 +    public static final Type anyPoly = new Type(NONE, null);
   20.98 +
   20.99     /**
  20.100      * This exception class is design to store a list of diagnostics corresponding
  20.101      * to inference errors that can arise during a method applicability check.
  20.102 @@ -118,140 +127,12 @@
  20.103          }
  20.104      }
  20.105  
  20.106 -    final InferenceException inferenceException;
  20.107 +    protected final InferenceException inferenceException;
  20.108  
  20.109 -/***************************************************************************
  20.110 - * Mini/Maximization of UndetVars
  20.111 - ***************************************************************************/
  20.112 -
  20.113 -    /** Instantiate undetermined type variable to its minimal upper bound.
  20.114 -     *  Throw a NoInstanceException if this not possible.
  20.115 -     */
  20.116 -   void maximizeInst(UndetVar that, Warner warn) throws InferenceException {
  20.117 -        List<Type> hibounds = Type.filter(that.getBounds(InferenceBound.UPPER), boundFilter);
  20.118 -        if (that.getBounds(InferenceBound.EQ).isEmpty()) {
  20.119 -            if (hibounds.isEmpty())
  20.120 -                that.inst = syms.objectType;
  20.121 -            else if (hibounds.tail.isEmpty())
  20.122 -                that.inst = hibounds.head;
  20.123 -            else
  20.124 -                that.inst = types.glb(hibounds);
  20.125 -        } else {
  20.126 -            that.inst = that.getBounds(InferenceBound.EQ).head;
  20.127 -        }
  20.128 -        if (that.inst == null ||
  20.129 -            that.inst.isErroneous())
  20.130 -            throw inferenceException
  20.131 -                .setMessage("no.unique.maximal.instance.exists",
  20.132 -                            that.qtype, hibounds);
  20.133 -    }
  20.134 -
  20.135 -    private Filter<Type> boundFilter = new Filter<Type>() {
  20.136 -        @Override
  20.137 -        public boolean accepts(Type t) {
  20.138 -            return !t.isErroneous() && !t.hasTag(BOT);
  20.139 -        }
  20.140 -    };
  20.141 -
  20.142 -    /** Instantiate undetermined type variable to the lub of all its lower bounds.
  20.143 -     *  Throw a NoInstanceException if this not possible.
  20.144 -     */
  20.145 -    void minimizeInst(UndetVar that, Warner warn) throws InferenceException {
  20.146 -        List<Type> lobounds = Type.filter(that.getBounds(InferenceBound.LOWER), boundFilter);
  20.147 -        if (that.getBounds(InferenceBound.EQ).isEmpty()) {
  20.148 -            if (lobounds.isEmpty()) {
  20.149 -                //do nothing - the inference variable is under-constrained
  20.150 -                return;
  20.151 -            } else if (lobounds.tail.isEmpty())
  20.152 -                that.inst = lobounds.head.isPrimitive() ? syms.errType : lobounds.head;
  20.153 -            else {
  20.154 -                that.inst = types.lub(lobounds);
  20.155 -            }
  20.156 -            if (that.inst == null || that.inst.hasTag(ERROR))
  20.157 -                    throw inferenceException
  20.158 -                        .setMessage("no.unique.minimal.instance.exists",
  20.159 -                                    that.qtype, lobounds);
  20.160 -        } else {
  20.161 -            that.inst = that.getBounds(InferenceBound.EQ).head;
  20.162 -        }
  20.163 -    }
  20.164 -
  20.165 -/***************************************************************************
  20.166 - * Exported Methods
  20.167 - ***************************************************************************/
  20.168 -
  20.169 +    // <editor-fold defaultstate="collapsed" desc="Inference routines">
  20.170      /**
  20.171 -     * Instantiate uninferred inference variables (JLS 15.12.2.8). First
  20.172 -     * if the method return type is non-void, we derive constraints from the
  20.173 -     * expected type - then we use declared bound well-formedness to derive additional
  20.174 -     * constraints. If no instantiation exists, or if several incomparable
  20.175 -     * best instantiations exist throw a NoInstanceException.
  20.176 -     */
  20.177 -    public void instantiateUninferred(DiagnosticPosition pos,
  20.178 -            InferenceContext inferenceContext,
  20.179 -            MethodType mtype,
  20.180 -            Attr.ResultInfo resultInfo,
  20.181 -            Warner warn) throws InferenceException {
  20.182 -        while (true) {
  20.183 -            boolean stuck = true;
  20.184 -            for (Type t : inferenceContext.undetvars) {
  20.185 -                UndetVar uv = (UndetVar)t;
  20.186 -                if (uv.inst == null && (uv.getBounds(InferenceBound.EQ).nonEmpty() ||
  20.187 -                        !inferenceContext.free(uv.getBounds(InferenceBound.UPPER)))) {
  20.188 -                    maximizeInst((UndetVar)t, warn);
  20.189 -                    stuck = false;
  20.190 -                }
  20.191 -            }
  20.192 -            if (inferenceContext.restvars().isEmpty()) {
  20.193 -                //all variables have been instantiated - exit
  20.194 -                break;
  20.195 -            } else if (stuck) {
  20.196 -                //some variables could not be instantiated because of cycles in
  20.197 -                //upper bounds - provide a (possibly recursive) default instantiation
  20.198 -                instantiateAsUninferredVars(inferenceContext);
  20.199 -                break;
  20.200 -            } else {
  20.201 -                //some variables have been instantiated - replace newly instantiated
  20.202 -                //variables in remaining upper bounds and continue
  20.203 -                for (Type t : inferenceContext.undetvars) {
  20.204 -                    UndetVar uv = (UndetVar)t;
  20.205 -                    uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), types);
  20.206 -                }
  20.207 -            }
  20.208 -        }
  20.209 -    }
  20.210 -
  20.211 -    /**
  20.212 -     * Infer cyclic inference variables as described in 15.12.2.8.
  20.213 -     */
  20.214 -    private void instantiateAsUninferredVars(InferenceContext inferenceContext) {
  20.215 -        ListBuffer<Type> todo = ListBuffer.lb();
  20.216 -        //step 1 - create fresh tvars
  20.217 -        for (Type t : inferenceContext.undetvars) {
  20.218 -            UndetVar uv = (UndetVar)t;
  20.219 -            if (uv.inst == null) {
  20.220 -                TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
  20.221 -                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
  20.222 -                todo.append(uv);
  20.223 -                uv.inst = fresh_tvar.type;
  20.224 -            }
  20.225 -        }
  20.226 -        //step 2 - replace fresh tvars in their bounds
  20.227 -        List<Type> formals = inferenceContext.inferenceVars();
  20.228 -        for (Type t : todo) {
  20.229 -            UndetVar uv = (UndetVar)t;
  20.230 -            TypeVar ct = (TypeVar)uv.inst;
  20.231 -            ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct), types));
  20.232 -            if (ct.bound.isErroneous()) {
  20.233 -                //report inference error if glb fails
  20.234 -                reportBoundError(uv, BoundErrorKind.BAD_UPPER);
  20.235 -            }
  20.236 -            formals = formals.tail;
  20.237 -        }
  20.238 -    }
  20.239 -
  20.240 -    /** Instantiate a generic method type by finding instantiations for all its
  20.241 -     * inference variables so that it can be applied to a given argument type list.
  20.242 +     * Main inference entry point - instantiate a generic method type
  20.243 +     * using given argument types and (possibly) an expected target-type.
  20.244       */
  20.245      public Type instantiateMethod(Env<AttrContext> env,
  20.246                                    List<Type> tvars,
  20.247 @@ -265,259 +146,146 @@
  20.248                                    Resolve.MethodCheck methodCheck,
  20.249                                    Warner warn) throws InferenceException {
  20.250          //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG
  20.251 -        final InferenceContext inferenceContext = new InferenceContext(tvars, this, true);
  20.252 +        final InferenceContext inferenceContext = new InferenceContext(tvars);
  20.253          inferenceException.clear();
  20.254 +        try {
  20.255 +            DeferredAttr.DeferredAttrContext deferredAttrContext =
  20.256 +                    resolveContext.deferredAttrContext(msym, inferenceContext, resultInfo, warn);
  20.257  
  20.258 -        DeferredAttr.DeferredAttrContext deferredAttrContext =
  20.259 -                resolveContext.deferredAttrContext(msym, inferenceContext);
  20.260 +            methodCheck.argumentsAcceptable(env, deferredAttrContext,
  20.261 +                    argtypes, mt.getParameterTypes(), warn);
  20.262  
  20.263 -        try {
  20.264 -            methodCheck.argumentsAcceptable(env, deferredAttrContext, argtypes, mt.getParameterTypes(), warn);
  20.265 -
  20.266 -            if (resultInfo != null && allowEarlyReturnConstraints &&
  20.267 +            if (allowGraphInference &&
  20.268 +                    resultInfo != null &&
  20.269                      !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
  20.270 -                generateReturnConstraints(mt, inferenceContext, resultInfo);
  20.271 +                //inject return constraints earlier
  20.272 +                checkWithinBounds(inferenceContext, warn); //propagation
  20.273 +                generateReturnConstraints(resultInfo, mt, inferenceContext);
  20.274 +                //propagate outwards if needed
  20.275 +                if (resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
  20.276 +                    //propagate inference context outwards and exit
  20.277 +                    inferenceContext.dupTo(resultInfo.checkContext.inferenceContext());
  20.278 +                    deferredAttrContext.complete();
  20.279 +                    return mt;
  20.280 +                }
  20.281              }
  20.282  
  20.283              deferredAttrContext.complete();
  20.284  
  20.285              // minimize as yet undetermined type variables
  20.286 -            for (Type t : inferenceContext.undetvars) {
  20.287 -                minimizeInst((UndetVar)t, warn);
  20.288 +            if (allowGraphInference) {
  20.289 +                inferenceContext.solve(warn);
  20.290 +            } else {
  20.291 +                inferenceContext.solveLegacy(true, warn, LegacyInferenceSteps.EQ_LOWER.steps); //minimizeInst
  20.292              }
  20.293  
  20.294 -            checkWithinBounds(inferenceContext, warn);
  20.295 +            mt = (MethodType)inferenceContext.asInstType(mt);
  20.296  
  20.297 -            mt = (MethodType)inferenceContext.asInstType(mt, types);
  20.298 +            if (!allowGraphInference &&
  20.299 +                    inferenceContext.restvars().nonEmpty() &&
  20.300 +                    resultInfo != null &&
  20.301 +                    !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
  20.302 +                generateReturnConstraints(resultInfo, mt, inferenceContext);
  20.303 +                inferenceContext.solveLegacy(false, warn, LegacyInferenceSteps.EQ_UPPER.steps); //maximizeInst
  20.304 +                mt = (MethodType)inferenceContext.asInstType(mt);
  20.305 +            }
  20.306  
  20.307 -            List<Type> restvars = inferenceContext.restvars();
  20.308 -
  20.309 -            if (!restvars.isEmpty()) {
  20.310 -                if (resultInfo != null && !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
  20.311 -                    if (!allowEarlyReturnConstraints) {
  20.312 -                        generateReturnConstraints(mt, inferenceContext, resultInfo);
  20.313 -                    }
  20.314 -                    instantiateUninferred(env.tree.pos(), inferenceContext, mt, resultInfo, warn);
  20.315 -                    checkWithinBounds(inferenceContext, warn);
  20.316 -                    mt = (MethodType)inferenceContext.asInstType(mt, types);
  20.317 -                    if (rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
  20.318 -                        log.note(env.tree.pos, "deferred.method.inst", msym, mt, resultInfo.pt);
  20.319 -                    }
  20.320 -                }
  20.321 +            if (resultInfo != null && rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
  20.322 +                log.note(env.tree.pos, "deferred.method.inst", msym, mt, resultInfo.pt);
  20.323              }
  20.324  
  20.325              // return instantiated version of method type
  20.326              return mt;
  20.327          } finally {
  20.328 -            inferenceContext.notifyChange(types);
  20.329 -        }
  20.330 -    }
  20.331 -    //where
  20.332 -        void generateReturnConstraints(Type mt, InferenceContext inferenceContext, Attr.ResultInfo resultInfo) {
  20.333 -            if (resultInfo != null) {
  20.334 -                Type to = resultInfo.pt;
  20.335 -                if (to.hasTag(NONE) || resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
  20.336 -                    to = mt.getReturnType().isPrimitiveOrVoid() ?
  20.337 -                            mt.getReturnType() : syms.objectType;
  20.338 -                }
  20.339 -                Type qtype1 = inferenceContext.asFree(mt.getReturnType(), types);
  20.340 -                Warner retWarn = new Warner();
  20.341 -                if (!resultInfo.checkContext.compatible(qtype1, qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to, retWarn) ||
  20.342 -                        //unchecked conversion is not allowed
  20.343 -                        retWarn.hasLint(Lint.LintCategory.UNCHECKED)) {
  20.344 -                    throw inferenceException
  20.345 -                            .setMessage("infer.no.conforming.instance.exists",
  20.346 -                            inferenceContext.restvars(), mt.getReturnType(), to);
  20.347 -                }
  20.348 -            }
  20.349 -        }
  20.350 -
  20.351 -    /** check that type parameters are within their bounds.
  20.352 -     */
  20.353 -    void checkWithinBounds(InferenceContext inferenceContext,
  20.354 -                           Warner warn) throws InferenceException {
  20.355 -        //step 1 - check compatibility of instantiated type w.r.t. initial bounds
  20.356 -        for (Type t : inferenceContext.undetvars) {
  20.357 -            UndetVar uv = (UndetVar)t;
  20.358 -            uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), types);
  20.359 -            checkCompatibleUpperBounds(uv, inferenceContext.inferenceVars());
  20.360 -            if (!inferenceContext.restvars().contains(uv.qtype)) {
  20.361 -                Type inst = inferenceContext.asInstType(t, types);
  20.362 -                for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  20.363 -                    if (!types.isSubtypeUnchecked(inst, inferenceContext.asFree(u, types), warn)) {
  20.364 -                        reportBoundError(uv, BoundErrorKind.UPPER);
  20.365 -                    }
  20.366 -                }
  20.367 -                for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  20.368 -                    Assert.check(!inferenceContext.free(l));
  20.369 -                    if (!types.isSubtypeUnchecked(l, inst, warn)) {
  20.370 -                        reportBoundError(uv, BoundErrorKind.LOWER);
  20.371 -                    }
  20.372 -                }
  20.373 -                for (Type e : uv.getBounds(InferenceBound.EQ)) {
  20.374 -                    Assert.check(!inferenceContext.free(e));
  20.375 -                    if (!types.isSameType(inst, e)) {
  20.376 -                        reportBoundError(uv, BoundErrorKind.EQ);
  20.377 -                    }
  20.378 -                }
  20.379 -            }
  20.380 -        }
  20.381 -
  20.382 -        //step 2 - check that eq bounds are consistent w.r.t. eq/lower bounds
  20.383 -        for (Type t : inferenceContext.undetvars) {
  20.384 -            UndetVar uv = (UndetVar)t;
  20.385 -            //check eq bounds consistency
  20.386 -            Type eq = null;
  20.387 -            for (Type e : uv.getBounds(InferenceBound.EQ)) {
  20.388 -                Assert.check(!inferenceContext.free(e));
  20.389 -                if (eq != null && !types.isSameType(e, eq)) {
  20.390 -                    reportBoundError(uv, BoundErrorKind.EQ);
  20.391 -                }
  20.392 -                eq = e;
  20.393 -                for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  20.394 -                    Assert.check(!inferenceContext.free(l));
  20.395 -                    if (!types.isSubtypeUnchecked(l, e, warn)) {
  20.396 -                        reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
  20.397 -                    }
  20.398 -                }
  20.399 -                for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  20.400 -                    if (inferenceContext.free(u)) continue;
  20.401 -                    if (!types.isSubtypeUnchecked(e, u, warn)) {
  20.402 -                        reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
  20.403 -                    }
  20.404 -                }
  20.405 +            if (resultInfo != null || !allowGraphInference) {
  20.406 +                inferenceContext.notifyChange();
  20.407 +            } else {
  20.408 +                inferenceContext.notifyChange(inferenceContext.boundedVars());
  20.409              }
  20.410          }
  20.411      }
  20.412  
  20.413 -    void checkCompatibleUpperBounds(UndetVar uv, List<Type> tvars) {
  20.414 -        // VGJ: sort of inlined maximizeInst() below.  Adding
  20.415 -        // bounds can cause lobounds that are above hibounds.
  20.416 -        ListBuffer<Type> hiboundsNoVars = ListBuffer.lb();
  20.417 -        for (Type t : Type.filter(uv.getBounds(InferenceBound.UPPER), boundFilter)) {
  20.418 -            if (!t.containsAny(tvars)) {
  20.419 -                hiboundsNoVars.append(t);
  20.420 +    /**
  20.421 +     * Generate constraints from the generic method's return type. If the method
  20.422 +     * call occurs in a context where a type T is expected, use the expected
  20.423 +     * type to derive more constraints on the generic method inference variables.
  20.424 +     */
  20.425 +    void generateReturnConstraints(Attr.ResultInfo resultInfo,
  20.426 +            MethodType mt, InferenceContext inferenceContext) {
  20.427 +        Type qtype1 = inferenceContext.asFree(mt.getReturnType());
  20.428 +        Type to = returnConstraintTarget(qtype1, resultInfo.pt);
  20.429 +        Assert.check(allowGraphInference || !resultInfo.checkContext.inferenceContext().free(to),
  20.430 +                "legacy inference engine cannot handle constraints on both sides of a subtyping assertion");
  20.431 +        //we need to skip capture?
  20.432 +        Warner retWarn = new Warner();
  20.433 +        if (!resultInfo.checkContext.compatible(qtype1, resultInfo.checkContext.inferenceContext().asFree(to), retWarn) ||
  20.434 +                //unchecked conversion is not allowed
  20.435 +                retWarn.hasLint(Lint.LintCategory.UNCHECKED)) {
  20.436 +            throw inferenceException
  20.437 +                    .setMessage("infer.no.conforming.instance.exists",
  20.438 +                    inferenceContext.restvars(), mt.getReturnType(), to);
  20.439 +        }
  20.440 +    }
  20.441 +    //where
  20.442 +        private Type returnConstraintTarget(Type from, Type to) {
  20.443 +            if (from.hasTag(VOID)) {
  20.444 +                return syms.voidType;
  20.445 +            } else if (to.hasTag(NONE)) {
  20.446 +                return from.isPrimitive() ? from : syms.objectType;
  20.447 +            } else if (from.hasTag(UNDETVAR) && to.isPrimitive()) {
  20.448 +                if (!allowGraphInference) {
  20.449 +                    //if legacy, just return boxed type
  20.450 +                    return types.boxedClass(to).type;
  20.451 +                }
  20.452 +                //if graph inference we need to skip conflicting boxed bounds...
  20.453 +                UndetVar uv = (UndetVar)from;
  20.454 +                for (Type t : uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
  20.455 +                    Type boundAsPrimitive = types.unboxedType(t);
  20.456 +                    if (boundAsPrimitive == null) continue;
  20.457 +                    if (types.isConvertible(boundAsPrimitive, to)) {
  20.458 +                        //effectively skip return-type constraint generation (compatibility)
  20.459 +                        return syms.objectType;
  20.460 +                    }
  20.461 +                }
  20.462 +                return types.boxedClass(to).type;
  20.463 +            } else {
  20.464 +                return to;
  20.465              }
  20.466          }
  20.467 -        List<Type> hibounds = hiboundsNoVars.toList();
  20.468 -        Type hb = null;
  20.469 -        if (hibounds.isEmpty())
  20.470 -            hb = syms.objectType;
  20.471 -        else if (hibounds.tail.isEmpty())
  20.472 -            hb = hibounds.head;
  20.473 -        else
  20.474 -            hb = types.glb(hibounds);
  20.475 -        if (hb == null || hb.isErroneous())
  20.476 -            reportBoundError(uv, BoundErrorKind.BAD_UPPER);
  20.477 -    }
  20.478  
  20.479 -    enum BoundErrorKind {
  20.480 -        BAD_UPPER() {
  20.481 -            @Override
  20.482 -            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
  20.483 -                return ex.setMessage("incompatible.upper.bounds", uv.qtype,
  20.484 -                        uv.getBounds(InferenceBound.UPPER));
  20.485 +    /**
  20.486 +      * Infer cyclic inference variables as described in 15.12.2.8.
  20.487 +      */
  20.488 +    private void instantiateAsUninferredVars(List<Type> vars, InferenceContext inferenceContext) {
  20.489 +        ListBuffer<Type> todo = ListBuffer.lb();
  20.490 +        //step 1 - create fresh tvars
  20.491 +        for (Type t : vars) {
  20.492 +            UndetVar uv = (UndetVar)inferenceContext.asFree(t);
  20.493 +            List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER);
  20.494 +            if (Type.containsAny(upperBounds, vars)) {
  20.495 +                TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
  20.496 +                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
  20.497 +                todo.append(uv);
  20.498 +                uv.inst = fresh_tvar.type;
  20.499 +            } else if (upperBounds.nonEmpty()) {
  20.500 +                uv.inst = types.glb(upperBounds);
  20.501 +            } else {
  20.502 +                uv.inst = syms.objectType;
  20.503              }
  20.504 -        },
  20.505 -        BAD_EQ_UPPER() {
  20.506 -            @Override
  20.507 -            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
  20.508 -                return ex.setMessage("incompatible.eq.upper.bounds", uv.qtype,
  20.509 -                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.UPPER));
  20.510 +        }
  20.511 +        //step 2 - replace fresh tvars in their bounds
  20.512 +        List<Type> formals = vars;
  20.513 +        for (Type t : todo) {
  20.514 +            UndetVar uv = (UndetVar)t;
  20.515 +            TypeVar ct = (TypeVar)uv.inst;
  20.516 +            ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct)));
  20.517 +            if (ct.bound.isErroneous()) {
  20.518 +                //report inference error if glb fails
  20.519 +                reportBoundError(uv, BoundErrorKind.BAD_UPPER);
  20.520              }
  20.521 -        },
  20.522 -        BAD_EQ_LOWER() {
  20.523 -            @Override
  20.524 -            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
  20.525 -                return ex.setMessage("incompatible.eq.lower.bounds", uv.qtype,
  20.526 -                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.LOWER));
  20.527 -            }
  20.528 -        },
  20.529 -        UPPER() {
  20.530 -            @Override
  20.531 -            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
  20.532 -                return ex.setMessage("inferred.do.not.conform.to.upper.bounds", uv.inst,
  20.533 -                        uv.getBounds(InferenceBound.UPPER));
  20.534 -            }
  20.535 -        },
  20.536 -        LOWER() {
  20.537 -            @Override
  20.538 -            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
  20.539 -                return ex.setMessage("inferred.do.not.conform.to.lower.bounds", uv.inst,
  20.540 -                        uv.getBounds(InferenceBound.LOWER));
  20.541 -            }
  20.542 -        },
  20.543 -        EQ() {
  20.544 -            @Override
  20.545 -            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
  20.546 -                return ex.setMessage("inferred.do.not.conform.to.eq.bounds", uv.inst,
  20.547 -                        uv.getBounds(InferenceBound.EQ));
  20.548 -            }
  20.549 -        };
  20.550 -
  20.551 -        abstract InapplicableMethodException setMessage(InferenceException ex, UndetVar uv);
  20.552 -    }
  20.553 -    //where
  20.554 -    void reportBoundError(UndetVar uv, BoundErrorKind bk) {
  20.555 -        throw bk.setMessage(inferenceException, uv);
  20.556 -    }
  20.557 -
  20.558 -    // <editor-fold desc="functional interface instantiation">
  20.559 -    /**
  20.560 -     * This method is used to infer a suitable target functional interface in case
  20.561 -     * the original parameterized interface contains wildcards. An inference process
  20.562 -     * is applied so that wildcard bounds, as well as explicit lambda/method ref parameters
  20.563 -     * (where applicable) are used to constraint the solution.
  20.564 -     */
  20.565 -    public Type instantiateFunctionalInterface(DiagnosticPosition pos, Type funcInterface,
  20.566 -            List<Type> paramTypes, Check.CheckContext checkContext) {
  20.567 -        if (types.capture(funcInterface) == funcInterface) {
  20.568 -            //if capture doesn't change the type then return the target unchanged
  20.569 -            //(this means the target contains no wildcards!)
  20.570 -            return funcInterface;
  20.571 -        } else {
  20.572 -            Type formalInterface = funcInterface.tsym.type;
  20.573 -            InferenceContext funcInterfaceContext =
  20.574 -                    new InferenceContext(funcInterface.tsym.type.getTypeArguments(), this, false);
  20.575 -            Assert.check(paramTypes != null);
  20.576 -            //get constraints from explicit params (this is done by
  20.577 -            //checking that explicit param types are equal to the ones
  20.578 -            //in the functional interface descriptors)
  20.579 -            List<Type> descParameterTypes = types.findDescriptorType(formalInterface).getParameterTypes();
  20.580 -            if (descParameterTypes.size() != paramTypes.size()) {
  20.581 -                checkContext.report(pos, diags.fragment("incompatible.arg.types.in.lambda"));
  20.582 -                return types.createErrorType(funcInterface);
  20.583 -            }
  20.584 -            for (Type p : descParameterTypes) {
  20.585 -                if (!types.isSameType(funcInterfaceContext.asFree(p, types), paramTypes.head)) {
  20.586 -                    checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
  20.587 -                    return types.createErrorType(funcInterface);
  20.588 -                }
  20.589 -                paramTypes = paramTypes.tail;
  20.590 -            }
  20.591 -            List<Type> actualTypeargs = funcInterface.getTypeArguments();
  20.592 -            for (Type t : funcInterfaceContext.undetvars) {
  20.593 -                UndetVar uv = (UndetVar)t;
  20.594 -                minimizeInst(uv, types.noWarnings);
  20.595 -                if (uv.inst == null &&
  20.596 -                        Type.filter(uv.getBounds(InferenceBound.UPPER), boundFilter).nonEmpty()) {
  20.597 -                    maximizeInst(uv, types.noWarnings);
  20.598 -                }
  20.599 -                if (uv.inst == null) {
  20.600 -                    uv.inst = actualTypeargs.head;
  20.601 -                }
  20.602 -                actualTypeargs = actualTypeargs.tail;
  20.603 -            }
  20.604 -            Type owntype = funcInterfaceContext.asInstType(formalInterface, types);
  20.605 -            if (!chk.checkValidGenericType(owntype)) {
  20.606 -                //if the inferred functional interface type is not well-formed,
  20.607 -                //or if it's not a subtype of the original target, issue an error
  20.608 -                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
  20.609 -            }
  20.610 -            return owntype;
  20.611 +            formals = formals.tail;
  20.612          }
  20.613      }
  20.614 -    // </editor-fold>
  20.615  
  20.616      /**
  20.617       * Compute a synthetic method type corresponding to the requested polymorphic
  20.618 @@ -571,7 +339,7 @@
  20.619          class ImplicitArgType extends DeferredAttr.DeferredTypeMap {
  20.620  
  20.621              public ImplicitArgType(Symbol msym, Resolve.MethodResolutionPhase phase) {
  20.622 -                deferredAttr.super(AttrMode.SPECULATIVE, msym, phase);
  20.623 +                rs.deferredAttr.super(AttrMode.SPECULATIVE, msym, phase);
  20.624              }
  20.625  
  20.626              public Type apply(Type t) {
  20.627 @@ -585,23 +353,927 @@
  20.628          }
  20.629  
  20.630      /**
  20.631 -     * Mapping that turns inference variables into undet vars
  20.632 -     * (used by inference context)
  20.633 +      * This method is used to infer a suitable target SAM in case the original
  20.634 +      * SAM type contains one or more wildcards. An inference process is applied
  20.635 +      * so that wildcard bounds, as well as explicit lambda/method ref parameters
  20.636 +      * (where applicable) are used to constraint the solution.
  20.637 +      */
  20.638 +    public Type instantiateFunctionalInterface(DiagnosticPosition pos, Type funcInterface,
  20.639 +            List<Type> paramTypes, Check.CheckContext checkContext) {
  20.640 +        if (types.capture(funcInterface) == funcInterface) {
  20.641 +            //if capture doesn't change the type then return the target unchanged
  20.642 +            //(this means the target contains no wildcards!)
  20.643 +            return funcInterface;
  20.644 +        } else {
  20.645 +            Type formalInterface = funcInterface.tsym.type;
  20.646 +            InferenceContext funcInterfaceContext =
  20.647 +                    new InferenceContext(funcInterface.tsym.type.getTypeArguments());
  20.648 +
  20.649 +            Assert.check(paramTypes != null);
  20.650 +            //get constraints from explicit params (this is done by
  20.651 +            //checking that explicit param types are equal to the ones
  20.652 +            //in the functional interface descriptors)
  20.653 +            List<Type> descParameterTypes = types.findDescriptorType(formalInterface).getParameterTypes();
  20.654 +            if (descParameterTypes.size() != paramTypes.size()) {
  20.655 +                checkContext.report(pos, diags.fragment("incompatible.arg.types.in.lambda"));
  20.656 +                return types.createErrorType(funcInterface);
  20.657 +            }
  20.658 +            for (Type p : descParameterTypes) {
  20.659 +                if (!types.isSameType(funcInterfaceContext.asFree(p), paramTypes.head)) {
  20.660 +                    checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
  20.661 +                    return types.createErrorType(funcInterface);
  20.662 +                }
  20.663 +                paramTypes = paramTypes.tail;
  20.664 +            }
  20.665 +
  20.666 +            try {
  20.667 +                funcInterfaceContext.solve(funcInterfaceContext.boundedVars(), types.noWarnings);
  20.668 +            } catch (InferenceException ex) {
  20.669 +                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
  20.670 +            }
  20.671 +
  20.672 +            List<Type> actualTypeargs = funcInterface.getTypeArguments();
  20.673 +            for (Type t : funcInterfaceContext.undetvars) {
  20.674 +                UndetVar uv = (UndetVar)t;
  20.675 +                if (uv.inst == null) {
  20.676 +                    uv.inst = actualTypeargs.head;
  20.677 +                }
  20.678 +                actualTypeargs = actualTypeargs.tail;
  20.679 +            }
  20.680 +
  20.681 +            Type owntype = funcInterfaceContext.asInstType(formalInterface);
  20.682 +            if (!chk.checkValidGenericType(owntype)) {
  20.683 +                //if the inferred functional interface type is not well-formed,
  20.684 +                //or if it's not a subtype of the original target, issue an error
  20.685 +                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
  20.686 +            }
  20.687 +            return owntype;
  20.688 +        }
  20.689 +    }
  20.690 +    // </editor-fold>
  20.691 +
  20.692 +    // <editor-fold defaultstate="collapsed" desc="Bound checking">
  20.693 +    /**
  20.694 +     * Check bounds and perform incorporation
  20.695       */
  20.696 -    class FromTypeVarFun extends Mapping {
  20.697 +    void checkWithinBounds(InferenceContext inferenceContext,
  20.698 +                             Warner warn) throws InferenceException {
  20.699 +        MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars);
  20.700 +        try {
  20.701 +            while (true) {
  20.702 +                mlistener.reset();
  20.703 +                if (!allowGraphInference) {
  20.704 +                    //in legacy mode we lack of transitivity, so bound check
  20.705 +                    //cannot be run in parallel with other incoprporation rounds
  20.706 +                    for (Type t : inferenceContext.undetvars) {
  20.707 +                        UndetVar uv = (UndetVar)t;
  20.708 +                        IncorporationStep.CHECK_BOUNDS.apply(uv, inferenceContext, warn);
  20.709 +                    }
  20.710 +                }
  20.711 +                for (Type t : inferenceContext.undetvars) {
  20.712 +                    UndetVar uv = (UndetVar)t;
  20.713 +                    //bound incorporation
  20.714 +                    EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ?
  20.715 +                            incorporationStepsGraph : incorporationStepsLegacy;
  20.716 +                    for (IncorporationStep is : incorporationSteps) {
  20.717 +                        is.apply(uv, inferenceContext, warn);
  20.718 +                    }
  20.719 +                }
  20.720 +                if (!mlistener.changed || !allowGraphInference) break;
  20.721 +            }
  20.722 +        }
  20.723 +        finally {
  20.724 +            mlistener.detach();
  20.725 +        }
  20.726 +    }
  20.727 +    //where
  20.728 +        /**
  20.729 +         * This listener keeps track of changes on a group of inference variable
  20.730 +         * bounds. Note: the listener must be detached (calling corresponding
  20.731 +         * method) to make sure that the underlying inference variable is
  20.732 +         * left in a clean state.
  20.733 +         */
  20.734 +        class MultiUndetVarListener implements UndetVar.UndetVarListener {
  20.735  
  20.736 -        boolean includeBounds;
  20.737 +            int rounds;
  20.738 +            boolean changed;
  20.739 +            List<Type> undetvars;
  20.740  
  20.741 -        FromTypeVarFun(boolean includeBounds) {
  20.742 -            super("fromTypeVarFunWithBounds");
  20.743 -            this.includeBounds = includeBounds;
  20.744 +            public MultiUndetVarListener(List<Type> undetvars) {
  20.745 +                this.undetvars = undetvars;
  20.746 +                for (Type t : undetvars) {
  20.747 +                    UndetVar uv = (UndetVar)t;
  20.748 +                    uv.listener = this;
  20.749 +                }
  20.750 +            }
  20.751 +
  20.752 +            public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
  20.753 +                //avoid non-termination
  20.754 +                if (rounds < MAX_INCORPORATION_STEPS) {
  20.755 +                    changed = true;
  20.756 +                }
  20.757 +            }
  20.758 +
  20.759 +            void reset() {
  20.760 +                rounds++;
  20.761 +                changed = false;
  20.762 +            }
  20.763 +
  20.764 +            void detach() {
  20.765 +                for (Type t : undetvars) {
  20.766 +                    UndetVar uv = (UndetVar)t;
  20.767 +                    uv.listener = null;
  20.768 +                }
  20.769 +            }
  20.770 +        };
  20.771 +
  20.772 +        /** max number of incorporation rounds */
  20.773 +        static final int MAX_INCORPORATION_STEPS = 100;
  20.774 +
  20.775 +    /**
  20.776 +     * This enumeration defines an entry point for doing inference variable
  20.777 +     * bound incorporation - it can be used to inject custom incorporation
  20.778 +     * logic into the basic bound checking routine
  20.779 +     */
  20.780 +    enum IncorporationStep {
  20.781 +        /**
  20.782 +         * Performs basic bound checking - i.e. is the instantiated type for a given
  20.783 +         * inference variable compatible with its bounds?
  20.784 +         */
  20.785 +        CHECK_BOUNDS() {
  20.786 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.787 +                Infer infer = inferenceContext.infer();
  20.788 +                uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), infer.types);
  20.789 +                infer.checkCompatibleUpperBounds(uv, inferenceContext);
  20.790 +                if (uv.inst != null) {
  20.791 +                    Type inst = uv.inst;
  20.792 +                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  20.793 +                        if (!infer.types.isSubtypeUnchecked(inst, inferenceContext.asFree(u), warn)) {
  20.794 +                            infer.reportBoundError(uv, BoundErrorKind.UPPER);
  20.795 +                        }
  20.796 +                    }
  20.797 +                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  20.798 +                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), inst, warn)) {
  20.799 +                            infer.reportBoundError(uv, BoundErrorKind.LOWER);
  20.800 +                        }
  20.801 +                    }
  20.802 +                    for (Type e : uv.getBounds(InferenceBound.EQ)) {
  20.803 +                        if (!infer.types.isSameType(inst, inferenceContext.asFree(e))) {
  20.804 +                            infer.reportBoundError(uv, BoundErrorKind.EQ);
  20.805 +                        }
  20.806 +                    }
  20.807 +                }
  20.808 +            }
  20.809 +        },
  20.810 +        /**
  20.811 +         * Check consistency of equality constraints. This is a slightly more aggressive
  20.812 +         * inference routine that is designed as to maximize compatibility with JDK 7.
  20.813 +         * Note: this is not used in graph mode.
  20.814 +         */
  20.815 +        EQ_CHECK_LEGACY() {
  20.816 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.817 +                Infer infer = inferenceContext.infer();
  20.818 +                Type eq = null;
  20.819 +                for (Type e : uv.getBounds(InferenceBound.EQ)) {
  20.820 +                    Assert.check(!inferenceContext.free(e));
  20.821 +                    if (eq != null && !infer.types.isSameType(e, eq)) {
  20.822 +                        infer.reportBoundError(uv, BoundErrorKind.EQ);
  20.823 +                    }
  20.824 +                    eq = e;
  20.825 +                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  20.826 +                        Assert.check(!inferenceContext.free(l));
  20.827 +                        if (!infer.types.isSubtypeUnchecked(l, e, warn)) {
  20.828 +                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
  20.829 +                        }
  20.830 +                    }
  20.831 +                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  20.832 +                        if (inferenceContext.free(u)) continue;
  20.833 +                        if (!infer.types.isSubtypeUnchecked(e, u, warn)) {
  20.834 +                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
  20.835 +                        }
  20.836 +                    }
  20.837 +                }
  20.838 +            }
  20.839 +        },
  20.840 +        /**
  20.841 +         * Check consistency of equality constraints.
  20.842 +         */
  20.843 +        EQ_CHECK() {
  20.844 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.845 +                Infer infer = inferenceContext.infer();
  20.846 +                for (Type e : uv.getBounds(InferenceBound.EQ)) {
  20.847 +                    if (e.containsAny(inferenceContext.inferenceVars())) continue;
  20.848 +                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  20.849 +                        if (!infer.types.isSubtypeUnchecked(e, inferenceContext.asFree(u), warn)) {
  20.850 +                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
  20.851 +                        }
  20.852 +                    }
  20.853 +                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  20.854 +                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), e, warn)) {
  20.855 +                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
  20.856 +                        }
  20.857 +                    }
  20.858 +                }
  20.859 +            }
  20.860 +        },
  20.861 +        /**
  20.862 +         * Given a bound set containing {@code alpha <: T} and {@code alpha :> S}
  20.863 +         * perform {@code S <: T} (which could lead to new bounds).
  20.864 +         */
  20.865 +        CROSS_UPPER_LOWER() {
  20.866 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.867 +                Infer infer = inferenceContext.infer();
  20.868 +                for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
  20.869 +                    for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
  20.870 +                        if (!inferenceContext.inferenceVars().contains(b1) &&
  20.871 +                                !inferenceContext.inferenceVars().contains(b2) &&
  20.872 +                                infer.types.asSuper(b2, b1.tsym) != null) {
  20.873 +                            infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
  20.874 +                        }
  20.875 +                    }
  20.876 +                }
  20.877 +            }
  20.878 +        },
  20.879 +        /**
  20.880 +         * Given a bound set containing {@code alpha <: T} and {@code alpha == S}
  20.881 +         * perform {@code S <: T} (which could lead to new bounds).
  20.882 +         */
  20.883 +        CROSS_UPPER_EQ() {
  20.884 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.885 +                Infer infer = inferenceContext.infer();
  20.886 +                for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
  20.887 +                    for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
  20.888 +                        if (!inferenceContext.inferenceVars().contains(b1) &&
  20.889 +                                !inferenceContext.inferenceVars().contains(b2) &&
  20.890 +                                infer.types.asSuper(b2, b1.tsym) != null) {
  20.891 +                            infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
  20.892 +                        }
  20.893 +                    }
  20.894 +                }
  20.895 +            }
  20.896 +        },
  20.897 +        /**
  20.898 +         * Given a bound set containing {@code alpha :> S} and {@code alpha == T}
  20.899 +         * perform {@code S <: T} (which could lead to new bounds).
  20.900 +         */
  20.901 +        CROSS_EQ_LOWER() {
  20.902 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.903 +                Infer infer = inferenceContext.infer();
  20.904 +                for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
  20.905 +                    for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
  20.906 +                        if (!inferenceContext.inferenceVars().contains(b1) &&
  20.907 +                                !inferenceContext.inferenceVars().contains(b2) &&
  20.908 +                                infer.types.asSuper(b2, b1.tsym) != null) {
  20.909 +                            infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
  20.910 +                        }
  20.911 +                    }
  20.912 +                }
  20.913 +            }
  20.914 +        },
  20.915 +        /**
  20.916 +         * Given a bound set containing {@code alpha <: beta} propagate lower bounds
  20.917 +         * from alpha to beta; also propagate upper bounds from beta to alpha.
  20.918 +         */
  20.919 +        PROP_UPPER() {
  20.920 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.921 +                Infer infer = inferenceContext.infer();
  20.922 +                for (Type b : uv.getBounds(InferenceBound.UPPER)) {
  20.923 +                    if (inferenceContext.inferenceVars().contains(b)) {
  20.924 +                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
  20.925 +                        //alpha <: beta
  20.926 +                        //1. copy alpha's lower to beta's
  20.927 +                        for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  20.928 +                            uv2.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
  20.929 +                        }
  20.930 +                        //2. copy beta's upper to alpha's
  20.931 +                        for (Type u : uv2.getBounds(InferenceBound.UPPER)) {
  20.932 +                            uv.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
  20.933 +                        }
  20.934 +                    }
  20.935 +                }
  20.936 +            }
  20.937 +        },
  20.938 +        /**
  20.939 +         * Given a bound set containing {@code alpha :> beta} propagate lower bounds
  20.940 +         * from beta to alpha; also propagate upper bounds from alpha to beta.
  20.941 +         */
  20.942 +        PROP_LOWER() {
  20.943 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.944 +                Infer infer = inferenceContext.infer();
  20.945 +                for (Type b : uv.getBounds(InferenceBound.LOWER)) {
  20.946 +                    if (inferenceContext.inferenceVars().contains(b)) {
  20.947 +                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
  20.948 +                        //alpha :> beta
  20.949 +                        //1. copy alpha's upper to beta's
  20.950 +                        for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  20.951 +                            uv2.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
  20.952 +                        }
  20.953 +                        //2. copy beta's lower to alpha's
  20.954 +                        for (Type l : uv2.getBounds(InferenceBound.LOWER)) {
  20.955 +                            uv.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
  20.956 +                        }
  20.957 +                    }
  20.958 +                }
  20.959 +            }
  20.960 +        },
  20.961 +        /**
  20.962 +         * Given a bound set containing {@code alpha == beta} propagate lower/upper
  20.963 +         * bounds from alpha to beta and back.
  20.964 +         */
  20.965 +        PROP_EQ() {
  20.966 +            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
  20.967 +                Infer infer = inferenceContext.infer();
  20.968 +                for (Type b : uv.getBounds(InferenceBound.EQ)) {
  20.969 +                    if (inferenceContext.inferenceVars().contains(b)) {
  20.970 +                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
  20.971 +                        //alpha == beta
  20.972 +                        //1. copy all alpha's bounds to beta's
  20.973 +                        for (InferenceBound ib : InferenceBound.values()) {
  20.974 +                            for (Type b2 : uv.getBounds(ib)) {
  20.975 +                                if (b2 != uv2) {
  20.976 +                                    uv2.addBound(ib, inferenceContext.asInstType(b2), infer.types);
  20.977 +                                }
  20.978 +                            }
  20.979 +                        }
  20.980 +                        //2. copy all beta's bounds to alpha's
  20.981 +                        for (InferenceBound ib : InferenceBound.values()) {
  20.982 +                            for (Type b2 : uv2.getBounds(ib)) {
  20.983 +                                if (b2 != uv) {
  20.984 +                                    uv.addBound(ib, inferenceContext.asInstType(b2), infer.types);
  20.985 +                                }
  20.986 +                            }
  20.987 +                        }
  20.988 +                    }
  20.989 +                }
  20.990 +            }
  20.991 +        };
  20.992 +
  20.993 +        abstract void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn);
  20.994 +    }
  20.995 +
  20.996 +    /** incorporation steps to be executed when running in legacy mode */
  20.997 +    EnumSet<IncorporationStep> incorporationStepsLegacy = EnumSet.of(IncorporationStep.EQ_CHECK_LEGACY);
  20.998 +
  20.999 +    /** incorporation steps to be executed when running in graph mode */
 20.1000 +    EnumSet<IncorporationStep> incorporationStepsGraph =
 20.1001 +            EnumSet.complementOf(EnumSet.of(IncorporationStep.EQ_CHECK_LEGACY));
 20.1002 +
 20.1003 +    /**
 20.1004 +     * Make sure that the upper bounds we got so far lead to a solvable inference
 20.1005 +     * variable by making sure that a glb exists.
 20.1006 +     */
 20.1007 +    void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) {
 20.1008 +        List<Type> hibounds =
 20.1009 +                Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext));
 20.1010 +        Type hb = null;
 20.1011 +        if (hibounds.isEmpty())
 20.1012 +            hb = syms.objectType;
 20.1013 +        else if (hibounds.tail.isEmpty())
 20.1014 +            hb = hibounds.head;
 20.1015 +        else
 20.1016 +            hb = types.glb(hibounds);
 20.1017 +        if (hb == null || hb.isErroneous())
 20.1018 +            reportBoundError(uv, BoundErrorKind.BAD_UPPER);
 20.1019 +    }
 20.1020 +    //where
 20.1021 +        protected static class BoundFilter implements Filter<Type> {
 20.1022 +
 20.1023 +            InferenceContext inferenceContext;
 20.1024 +
 20.1025 +            public BoundFilter(InferenceContext inferenceContext) {
 20.1026 +                this.inferenceContext = inferenceContext;
 20.1027 +            }
 20.1028 +
 20.1029 +            @Override
 20.1030 +            public boolean accepts(Type t) {
 20.1031 +                return !t.isErroneous() && !inferenceContext.free(t) &&
 20.1032 +                        !t.hasTag(BOT);
 20.1033 +            }
 20.1034 +        };
 20.1035 +
 20.1036 +    /**
 20.1037 +     * This enumeration defines all possible bound-checking related errors.
 20.1038 +     */
 20.1039 +    enum BoundErrorKind {
 20.1040 +        /**
 20.1041 +         * The (uninstantiated) inference variable has incompatible upper bounds.
 20.1042 +         */
 20.1043 +        BAD_UPPER() {
 20.1044 +            @Override
 20.1045 +            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
 20.1046 +                return ex.setMessage("incompatible.upper.bounds", uv.qtype,
 20.1047 +                        uv.getBounds(InferenceBound.UPPER));
 20.1048 +            }
 20.1049 +        },
 20.1050 +        /**
 20.1051 +         * An equality constraint is not compatible with an upper bound.
 20.1052 +         */
 20.1053 +        BAD_EQ_UPPER() {
 20.1054 +            @Override
 20.1055 +            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
 20.1056 +                return ex.setMessage("incompatible.eq.upper.bounds", uv.qtype,
 20.1057 +                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.UPPER));
 20.1058 +            }
 20.1059 +        },
 20.1060 +        /**
 20.1061 +         * An equality constraint is not compatible with a lower bound.
 20.1062 +         */
 20.1063 +        BAD_EQ_LOWER() {
 20.1064 +            @Override
 20.1065 +            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
 20.1066 +                return ex.setMessage("incompatible.eq.lower.bounds", uv.qtype,
 20.1067 +                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.LOWER));
 20.1068 +            }
 20.1069 +        },
 20.1070 +        /**
 20.1071 +         * Instantiated inference variable is not compatible with an upper bound.
 20.1072 +         */
 20.1073 +        UPPER() {
 20.1074 +            @Override
 20.1075 +            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
 20.1076 +                return ex.setMessage("inferred.do.not.conform.to.upper.bounds", uv.inst,
 20.1077 +                        uv.getBounds(InferenceBound.UPPER));
 20.1078 +            }
 20.1079 +        },
 20.1080 +        /**
 20.1081 +         * Instantiated inference variable is not compatible with a lower bound.
 20.1082 +         */
 20.1083 +        LOWER() {
 20.1084 +            @Override
 20.1085 +            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
 20.1086 +                return ex.setMessage("inferred.do.not.conform.to.lower.bounds", uv.inst,
 20.1087 +                        uv.getBounds(InferenceBound.LOWER));
 20.1088 +            }
 20.1089 +        },
 20.1090 +        /**
 20.1091 +         * Instantiated inference variable is not compatible with an equality constraint.
 20.1092 +         */
 20.1093 +        EQ() {
 20.1094 +            @Override
 20.1095 +            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
 20.1096 +                return ex.setMessage("inferred.do.not.conform.to.eq.bounds", uv.inst,
 20.1097 +                        uv.getBounds(InferenceBound.EQ));
 20.1098 +            }
 20.1099 +        };
 20.1100 +
 20.1101 +        abstract InapplicableMethodException setMessage(InferenceException ex, UndetVar uv);
 20.1102 +    }
 20.1103 +
 20.1104 +    /**
 20.1105 +     * Report a bound-checking error of given kind
 20.1106 +     */
 20.1107 +    void reportBoundError(UndetVar uv, BoundErrorKind bk) {
 20.1108 +        throw bk.setMessage(inferenceException, uv);
 20.1109 +    }
 20.1110 +    // </editor-fold>
 20.1111 +
 20.1112 +    // <editor-fold defaultstate="collapsed" desc="Inference engine">
 20.1113 +    /**
 20.1114 +     * Graph inference strategy - act as an input to the inference solver; a strategy is
 20.1115 +     * composed of two ingredients: (i) find a node to solve in the inference graph,
 20.1116 +     * and (ii) tell th engine when we are done fixing inference variables
 20.1117 +     */
 20.1118 +    interface GraphStrategy {
 20.1119 +        /**
 20.1120 +         * Pick the next node (leaf) to solve in the graph
 20.1121 +         */
 20.1122 +        Node pickNode(InferenceGraph g);
 20.1123 +        /**
 20.1124 +         * Is this the last step?
 20.1125 +         */
 20.1126 +        boolean done();
 20.1127 +    }
 20.1128 +
 20.1129 +    /**
 20.1130 +     * Simple solver strategy class that locates all leaves inside a graph
 20.1131 +     * and picks the first leaf as the next node to solve
 20.1132 +     */
 20.1133 +    abstract class LeafSolver implements GraphStrategy {
 20.1134 +        public Node pickNode(InferenceGraph g) {
 20.1135 +                        Assert.check(!g.nodes.isEmpty(), "No nodes to solve!");
 20.1136 +            return g.nodes.get(0);
 20.1137 +        }
 20.1138 +    }
 20.1139 +
 20.1140 +    /**
 20.1141 +     * This solver uses an heuristic to pick the best leaf - the heuristic
 20.1142 +     * tries to select the node that has maximal probability to contain one
 20.1143 +     * or more inference variables in a given list
 20.1144 +     */
 20.1145 +    abstract class BestLeafSolver extends LeafSolver {
 20.1146 +
 20.1147 +        List<Type> varsToSolve;
 20.1148 +
 20.1149 +        BestLeafSolver(List<Type> varsToSolve) {
 20.1150 +            this.varsToSolve = varsToSolve;
 20.1151          }
 20.1152  
 20.1153 -        public Type apply(Type t) {
 20.1154 -            if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types, includeBounds);
 20.1155 -            else return t.map(this);
 20.1156 +        /**
 20.1157 +         * Computes the cost associated with a given node; the cost is computed
 20.1158 +         * as the total number of type-variables that should be eagerly instantiated
 20.1159 +         * in order to get to some of the variables in {@code varsToSolve} from
 20.1160 +         * a given node
 20.1161 +         */
 20.1162 +        void computeCostIfNeeded(Node n, Map<Node, Integer> costMap) {
 20.1163 +            if (costMap.containsKey(n)) {
 20.1164 +                return;
 20.1165 +            } else if (!Collections.disjoint(n.data, varsToSolve)) {
 20.1166 +                costMap.put(n, n.data.size());
 20.1167 +            } else {
 20.1168 +                int subcost = Integer.MAX_VALUE;
 20.1169 +                costMap.put(n, subcost); //avoid loops
 20.1170 +                for (Node n2 : n.getDependencies()) {
 20.1171 +                    computeCostIfNeeded(n2, costMap);
 20.1172 +                    subcost = Math.min(costMap.get(n2), subcost);
 20.1173 +                }
 20.1174 +                //update cost map to reflect real cost
 20.1175 +                costMap.put(n, subcost == Integer.MAX_VALUE ?
 20.1176 +                        Integer.MAX_VALUE :
 20.1177 +                        n.data.size() + subcost);
 20.1178 +            }
 20.1179          }
 20.1180 -    };
 20.1181 +
 20.1182 +        /**
 20.1183 +         * Pick the leaf that minimize cost
 20.1184 +         */
 20.1185 +        @Override
 20.1186 +        public Node pickNode(final InferenceGraph g) {
 20.1187 +            final Map<Node, Integer> costMap = new HashMap<Node, Integer>();
 20.1188 +            ArrayList<Node> leaves = new ArrayList<Node>();
 20.1189 +            for (Node n : g.nodes) {
 20.1190 +                computeCostIfNeeded(n, costMap);
 20.1191 +                if (n.isLeaf(n)) {
 20.1192 +                    leaves.add(n);
 20.1193 +                }
 20.1194 +            }
 20.1195 +            Assert.check(!leaves.isEmpty(), "No nodes to solve!");
 20.1196 +            Collections.sort(leaves, new java.util.Comparator<Node>() {
 20.1197 +                public int compare(Node n1, Node n2) {
 20.1198 +                    return costMap.get(n1) - costMap.get(n2);
 20.1199 +                }
 20.1200 +            });
 20.1201 +            return leaves.get(0);
 20.1202 +        }
 20.1203 +    }
 20.1204 +
 20.1205 +    /**
 20.1206 +     * The inference process can be thought of as a sequence of steps. Each step
 20.1207 +     * instantiates an inference variable using a subset of the inference variable
 20.1208 +     * bounds, if certain condition are met. Decisions such as the sequence in which
 20.1209 +     * steps are applied, or which steps are to be applied are left to the inference engine.
 20.1210 +     */
 20.1211 +    enum InferenceStep {
 20.1212 +
 20.1213 +        /**
 20.1214 +         * Instantiate an inference variables using one of its (ground) equality
 20.1215 +         * constraints
 20.1216 +         */
 20.1217 +        EQ(InferenceBound.EQ) {
 20.1218 +            @Override
 20.1219 +            Type solve(UndetVar uv, InferenceContext inferenceContext) {
 20.1220 +                return filterBounds(uv, inferenceContext).head;
 20.1221 +            }
 20.1222 +        },
 20.1223 +        /**
 20.1224 +         * Instantiate an inference variables using its (ground) lower bounds. Such
 20.1225 +         * bounds are merged together using lub().
 20.1226 +         */
 20.1227 +        LOWER(InferenceBound.LOWER) {
 20.1228 +            @Override
 20.1229 +            Type solve(UndetVar uv, InferenceContext inferenceContext) {
 20.1230 +                Infer infer = inferenceContext.infer();
 20.1231 +                List<Type> lobounds = filterBounds(uv, inferenceContext);
 20.1232 +                Type owntype = infer.types.lub(lobounds);
 20.1233 +                if (owntype.hasTag(ERROR)) {
 20.1234 +                    throw infer.inferenceException
 20.1235 +                        .setMessage("no.unique.minimal.instance.exists",
 20.1236 +                                    uv.qtype, lobounds);
 20.1237 +                } else {
 20.1238 +                    return owntype;
 20.1239 +                }
 20.1240 +            }
 20.1241 +        },
 20.1242 +        /**
 20.1243 +         * Instantiate an inference variables using its (ground) upper bounds. Such
 20.1244 +         * bounds are merged together using glb().
 20.1245 +         */
 20.1246 +        UPPER(InferenceBound.UPPER) {
 20.1247 +            @Override
 20.1248 +            Type solve(UndetVar uv, InferenceContext inferenceContext) {
 20.1249 +                Infer infer = inferenceContext.infer();
 20.1250 +                List<Type> hibounds = filterBounds(uv, inferenceContext);
 20.1251 +                Type owntype = infer.types.glb(hibounds);
 20.1252 +                if (owntype.isErroneous()) {
 20.1253 +                    throw infer.inferenceException
 20.1254 +                        .setMessage("no.unique.maximal.instance.exists",
 20.1255 +                                    uv.qtype, hibounds);
 20.1256 +                } else {
 20.1257 +                    return owntype;
 20.1258 +                }
 20.1259 +            }
 20.1260 +        },
 20.1261 +        /**
 20.1262 +         * Like the former; the only difference is that this step can only be applied
 20.1263 +         * if all upper bounds are ground.
 20.1264 +         */
 20.1265 +        UPPER_LEGACY(InferenceBound.UPPER) {
 20.1266 +            @Override
 20.1267 +            public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
 20.1268 +                return !inferenceContext.free(t.getBounds(ib));
 20.1269 +            }
 20.1270 +
 20.1271 +            @Override
 20.1272 +            Type solve(UndetVar uv, InferenceContext inferenceContext) {
 20.1273 +                return UPPER.solve(uv, inferenceContext);
 20.1274 +            }
 20.1275 +        };
 20.1276 +
 20.1277 +        final InferenceBound ib;
 20.1278 +
 20.1279 +        InferenceStep(InferenceBound ib) {
 20.1280 +            this.ib = ib;
 20.1281 +        }
 20.1282 +
 20.1283 +        /**
 20.1284 +         * Find an instantiated type for a given inference variable within
 20.1285 +         * a given inference context
 20.1286 +         */
 20.1287 +        abstract Type solve(UndetVar uv, InferenceContext inferenceContext);
 20.1288 +
 20.1289 +        /**
 20.1290 +         * Can the inference variable be instantiated using this step?
 20.1291 +         */
 20.1292 +        public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
 20.1293 +            return filterBounds(t, inferenceContext).nonEmpty();
 20.1294 +        }
 20.1295 +
 20.1296 +        /**
 20.1297 +         * Return the subset of ground bounds in a given bound set (i.e. eq/lower/upper)
 20.1298 +         */
 20.1299 +        List<Type> filterBounds(UndetVar uv, InferenceContext inferenceContext) {
 20.1300 +            return Type.filter(uv.getBounds(ib), new BoundFilter(inferenceContext));
 20.1301 +        }
 20.1302 +    }
 20.1303 +
 20.1304 +    /**
 20.1305 +     * This enumeration defines the sequence of steps to be applied when the
 20.1306 +     * solver works in legacy mode. The steps in this enumeration reflect
 20.1307 +     * the behavior of old inference routine (see JLS SE 7 15.12.2.7/15.12.2.8).
 20.1308 +     */
 20.1309 +    enum LegacyInferenceSteps {
 20.1310 +
 20.1311 +        EQ_LOWER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER)),
 20.1312 +        EQ_UPPER(EnumSet.of(InferenceStep.EQ, InferenceStep.UPPER_LEGACY));
 20.1313 +
 20.1314 +        final EnumSet<InferenceStep> steps;
 20.1315 +
 20.1316 +        LegacyInferenceSteps(EnumSet<InferenceStep> steps) {
 20.1317 +            this.steps = steps;
 20.1318 +        }
 20.1319 +    }
 20.1320 +
 20.1321 +    /**
 20.1322 +     * This enumeration defines the sequence of steps to be applied when the
 20.1323 +     * graph solver is used. This order is defined so as to maximize compatibility
 20.1324 +     * w.r.t. old inference routine (see JLS SE 7 15.12.2.7/15.12.2.8).
 20.1325 +     */
 20.1326 +    enum GraphInferenceSteps {
 20.1327 +
 20.1328 +        EQ(EnumSet.of(InferenceStep.EQ)),
 20.1329 +        EQ_LOWER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER)),
 20.1330 +        EQ_LOWER_UPPER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER, InferenceStep.UPPER));
 20.1331 +
 20.1332 +        final EnumSet<InferenceStep> steps;
 20.1333 +
 20.1334 +        GraphInferenceSteps(EnumSet<InferenceStep> steps) {
 20.1335 +            this.steps = steps;
 20.1336 +        }
 20.1337 +    }
 20.1338 +
 20.1339 +    /**
 20.1340 +     * This is the graph inference solver - the solver organizes all inference variables in
 20.1341 +     * a given inference context by bound dependencies - in the general case, such dependencies
 20.1342 +     * would lead to a cyclic directed graph (hence the name); the dependency info is used to build
 20.1343 +     * an acyclic graph, where all cyclic variables are bundled together. An inference
 20.1344 +     * step corresponds to solving a node in the acyclic graph - this is done by
 20.1345 +     * relying on a given strategy (see GraphStrategy).
 20.1346 +     */
 20.1347 +    class GraphSolver {
 20.1348 +
 20.1349 +        InferenceContext inferenceContext;
 20.1350 +        Warner warn;
 20.1351 +
 20.1352 +        GraphSolver(InferenceContext inferenceContext, Warner warn) {
 20.1353 +            this.inferenceContext = inferenceContext;
 20.1354 +            this.warn = warn;
 20.1355 +        }
 20.1356 +
 20.1357 +        /**
 20.1358 +         * Solve variables in a given inference context. The amount of variables
 20.1359 +         * to be solved, and the way in which the underlying acyclic graph is explored
 20.1360 +         * depends on the selected solver strategy.
 20.1361 +         */
 20.1362 +        void solve(GraphStrategy sstrategy) {
 20.1363 +            checkWithinBounds(inferenceContext, warn); //initial propagation of bounds
 20.1364 +            InferenceGraph inferenceGraph = new InferenceGraph();
 20.1365 +            while (!sstrategy.done()) {
 20.1366 +                InferenceGraph.Node nodeToSolve = sstrategy.pickNode(inferenceGraph);
 20.1367 +                List<Type> varsToSolve = List.from(nodeToSolve.data);
 20.1368 +                inferenceContext.save();
 20.1369 +                try {
 20.1370 +                    //repeat until all variables are solved
 20.1371 +                    outer: while (Type.containsAny(inferenceContext.restvars(), varsToSolve)) {
 20.1372 +                        //for each inference phase
 20.1373 +                        for (GraphInferenceSteps step : GraphInferenceSteps.values()) {
 20.1374 +                            if (inferenceContext.solveBasic(varsToSolve, step.steps)) {
 20.1375 +                                checkWithinBounds(inferenceContext, warn);
 20.1376 +                                continue outer;
 20.1377 +                            }
 20.1378 +                        }
 20.1379 +                        //no progress
 20.1380 +                        throw inferenceException;
 20.1381 +                    }
 20.1382 +                }
 20.1383 +                catch (InferenceException ex) {
 20.1384 +                    inferenceContext.rollback();
 20.1385 +                    instantiateAsUninferredVars(varsToSolve, inferenceContext);
 20.1386 +                    checkWithinBounds(inferenceContext, warn);
 20.1387 +                }
 20.1388 +                inferenceGraph.deleteNode(nodeToSolve);
 20.1389 +            }
 20.1390 +        }
 20.1391 +
 20.1392 +        /**
 20.1393 +         * The dependencies between the inference variables that need to be solved
 20.1394 +         * form a (possibly cyclic) graph. This class reduces the original dependency graph
 20.1395 +         * to an acyclic version, where cyclic nodes are folded into a single 'super node'.
 20.1396 +         */
 20.1397 +        class InferenceGraph {
 20.1398 +
 20.1399 +            /**
 20.1400 +             * This class represents a node in the graph. Each node corresponds
 20.1401 +             * to an inference variable and has edges (dependencies) on other
 20.1402 +             * nodes. The node defines an entry point that can be used to receive
 20.1403 +             * updates on the structure of the graph this node belongs to (used to
 20.1404 +             * keep dependencies in sync).
 20.1405 +             */
 20.1406 +            class Node extends GraphUtils.TarjanNode<ListBuffer<Type>> {
 20.1407 +
 20.1408 +                Set<Node> deps;
 20.1409 +
 20.1410 +                Node(Type ivar) {
 20.1411 +                    super(ListBuffer.of(ivar));
 20.1412 +                    this.deps = new HashSet<Node>();
 20.1413 +                }
 20.1414 +
 20.1415 +                @Override
 20.1416 +                public Iterable<? extends Node> getDependencies() {
 20.1417 +                    return deps;
 20.1418 +                }
 20.1419 +
 20.1420 +                @Override
 20.1421 +                public String printDependency(GraphUtils.Node<ListBuffer<Type>> to) {
 20.1422 +                    StringBuilder buf = new StringBuilder();
 20.1423 +                    String sep = "";
 20.1424 +                    for (Type from : data) {
 20.1425 +                        UndetVar uv = (UndetVar)inferenceContext.asFree(from);
 20.1426 +                        for (Type bound : uv.getBounds(InferenceBound.values())) {
 20.1427 +                            if (bound.containsAny(List.from(to.data))) {
 20.1428 +                                buf.append(sep);
 20.1429 +                                buf.append(bound);
 20.1430 +                                sep = ",";
 20.1431 +                            }
 20.1432 +                        }
 20.1433 +                    }
 20.1434 +                    return buf.toString();
 20.1435 +                }
 20.1436 +
 20.1437 +                boolean isLeaf(Node n) {
 20.1438 +                    //no deps, or only one self dep
 20.1439 +                    return (n.deps.isEmpty() ||
 20.1440 +                            n.deps.size() == 1 && n.deps.contains(n));
 20.1441 +                }
 20.1442 +
 20.1443 +                void mergeWith(List<? extends Node> nodes) {
 20.1444 +                    for (Node n : nodes) {
 20.1445 +                        Assert.check(n.data.length() == 1, "Attempt to merge a compound node!");
 20.1446 +                        data.appendList(n.data);
 20.1447 +                        deps.addAll(n.deps);
 20.1448 +                    }
 20.1449 +                    //update deps
 20.1450 +                    Set<Node> deps2 = new HashSet<Node>();
 20.1451 +                    for (Node d : deps) {
 20.1452 +                        if (data.contains(d.data.first())) {
 20.1453 +                            deps2.add(this);
 20.1454 +                        } else {
 20.1455 +                            deps2.add(d);
 20.1456 +                        }
 20.1457 +                    }
 20.1458 +                    deps = deps2;
 20.1459 +                }
 20.1460 +
 20.1461 +                void graphChanged(Node from, Node to) {
 20.1462 +                    if (deps.contains(from)) {
 20.1463 +                        deps.remove(from);
 20.1464 +                        if (to != null) {
 20.1465 +                            deps.add(to);
 20.1466 +                        }
 20.1467 +                    }
 20.1468 +                }
 20.1469 +            }
 20.1470 +
 20.1471 +            /** the nodes in the inference graph */
 20.1472 +            ArrayList<Node> nodes;
 20.1473 +
 20.1474 +            InferenceGraph() {
 20.1475 +                initNodes();
 20.1476 +            }
 20.1477 +
 20.1478 +            /**
 20.1479 +             * Delete a node from the graph. This update the underlying structure
 20.1480 +             * of the graph (including dependencies) via listeners updates.
 20.1481 +             */
 20.1482 +            public void deleteNode(Node n) {
 20.1483 +                Assert.check(nodes.contains(n));
 20.1484 +                nodes.remove(n);
 20.1485 +                notifyUpdate(n, null);
 20.1486 +            }
 20.1487 +
 20.1488 +            /**
 20.1489 +             * Notify all nodes of a change in the graph. If the target node is
 20.1490 +             * {@code null} the source node is assumed to be removed.
 20.1491 +             */
 20.1492 +            void notifyUpdate(Node from, Node to) {
 20.1493 +                for (Node n : nodes) {
 20.1494 +                    n.graphChanged(from, to);
 20.1495 +                }
 20.1496 +            }
 20.1497 +
 20.1498 +            /**
 20.1499 +             * Create the graph nodes. First a simple node is created for every inference
 20.1500 +             * variables to be solved. Then Tarjan is used to found all connected components
 20.1501 +             * in the graph. For each component containing more than one node, a super node is
 20.1502 +                 * created, effectively replacing the original cyclic nodes.
 20.1503 +             */
 20.1504 +            void initNodes() {
 20.1505 +                ArrayList<Node> nodes = new ArrayList<Node>();
 20.1506 +                for (Type t : inferenceContext.restvars()) {
 20.1507 +                    nodes.add(new Node(t));
 20.1508 +                }
 20.1509 +                for (Node n_i : nodes) {
 20.1510 +                    Type i = n_i.data.first();
 20.1511 +                    for (Node n_j : nodes) {
 20.1512 +                        Type j = n_j.data.first();
 20.1513 +                        UndetVar uv_i = (UndetVar)inferenceContext.asFree(i);
 20.1514 +                        if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) {
 20.1515 +                            //update i's deps
 20.1516 +                            n_i.deps.add(n_j);
 20.1517 +                            //update j's deps - only if i's bounds contain _exactly_ j
 20.1518 +                            if (uv_i.getBounds(InferenceBound.values()).contains(j)) {
 20.1519 +                                n_j.deps.add(n_i);
 20.1520 +                            }
 20.1521 +                        }
 20.1522 +                    }
 20.1523 +                }
 20.1524 +                this.nodes = new ArrayList<Node>();
 20.1525 +                for (List<? extends Node> conSubGraph : GraphUtils.tarjan(nodes)) {
 20.1526 +                    if (conSubGraph.length() > 1) {
 20.1527 +                        Node root = conSubGraph.head;
 20.1528 +                        root.mergeWith(conSubGraph.tail);
 20.1529 +                        for (Node n : conSubGraph) {
 20.1530 +                            notifyUpdate(n, root);
 20.1531 +                        }
 20.1532 +                    }
 20.1533 +                    this.nodes.add(conSubGraph.head);
 20.1534 +                }
 20.1535 +            }
 20.1536 +
 20.1537 +            /**
 20.1538 +             * Debugging: dot representation of this graph
 20.1539 +             */
 20.1540 +            String toDot() {
 20.1541 +                StringBuilder buf = new StringBuilder();
 20.1542 +                for (Type t : inferenceContext.undetvars) {
 20.1543 +                    UndetVar uv = (UndetVar)t;
 20.1544 +                    buf.append(String.format("var %s - upper bounds = %s, lower bounds = %s, eq bounds = %s\\n",
 20.1545 +                            uv.qtype, uv.getBounds(InferenceBound.UPPER), uv.getBounds(InferenceBound.LOWER),
 20.1546 +                            uv.getBounds(InferenceBound.EQ)));
 20.1547 +                }
 20.1548 +                return GraphUtils.toDot(nodes, "inferenceGraph" + hashCode(), buf.toString());
 20.1549 +            }
 20.1550 +        }
 20.1551 +    }
 20.1552 +    // </editor-fold>
 20.1553 +
 20.1554 +    // <editor-fold defaultstate="collapsed" desc="Inference context">
 20.1555 +    /**
 20.1556 +     * Functional interface for defining inference callbacks. Certain actions
 20.1557 +     * (i.e. subtyping checks) might need to be redone after all inference variables
 20.1558 +     * have been fixed.
 20.1559 +     */
 20.1560 +    interface FreeTypeListener {
 20.1561 +        void typesInferred(InferenceContext inferenceContext);
 20.1562 +    }
 20.1563  
 20.1564      /**
 20.1565       * An inference context keeps track of the set of variables that are free
 20.1566 @@ -611,16 +1283,7 @@
 20.1567       * it can be used as an entry point for performing upper/lower bound inference
 20.1568       * (see InferenceKind).
 20.1569       */
 20.1570 -    static class InferenceContext {
 20.1571 -
 20.1572 -        /**
 20.1573 -        * Single-method-interface for defining inference callbacks. Certain actions
 20.1574 -        * (i.e. subtyping checks) might need to be redone after all inference variables
 20.1575 -        * have been fixed.
 20.1576 -        */
 20.1577 -        interface FreeTypeListener {
 20.1578 -            void typesInferred(InferenceContext inferenceContext);
 20.1579 -        }
 20.1580 +     class InferenceContext {
 20.1581  
 20.1582          /** list of inference vars as undet vars */
 20.1583          List<Type> undetvars;
 20.1584 @@ -628,15 +1291,26 @@
 20.1585          /** list of inference vars in this context */
 20.1586          List<Type> inferencevars;
 20.1587  
 20.1588 +        /** backed up inference variables */
 20.1589 +        List<Type> saved_undet;
 20.1590 +
 20.1591          java.util.Map<FreeTypeListener, List<Type>> freeTypeListeners =
 20.1592                  new java.util.HashMap<FreeTypeListener, List<Type>>();
 20.1593  
 20.1594          List<FreeTypeListener> freetypeListeners = List.nil();
 20.1595  
 20.1596 -        public InferenceContext(List<Type> inferencevars, Infer infer, boolean includeBounds) {
 20.1597 -            this.undetvars = Type.map(inferencevars, infer.new FromTypeVarFun(includeBounds));
 20.1598 +        public InferenceContext(List<Type> inferencevars) {
 20.1599 +            this.undetvars = Type.map(inferencevars, fromTypeVarFun);
 20.1600              this.inferencevars = inferencevars;
 20.1601          }
 20.1602 +        //where
 20.1603 +            Mapping fromTypeVarFun = new Mapping("fromTypeVarFunWithBounds") {
 20.1604 +                // mapping that turns inference variables into undet vars
 20.1605 +                public Type apply(Type t) {
 20.1606 +                    if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types);
 20.1607 +                    else return t.map(this);
 20.1608 +                }
 20.1609 +            };
 20.1610  
 20.1611          /**
 20.1612           * returns the list of free variables (as type-variables) in this
 20.1613 @@ -648,19 +1322,51 @@
 20.1614  
 20.1615          /**
 20.1616           * returns the list of uninstantiated variables (as type-variables) in this
 20.1617 -         * inference context (usually called after instantiate())
 20.1618 +         * inference context
 20.1619           */
 20.1620          List<Type> restvars() {
 20.1621 -            List<Type> undetvars = this.undetvars;
 20.1622 -            ListBuffer<Type> restvars = ListBuffer.lb();
 20.1623 -            for (Type t : instTypes()) {
 20.1624 -                UndetVar uv = (UndetVar)undetvars.head;
 20.1625 -                if (uv.qtype == t) {
 20.1626 -                    restvars.append(t);
 20.1627 +            return filterVars(new Filter<UndetVar>() {
 20.1628 +                public boolean accepts(UndetVar uv) {
 20.1629 +                    return uv.inst == null;
 20.1630                  }
 20.1631 -                undetvars = undetvars.tail;
 20.1632 +            });
 20.1633 +        }
 20.1634 +
 20.1635 +        /**
 20.1636 +         * returns the list of instantiated variables (as type-variables) in this
 20.1637 +         * inference context
 20.1638 +         */
 20.1639 +        List<Type> instvars() {
 20.1640 +            return filterVars(new Filter<UndetVar>() {
 20.1641 +                public boolean accepts(UndetVar uv) {
 20.1642 +                    return uv.inst != null;
 20.1643 +                }
 20.1644 +            });
 20.1645 +        }
 20.1646 +
 20.1647 +        /**
 20.1648 +         * Get list of bounded inference variables (where bound is other than
 20.1649 +         * declared bounds).
 20.1650 +         */
 20.1651 +        final List<Type> boundedVars() {
 20.1652 +            return filterVars(new Filter<UndetVar>() {
 20.1653 +                public boolean accepts(UndetVar uv) {
 20.1654 +                    return uv.getBounds(InferenceBound.UPPER)
 20.1655 +                            .diff(uv.getDeclaredBounds())
 20.1656 +                            .appendList(uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)).nonEmpty();
 20.1657 +                }
 20.1658 +            });
 20.1659 +        }
 20.1660 +
 20.1661 +        private List<Type> filterVars(Filter<UndetVar> fu) {
 20.1662 +            ListBuffer<Type> res = ListBuffer.lb();
 20.1663 +            for (Type t : undetvars) {
 20.1664 +                UndetVar uv = (UndetVar)t;
 20.1665 +                if (fu.accepts(uv)) {
 20.1666 +                    res.append(uv.qtype);
 20.1667 +                }
 20.1668              }
 20.1669 -            return restvars.toList();
 20.1670 +            return res.toList();
 20.1671          }
 20.1672  
 20.1673          /**
 20.1674 @@ -709,14 +1415,14 @@
 20.1675           * undet vars (used ahead of subtyping/compatibility checks to allow propagation
 20.1676           * of inference constraints).
 20.1677           */
 20.1678 -        final Type asFree(Type t, Types types) {
 20.1679 +        final Type asFree(Type t) {
 20.1680              return types.subst(t, inferencevars, undetvars);
 20.1681          }
 20.1682  
 20.1683 -        final List<Type> asFree(List<Type> ts, Types types) {
 20.1684 +        final List<Type> asFree(List<Type> ts) {
 20.1685              ListBuffer<Type> buf = ListBuffer.lb();
 20.1686              for (Type t : ts) {
 20.1687 -                buf.append(asFree(t, types));
 20.1688 +                buf.append(asFree(t));
 20.1689              }
 20.1690              return buf.toList();
 20.1691          }
 20.1692 @@ -735,14 +1441,14 @@
 20.1693           * instantiated types - if one or more free variable has not been
 20.1694           * fully instantiated, it will still be available in the resulting type.
 20.1695           */
 20.1696 -        Type asInstType(Type t, Types types) {
 20.1697 +        Type asInstType(Type t) {
 20.1698              return types.subst(t, inferencevars, instTypes());
 20.1699          }
 20.1700  
 20.1701 -        List<Type> asInstTypes(List<Type> ts, Types types) {
 20.1702 +        List<Type> asInstTypes(List<Type> ts) {
 20.1703              ListBuffer<Type> buf = ListBuffer.lb();
 20.1704              for (Type t : ts) {
 20.1705 -                buf.append(asInstType(t, types));
 20.1706 +                buf.append(asInstType(t));
 20.1707              }
 20.1708              return buf.toList();
 20.1709          }
 20.1710 @@ -758,11 +1464,15 @@
 20.1711           * Mark the inference context as complete and trigger evaluation
 20.1712           * of all deferred checks.
 20.1713           */
 20.1714 -        void notifyChange(Types types) {
 20.1715 +        void notifyChange() {
 20.1716 +            notifyChange(inferencevars.diff(restvars()));
 20.1717 +        }
 20.1718 +
 20.1719 +        void notifyChange(List<Type> inferredVars) {
 20.1720              InferenceException thrownEx = null;
 20.1721              for (Map.Entry<FreeTypeListener, List<Type>> entry :
 20.1722                      new HashMap<FreeTypeListener, List<Type>>(freeTypeListeners).entrySet()) {
 20.1723 -                if (!Type.containsAny(entry.getValue(), restvars())) {
 20.1724 +                if (!Type.containsAny(entry.getValue(), inferencevars.diff(inferredVars))) {
 20.1725                      try {
 20.1726                          entry.getKey().typesInferred(this);
 20.1727                          freeTypeListeners.remove(entry.getKey());
 20.1728 @@ -780,22 +1490,156 @@
 20.1729              }
 20.1730          }
 20.1731  
 20.1732 -        void solveAny(List<Type> varsToSolve, Types types, Infer infer) {
 20.1733 -            boolean progress = false;
 20.1734 -            for (Type t : varsToSolve) {
 20.1735 -                UndetVar uv = (UndetVar)asFree(t, types);
 20.1736 -                if (uv.inst == null) {
 20.1737 -                    infer.minimizeInst(uv, types.noWarnings);
 20.1738 -                    if (uv.inst != null) {
 20.1739 -                        progress = true;
 20.1740 +        /**
 20.1741 +         * Save the state of this inference context
 20.1742 +         */
 20.1743 +        void save() {
 20.1744 +            ListBuffer<Type> buf = ListBuffer.lb();
 20.1745 +            for (Type t : undetvars) {
 20.1746 +                UndetVar uv = (UndetVar)t;
 20.1747 +                UndetVar uv2 = new UndetVar((TypeVar)uv.qtype, types);
 20.1748 +                for (InferenceBound ib : InferenceBound.values()) {
 20.1749 +                    for (Type b : uv.getBounds(ib)) {
 20.1750 +                        uv2.addBound(ib, b, types);
 20.1751 +                    }
 20.1752 +                }
 20.1753 +                uv2.inst = uv.inst;
 20.1754 +                buf.add(uv2);
 20.1755 +            }
 20.1756 +            saved_undet = buf.toList();
 20.1757 +        }
 20.1758 +
 20.1759 +        /**
 20.1760 +         * Restore the state of this inference context to the previous known checkpoint
 20.1761 +         */
 20.1762 +        void rollback() {
 20.1763 +            Assert.check(saved_undet != null && saved_undet.length() == undetvars.length());
 20.1764 +            undetvars = saved_undet;
 20.1765 +            saved_undet = null;
 20.1766 +        }
 20.1767 +
 20.1768 +        /**
 20.1769 +         * Copy variable in this inference context to the given context
 20.1770 +         */
 20.1771 +        void dupTo(final InferenceContext that) {
 20.1772 +            that.inferencevars = that.inferencevars.appendList(inferencevars);
 20.1773 +            that.undetvars = that.undetvars.appendList(undetvars);
 20.1774 +            //set up listeners to notify original inference contexts as
 20.1775 +            //propagated vars are inferred in new context
 20.1776 +            for (Type t : inferencevars) {
 20.1777 +                that.freeTypeListeners.put(new FreeTypeListener() {
 20.1778 +                    public void typesInferred(InferenceContext inferenceContext) {
 20.1779 +                        InferenceContext.this.notifyChange();
 20.1780 +                    }
 20.1781 +                }, List.of(t));
 20.1782 +            }
 20.1783 +        }
 20.1784 +
 20.1785 +        /**
 20.1786 +         * Solve with given graph strategy.
 20.1787 +         */
 20.1788 +        private void solve(GraphStrategy ss, Warner warn) {
 20.1789 +            GraphSolver s = new GraphSolver(this, warn);
 20.1790 +            s.solve(ss);
 20.1791 +        }
 20.1792 +
 20.1793 +        /**
 20.1794 +         * Solve all variables in this context.
 20.1795 +         */
 20.1796 +        public void solve(Warner warn) {
 20.1797 +            solve(new LeafSolver() {
 20.1798 +                public boolean done() {
 20.1799 +                    return restvars().isEmpty();
 20.1800 +                }
 20.1801 +            }, warn);
 20.1802 +        }
 20.1803 +
 20.1804 +        /**
 20.1805 +         * Solve all variables in the given list.
 20.1806 +         */
 20.1807 +        public void solve(final List<Type> vars, Warner warn) {
 20.1808 +            solve(new BestLeafSolver(vars) {
 20.1809 +                public boolean done() {
 20.1810 +                    return !free(asInstTypes(vars));
 20.1811 +                }
 20.1812 +            }, warn);
 20.1813 +        }
 20.1814 +
 20.1815 +        /**
 20.1816 +         * Solve at least one variable in given list.
 20.1817 +         */
 20.1818 +        public void solveAny(List<Type> varsToSolve, Warner warn) {
 20.1819 +            checkWithinBounds(this, warn); //propagate bounds
 20.1820 +            List<Type> boundedVars = boundedVars().intersect(restvars()).intersect(varsToSolve);
 20.1821 +            if (boundedVars.isEmpty()) {
 20.1822 +                throw inferenceException.setMessage("cyclic.inference",
 20.1823 +                                freeVarsIn(varsToSolve));
 20.1824 +            }
 20.1825 +            solve(new BestLeafSolver(boundedVars) {
 20.1826 +                public boolean done() {
 20.1827 +                    return instvars().intersect(varsToSolve).nonEmpty();
 20.1828 +                }
 20.1829 +            }, warn);
 20.1830 +        }
 20.1831 +
 20.1832 +        /**
 20.1833 +         * Apply a set of inference steps
 20.1834 +         */
 20.1835 +        private boolean solveBasic(EnumSet<InferenceStep> steps) {
 20.1836 +            return solveBasic(inferencevars, steps);
 20.1837 +        }
 20.1838 +
 20.1839 +        private boolean solveBasic(List<Type> varsToSolve, EnumSet<InferenceStep> steps) {
 20.1840 +            boolean changed = false;
 20.1841 +            for (Type t : varsToSolve.intersect(restvars())) {
 20.1842 +                UndetVar uv = (UndetVar)asFree(t);
 20.1843 +                for (InferenceStep step : steps) {
 20.1844 +                    if (step.accepts(uv, this)) {
 20.1845 +                        uv.inst = step.solve(uv, this);
 20.1846 +                        changed = true;
 20.1847 +                        break;
 20.1848                      }
 20.1849                  }
 20.1850              }
 20.1851 -            if (!progress) {
 20.1852 -                throw infer.inferenceException.setMessage("cyclic.inference", varsToSolve);
 20.1853 +            return changed;
 20.1854 +        }
 20.1855 +
 20.1856 +        /**
 20.1857 +         * Instantiate inference variables in legacy mode (JLS 15.12.2.7, 15.12.2.8).
 20.1858 +         * During overload resolution, instantiation is done by doing a partial
 20.1859 +         * inference process using eq/lower bound instantiation. During check,
 20.1860 +         * we also instantiate any remaining vars by repeatedly using eq/upper
 20.1861 +         * instantiation, until all variables are solved.
 20.1862 +         */
 20.1863 +        public void solveLegacy(boolean partial, Warner warn, EnumSet<InferenceStep> steps) {
 20.1864 +            while (true) {
 20.1865 +                boolean stuck = !solveBasic(steps);
 20.1866 +                if (restvars().isEmpty() || partial) {
 20.1867 +                    //all variables have been instantiated - exit
 20.1868 +                    break;
 20.1869 +                } else if (stuck) {
 20.1870 +                    //some variables could not be instantiated because of cycles in
 20.1871 +                    //upper bounds - provide a (possibly recursive) default instantiation
 20.1872 +                    instantiateAsUninferredVars(restvars(), this);
 20.1873 +                    break;
 20.1874 +                } else {
 20.1875 +                    //some variables have been instantiated - replace newly instantiated
 20.1876 +                    //variables in remaining upper bounds and continue
 20.1877 +                    for (Type t : undetvars) {
 20.1878 +                        UndetVar uv = (UndetVar)t;
 20.1879 +                        uv.substBounds(inferenceVars(), instTypes(), types);
 20.1880 +                    }
 20.1881 +                }
 20.1882              }
 20.1883 +            checkWithinBounds(this, warn);
 20.1884 +        }
 20.1885 +
 20.1886 +        private Infer infer() {
 20.1887 +            //back-door to infer
 20.1888 +            return Infer.this;
 20.1889          }
 20.1890      }
 20.1891  
 20.1892 -    final InferenceContext emptyContext = new InferenceContext(List.<Type>nil(), this, false);
 20.1893 +    final InferenceContext emptyContext = new InferenceContext(List.<Type>nil());
 20.1894 +    // </editor-fold>
 20.1895  }
    21.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Feb 04 18:08:53 2013 -0500
    21.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Sun Feb 17 16:44:55 2013 -0500
    21.3 @@ -570,10 +570,19 @@
    21.4       *  @param flags    The class symbol's flags
    21.5       *  @param owner    The class symbol's owner
    21.6       */
    21.7 -    ClassSymbol makeEmptyClass(long flags, ClassSymbol owner) {
    21.8 +    JCClassDecl makeEmptyClass(long flags, ClassSymbol owner) {
    21.9 +        return makeEmptyClass(flags, owner, null, true);
   21.10 +    }
   21.11 +
   21.12 +    JCClassDecl makeEmptyClass(long flags, ClassSymbol owner, Name flatname,
   21.13 +            boolean addToDefs) {
   21.14          // Create class symbol.
   21.15          ClassSymbol c = reader.defineClass(names.empty, owner);
   21.16 -        c.flatname = chk.localClassName(c);
   21.17 +        if (flatname != null) {
   21.18 +            c.flatname = flatname;
   21.19 +        } else {
   21.20 +            c.flatname = chk.localClassName(c);
   21.21 +        }
   21.22          c.sourcefile = owner.sourcefile;
   21.23          c.completer = null;
   21.24          c.members_field = new Scope(c);
   21.25 @@ -597,9 +606,8 @@
   21.26          cdef.type = c.type;
   21.27  
   21.28          // Append class definition tree to owner's definitions.
   21.29 -        odef.defs = odef.defs.prepend(cdef);
   21.30 -
   21.31 -        return c;
   21.32 +        if (addToDefs) odef.defs = odef.defs.prepend(cdef);
   21.33 +        return cdef;
   21.34      }
   21.35  
   21.36  /**************************************************************************
   21.37 @@ -706,7 +714,7 @@
   21.38       * and synthethise a class (with makeEmptyClass) if one is not available.
   21.39       * However, there is a small possibility that an existing class will not
   21.40       * be generated as expected if it is inside a conditional with a constant
   21.41 -     * expression. If that is found to be the case, create an empty class here.
   21.42 +     * expression. If that is found to be the case, create an empty class tree here.
   21.43       */
   21.44      private void checkAccessConstructorTags() {
   21.45          for (List<ClassSymbol> l = accessConstrTags; l.nonEmpty(); l = l.tail) {
   21.46 @@ -714,14 +722,10 @@
   21.47              if (isTranslatedClassAvailable(c))
   21.48                  continue;
   21.49              // Create class definition tree.
   21.50 -            JCClassDecl cdef = make.ClassDef(
   21.51 -                make.Modifiers(STATIC | SYNTHETIC), names.empty,
   21.52 -                List.<JCTypeParameter>nil(),
   21.53 -                null, List.<JCExpression>nil(), List.<JCTree>nil());
   21.54 -            cdef.sym = c;
   21.55 -            cdef.type = c.type;
   21.56 -            // add it to the list of classes to be generated
   21.57 -            translated.append(cdef);
   21.58 +            JCClassDecl cdec = makeEmptyClass(STATIC | SYNTHETIC,
   21.59 +                    c.outermostClass(), c.flatname, false);
   21.60 +            swapAccessConstructorTag(c, cdec.sym);
   21.61 +            translated.append(cdec);
   21.62          }
   21.63      }
   21.64      // where
   21.65 @@ -735,6 +739,19 @@
   21.66          return false;
   21.67      }
   21.68  
   21.69 +    void swapAccessConstructorTag(ClassSymbol oldCTag, ClassSymbol newCTag) {
   21.70 +        for (MethodSymbol methodSymbol : accessConstrs.values()) {
   21.71 +            Assert.check(methodSymbol.type.hasTag(METHOD));
   21.72 +            MethodType oldMethodType =
   21.73 +                    (MethodType)methodSymbol.type;
   21.74 +            if (oldMethodType.argtypes.head.tsym == oldCTag)
   21.75 +                methodSymbol.type =
   21.76 +                    types.createMethodTypeWithParameters(oldMethodType,
   21.77 +                        oldMethodType.getParameterTypes().tail
   21.78 +                            .prepend(newCTag.erasure(types)));
   21.79 +        }
   21.80 +    }
   21.81 +
   21.82  /**************************************************************************
   21.83   * Access methods
   21.84   *************************************************************************/
   21.85 @@ -1211,7 +1228,7 @@
   21.86                                           "1");
   21.87          ClassSymbol ctag = chk.compiled.get(flatname);
   21.88          if (ctag == null)
   21.89 -            ctag = makeEmptyClass(STATIC | SYNTHETIC, topClass);
   21.90 +            ctag = makeEmptyClass(STATIC | SYNTHETIC, topClass).sym;
   21.91          // keep a record of all tags, to verify that all are generated as required
   21.92          accessConstrTags = accessConstrTags.prepend(ctag);
   21.93          return ctag;
   21.94 @@ -1428,22 +1445,49 @@
   21.95          return result;
   21.96      }
   21.97  
   21.98 +    private VarSymbol makeOuterThisVarSymbol(Symbol owner, long flags) {
   21.99 +        if (owner.kind == TYP &&
  21.100 +            target.usePrivateSyntheticFields())
  21.101 +            flags |= PRIVATE;
  21.102 +        Type target = types.erasure(owner.enclClass().type.getEnclosingType());
  21.103 +        VarSymbol outerThis =
  21.104 +            new VarSymbol(flags, outerThisName(target, owner), target, owner);
  21.105 +        outerThisStack = outerThisStack.prepend(outerThis);
  21.106 +        return outerThis;
  21.107 +    }
  21.108 +
  21.109 +    private JCVariableDecl makeOuterThisVarDecl(int pos, VarSymbol sym) {
  21.110 +        JCVariableDecl vd = make.at(pos).VarDef(sym, null);
  21.111 +        vd.vartype = access(vd.vartype);
  21.112 +        return vd;
  21.113 +    }
  21.114 +
  21.115 +    /** Definition for this$n field.
  21.116 +     *  @param pos        The source code position of the definition.
  21.117 +     *  @param owner      The method in which the definition goes.
  21.118 +     */
  21.119 +    JCVariableDecl outerThisDef(int pos, MethodSymbol owner) {
  21.120 +        ClassSymbol c = owner.enclClass();
  21.121 +        boolean isMandated =
  21.122 +            // Anonymous constructors
  21.123 +            (owner.isConstructor() && owner.isAnonymous()) ||
  21.124 +            // Constructors of non-private inner member classes
  21.125 +            (owner.isConstructor() && c.isInner() &&
  21.126 +             !c.isPrivate() && !c.isStatic());
  21.127 +        long flags =
  21.128 +            FINAL | (isMandated ? MANDATED : SYNTHETIC);
  21.129 +        VarSymbol outerThis = makeOuterThisVarSymbol(owner, flags);
  21.130 +        owner.extraParams = owner.extraParams.prepend(outerThis);
  21.131 +        return makeOuterThisVarDecl(pos, outerThis);
  21.132 +    }
  21.133 +
  21.134      /** Definition for this$n field.
  21.135       *  @param pos        The source code position of the definition.
  21.136       *  @param owner      The class in which the definition goes.
  21.137       */
  21.138 -    JCVariableDecl outerThisDef(int pos, Symbol owner) {
  21.139 -        long flags = FINAL | SYNTHETIC;
  21.140 -        if (owner.kind == TYP &&
  21.141 -            target.usePrivateSyntheticFields())
  21.142 -            flags |= PRIVATE;
  21.143 -        Type target = types.erasure(owner.enclClass().type.getEnclosingType());
  21.144 -        VarSymbol outerThis = new VarSymbol(
  21.145 -            flags, outerThisName(target, owner), target, owner);
  21.146 -        outerThisStack = outerThisStack.prepend(outerThis);
  21.147 -        JCVariableDecl vd = make.at(pos).VarDef(outerThis, null);
  21.148 -        vd.vartype = access(vd.vartype);
  21.149 -        return vd;
  21.150 +    JCVariableDecl outerThisDef(int pos, ClassSymbol owner) {
  21.151 +        VarSymbol outerThis = makeOuterThisVarSymbol(owner, FINAL | SYNTHETIC);
  21.152 +        return makeOuterThisVarDecl(pos, outerThis);
  21.153      }
  21.154  
  21.155      /** Return a list of trees that load the free variables in given list,
  21.156 @@ -1778,7 +1822,7 @@
  21.157              if (e.sym.kind == TYP &&
  21.158                  e.sym.name == names.empty &&
  21.159                  (e.sym.flags() & INTERFACE) == 0) return (ClassSymbol) e.sym;
  21.160 -        return makeEmptyClass(STATIC | SYNTHETIC, clazz);
  21.161 +        return makeEmptyClass(STATIC | SYNTHETIC, clazz).sym;
  21.162      }
  21.163  
  21.164      /** Return symbol for "class$" method. If there is no method definition
  21.165 @@ -2551,7 +2595,6 @@
  21.166                                         "enum" + target.syntheticNameChar() + "name"),
  21.167                        syms.stringType, tree.sym);
  21.168              nameParam.mods.flags |= SYNTHETIC; nameParam.sym.flags_field |= SYNTHETIC;
  21.169 -
  21.170              JCVariableDecl ordParam = make.
  21.171                  Param(names.fromString(target.syntheticNameChar() +
  21.172                                         "enum" + target.syntheticNameChar() +
  21.173 @@ -2562,6 +2605,8 @@
  21.174              tree.params = tree.params.prepend(ordParam).prepend(nameParam);
  21.175  
  21.176              MethodSymbol m = tree.sym;
  21.177 +            m.extraParams = m.extraParams.prepend(ordParam.sym);
  21.178 +            m.extraParams = m.extraParams.prepend(nameParam.sym);
  21.179              Type olderasure = m.erasure(types);
  21.180              m.erasure_field = new MethodType(
  21.181                  olderasure.getParameterTypes().prepend(syms.intType).prepend(syms.stringType),
  21.182 @@ -3049,55 +3094,38 @@
  21.183      }
  21.184  
  21.185      public void visitAssignop(final JCAssignOp tree) {
  21.186 -        if (!tree.lhs.type.isPrimitive() &&
  21.187 -            tree.operator.type.getReturnType().isPrimitive()) {
  21.188 -            // boxing required; need to rewrite as x = (unbox typeof x)(x op y);
  21.189 -            // or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y)
  21.190 -            // (but without recomputing x)
  21.191 -            JCTree newTree = abstractLval(tree.lhs, new TreeBuilder() {
  21.192 -                    public JCTree build(final JCTree lhs) {
  21.193 -                        JCTree.Tag newTag = tree.getTag().noAssignOp();
  21.194 -                        // Erasure (TransTypes) can change the type of
  21.195 -                        // tree.lhs.  However, we can still get the
  21.196 -                        // unerased type of tree.lhs as it is stored
  21.197 -                        // in tree.type in Attr.
  21.198 -                        Symbol newOperator = rs.resolveBinaryOperator(tree.pos(),
  21.199 -                                                                      newTag,
  21.200 -                                                                      attrEnv,
  21.201 -                                                                      tree.type,
  21.202 -                                                                      tree.rhs.type);
  21.203 -                        JCExpression expr = (JCExpression)lhs;
  21.204 -                        if (expr.type != tree.type)
  21.205 -                            expr = make.TypeCast(tree.type, expr);
  21.206 -                        JCBinary opResult = make.Binary(newTag, expr, tree.rhs);
  21.207 -                        opResult.operator = newOperator;
  21.208 -                        opResult.type = newOperator.type.getReturnType();
  21.209 -                        JCTypeCast newRhs = make.TypeCast(types.unboxedType(tree.type),
  21.210 -                                                          opResult);
  21.211 -                        return make.Assign((JCExpression)lhs, newRhs).setType(tree.type);
  21.212 -                    }
  21.213 -                });
  21.214 -            result = translate(newTree);
  21.215 -            return;
  21.216 -        }
  21.217 -        tree.lhs = translate(tree.lhs, tree);
  21.218 -        tree.rhs = translate(tree.rhs, tree.operator.type.getParameterTypes().tail.head);
  21.219 -
  21.220 -        // If translated left hand side is an Apply, we are
  21.221 -        // seeing an access method invocation. In this case, append
  21.222 -        // right hand side as last argument of the access method.
  21.223 -        if (tree.lhs.hasTag(APPLY)) {
  21.224 -            JCMethodInvocation app = (JCMethodInvocation)tree.lhs;
  21.225 -            // if operation is a += on strings,
  21.226 -            // make sure to convert argument to string
  21.227 -            JCExpression rhs = (((OperatorSymbol)tree.operator).opcode == string_add)
  21.228 -              ? makeString(tree.rhs)
  21.229 -              : tree.rhs;
  21.230 -            app.args = List.of(rhs).prependList(app.args);
  21.231 -            result = app;
  21.232 -        } else {
  21.233 -            result = tree;
  21.234 -        }
  21.235 +        final boolean boxingReq = !tree.lhs.type.isPrimitive() &&
  21.236 +            tree.operator.type.getReturnType().isPrimitive();
  21.237 +
  21.238 +        // boxing required; need to rewrite as x = (unbox typeof x)(x op y);
  21.239 +        // or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y)
  21.240 +        // (but without recomputing x)
  21.241 +        JCTree newTree = abstractLval(tree.lhs, new TreeBuilder() {
  21.242 +                public JCTree build(final JCTree lhs) {
  21.243 +                    JCTree.Tag newTag = tree.getTag().noAssignOp();
  21.244 +                    // Erasure (TransTypes) can change the type of
  21.245 +                    // tree.lhs.  However, we can still get the
  21.246 +                    // unerased type of tree.lhs as it is stored
  21.247 +                    // in tree.type in Attr.
  21.248 +                    Symbol newOperator = rs.resolveBinaryOperator(tree.pos(),
  21.249 +                                                                  newTag,
  21.250 +                                                                  attrEnv,
  21.251 +                                                                  tree.type,
  21.252 +                                                                  tree.rhs.type);
  21.253 +                    JCExpression expr = (JCExpression)lhs;
  21.254 +                    if (expr.type != tree.type)
  21.255 +                        expr = make.TypeCast(tree.type, expr);
  21.256 +                    JCBinary opResult = make.Binary(newTag, expr, tree.rhs);
  21.257 +                    opResult.operator = newOperator;
  21.258 +                    opResult.type = newOperator.type.getReturnType();
  21.259 +                    JCExpression newRhs = boxingReq ?
  21.260 +                            make.TypeCast(types.unboxedType(tree.type),
  21.261 +                                                      opResult) :
  21.262 +                            opResult;
  21.263 +                    return make.Assign((JCExpression)lhs, newRhs).setType(tree.type);
  21.264 +                }
  21.265 +            });
  21.266 +        result = translate(newTree);
  21.267      }
  21.268  
  21.269      /** Lower a tree of the form e++ or e-- where e is an object type */
    22.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Mon Feb 04 18:08:53 2013 -0500
    22.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Sun Feb 17 16:44:55 2013 -0500
    22.3 @@ -465,7 +465,8 @@
    22.4                        names.valueOf,
    22.5                        make.Type(tree.sym.type),
    22.6                        List.<JCTypeParameter>nil(),
    22.7 -                      List.of(make.VarDef(make.Modifiers(Flags.PARAMETER),
    22.8 +                      List.of(make.VarDef(make.Modifiers(Flags.PARAMETER |
    22.9 +                                                         Flags.MANDATED),
   22.10                                              names.fromString("name"),
   22.11                                              make.Type(syms.stringType), null)),
   22.12                        List.<JCExpression>nil(), // thrown
    23.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Feb 04 18:08:53 2013 -0500
    23.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Sun Feb 17 16:44:55 2013 -0500
    23.3 @@ -35,7 +35,7 @@
    23.4  import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
    23.5  import com.sun.tools.javac.comp.DeferredAttr.DeferredType;
    23.6  import com.sun.tools.javac.comp.Infer.InferenceContext;
    23.7 -import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
    23.8 +import com.sun.tools.javac.comp.Infer.FreeTypeListener;
    23.9  import com.sun.tools.javac.comp.Resolve.MethodResolutionContext.Candidate;
   23.10  import com.sun.tools.javac.jvm.*;
   23.11  import com.sun.tools.javac.tree.*;
   23.12 @@ -564,7 +564,7 @@
   23.13                                      methodCheck,
   23.14                                      warn);
   23.15  
   23.16 -        methodCheck.argumentsAcceptable(env, currentResolutionContext.deferredAttrContext(m, infer.emptyContext),
   23.17 +        methodCheck.argumentsAcceptable(env, currentResolutionContext.deferredAttrContext(m, infer.emptyContext, resultInfo, warn),
   23.18                                  argtypes, mt.getParameterTypes(), warn);
   23.19          return mt;
   23.20      }
   23.21 @@ -741,7 +741,7 @@
   23.22                  inferenceContext.addFreeTypeListener(List.of(t), new FreeTypeListener() {
   23.23                      @Override
   23.24                      public void typesInferred(InferenceContext inferenceContext) {
   23.25 -                        varargsAccessible(env, inferenceContext.asInstType(t, types), inferenceContext);
   23.26 +                        varargsAccessible(env, inferenceContext.asInstType(t), inferenceContext);
   23.27                      }
   23.28                  });
   23.29              } else {
   23.30 @@ -785,8 +785,8 @@
   23.31  
   23.32          public boolean compatible(Type found, Type req, Warner warn) {
   23.33              return strict ?
   23.34 -                    types.isSubtypeUnchecked(found, deferredAttrContext.inferenceContext.asFree(req, types), warn) :
   23.35 -                    types.isConvertible(found, deferredAttrContext.inferenceContext.asFree(req, types), warn);
   23.36 +                    types.isSubtypeUnchecked(found, deferredAttrContext.inferenceContext.asFree(req), warn) :
   23.37 +                    types.isConvertible(found, deferredAttrContext.inferenceContext.asFree(req), warn);
   23.38          }
   23.39  
   23.40          public void report(DiagnosticPosition pos, JCDiagnostic details) {
   23.41 @@ -3589,8 +3589,8 @@
   23.42              candidates = candidates.append(c);
   23.43          }
   23.44  
   23.45 -        DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceContext) {
   23.46 -            return deferredAttr.new DeferredAttrContext(attrMode, sym, step, inferenceContext);
   23.47 +        DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceContext, ResultInfo pendingResult, Warner warn) {
   23.48 +            return deferredAttr.new DeferredAttrContext(attrMode, sym, step, inferenceContext, pendingResult != null ? pendingResult.checkContext.deferredAttrContext() : deferredAttr.emptyDeferredAttrContext, warn);
   23.49          }
   23.50  
   23.51          /**
    24.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Feb 04 18:08:53 2013 -0500
    24.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Sun Feb 17 16:44:55 2013 -0500
    24.3 @@ -1490,12 +1490,13 @@
    24.4          position.type = type;
    24.5  
    24.6          switch (type) {
    24.7 -        // type cast
    24.8 -        case CAST:
    24.9          // instanceof
   24.10          case INSTANCEOF:
   24.11          // new expression
   24.12          case NEW:
   24.13 +        // constructor/method reference receiver
   24.14 +        case CONSTRUCTOR_REFERENCE:
   24.15 +        case METHOD_REFERENCE:
   24.16              position.offset = nextChar();
   24.17              break;
   24.18          // local variable
   24.19 @@ -1544,9 +1545,12 @@
   24.20          case METHOD_FORMAL_PARAMETER:
   24.21              position.parameter_index = nextByte();
   24.22              break;
   24.23 +        // type cast
   24.24 +        case CAST:
   24.25          // method/constructor/reference type argument
   24.26          case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
   24.27          case METHOD_INVOCATION_TYPE_ARGUMENT:
   24.28 +        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
   24.29          case METHOD_REFERENCE_TYPE_ARGUMENT:
   24.30              position.offset = nextChar();
   24.31              position.type_index = nextByte();
   24.32 @@ -1555,10 +1559,6 @@
   24.33          case METHOD_RETURN:
   24.34          case FIELD:
   24.35              break;
   24.36 -        // lambda formal parameter
   24.37 -        case LAMBDA_FORMAL_PARAMETER:
   24.38 -            position.parameter_index = nextByte();
   24.39 -            break;
   24.40          case UNKNOWN:
   24.41              throw new AssertionError("jvm.ClassReader: UNKNOWN target type should never occur!");
   24.42          default:
    25.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Feb 04 18:08:53 2013 -0500
    25.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Sun Feb 17 16:44:55 2013 -0500
    25.3 @@ -482,10 +482,8 @@
    25.4          while (i < pool.pp) {
    25.5              Object value = pool.pool[i];
    25.6              Assert.checkNonNull(value);
    25.7 -            if (value instanceof Method)
    25.8 -                value = ((Method)value).m;
    25.9 -            else if (value instanceof Variable)
   25.10 -                value = ((Variable)value).v;
   25.11 +            if (value instanceof Method || value instanceof Variable)
   25.12 +                value = ((DelegatedSymbol)value).getUnderlyingSymbol();
   25.13  
   25.14              if (value instanceof MethodSymbol) {
   25.15                  MethodSymbol m = (MethodSymbol)value;
   25.16 @@ -730,14 +728,24 @@
   25.17       * Write method parameter names attribute.
   25.18       */
   25.19      int writeMethodParametersAttr(MethodSymbol m) {
   25.20 -        if (m.params != null && 0 != m.params.length()) {
   25.21 -            int attrIndex = writeAttr(names.MethodParameters);
   25.22 -            databuf.appendByte(m.params.length());
   25.23 +        MethodType ty = m.externalType(types).asMethodType();
   25.24 +        final int allparams = ty.argtypes.size();
   25.25 +        if (m.params != null && allparams != 0) {
   25.26 +            final int attrIndex = writeAttr(names.MethodParameters);
   25.27 +            databuf.appendByte(allparams);
   25.28 +            // Write extra parameters first
   25.29 +            for (VarSymbol s : m.extraParams) {
   25.30 +                final int flags =
   25.31 +                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
   25.32 +                    ((int) m.flags() & SYNTHETIC);
   25.33 +                databuf.appendChar(pool.put(s.name));
   25.34 +                databuf.appendInt(flags);
   25.35 +            }
   25.36 +            // Now write the real parameters
   25.37              for (VarSymbol s : m.params) {
   25.38 -                // TODO: expand to cover synthesized, once we figure out
   25.39 -                // how to represent that.
   25.40 -                final int flags = (int) s.flags() & (FINAL | SYNTHETIC);
   25.41 -                // output parameter info
   25.42 +                final int flags =
   25.43 +                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
   25.44 +                    ((int) m.flags() & SYNTHETIC);
   25.45                  databuf.appendChar(pool.put(s.name));
   25.46                  databuf.appendInt(flags);
   25.47              }
   25.48 @@ -994,12 +1002,13 @@
   25.49      void writePosition(TypeAnnotationPosition p) {
   25.50          databuf.appendByte(p.type.targetTypeValue()); // TargetType tag is a byte
   25.51          switch (p.type) {
   25.52 -        // type cast
   25.53 -        case CAST:
   25.54          // instanceof
   25.55          case INSTANCEOF:
   25.56          // new expression
   25.57          case NEW:
   25.58 +        // constructor/method reference receiver
   25.59 +        case CONSTRUCTOR_REFERENCE:
   25.60 +        case METHOD_REFERENCE:
   25.61              databuf.appendChar(p.offset);
   25.62              break;
   25.63          // local variable
   25.64 @@ -1044,9 +1053,12 @@
   25.65          case METHOD_FORMAL_PARAMETER:
   25.66              databuf.appendByte(p.parameter_index);
   25.67              break;
   25.68 +        // type cast
   25.69 +        case CAST:
   25.70          // method/constructor/reference type argument
   25.71          case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
   25.72          case METHOD_INVOCATION_TYPE_ARGUMENT:
   25.73 +        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
   25.74          case METHOD_REFERENCE_TYPE_ARGUMENT:
   25.75              databuf.appendChar(p.offset);
   25.76              databuf.appendByte(p.type_index);
   25.77 @@ -1055,10 +1067,6 @@
   25.78          case METHOD_RETURN:
   25.79          case FIELD:
   25.80              break;
   25.81 -        // lambda formal parameter
   25.82 -        case LAMBDA_FORMAL_PARAMETER:
   25.83 -            databuf.appendByte(p.parameter_index);
   25.84 -            break;
   25.85          case UNKNOWN:
   25.86              throw new AssertionError("jvm.ClassWriter: UNKNOWN target type should never occur!");
   25.87          default:
    26.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon Feb 04 18:08:53 2013 -0500
    26.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Sun Feb 17 16:44:55 2013 -0500
    26.3 @@ -513,7 +513,8 @@
    26.4          // that contains them as its body.
    26.5          if (clinitCode.length() != 0) {
    26.6              MethodSymbol clinit = new MethodSymbol(
    26.7 -                STATIC, names.clinit,
    26.8 +                STATIC | (c.flags() & STRICTFP),
    26.9 +                names.clinit,
   26.10                  new MethodType(
   26.11                      List.<Type>nil(), syms.voidType,
   26.12                      List.<Type>nil(), syms.methodClass),
    27.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Mon Feb 04 18:08:53 2013 -0500
    27.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Sun Feb 17 16:44:55 2013 -0500
    27.3 @@ -1,5 +1,5 @@
    27.4  /*
    27.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
    27.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
    27.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.8   *
    27.9   * This code is free software; you can redistribute it and/or modify it
   27.10 @@ -140,23 +140,23 @@
   27.11          return n == null ? -1 : n.intValue();
   27.12      }
   27.13  
   27.14 -    static class Method extends DelegatedSymbol {
   27.15 -        MethodSymbol m;
   27.16 +    static class Method extends DelegatedSymbol<MethodSymbol> {
   27.17          UniqueType uniqueType;
   27.18          Method(MethodSymbol m, Types types) {
   27.19              super(m);
   27.20 -            this.m = m;
   27.21              this.uniqueType = new UniqueType(m.type, types);
   27.22          }
   27.23 -        public boolean equals(Object other) {
   27.24 -            if (!(other instanceof Method)) return false;
   27.25 -            MethodSymbol o = ((Method)other).m;
   27.26 +        public boolean equals(Object any) {
   27.27 +            if (!(any instanceof Method)) return false;
   27.28 +            MethodSymbol o = ((Method)any).other;
   27.29 +            MethodSymbol m = this.other;
   27.30              return
   27.31                  o.name == m.name &&
   27.32                  o.owner == m.owner &&
   27.33 -                ((Method)other).uniqueType.equals(uniqueType);
   27.34 +                ((Method)any).uniqueType.equals(uniqueType);
   27.35          }
   27.36          public int hashCode() {
   27.37 +            MethodSymbol m = this.other;
   27.38              return
   27.39                  m.name.hashCode() * 33 +
   27.40                  m.owner.hashCode() * 9 +
   27.41 @@ -173,21 +173,21 @@
   27.42          }
   27.43  
   27.44          @Override
   27.45 -        public boolean equals(Object other) {
   27.46 -            if (!super.equals(other)) return false;
   27.47 -            if (!(other instanceof DynamicMethod)) return false;
   27.48 -            DynamicMethodSymbol dm1 = (DynamicMethodSymbol)m;
   27.49 -            DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)other).m;
   27.50 +        public boolean equals(Object any) {
   27.51 +            if (!super.equals(any)) return false;
   27.52 +            if (!(any instanceof DynamicMethod)) return false;
   27.53 +            DynamicMethodSymbol dm1 = (DynamicMethodSymbol)other;
   27.54 +            DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)any).other;
   27.55              return dm1.bsm == dm2.bsm &&
   27.56                          dm1.bsmKind == dm2.bsmKind &&
   27.57                          Arrays.equals(uniqueStaticArgs,
   27.58 -                            ((DynamicMethod)other).uniqueStaticArgs);
   27.59 +                            ((DynamicMethod)any).uniqueStaticArgs);
   27.60          }
   27.61  
   27.62          @Override
   27.63          public int hashCode() {
   27.64              int hash = super.hashCode();
   27.65 -            DynamicMethodSymbol dm = (DynamicMethodSymbol)m;
   27.66 +            DynamicMethodSymbol dm = (DynamicMethodSymbol)other;
   27.67              hash += dm.bsmKind * 7 +
   27.68                      dm.bsm.hashCode() * 11;
   27.69              for (int i = 0; i < dm.staticArgs.length; i++) {
   27.70 @@ -209,23 +209,23 @@
   27.71          }
   27.72      }
   27.73  
   27.74 -    static class Variable extends DelegatedSymbol {
   27.75 -        VarSymbol v;
   27.76 +    static class Variable extends DelegatedSymbol<VarSymbol> {
   27.77          UniqueType uniqueType;
   27.78          Variable(VarSymbol v, Types types) {
   27.79              super(v);
   27.80 -            this.v = v;
   27.81              this.uniqueType = new UniqueType(v.type, types);
   27.82          }
   27.83 -        public boolean equals(Object other) {
   27.84 -            if (!(other instanceof Variable)) return false;
   27.85 -            VarSymbol o = ((Variable)other).v;
   27.86 +        public boolean equals(Object any) {
   27.87 +            if (!(any instanceof Variable)) return false;
   27.88 +            VarSymbol o = ((Variable)any).other;
   27.89 +            VarSymbol v = other;
   27.90              return
   27.91                  o.name == v.name &&
   27.92                  o.owner == v.owner &&
   27.93 -                ((Variable)other).uniqueType.equals(uniqueType);
   27.94 +                ((Variable)any).uniqueType.equals(uniqueType);
   27.95          }
   27.96          public int hashCode() {
   27.97 +            VarSymbol v = other;
   27.98              return
   27.99                  v.name.hashCode() * 33 +
  27.100                  v.owner.hashCode() * 9 +
    28.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Feb 04 18:08:53 2013 -0500
    28.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Sun Feb 17 16:44:55 2013 -0500
    28.3 @@ -629,6 +629,8 @@
    28.4              if (!taskListener.isEmpty()) {
    28.5                  TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
    28.6                  taskListener.started(e);
    28.7 +                keepComments = true;
    28.8 +                genEndPos = true;
    28.9              }
   28.10              Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
   28.11              tree = parser.parseCompilationUnit();
    29.1 --- a/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Mon Feb 04 18:08:53 2013 -0500
    29.2 +++ b/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Sun Feb 17 16:44:55 2013 -0500
    29.3 @@ -760,6 +760,16 @@
    29.4          return names.fromString(cs.toString());
    29.5      }
    29.6  
    29.7 +    @Override
    29.8 +    public boolean isFunctionalInterface(TypeElement element) {
    29.9 +        if (element.getKind() != ElementKind.INTERFACE)
   29.10 +            return false;
   29.11 +        else {
   29.12 +            TypeSymbol tsym = cast(TypeSymbol.class, element);
   29.13 +            return types.isFunctionalInterface(tsym);
   29.14 +        }
   29.15 +    }
   29.16 +
   29.17      /**
   29.18       * Returns the tree node and compilation unit corresponding to this
   29.19       * element, or null if they can't be found.
    30.1 --- a/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Mon Feb 04 18:08:53 2013 -0500
    30.2 +++ b/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Sun Feb 17 16:44:55 2013 -0500
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -279,13 +279,7 @@
   30.11          try {
   30.12              nextChar();
   30.13              if (isIdentifierStart(ch)) {
   30.14 -                int namePos = bp;
   30.15 -                nextChar();
   30.16 -                while (isIdentifierPart(ch))
   30.17 -                    nextChar();
   30.18 -                int nameLen = bp - namePos;
   30.19 -
   30.20 -                Name name = names.fromChars(buf, namePos, nameLen);
   30.21 +                Name name = readIdentifier();
   30.22                  TagParser tp = tagParsers.get(name);
   30.23                  if (tp == null) {
   30.24                      List<DCTree> content = blockContent();
   30.25 @@ -334,14 +328,9 @@
   30.26          try {
   30.27              nextChar();
   30.28              if (isIdentifierStart(ch)) {
   30.29 -                int namePos = bp;
   30.30 -                nextChar();
   30.31 -                while (isIdentifierPart(ch))
   30.32 -                    nextChar();
   30.33 -                int nameLen = bp - namePos;
   30.34 +                Name name = readIdentifier();
   30.35                  skipWhitespace();
   30.36  
   30.37 -                Name name = names.fromChars(buf, namePos, nameLen);
   30.38                  TagParser tp = tagParsers.get(name);
   30.39                  if (tp == null) {
   30.40                      DCTree text = inlineText();
   30.41 @@ -575,10 +564,8 @@
   30.42          int pos = bp;
   30.43  
   30.44          if (isJavaIdentifierStart(ch)) {
   30.45 -            nextChar();
   30.46 -            while (isJavaIdentifierPart(ch))
   30.47 -                nextChar();
   30.48 -            return m.at(pos).Identifier(names.fromChars(buf, pos, bp - pos));
   30.49 +            Name name = readJavaIdentifier();
   30.50 +            return m.at(pos).Identifier(name);
   30.51          }
   30.52  
   30.53          throw new ParseException("dc.identifier.expected");
   30.54 @@ -703,39 +690,36 @@
   30.55      protected DCTree entity() {
   30.56          int p = bp;
   30.57          nextChar();
   30.58 -        int namep = bp;
   30.59 +        Name name = null;
   30.60          boolean checkSemi = false;
   30.61          if (ch == '#') {
   30.62 +            int namep = bp;
   30.63              nextChar();
   30.64              if (isDecimalDigit(ch)) {
   30.65                  nextChar();
   30.66                  while (isDecimalDigit(ch))
   30.67                      nextChar();
   30.68 -                checkSemi = true;
   30.69 +                name = names.fromChars(buf, namep, bp - namep);
   30.70              } else if (ch == 'x' || ch == 'X') {
   30.71                  nextChar();
   30.72                  if (isHexDigit(ch)) {
   30.73                      nextChar();
   30.74                      while (isHexDigit(ch))
   30.75                          nextChar();
   30.76 -                    checkSemi = true;
   30.77 +                    name = names.fromChars(buf, namep, bp - namep);
   30.78                  }
   30.79              }
   30.80          } else if (isIdentifierStart(ch)) {
   30.81 -            nextChar();
   30.82 -            while (isIdentifierPart(ch))
   30.83 -                nextChar();
   30.84 -            checkSemi = true;
   30.85 +            name = readIdentifier();
   30.86          }
   30.87  
   30.88 -        if (checkSemi && ch == ';') {
   30.89 +        if (name == null)
   30.90 +            return erroneous("dc.bad.entity", p);
   30.91 +        else {
   30.92 +            if (ch != ';')
   30.93 +                return erroneous("dc.missing.semicolon", p);
   30.94              nextChar();
   30.95 -            return m.at(p).Entity(names.fromChars(buf, namep, bp - namep - 1));
   30.96 -        } else {
   30.97 -            String code = checkSemi
   30.98 -                    ? "dc.missing.semicolon"
   30.99 -                    : "dc.bad.entity";
  30.100 -            return erroneous(code, p);
  30.101 +            return m.at(p).Entity(name);
  30.102          }
  30.103      }
  30.104  
  30.105 @@ -747,11 +731,7 @@
  30.106          int p = bp;
  30.107          nextChar();
  30.108          if (isIdentifierStart(ch)) {
  30.109 -            int namePos = bp;
  30.110 -            nextChar();
  30.111 -            while (isIdentifierPart(ch))
  30.112 -                nextChar();
  30.113 -            int nameLen = bp - namePos;
  30.114 +            Name name = readIdentifier();
  30.115              List<DCTree> attrs = htmlAttrs();
  30.116              if (attrs != null) {
  30.117                  boolean selfClosing = false;
  30.118 @@ -761,22 +741,16 @@
  30.119                  }
  30.120                  if (ch == '>') {
  30.121                      nextChar();
  30.122 -                    Name name = names.fromChars(buf, namePos, nameLen);
  30.123                      return m.at(p).StartElement(name, attrs, selfClosing);
  30.124                  }
  30.125              }
  30.126          } else if (ch == '/') {
  30.127              nextChar();
  30.128              if (isIdentifierStart(ch)) {
  30.129 -                int namePos = bp;
  30.130 -                nextChar();
  30.131 -                while (isIdentifierPart(ch))
  30.132 -                    nextChar();
  30.133 -                int nameLen = bp - namePos;
  30.134 +                Name name = readIdentifier();
  30.135                  skipWhitespace();
  30.136                  if (ch == '>') {
  30.137                      nextChar();
  30.138 -                    Name name = names.fromChars(buf, namePos, nameLen);
  30.139                      return m.at(p).EndElement(name);
  30.140                  }
  30.141              }
  30.142 @@ -822,10 +796,7 @@
  30.143          loop:
  30.144          while (isIdentifierStart(ch)) {
  30.145              int namePos = bp;
  30.146 -            nextChar();
  30.147 -            while (isIdentifierPart(ch))
  30.148 -                nextChar();
  30.149 -            int nameLen = bp - namePos;
  30.150 +            Name name = readIdentifier();
  30.151              skipWhitespace();
  30.152              List<DCTree> value = null;
  30.153              ValueKind vkind = ValueKind.EMPTY;
  30.154 @@ -862,7 +833,6 @@
  30.155                  skipWhitespace();
  30.156                  value = v.toList();
  30.157              }
  30.158 -            Name name = names.fromChars(buf, namePos, nameLen);
  30.159              DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
  30.160              attrs.add(attr);
  30.161          }
  30.162 @@ -897,7 +867,7 @@
  30.163      protected DCErroneous erroneous(String code, int pos) {
  30.164          int i = bp - 1;
  30.165          loop:
  30.166 -        while (i > 0) {
  30.167 +        while (i > pos) {
  30.168              switch (buf[i]) {
  30.169                  case '\f': case '\n': case '\r':
  30.170                      newline = true;
  30.171 @@ -926,16 +896,24 @@
  30.172          return Character.isUnicodeIdentifierStart(ch);
  30.173      }
  30.174  
  30.175 -    protected boolean isIdentifierPart(char ch) {
  30.176 -        return Character.isUnicodeIdentifierPart(ch);
  30.177 +    protected Name readIdentifier() {
  30.178 +        int start = bp;
  30.179 +        nextChar();
  30.180 +        while (bp < buflen && Character.isUnicodeIdentifierPart(ch))
  30.181 +            nextChar();
  30.182 +        return names.fromChars(buf, start, bp - start);
  30.183      }
  30.184  
  30.185      protected boolean isJavaIdentifierStart(char ch) {
  30.186          return Character.isJavaIdentifierStart(ch);
  30.187      }
  30.188  
  30.189 -    protected boolean isJavaIdentifierPart(char ch) {
  30.190 -        return Character.isJavaIdentifierPart(ch);
  30.191 +    protected Name readJavaIdentifier() {
  30.192 +        int start = bp;
  30.193 +        nextChar();
  30.194 +        while (bp < buflen && Character.isJavaIdentifierPart(ch))
  30.195 +            nextChar();
  30.196 +        return names.fromChars(buf, start, bp - start);
  30.197      }
  30.198  
  30.199      protected boolean isDecimalDigit(char ch) {
    31.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Feb 04 18:08:53 2013 -0500
    31.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Sun Feb 17 16:44:55 2013 -0500
    31.3 @@ -1164,7 +1164,7 @@
    31.4              } else return illegal();
    31.5              break;
    31.6          case MONKEYS_AT:
    31.7 -            // Only annotated cast types are valid
    31.8 +            // Only annotated cast types and method references are valid
    31.9              List<JCAnnotation> typeAnnos = typeAnnotationsOpt();
   31.10              if (typeAnnos.isEmpty()) {
   31.11                  // else there would be no '@'
   31.12 @@ -1175,17 +1175,27 @@
   31.13  
   31.14              if ((mode & TYPE) == 0) {
   31.15                  // Type annotations on class literals no longer legal
   31.16 -                if (!expr.hasTag(Tag.SELECT)) {
   31.17 +                switch (expr.getTag()) {
   31.18 +                case REFERENCE: {
   31.19 +                    JCMemberReference mref = (JCMemberReference) expr;
   31.20 +                    mref.expr = toP(F.at(pos).AnnotatedType(typeAnnos, mref.expr));
   31.21 +                    t = mref;
   31.22 +                    break;
   31.23 +                }
   31.24 +                case SELECT: {
   31.25 +                    JCFieldAccess sel = (JCFieldAccess) expr;
   31.26 +
   31.27 +                    if (sel.name != names._class) {
   31.28 +                        return illegal();
   31.29 +                    } else {
   31.30 +                        log.error(token.pos, "no.annotations.on.dot.class");
   31.31 +                        return expr;
   31.32 +                    }
   31.33 +                }
   31.34 +                default:
   31.35                      return illegal(typeAnnos.head.pos);
   31.36                  }
   31.37 -                JCFieldAccess sel = (JCFieldAccess)expr;
   31.38 -
   31.39 -                if (sel.name != names._class) {
   31.40 -                    return illegal();
   31.41 -                } else {
   31.42 -                    log.error(token.pos, "no.annotations.on.dot.class");
   31.43 -                    return expr;
   31.44 -                }
   31.45 +
   31.46              } else {
   31.47                  // Type annotations targeting a cast
   31.48                  t = insertAnnotationsToMostInner(expr, typeAnnos, false);
   31.49 @@ -1457,18 +1467,40 @@
   31.50      /**
   31.51       * If we see an identifier followed by a '&lt;' it could be an unbound
   31.52       * method reference or a binary expression. To disambiguate, look for a
   31.53 -     * matching '&gt;' and see if the subsequent terminal is either '.' or '#'.
   31.54 +     * matching '&gt;' and see if the subsequent terminal is either '.' or '::'.
   31.55       */
   31.56      @SuppressWarnings("fallthrough")
   31.57      boolean isUnboundMemberRef() {
   31.58          int pos = 0, depth = 0;
   31.59 -        for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
   31.60 +        outer: for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
   31.61              switch (t.kind) {
   31.62                  case IDENTIFIER: case UNDERSCORE: case QUES: case EXTENDS: case SUPER:
   31.63                  case DOT: case RBRACKET: case LBRACKET: case COMMA:
   31.64                  case BYTE: case SHORT: case INT: case LONG: case FLOAT:
   31.65                  case DOUBLE: case BOOLEAN: case CHAR:
   31.66 +                case MONKEYS_AT:
   31.67                      break;
   31.68 +
   31.69 +                case LPAREN:
   31.70 +                    // skip annotation values
   31.71 +                    int nesting = 0;
   31.72 +                    for (; ; pos++) {
   31.73 +                        TokenKind tk2 = S.token(pos).kind;
   31.74 +                        switch (tk2) {
   31.75 +                            case EOF:
   31.76 +                                return false;
   31.77 +                            case LPAREN:
   31.78 +                                nesting++;
   31.79 +                                break;
   31.80 +                            case RPAREN:
   31.81 +                                nesting--;
   31.82 +                                if (nesting == 0) {
   31.83 +                                    continue outer;
   31.84 +                                }
   31.85 +                                break;
   31.86 +                        }
   31.87 +                    }
   31.88 +
   31.89                  case LT:
   31.90                      depth++; break;
   31.91                  case GTGTGT:
   31.92 @@ -1494,7 +1526,7 @@
   31.93      /**
   31.94       * If we see an identifier followed by a '&lt;' it could be an unbound
   31.95       * method reference or a binary expression. To disambiguate, look for a
   31.96 -     * matching '&gt;' and see if the subsequent terminal is either '.' or '#'.
   31.97 +     * matching '&gt;' and see if the subsequent terminal is either '.' or '::'.
   31.98       */
   31.99      @SuppressWarnings("fallthrough")
  31.100      ParensResult analyzeParens() {
  31.101 @@ -3022,7 +3054,7 @@
  31.102          boolean checkForImports = true;
  31.103          boolean firstTypeDecl = true;
  31.104          while (token.kind != EOF) {
  31.105 -            if (token.pos <= endPosTable.errorEndPos) {
  31.106 +            if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) {
  31.107                  // error recovery
  31.108                  skip(checkForImports, false, false, false);
  31.109                  if (token.kind == EOF)
    32.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Mon Feb 04 18:08:53 2013 -0500
    32.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Sun Feb 17 16:44:55 2013 -0500
    32.3 @@ -1,5 +1,5 @@
    32.4  /*
    32.5 - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
    32.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
    32.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.8   *
    32.9   * This code is free software; you can redistribute it and/or modify it
   32.10 @@ -236,7 +236,7 @@
   32.11              // relative to the best match found in the array.
   32.12              if (pos == Position.NOPOS)
   32.13                  return Position.NOPOS;
   32.14 -            if (pos < 0 || pos >= docComment.length())
   32.15 +            if (pos < 0 || pos > docComment.length())
   32.16                  throw new StringIndexOutOfBoundsException(String.valueOf(pos));
   32.17              if (docPosns == null)
   32.18                  return Position.NOPOS;
    33.1 --- a/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Mon Feb 04 18:08:53 2013 -0500
    33.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Sun Feb 17 16:44:55 2013 -0500
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
    33.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.8   *
    33.9   * This code is free software; you can redistribute it and/or modify it
   33.10 @@ -119,7 +119,7 @@
   33.11  
   33.12      }
   33.13  
   33.14 -    public static abstract class DCBlockTag extends DCTree implements InlineTagTree {
   33.15 +    public static abstract class DCBlockTag extends DCTree implements BlockTagTree {
   33.16          public String getTagName() {
   33.17              return getKind().tagName;
   33.18          }
   33.19 @@ -169,7 +169,7 @@
   33.20          }
   33.21      }
   33.22  
   33.23 -    public static class DCAuthor extends DCInlineTag implements AuthorTree {
   33.24 +    public static class DCAuthor extends DCBlockTag implements AuthorTree {
   33.25          public final List<DCTree> name;
   33.26  
   33.27          DCAuthor(List<DCTree> name) {
   33.28 @@ -640,7 +640,7 @@
   33.29          }
   33.30      }
   33.31  
   33.32 -    public static class DCSince extends DCInlineTag implements SinceTree {
   33.33 +    public static class DCSince extends DCBlockTag implements SinceTree {
   33.34          public final List<DCTree> body;
   33.35  
   33.36          DCSince(List<DCTree> body) {
    34.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon Feb 04 18:08:53 2013 -0500
    34.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Sun Feb 17 16:44:55 2013 -0500
    34.3 @@ -235,6 +235,7 @@
    34.4          switch(tree.getTag()) {
    34.5              case TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty();
    34.6              case NEWCLASS: return isDiamond(((JCNewClass)tree).clazz);
    34.7 +            case ANNOTATED_TYPE: return isDiamond(((JCAnnotatedType)tree).underlyingType);
    34.8              default: return false;
    34.9          }
   34.10      }
   34.11 @@ -335,6 +336,8 @@
   34.12              case TYPEAPPLY:
   34.13              case TYPEARRAY:
   34.14                  return true;
   34.15 +            case ANNOTATED_TYPE:
   34.16 +                return isStaticSelector(((JCAnnotatedType)base).underlyingType, names);
   34.17              default:
   34.18                  return false;
   34.19          }
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/src/share/classes/com/sun/tools/javac/util/GraphUtils.java	Sun Feb 17 16:44:55 2013 -0500
    35.3 @@ -0,0 +1,145 @@
    35.4 +/*
    35.5 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
    35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.7 + *
    35.8 + * This code is free software; you can redistribute it and/or modify it
    35.9 + * under the terms of the GNU General Public License version 2 only, as
   35.10 + * published by the Free Software Foundation.  Oracle designates this
   35.11 + * particular file as subject to the "Classpath" exception as provided
   35.12 + * by Oracle in the LICENSE file that accompanied this code.
   35.13 + *
   35.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   35.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   35.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   35.17 + * version 2 for more details (a copy is included in the LICENSE file that
   35.18 + * accompanied this code).
   35.19 + *
   35.20 + * You should have received a copy of the GNU General Public License version
   35.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   35.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   35.23 + *
   35.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   35.25 + * or visit www.oracle.com if you need additional information or have any
   35.26 + * questions.
   35.27 + */
   35.28 +
   35.29 +package com.sun.tools.javac.util;
   35.30 +
   35.31 +/** <p><b>This is NOT part of any supported API.
   35.32 + *  If you write code that depends on this, you do so at your own risk.
   35.33 + *  This code and its internal interfaces are subject to change or
   35.34 + *  deletion without notice.</b>
   35.35 + */
   35.36 +public class GraphUtils {
   35.37 +
   35.38 +    /**
   35.39 +     * This class is a basic abstract class for representing a node.
   35.40 +     * A node is associated with a given data.
   35.41 +     */
   35.42 +    public static abstract class Node<D> {
   35.43 +        public final D data;
   35.44 +
   35.45 +        public Node(D data) {
   35.46 +            this.data = data;
   35.47 +        }
   35.48 +
   35.49 +        public abstract Iterable<? extends Node<D>> getDependencies();
   35.50 +
   35.51 +        public abstract String printDependency(Node<D> to);
   35.52 +
   35.53 +        @Override
   35.54 +        public String toString() {
   35.55 +            return data.toString();
   35.56 +        }
   35.57 +    }
   35.58 +
   35.59 +    /**
   35.60 +     * This class specialized Node, by adding elements that are required in order
   35.61 +     * to perform Tarjan computation of strongly connected components.
   35.62 +     */
   35.63 +    public static abstract class TarjanNode<D> extends Node<D> implements Comparable<TarjanNode<D>> {
   35.64 +        int index = -1;
   35.65 +        int lowlink;
   35.66 +        boolean active;
   35.67 +
   35.68 +        public TarjanNode(D data) {
   35.69 +            super(data);
   35.70 +        }
   35.71 +
   35.72 +        public abstract Iterable<? extends TarjanNode<D>> getDependencies();
   35.73 +
   35.74 +        public int compareTo(TarjanNode<D> o) {
   35.75 +            return (index < o.index) ? -1 : (index == o.index) ? 0 : 1;
   35.76 +        }
   35.77 +    }
   35.78 +
   35.79 +    /**
   35.80 +     * Tarjan's algorithm to determine strongly connected components of a
   35.81 +     * directed graph in linear time. Works on TarjanNode.
   35.82 +     */
   35.83 +    public static <D, N extends TarjanNode<D>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) {
   35.84 +        ListBuffer<List<N>> cycles = ListBuffer.lb();
   35.85 +        ListBuffer<N> stack = ListBuffer.lb();
   35.86 +        int index = 0;
   35.87 +        for (N node: nodes) {
   35.88 +            if (node.index == -1) {
   35.89 +                index += tarjan(node, index, stack, cycles);
   35.90 +            }
   35.91 +        }
   35.92 +        return cycles.toList();
   35.93 +    }
   35.94 +
   35.95 +    private static <D, N extends TarjanNode<D>> int tarjan(N v, int index, ListBuffer<N> stack, ListBuffer<List<N>> cycles) {
   35.96 +        v.index = index;
   35.97 +        v.lowlink = index;
   35.98 +        index++;
   35.99 +        stack.prepend(v);
  35.100 +        v.active = true;
  35.101 +        for (TarjanNode<D> nd: v.getDependencies()) {
  35.102 +            @SuppressWarnings("unchecked")
  35.103 +            N n = (N)nd;
  35.104 +            if (n.index == -1) {
  35.105 +                tarjan(n, index, stack, cycles);
  35.106 +                v.lowlink = Math.min(v.lowlink, n.lowlink);
  35.107 +            } else if (stack.contains(n)) {
  35.108 +                v.lowlink = Math.min(v.lowlink, n.index);
  35.109 +            }
  35.110 +        }
  35.111 +        if (v.lowlink == v.index) {
  35.112 +            N n;
  35.113 +            ListBuffer<N> cycle = ListBuffer.lb();
  35.114 +            do {
  35.115 +                n = stack.remove();
  35.116 +                n.active = false;
  35.117 +                cycle.add(n);
  35.118 +            } while (n != v);
  35.119 +            cycles.add(cycle.toList());
  35.120 +        }
  35.121 +        return index;
  35.122 +    }
  35.123 +
  35.124 +    /**
  35.125 +     * Debugging: dot representation of a set of connected nodes. The resulting
  35.126 +     * dot representation will use {@code Node.toString} to display node labels
  35.127 +     * and {@code Node.printDependency} to display edge labels. The resulting
  35.128 +     * representation is also customizable with a graph name and a header.
  35.129 +     */
  35.130 +    public static <D> String toDot(Iterable<? extends TarjanNode<D>> nodes, String name, String header) {
  35.131 +        StringBuilder buf = new StringBuilder();
  35.132 +        buf.append(String.format("digraph %s {\n", name));
  35.133 +        buf.append(String.format("label = \"%s\";\n", header));
  35.134 +        //dump nodes
  35.135 +        for (TarjanNode<D> n : nodes) {
  35.136 +            buf.append(String.format("%s [label = \"%s\"];\n", n.hashCode(), n.toString()));
  35.137 +        }
  35.138 +        //dump arcs
  35.139 +        for (TarjanNode<D> from : nodes) {
  35.140 +            for (TarjanNode<D> to : from.getDependencies()) {
  35.141 +                buf.append(String.format("%s -> %s [label = \" %s \"];\n",
  35.142 +                        from.hashCode(), to.hashCode(), from.printDependency(to)));
  35.143 +            }
  35.144 +        }
  35.145 +        buf.append("}\n");
  35.146 +        return buf.toString();
  35.147 +    }
  35.148 +}
    36.1 --- a/src/share/classes/com/sun/tools/javac/util/List.java	Mon Feb 04 18:08:53 2013 -0500
    36.2 +++ b/src/share/classes/com/sun/tools/javac/util/List.java	Sun Feb 17 16:44:55 2013 -0500
    36.3 @@ -96,6 +96,26 @@
    36.4          return res.reverse();
    36.5      }
    36.6  
    36.7 +    public List<A> intersect(List<A> that) {
    36.8 +        ListBuffer<A> buf = ListBuffer.lb();
    36.9 +        for (A el : this) {
   36.10 +            if (that.contains(el)) {
   36.11 +                buf.append(el);
   36.12 +            }
   36.13 +        }
   36.14 +        return buf.toList();
   36.15 +    }
   36.16 +
   36.17 +    public List<A> diff(List<A> that) {
   36.18 +        ListBuffer<A> buf = ListBuffer.lb();
   36.19 +        for (A el : this) {
   36.20 +            if (!that.contains(el)) {
   36.21 +                buf.append(el);
   36.22 +            }
   36.23 +        }
   36.24 +        return buf.toList();
   36.25 +    }
   36.26 +
   36.27      /** Construct a list consisting of given element.
   36.28       */
   36.29      public static <A> List<A> of(A x1) {
    37.1 --- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Mon Feb 04 18:08:53 2013 -0500
    37.2 +++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Sun Feb 17 16:44:55 2013 -0500
    37.3 @@ -801,7 +801,9 @@
    37.4              doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    37.5          }
    37.6  
    37.7 -        if (doclintOpts.size() == 1
    37.8 +        if (doclintOpts.isEmpty()) {
    37.9 +            doclintOpts.add(DocLint.XMSGS_OPTION);
   37.10 +        } else if (doclintOpts.size() == 1
   37.11                  && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
   37.12              return;
   37.13          }
    38.1 --- a/src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Mon Feb 04 18:08:53 2013 -0500
    38.2 +++ b/src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Sun Feb 17 16:44:55 2013 -0500
    38.3 @@ -1,5 +1,5 @@
    38.4  /*
    38.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    38.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    38.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.8   *
    38.9   * This code is free software; you can redistribute it and/or modify it
   38.10 @@ -139,12 +139,13 @@
   38.11  
   38.12      @Override
   38.13      public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
   38.14 -        PrintWriter err_pw = new PrintWriter(err, true);
   38.15 -        PrintWriter out_pw = new PrintWriter(out);
   38.16 +        PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
   38.17 +        PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
   38.18          try {
   38.19              String standardDocletName = "com.sun.tools.doclets.standard.Standard";
   38.20 +            ClassLoader cl = getClass().getClassLoader();
   38.21              return com.sun.tools.javadoc.Main.execute(
   38.22 -                    "javadoc", err_pw, err_pw, out_pw, standardDocletName, arguments);
   38.23 +                    "javadoc", err_pw, err_pw, out_pw, standardDocletName, cl, arguments);
   38.24          } finally {
   38.25              err_pw.flush();
   38.26              out_pw.flush();
    39.1 --- a/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Mon Feb 04 18:08:53 2013 -0500
    39.2 +++ b/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Sun Feb 17 16:44:55 2013 -0500
    39.3 @@ -91,12 +91,13 @@
    39.4          print(pos.type);
    39.5  
    39.6          switch (pos.type) {
    39.7 -        // type cast
    39.8 -        case CAST:
    39.9          // instanceof
   39.10          case INSTANCEOF:
   39.11          // new expression
   39.12          case NEW:
   39.13 +        // constructor/method reference receiver
   39.14 +        case CONSTRUCTOR_REFERENCE:
   39.15 +        case METHOD_REFERENCE:
   39.16              if (showOffsets) {
   39.17                  print(", offset=");
   39.18                  print(pos.offset);
   39.19 @@ -162,9 +163,12 @@
   39.20              print(", param_index=");
   39.21              print(pos.parameter_index);
   39.22              break;
   39.23 +        // type cast
   39.24 +        case CAST:
   39.25          // method/constructor/reference type argument
   39.26          case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
   39.27          case METHOD_INVOCATION_TYPE_ARGUMENT:
   39.28 +        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
   39.29          case METHOD_REFERENCE_TYPE_ARGUMENT:
   39.30              if (showOffsets) {
   39.31                  print(", offset=");
   39.32 @@ -177,11 +181,6 @@
   39.33          case METHOD_RETURN:
   39.34          case FIELD:
   39.35              break;
   39.36 -        // lambda formal parameter
   39.37 -        case LAMBDA_FORMAL_PARAMETER:
   39.38 -            print(", param_index=");
   39.39 -            print(pos.parameter_index);
   39.40 -            break;
   39.41          case UNKNOWN:
   39.42              throw new AssertionError("AnnotationWriter: UNKNOWN target type should never occur!");
   39.43          default:
    40.1 --- a/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Mon Feb 04 18:08:53 2013 -0500
    40.2 +++ b/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Sun Feb 17 16:44:55 2013 -0500
    40.3 @@ -400,12 +400,14 @@
    40.4          println(header);
    40.5          for (MethodParameters_attribute.Entry entry :
    40.6                   attr.method_parameter_table) {
    40.7 +            String namestr =
    40.8 +                entry.name_index != 0 ?
    40.9 +                constantWriter.stringValue(entry.name_index) : "<no name>";
   40.10              String flagstr =
   40.11 -                (0 != (entry.flags & ACC_FINAL) ? " final" : "") +
   40.12 -                (0 != (entry.flags & ACC_SYNTHETIC) ? " synthetic" : "");
   40.13 -            println(String.format(format,
   40.14 -                                  constantWriter.stringValue(entry.name_index),
   40.15 -                                  flagstr));
   40.16 +                (0 != (entry.flags & ACC_FINAL) ? "final " : "") +
   40.17 +                (0 != (entry.flags & ACC_MANDATED) ? "mandated " : "") +
   40.18 +                (0 != (entry.flags & ACC_SYNTHETIC) ? "synthetic" : "");
   40.19 +            println(String.format(format, namestr, flagstr));
   40.20          }
   40.21          indent(-1);
   40.22          return null;
    41.1 --- a/src/share/classes/com/sun/tools/javap/JavapTask.java	Mon Feb 04 18:08:53 2013 -0500
    41.2 +++ b/src/share/classes/com/sun/tools/javap/JavapTask.java	Sun Feb 17 16:44:55 2013 -0500
    41.3 @@ -1,5 +1,5 @@
    41.4  /*
    41.5 - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
    41.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
    41.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.8   *
    41.9   * This code is free software; you can redistribute it and/or modify it
   41.10 @@ -362,7 +362,8 @@
   41.11          }
   41.12  
   41.13          try {
   41.14 -            handleOptions(options, false);
   41.15 +            if (options != null)
   41.16 +                handleOptions(options, false);
   41.17          } catch (BadArgs e) {
   41.18              throw new IllegalArgumentException(e.getMessage());
   41.19          }
    42.1 --- a/src/share/classes/javax/lang/model/element/Element.java	Mon Feb 04 18:08:53 2013 -0500
    42.2 +++ b/src/share/classes/javax/lang/model/element/Element.java	Sun Feb 17 16:44:55 2013 -0500
    42.3 @@ -149,12 +149,15 @@
    42.4      <A extends Annotation> A getAnnotation(Class<A> annotationType);
    42.5  
    42.6      /**
    42.7 -     * Returns an array of all of this element's annotation for the
    42.8 -     * specified type if such annotations are present, else an empty
    42.9 -     * array.  The annotation may be either inherited or directly
   42.10 -     * present on this element. This method will look through a container
   42.11 -     * annotation (if present) if the supplied annotation type is
   42.12 -     * repeatable.
   42.13 +     * Returns annotations that are <em>present</em> on this element.
   42.14 +     *
   42.15 +     * If there are no annotations <em>present</em> on this element, the return
   42.16 +     * value is an array of length 0.
   42.17 +     *
   42.18 +     * The difference between this method and {@link #getAnnotation(Class)}
   42.19 +     * is that this method detects if its argument is a <em>repeatable
   42.20 +     * annotation type</em> (JLS 9.6), and if so, attempts to find one or more
   42.21 +     * annotations of that type by "looking through" a container annotation.
   42.22       *
   42.23       * <p> The annotations returned by this method could contain an element
   42.24       * whose value is of type {@code Class}.
   42.25 @@ -189,14 +192,14 @@
   42.26       *
   42.27       * @see #getAnnotationMirrors()
   42.28       * @see #getAnnotation(java.lang.Class)
   42.29 -     * @see java.lang.reflect.AnnotatedElement#getAnnotations
   42.30 +     * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType
   42.31       * @see EnumConstantNotPresentException
   42.32       * @see AnnotationTypeMismatchException
   42.33       * @see IncompleteAnnotationException
   42.34       * @see MirroredTypeException
   42.35       * @see MirroredTypesException
   42.36       */
   42.37 -    <A extends Annotation> A[] getAnnotations(Class<A> annotationType);
   42.38 +    <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType);
   42.39  
   42.40      /**
   42.41       * Returns the modifiers of this element, excluding annotations.
    43.1 --- a/src/share/classes/javax/lang/model/element/TypeElement.java	Mon Feb 04 18:08:53 2013 -0500
    43.2 +++ b/src/share/classes/javax/lang/model/element/TypeElement.java	Sun Feb 17 16:44:55 2013 -0500
    43.3 @@ -111,7 +111,6 @@
    43.4       */
    43.5      Name getQualifiedName();
    43.6  
    43.7 -
    43.8      /**
    43.9       * Returns the simple name of this type element.
   43.10       *
   43.11 @@ -152,7 +151,6 @@
   43.12       */
   43.13      List<? extends TypeParameterElement> getTypeParameters();
   43.14  
   43.15 -
   43.16      /**
   43.17       * Returns the package of a top-level type and returns the
   43.18       * immediately lexically enclosing element for a {@linkplain
    44.1 --- a/src/share/classes/javax/lang/model/util/Elements.java	Mon Feb 04 18:08:53 2013 -0500
    44.2 +++ b/src/share/classes/javax/lang/model/util/Elements.java	Sun Feb 17 16:44:55 2013 -0500
    44.3 @@ -1,5 +1,5 @@
    44.4  /*
    44.5 - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
    44.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
    44.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44.8   *
    44.9   * This code is free software; you can redistribute it and/or modify it
   44.10 @@ -249,4 +249,14 @@
   44.11       * @param cs the character sequence to return as a name
   44.12       */
   44.13      Name getName(CharSequence cs);
   44.14 +
   44.15 +    /**
   44.16 +     * Returns {@code true} if the type element is a functional interface, {@code false} otherwise.
   44.17 +     *
   44.18 +     * @param type the type element being examined
   44.19 +     * @return {@code true} if the element is a functional interface, {@code false} otherwise
   44.20 +     * @jls 9.8 Functional Interfaces
   44.21 +     * @since 1.8
   44.22 +     */
   44.23 +    boolean isFunctionalInterface(TypeElement type);
   44.24  }
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/src/share/classes/jdk/Supported.java	Sun Feb 17 16:44:55 2013 -0500
    45.3 @@ -0,0 +1,53 @@
    45.4 +/*
    45.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.7 + *
    45.8 + * This code is free software; you can redistribute it and/or modify it
    45.9 + * under the terms of the GNU General Public License version 2 only, as
   45.10 + * published by the Free Software Foundation.  Oracle designates this
   45.11 + * particular file as subject to the "Classpath" exception as provided
   45.12 + * by Oracle in the LICENSE file that accompanied this code.
   45.13 + *
   45.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   45.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   45.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   45.17 + * version 2 for more details (a copy is included in the LICENSE file that
   45.18 + * accompanied this code).
   45.19 + *
   45.20 + * You should have received a copy of the GNU General Public License version
   45.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   45.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   45.23 + *
   45.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   45.25 + * or visit www.oracle.com if you need additional information or have any
   45.26 + * questions.
   45.27 + */
   45.28 +
   45.29 +package jdk;
   45.30 +
   45.31 +import java.lang.annotation.*;
   45.32 +
   45.33 +/**
   45.34 +  * Indicates whether or not a JDK specific type or package is a
   45.35 +  * supported part of the JDK.
   45.36 +  *
   45.37 +  * This annotation should only be applied to types and packages
   45.38 +  * <em>outside</em> of the Java SE namespaces of {@code java.*} and
   45.39 +  * {@code javax.*} packages.  For example, certain portions of {@code
   45.40 +  * com.sun.*} are official parts of the JDK meant to be generally
   45.41 +  * usable while other portions of {@code com.sun.*} are not.  This
   45.42 +  * annotation type allows those portions to be easily and
   45.43 +  * programmaticly distinguished.
   45.44 +  *
   45.45 +  * @since 1.8
   45.46 +  */
   45.47 +@Documented
   45.48 +@Retention(RetentionPolicy.RUNTIME)
   45.49 +@Target({ElementType.TYPE, ElementType.PACKAGE})
   45.50 +@Supported
   45.51 +public @interface Supported {
   45.52 +    /**
   45.53 +     * Whether or not this package or type is a supported part of the JDK.
   45.54 +     */
   45.55 +    boolean value() default true;
   45.56 +}
    46.1 --- a/test/com/sun/javadoc/T6735320/T6735320.java	Mon Feb 04 18:08:53 2013 -0500
    46.2 +++ b/test/com/sun/javadoc/T6735320/T6735320.java	Sun Feb 17 16:44:55 2013 -0500
    46.3 @@ -1,5 +1,5 @@
    46.4  /*
    46.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    46.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
    46.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.8   *
    46.9   * This code is free software; you can redistribute it and/or modify it
   46.10 @@ -47,8 +47,8 @@
   46.11  
   46.12      public static void main(String... args) {
   46.13          T6735320 tester = new T6735320();
   46.14 -        if (tester.runJavadoc(ARGS) != 0) {
   46.15 -            throw new AssertionError("non-zero return code from javadoc");
   46.16 +        if (tester.runJavadoc(ARGS) == 0) {
   46.17 +            throw new AssertionError("zero return code from javadoc");
   46.18          }
   46.19          if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
   46.20              throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/test/tools/doclint/EndWithIdentifierTest.java	Sun Feb 17 16:44:55 2013 -0500
    47.3 @@ -0,0 +1,32 @@
    47.4 +/*
    47.5 + * @test /nodynamiccopyright/
    47.6 + * @bug 8007096
    47.7 + * @summary DocLint parsing problems with some comments
    47.8 + * @build DocLintTester
    47.9 + * @run main DocLintTester -Xmsgs:-html EndWithIdentifierTest.java
   47.10 + * @run main DocLintTester -Xmsgs -ref EndWithIdentifierTest.out EndWithIdentifierTest.java
   47.11 + * @author jlahoda
   47.12 + */
   47.13 +
   47.14 +/**@deprecated*/
   47.15 +public class EndWithIdentifierTest {
   47.16 +
   47.17 +    /**{@link*/
   47.18 +    private void unfinishedInlineTagName() {}
   47.19 +
   47.20 +    /**@see List*/
   47.21 +    private void endsWithIdentifier() {}
   47.22 +
   47.23 +    /**&amp*/
   47.24 +    private void entityName() {}
   47.25 +
   47.26 +    /**<a*/
   47.27 +    private void tag() {}
   47.28 +
   47.29 +    /**</a*/
   47.30 +    private void tagEnd() {}
   47.31 +
   47.32 +    /**<a name*/
   47.33 +    private void attribute() {}
   47.34 +}
   47.35 +
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/test/tools/doclint/EndWithIdentifierTest.out	Sun Feb 17 16:44:55 2013 -0500
    48.3 @@ -0,0 +1,20 @@
    48.4 +EndWithIdentifierTest.java:14: error: syntax error in reference
    48.5 +    /**{@link*/
    48.6 +       ^
    48.7 +EndWithIdentifierTest.java:17: error: reference not found
    48.8 +    /**@see List*/
    48.9 +            ^
   48.10 +EndWithIdentifierTest.java:20: error: semicolon missing
   48.11 +    /**&amp*/
   48.12 +       ^
   48.13 +EndWithIdentifierTest.java:23: error: malformed HTML
   48.14 +    /**<a*/
   48.15 +       ^
   48.16 +EndWithIdentifierTest.java:26: error: malformed HTML
   48.17 +    /**</a*/
   48.18 +       ^
   48.19 +EndWithIdentifierTest.java:29: error: malformed HTML
   48.20 +    /**<a name*/
   48.21 +       ^
   48.22 +6 errors
   48.23 +
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/tools/doclint/ParaTagTest.java	Sun Feb 17 16:44:55 2013 -0500
    49.3 @@ -0,0 +1,55 @@
    49.4 +/*
    49.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.7 + *
    49.8 + * This code is free software; you can redistribute it and/or modify it
    49.9 + * under the terms of the GNU General Public License version 2 only, as
   49.10 + * published by the Free Software Foundation.
   49.11 + *
   49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   49.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   49.15 + * version 2 for more details (a copy is included in the LICENSE file that
   49.16 + * accompanied this code).
   49.17 + *
   49.18 + * You should have received a copy of the GNU General Public License version
   49.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   49.21 + *
   49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   49.23 + * or visit www.oracle.com if you need additional information or have any
   49.24 + * questions.
   49.25 + */
   49.26 +
   49.27 +/*
   49.28 + * @test
   49.29 + * @bug 8007566
   49.30 + * @summary DocLint too aggressive with not allowed here: <p>
   49.31 + * @build DocLintTester
   49.32 + * @run main DocLintTester -Xmsgs ParaTagTest.java
   49.33 + */
   49.34 +
   49.35 +/**
   49.36 + * First line.
   49.37 + * <p> Para c1.</p>
   49.38 + * <p> Para c2.
   49.39 + * <p> Para c3.</p>
   49.40 + */
   49.41 +public class ParaTagTest {
   49.42 +    /**
   49.43 +     * m1 <code>code </code>.
   49.44 +     * <p> Para m1.
   49.45 +     * <p> Para m2.
   49.46 +     */
   49.47 +    public void m() {}
   49.48 +
   49.49 +    /**
   49.50 +     * m2.
   49.51 +     * <p> Para z1.
   49.52 +     * <p> Para z2.
   49.53 +     * <pre>
   49.54 +     *    Preformat 1.
   49.55 +     * </pre>
   49.56 +     */
   49.57 +    public void z() {}
   49.58 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/tools/doclint/UnfinishedInlineTagTest.java	Sun Feb 17 16:44:55 2013 -0500
    50.3 @@ -0,0 +1,17 @@
    50.4 +/*
    50.5 + * @test /nodynamiccopyright/
    50.6 + * @bug 8007096
    50.7 + * @summary DocLint parsing problems with some comments
    50.8 + * @build DocLintTester
    50.9 + * @run main DocLintTester -Xmsgs:-html UnfinishedInlineTagTest.java
   50.10 + * @run main DocLintTester -Xmsgs -ref UnfinishedInlineTagTest.out UnfinishedInlineTagTest.java
   50.11 + * @author jlahoda
   50.12 + */
   50.13 +
   50.14 +import java.util.List;
   50.15 +
   50.16 +/**{@link List
   50.17 + */
   50.18 +public class UnfinishedInlineTagTest {
   50.19 +}
   50.20 +
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/tools/doclint/UnfinishedInlineTagTest.out	Sun Feb 17 16:44:55 2013 -0500
    51.3 @@ -0,0 +1,5 @@
    51.4 +UnfinishedInlineTagTest.java:14: error: unterminated inline tag
    51.5 + */
    51.6 +^
    51.7 +1 error
    51.8 +
    52.1 --- a/test/tools/javac/6758789/T6758789b.out	Mon Feb 04 18:08:53 2013 -0500
    52.2 +++ b/test/tools/javac/6758789/T6758789b.out	Sun Feb 17 16:44:55 2013 -0500
    52.3 @@ -1,4 +1,4 @@
    52.4 -T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
    52.5 +T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<java.lang.Object>
    52.6  T6758789b.java:16:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
    52.7  - compiler.err.warnings.and.werror
    52.8  1 error
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java	Sun Feb 17 16:44:55 2013 -0500
    53.3 @@ -0,0 +1,107 @@
    53.4 +/*
    53.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.7 + *
    53.8 + * This code is free software; you can redistribute it and/or modify it
    53.9 + * under the terms of the GNU General Public License version 2 only, as
   53.10 + * published by the Free Software Foundation.  Oracle designates this
   53.11 + * particular file as subject to the "Classpath" exception as provided
   53.12 + * by Oracle in the LICENSE file that accompanied this code.
   53.13 + *
   53.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   53.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.17 + * version 2 for more details (a copy is included in the LICENSE file that
   53.18 + * accompanied this code).
   53.19 + *
   53.20 + * You should have received a copy of the GNU General Public License version
   53.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   53.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.23 + *
   53.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   53.25 + * or visit www.oracle.com if you need additional information or have any
   53.26 + * questions.
   53.27 + */
   53.28 +
   53.29 +/*
   53.30 + * @test
   53.31 + * @bug 7166455
   53.32 + * @summary javac doesn't set ACC_STRICT bit on <clinit> for strictfp class
   53.33 + * @run main CheckACC_STRICTFlagOnclinitTest
   53.34 + */
   53.35 +
   53.36 +import java.util.ArrayList;
   53.37 +import java.util.List;
   53.38 +import java.io.File;
   53.39 +import java.io.IOException;
   53.40 +import com.sun.tools.classfile.ClassFile;
   53.41 +import com.sun.tools.classfile.ConstantPoolException;
   53.42 +import com.sun.tools.classfile.Descriptor;
   53.43 +import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
   53.44 +import com.sun.tools.classfile.Method;
   53.45 +
   53.46 +import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
   53.47 +
   53.48 +public strictfp class CheckACC_STRICTFlagOnclinitTest {
   53.49 +    private static final String AssertionErrorMessage =
   53.50 +        "All methods should have the ACC_STRICT access flag " +
   53.51 +        "please check output";
   53.52 +    private static final String offendingMethodErrorMessage =
   53.53 +        "Method %s of class %s doesn't have the ACC_STRICT access flag";
   53.54 +
   53.55 +    static {
   53.56 +        class Foo {
   53.57 +            class Bar {
   53.58 +                void m11() {}
   53.59 +            }
   53.60 +            void m1() {}
   53.61 +        }
   53.62 +    }
   53.63 +    void m2() {
   53.64 +        class Any {
   53.65 +            void m21() {}
   53.66 +        }
   53.67 +    }
   53.68 +
   53.69 +    private List<String> errors = new ArrayList<>();
   53.70 +
   53.71 +    public static void main(String[] args)
   53.72 +            throws IOException, ConstantPoolException, InvalidDescriptor {
   53.73 +        new CheckACC_STRICTFlagOnclinitTest().run();
   53.74 +    }
   53.75 +
   53.76 +    private void run()
   53.77 +            throws IOException, ConstantPoolException, InvalidDescriptor {
   53.78 +        String testClasses = System.getProperty("test.classes");
   53.79 +        check(testClasses,
   53.80 +              "CheckACC_STRICTFlagOnclinitTest.class",
   53.81 +              "CheckACC_STRICTFlagOnclinitTest$1Foo.class",
   53.82 +              "CheckACC_STRICTFlagOnclinitTest$1Foo$Bar.class",
   53.83 +              "CheckACC_STRICTFlagOnclinitTest$1Any.class");
   53.84 +        if (errors.size() > 0) {
   53.85 +            for (String error: errors) {
   53.86 +                System.err.println(error);
   53.87 +            }
   53.88 +            throw new AssertionError(AssertionErrorMessage);
   53.89 +        }
   53.90 +    }
   53.91 +
   53.92 +    void check(String dir, String... fileNames)
   53.93 +        throws
   53.94 +            IOException,
   53.95 +            ConstantPoolException,
   53.96 +            Descriptor.InvalidDescriptor {
   53.97 +        for (String fileName : fileNames) {
   53.98 +            ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName));
   53.99 +
  53.100 +            for (Method method : classFileToCheck.methods) {
  53.101 +                if ((method.access_flags.flags & ACC_STRICT) == 0) {
  53.102 +                    errors.add(String.format(offendingMethodErrorMessage,
  53.103 +                            method.getName(classFileToCheck.constant_pool),
  53.104 +                            classFileToCheck.getName()));
  53.105 +                }
  53.106 +            }
  53.107 +        }
  53.108 +    }
  53.109 +
  53.110 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/tools/javac/7167125/DiffResultAfterSameOperationInnerClasses.java	Sun Feb 17 16:44:55 2013 -0500
    54.3 @@ -0,0 +1,61 @@
    54.4 +/*
    54.5 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + *
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.
   54.11 + *
   54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.15 + * version 2 for more details (a copy is included in the LICENSE file that
   54.16 + * accompanied this code).
   54.17 + *
   54.18 + * You should have received a copy of the GNU General Public License version
   54.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.21 + *
   54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.23 + * or visit www.oracle.com if you need additional information or have any
   54.24 + * questions.
   54.25 + */
   54.26 +
   54.27 +/*
   54.28 + * @test
   54.29 + * @bug 7167125
   54.30 + * @summary Two variables after the same operation in a inner class return
   54.31 + * different results
   54.32 + * @run main DiffResultAfterSameOperationInnerClasses
   54.33 + */
   54.34 +
   54.35 +public class DiffResultAfterSameOperationInnerClasses {
   54.36 +    public int i = 1;
   54.37 +    private int j = 1;
   54.38 +    public String s1 = "Hi, ";
   54.39 +    private String s2 = "Hi, ";
   54.40 +
   54.41 +    public static void main(String[] args) {
   54.42 +        InnerClass inner =
   54.43 +                new DiffResultAfterSameOperationInnerClasses().new InnerClass();
   54.44 +        if (!inner.test()) {
   54.45 +            throw new AssertionError("Different results after same calculation");
   54.46 +        }
   54.47 +    }
   54.48 +
   54.49 +    class InnerClass {
   54.50 +        public boolean test() {
   54.51 +            i += i += 1;
   54.52 +            j += j += 1;
   54.53 +
   54.54 +            s1 += s1 += "dude";
   54.55 +            s2 += s2 += "dude";
   54.56 +
   54.57 +            System.out.println("s1 = " + s1);
   54.58 +            System.out.println("s2 = " + s2);
   54.59 +
   54.60 +            return (i == j && i == 3 &&
   54.61 +                    s1.equals(s2) && s1.endsWith("Hi, Hi, dude"));
   54.62 +        }
   54.63 +    }
   54.64 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/tools/javac/7199823/InnerClassCannotBeVerified.java	Sun Feb 17 16:44:55 2013 -0500
    55.3 @@ -0,0 +1,110 @@
    55.4 +/*
    55.5 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.7 + *
    55.8 + * This code is free software; you can redistribute it and/or modify it
    55.9 + * under the terms of the GNU General Public License version 2 only, as
   55.10 + * published by the Free Software Foundation.
   55.11 + *
   55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.15 + * version 2 for more details (a copy is included in the LICENSE file that
   55.16 + * accompanied this code).
   55.17 + *
   55.18 + * You should have received a copy of the GNU General Public License version
   55.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.21 + *
   55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   55.23 + * or visit www.oracle.com if you need additional information or have any
   55.24 + * questions.
   55.25 + */
   55.26 +
   55.27 +/*
   55.28 + * @test
   55.29 + * @bug 7199823
   55.30 + * @summary javac generates inner class that can't be verified
   55.31 + * @run main InnerClassCannotBeVerified
   55.32 + */
   55.33 +
   55.34 +import java.util.Arrays;
   55.35 +import javax.tools.JavaFileObject;
   55.36 +import java.net.URI;
   55.37 +import javax.tools.SimpleJavaFileObject;
   55.38 +import javax.tools.ToolProvider;
   55.39 +import javax.tools.JavaCompiler;
   55.40 +import com.sun.source.util.JavacTask;
   55.41 +import com.sun.tools.classfile.ClassFile;
   55.42 +import com.sun.tools.classfile.ConstantPoolException;
   55.43 +import java.io.File;
   55.44 +import java.io.IOException;
   55.45 +
   55.46 +public class InnerClassCannotBeVerified {
   55.47 +
   55.48 +    private static final String errorMessage =
   55.49 +            "Compile error while compiling the following source:\n";
   55.50 +
   55.51 +    public static void main(String... args) throws Exception {
   55.52 +        new InnerClassCannotBeVerified().run();
   55.53 +    }
   55.54 +
   55.55 +    void run() throws Exception {
   55.56 +        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
   55.57 +        JavaSource source = new JavaSource();
   55.58 +        JavacTask ct = (JavacTask)comp.getTask(null, null, null,
   55.59 +                null, null, Arrays.asList(source));
   55.60 +        try {
   55.61 +            if (!ct.call()) {
   55.62 +                throw new AssertionError(errorMessage +
   55.63 +                        source.getCharContent(true));
   55.64 +            }
   55.65 +        } catch (Throwable ex) {
   55.66 +            throw new AssertionError(errorMessage +
   55.67 +                    source.getCharContent(true));
   55.68 +        }
   55.69 +        check();
   55.70 +    }
   55.71 +
   55.72 +    private void check() throws IOException, ConstantPoolException {
   55.73 +        File file = new File("Test$1.class");
   55.74 +        ClassFile classFile = ClassFile.read(file);
   55.75 +        boolean inheritsFromObject =
   55.76 +                classFile.getSuperclassName().equals("java/lang/Object");
   55.77 +        boolean implementsNoInterface = classFile.interfaces.length == 0;
   55.78 +        boolean noMethods = classFile.methods.length == 0;
   55.79 +        if (!(inheritsFromObject &&
   55.80 +              implementsNoInterface &&
   55.81 +              noMethods)) {
   55.82 +            throw new AssertionError("The inner classes reused as " +
   55.83 +                    "access constructor tag for this code must be empty");
   55.84 +        }
   55.85 +    }
   55.86 +
   55.87 +    class JavaSource extends SimpleJavaFileObject {
   55.88 +
   55.89 +        String internalSource =
   55.90 +                              "public class Test {\n" +
   55.91 +                              "    private static class Foo {}\n" +
   55.92 +                              "    public static void main(String[] args){ \n" +
   55.93 +                              "        new Foo();\n" +
   55.94 +                              "        if(false) {\n" +
   55.95 +                              "            new Runnable() {\n" +
   55.96 +                              "                @Override\n" +
   55.97 +                              "                public void run() {\n" +
   55.98 +                              "                    System.out.println();\n" +
   55.99 +                              "                }\n" +
  55.100 +                              "            }.run();\n" +
  55.101 +                              "        }\n" +
  55.102 +                              "   }\n" +
  55.103 +                              "}";
  55.104 +        public JavaSource() {
  55.105 +            super(URI.create("Test.java"), JavaFileObject.Kind.SOURCE);
  55.106 +        }
  55.107 +
  55.108 +        @Override
  55.109 +        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
  55.110 +            return internalSource;
  55.111 +        }
  55.112 +    }
  55.113 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java	Sun Feb 17 16:44:55 2013 -0500
    56.3 @@ -0,0 +1,130 @@
    56.4 +/*
    56.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.7 + *
    56.8 + * This code is free software; you can redistribute it and/or modify it
    56.9 + * under the terms of the GNU General Public License version 2 only, as
   56.10 + * published by the Free Software Foundation.  Oracle designates this
   56.11 + * particular file as subject to the "Classpath" exception as provided
   56.12 + * by Oracle in the LICENSE file that accompanied this code.
   56.13 + *
   56.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   56.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   56.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   56.17 + * version 2 for more details (a copy is included in the LICENSE file that
   56.18 + * accompanied this code).
   56.19 + *
   56.20 + * You should have received a copy of the GNU General Public License version
   56.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   56.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   56.23 + *
   56.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   56.25 + * or visit www.oracle.com if you need additional information or have any
   56.26 + * questions.
   56.27 + */
   56.28 +
   56.29 +/*
   56.30 + * @test
   56.31 + * @bug 8005931
   56.32 + * @summary javac doesn't set ACC_STRICT for classes with package access
   56.33 + * @run main CheckACC_STRICTFlagOnPkgAccessClassTest
   56.34 + */
   56.35 +
   56.36 +import java.io.File;
   56.37 +import java.io.IOException;
   56.38 +import java.net.URI;
   56.39 +import java.util.ArrayList;
   56.40 +import java.util.Arrays;
   56.41 +import java.util.List;
   56.42 +import javax.tools.JavaCompiler;
   56.43 +import javax.tools.JavaFileObject;
   56.44 +import javax.tools.SimpleJavaFileObject;
   56.45 +import javax.tools.ToolProvider;
   56.46 +import com.sun.source.util.JavacTask;
   56.47 +import com.sun.tools.classfile.ClassFile;
   56.48 +import com.sun.tools.classfile.ConstantPoolException;
   56.49 +import com.sun.tools.classfile.Descriptor;
   56.50 +import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
   56.51 +import com.sun.tools.classfile.Method;
   56.52 +
   56.53 +import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
   56.54 +
   56.55 +public class CheckACC_STRICTFlagOnPkgAccessClassTest {
   56.56 +
   56.57 +    private static final String AssertionErrorMessage =
   56.58 +        "All methods should have the ACC_STRICT access flag " +
   56.59 +        "please check output";
   56.60 +    private static final String CompilationErrorMessage =
   56.61 +        "Error thrown when compiling the following source:\n";
   56.62 +    private static final String offendingMethodErrorMessage =
   56.63 +        "Method %s of class %s doesn't have the ACC_STRICT access flag";
   56.64 +
   56.65 +    JavaSource source = new JavaSource();
   56.66 +
   56.67 +    private List<String> errors = new ArrayList<>();
   56.68 +
   56.69 +    public static void main(String[] args)
   56.70 +            throws IOException, ConstantPoolException, InvalidDescriptor {
   56.71 +        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
   56.72 +        new CheckACC_STRICTFlagOnPkgAccessClassTest().run(comp);
   56.73 +    }
   56.74 +
   56.75 +    private void run(JavaCompiler comp)
   56.76 +            throws IOException, ConstantPoolException, InvalidDescriptor {
   56.77 +        compile(comp);
   56.78 +        check();
   56.79 +        if (errors.size() > 0) {
   56.80 +            for (String error: errors) {
   56.81 +                System.err.println(error);
   56.82 +            }
   56.83 +            throw new AssertionError(AssertionErrorMessage);
   56.84 +        }
   56.85 +    }
   56.86 +
   56.87 +    private void compile(JavaCompiler comp) {
   56.88 +        JavacTask ct = (JavacTask)comp.getTask(null, null, null, null, null,
   56.89 +                Arrays.asList(source));
   56.90 +        try {
   56.91 +            if (!ct.call()) {
   56.92 +                throw new AssertionError(CompilationErrorMessage +
   56.93 +                        source.getCharContent(true));
   56.94 +            }
   56.95 +        } catch (Throwable ex) {
   56.96 +            throw new AssertionError(CompilationErrorMessage +
   56.97 +                    source.getCharContent(true));
   56.98 +        }
   56.99 +    }
  56.100 +
  56.101 +    void check()
  56.102 +        throws
  56.103 +            IOException,
  56.104 +            ConstantPoolException,
  56.105 +            Descriptor.InvalidDescriptor {
  56.106 +        ClassFile classFileToCheck = ClassFile.read(new File("Test.class"));
  56.107 +
  56.108 +        for (Method method : classFileToCheck.methods) {
  56.109 +            if ((method.access_flags.flags & ACC_STRICT) == 0) {
  56.110 +                errors.add(String.format(offendingMethodErrorMessage,
  56.111 +                        method.getName(classFileToCheck.constant_pool),
  56.112 +                        classFileToCheck.getName()));
  56.113 +            }
  56.114 +        }
  56.115 +    }
  56.116 +
  56.117 +    class JavaSource extends SimpleJavaFileObject {
  56.118 +
  56.119 +        String source = "strictfp class Test {" +
  56.120 +                "    Test(){}" +
  56.121 +                "    void m(){}" +
  56.122 +                "}";
  56.123 +
  56.124 +        public JavaSource() {
  56.125 +            super(URI.create("Test.java"), JavaFileObject.Kind.SOURCE);
  56.126 +        }
  56.127 +
  56.128 +        @Override
  56.129 +        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
  56.130 +            return source;
  56.131 +        }
  56.132 +    }
  56.133 +}
    57.1 --- a/test/tools/javac/Diagnostics/6799605/T6799605.out	Mon Feb 04 18:08:53 2013 -0500
    57.2 +++ b/test/tools/javac/Diagnostics/6799605/T6799605.out	Sun Feb 17 16:44:55 2013 -0500
    57.3 @@ -1,4 +1,4 @@
    57.4 -T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.type.captureof: 1, ?, T6799605<compiler.misc.type.captureof: 1, ?>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
    57.5 +T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.incompatible.eq.upper.bounds: T, compiler.misc.type.captureof: 1, ?, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
    57.6  T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
    57.7  T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?))}
    57.8  3 errors
    58.1 --- a/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java	Mon Feb 04 18:08:53 2013 -0500
    58.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java	Sun Feb 17 16:44:55 2013 -0500
    58.3 @@ -40,14 +40,17 @@
    58.4          IMPORTINHERITED("import java.lang.annotation.Inherited;\n"),
    58.5          IMPORTRETENTION("import java.lang.annotation.Retention;\n" +
    58.6                          "\nimport java.lang.annotation.RetentionPolicy;\n"),
    58.7 +        IMPORTSTMTS("import java.lang.annotation.*;\n"),
    58.8          REPEATABLE("\n@Repeatable(FooContainer.class)\n"),
    58.9          CONTAINER("@interface FooContainer {\n" +"  Foo[] value();\n}\n"),
   58.10          BASE("@interface Foo {}\n"),
   58.11 +        BASEANNO("@Foo"),
   58.12          REPEATABLEANNO("\n@Foo() @Foo()"),
   58.13          DEPRECATED("\n@Deprecated"),
   58.14          DOCUMENTED("\n@Documented"),
   58.15          INHERITED("\n@Inherited"),
   58.16 -        RETENTION("@Retention(RetentionPolicy.#VAL)\n");
   58.17 +        RETENTION("@Retention(RetentionPolicy.#VAL)\n"),
   58.18 +        TARGET("\n@Target(#VAL)\n");
   58.19  
   58.20          private String val;
   58.21  
   58.22 @@ -69,6 +72,7 @@
   58.23      public static final String template =
   58.24              "/*PACKAGE*/\n" +
   58.25              "//pkg test;\n\n" +
   58.26 +            "/*ANNODATA*/\n" + // import statements, declaration of Foo/FooContainer
   58.27              "/*TYPE*/ //class\n" +
   58.28              "class #ClassName {\n" +
   58.29              "  /*FIELD*/ //instance var\n" +
   58.30 @@ -97,7 +101,11 @@
   58.31              "interface TestInterface {}\n\n" +
   58.32              "/*TYPE*/\n" +
   58.33              "/*ANNOTATION_TYPE*/\n" +
   58.34 -            "@interface TestAnnotationType{}\n";
   58.35 +            "@interface TestAnnotationType{}\n" +
   58.36 +            "class TestPkg {}\n" +
   58.37 +            "class TestTypeAnno </*TYPE_PARAMETER*/ T extends Object> {\n" +
   58.38 +            "  String /*TYPE_USE*/[] arr;\n" +
   58.39 +            "}";
   58.40  
   58.41      // Create and compile FileObject using values for className and contents
   58.42      public static boolean compileCode(String className, String contents,
   58.43 @@ -150,3 +158,4 @@
   58.44          }
   58.45      }
   58.46  }
   58.47 +
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/combo/TargetAnnoCombo.java	Sun Feb 17 16:44:55 2013 -0500
    59.3 @@ -0,0 +1,469 @@
    59.4 +/*
    59.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.7 + *
    59.8 + * This code is free software; you can redistribute it and/or modify it
    59.9 + * under the terms of the GNU General Public License version 2 only, as
   59.10 + * published by the Free Software Foundation.
   59.11 + *
   59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   59.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   59.15 + * version 2 for more details (a copy is included in the LICENSE file that
   59.16 + * accompanied this code).
   59.17 + *
   59.18 + * You should have received a copy of the GNU General Public License version
   59.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   59.21 + *
   59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   59.23 + * or visit www.oracle.com if you need additional information or have any
   59.24 + * questions.
   59.25 + */
   59.26 +
   59.27 +/**
   59.28 + * @test
   59.29 + * @bug      7195131
   59.30 + * @author   sogoel
   59.31 + * @summary  Combo test for all possible combinations for Target values
   59.32 + * @build    Helper
   59.33 + * @compile  TargetAnnoCombo.java TestCaseGenerator.java
   59.34 + * @run main TargetAnnoCombo
   59.35 + */
   59.36 +
   59.37 +import java.io.IOException;
   59.38 +import java.util.ArrayList;
   59.39 +import java.util.Arrays;
   59.40 +import java.util.HashSet;
   59.41 +import java.util.Set;
   59.42 +import javax.tools.Diagnostic;
   59.43 +import javax.tools.DiagnosticCollector;
   59.44 +import javax.tools.JavaFileObject;
   59.45 +
   59.46 +/*
   59.47 + * TargetAnnoCombo gets a list of test case numbers using TestCaseGenerator.
   59.48 + * For each of the test case number, @Target sets for base and container annotations
   59.49 + * are determined, source files are generated, compiled, and the result is verified
   59.50 + * based on if the @Target set for base and container is a positive or negative combination.
   59.51 + *
   59.52 + * @Target sets for base and container annotations are determined using a bit mapping of
   59.53 + * 10 ElementType enum constants defined in JDK8.
   59.54 + *
   59.55 + * Bit      Target value
   59.56 + *  0  "ElementType.ANNOTATION_TYPE"
   59.57 + *  1  "ElementType.CONSTRUCTOR"
   59.58 + *  2  "ElementType.FIELD"
   59.59 + *  3  "ElementType.LOCAL_VARIABLE"
   59.60 + *  4  "ElementType.METHOD"
   59.61 + *  5  "ElementType.TYPE"
   59.62 + *  6  "ElementType.PARAMETER"
   59.63 + *  7  "ElementType.PACKAGE"
   59.64 + *  8  "ElementType.TYPE_USE"
   59.65 + *  9  "ElementType.TYPE_PARAMETER"
   59.66 + *
   59.67 + * Group 1:
   59.68 + * 20 bits mapping, representing a test case number, is used for all target set
   59.69 + * combinations ( 0 to 1048575 ) including empty @Target sets => @Target({}).
   59.70 + * From this 20 bits, 10 bits are for base followed by 10 bits for container
   59.71 + * where each bit maps to an ElementType enum constant defined in JDK8.
   59.72 + *
   59.73 + * Examples:
   59.74 + * Test case number: 4, binary: 100 => container=100, base=[], container=["ElementType.FIELD"]
   59.75 + * Test case number: 1003575, binary: 11110101000000110111 => base=1111010100, container=0000110111;
   59.76 + *                   base=["ElementType.PARAMETER", "ElementType.TYPE_USE", "ElementType.METHOD", "ElementType.FIELD", "ElementType.PACKAGE", "ElementType.TYPE_PARAMETER"],
   59.77 + *                   container=["ElementType.TYPE", "ElementType.METHOD", "ElementType.ANNOTATION_TYPE", "ElementType.CONSTRUCTOR", "ElementType.FIELD"]
   59.78 + *
   59.79 + * In the following groups, no @Target set is represented by null.
   59.80 + * Group 2:
   59.81 + * @Target is not defined on base.
   59.82 + * Target sets for container are determined using the 10-bit binary number
   59.83 + * resulting in 1024 test cases, mapping them to test case numbers from
   59.84 + * 1048576 to (1048576 + 1023) => 1048576 to 1049599.
   59.85 + *
   59.86 + * Example:
   59.87 + * Test case number: 1048587 => 1048587 - 1048576 = test case 11 in Group 2, binary: 1011 =>
   59.88 + *                   base = null,
   59.89 + *                   container = ["ElementType.ANNOTATION_TYPE","ElementType.CONSTRUCTOR","ElementType.LOCAL_VARIABLE"]
   59.90 + *
   59.91 + * Group 3:
   59.92 + * @Target is not defined on container
   59.93 + * Target sets for base are determined using the 10-bit binary number
   59.94 + * resulting in 1024 test cases, mapping them to test case numbers from
   59.95 + * 1049600 to (1049600 + 1023) => 1049600 to 1050623.
   59.96 + *
   59.97 + * Example:
   59.98 + * Test case number: 1049708 => 1049708 - 1049600 = test case 108 in Group 3, binary: 1101100 =>
   59.99 + *                   base = ["ElementType.FIELD", "ElementType.LOCAL_VARIABLE", "ElementType.TYPE", "ElementType.PARAMETER"],
  59.100 + *                   container = null
  59.101 + *
  59.102 + * For the above group, test case number: 1049855 gives compiler error, JDK-8006547 filed
  59.103 + *
  59.104 + * Group 4:
  59.105 + * @Target not defined for both base and container annotations.
  59.106 + *
  59.107 + * This is the last test and corresponds to test case number 1050624. base=null, container=null
  59.108 + *
  59.109 + * Examples to run this test:
  59.110 + * 1. Run a specific test case number:
  59.111 + *    ${JTREG} -DTestCaseNum=10782 -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
  59.112 + * 2. Run specific number of tests:
  59.113 + *    ${JTREG} -DNumberOfTests=4 -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
  59.114 + * 3. Run specific number of tests with a seed:
  59.115 + *    ${JTREG} -DNumberOfTests=4 -DTestSeed=-972894659 -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
  59.116 + * 4. Run tests in default mode (number of tests = 1000):
  59.117 + *    ${JTREG} -DTestMode=DEFAULT -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
  59.118 + * 5. Run all tests (FULL mode):
  59.119 + *    ${JTREG} -DTestMode=FULL -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
  59.120 + *
  59.121 + */
  59.122 +
  59.123 +public class TargetAnnoCombo {
  59.124 +    int errors = 0;
  59.125 +    static final String TESTPKG = "testpkg";
  59.126 +    /*
  59.127 +     *  Set it to true to get more debug information including base and
  59.128 +     *  container target sets for a given test case number
  59.129 +     */
  59.130 +    static final boolean DEBUG = false;
  59.131 +
  59.132 +    // JDK 5/6/7/8 Targets
  59.133 +    static final String[] targetVals = {"ElementType.ANNOTATION_TYPE",
  59.134 +      "ElementType.CONSTRUCTOR", "ElementType.FIELD",
  59.135 +      "ElementType.LOCAL_VARIABLE", "ElementType.METHOD",
  59.136 +      "ElementType.TYPE", "ElementType.PARAMETER",
  59.137 +      "ElementType.PACKAGE", "ElementType.TYPE_USE",
  59.138 +      "ElementType.TYPE_PARAMETER"};
  59.139 +
  59.140 +    // TYPE_USE and TYPE_PARAMETER (added in JDK8) are not part of default Target set
  59.141 +    static final int DEFAULT_TARGET_CNT = 8;
  59.142 +
  59.143 +    public static void main(String args[]) throws Exception {
  59.144 +
  59.145 +        /* maxTestNum = (base and container combinations of targetVals elems [0 - 1048575 combos])
  59.146 +         *              + (combinations where base or container has no Target [1024 combos])
  59.147 +         *              + (no -1 even though 1st test is number 0 as last test is where both
  59.148 +         *                 base and container have no target)
  59.149 +         */
  59.150 +
  59.151 +        int maxTestNum = (int)Math.pow(2, 2*targetVals.length) + 2*(int)Math.pow(2, targetVals.length);
  59.152 +        TestCaseGenerator tcg = new TestCaseGenerator(maxTestNum);
  59.153 +        TargetAnnoCombo tac = new TargetAnnoCombo();
  59.154 +
  59.155 +        int testCtr = 0;
  59.156 +        int testCase = -1;
  59.157 +        while ( (testCase=tcg.getNextTestCase()) != -1 ) {
  59.158 +            tac.executeTestCase(testCase, maxTestNum);
  59.159 +            testCtr++;
  59.160 +        }
  59.161 +
  59.162 +        System.out.println("Total tests run: " + testCtr);
  59.163 +        if (tac.errors > 0)
  59.164 +            throw new Exception(tac.errors + " errors found");
  59.165 +    }
  59.166 +
  59.167 +    /*
  59.168 +     * For given testCase, determine the base and container annotation Target sets,
  59.169 +     * get if testCase should compile, get test source file(s), get compilation result and verify.
  59.170 +     *
  59.171 +     */
  59.172 +    private void executeTestCase(int testCase, int maxTestNum) {
  59.173 +
  59.174 +        // Determine base and container annotation Target sets for the testCase
  59.175 +        Set<String> baseAnnoTarget = null;
  59.176 +        Set<String> conAnnoTarget = null;
  59.177 +
  59.178 +        //Number of base and container combinations [0 - 1048575 combos]
  59.179 +        int baseContCombos = (int)Math.pow(2, 2*targetVals.length);
  59.180 +        //Number of either base or container combinations when one of them has no @Target [1024 combos]
  59.181 +        int targetValsCombos = (int)Math.pow(2, targetVals.length);
  59.182 +
  59.183 +        if (testCase >= baseContCombos) {
  59.184 +            //Base annotation do not have @Target
  59.185 +            if (testCase < baseContCombos + targetValsCombos) {
  59.186 +                baseAnnoTarget = null;
  59.187 +                conAnnoTarget = getSetFromBitVec(Integer.toBinaryString(testCase - baseContCombos));
  59.188 +            } else if (testCase < baseContCombos + 2*targetValsCombos) {
  59.189 +                //Container annotation do not have @Target
  59.190 +                baseAnnoTarget = getSetFromBitVec(Integer.toBinaryString(testCase - baseContCombos - targetValsCombos));
  59.191 +                conAnnoTarget = null;
  59.192 +            } else {
  59.193 +                //Both Base and Container annotation do not have @Target
  59.194 +                baseAnnoTarget = null;
  59.195 +                conAnnoTarget = null;
  59.196 +            }
  59.197 +        } else {
  59.198 +            //TestCase number is represented as 10-bits for base followed by container bits
  59.199 +            String bin = Integer.toBinaryString(testCase);
  59.200 +            String base="", cont=bin;
  59.201 +            if (bin.length() > targetVals.length){
  59.202 +                base = bin.substring(0, bin.length() - targetVals.length);
  59.203 +                cont = bin.substring(bin.length() - targetVals.length,bin.length());
  59.204 +            }
  59.205 +            baseAnnoTarget = getSetFromBitVec(base);
  59.206 +            conAnnoTarget = getSetFromBitVec(cont);
  59.207 +        }
  59.208 +
  59.209 +        debugPrint("Test case number = " + testCase + " => binary = " + Integer.toBinaryString(testCase));
  59.210 +        debugPrint(" => baseAnnoTarget = " + baseAnnoTarget);
  59.211 +        debugPrint(" => containerAnnoTarget = " + conAnnoTarget);
  59.212 +
  59.213 +        // Determine if a testCase should compile or not
  59.214 +        String className = "TC" + testCase;
  59.215 +        boolean shouldCompile = isValidSubSet(baseAnnoTarget, conAnnoTarget);
  59.216 +
  59.217 +        // Get test source file(s)
  59.218 +        Iterable<? extends JavaFileObject> files = getFileList(className, baseAnnoTarget,
  59.219 +                conAnnoTarget, shouldCompile);
  59.220 +
  59.221 +        // Get result of compiling test src file(s)
  59.222 +        boolean result = getCompileResult(className, shouldCompile, files);
  59.223 +
  59.224 +        // List test src code if test fails
  59.225 +        if(!result) {
  59.226 +            System.out.println("FAIL: Test " + testCase);
  59.227 +            try {
  59.228 +                for (JavaFileObject f: files) {
  59.229 +                    System.out.println("File: " + f.getName() + "\n" + f.getCharContent(true));
  59.230 +                }
  59.231 +            } catch (IOException ioe) {
  59.232 +                System.out.println("Exception: " + ioe);
  59.233 +            }
  59.234 +        } else {
  59.235 +            debugPrint("PASS: Test " + testCase);
  59.236 +        }
  59.237 +    }
  59.238 +
  59.239 +    // Get a Set<String> based on bits that are set to 1
  59.240 +    public Set<String> getSetFromBitVec(String bitVec) {
  59.241 +        Set<String> ret = new HashSet<>();
  59.242 +        char[] bit = bitVec.toCharArray();
  59.243 +        for (int i=bit.length-1, j=0; i>=0; i--, j++){
  59.244 +            if (bit[i] == '1') {
  59.245 +                ret.add(targetVals[j]);
  59.246 +            }
  59.247 +        }
  59.248 +        return ret;
  59.249 +    }
  59.250 +
  59.251 +    // Compile the test source file(s) and return test result
  59.252 +    private boolean getCompileResult(String className, boolean shouldCompile,
  59.253 +            Iterable<? extends JavaFileObject> files) {
  59.254 +
  59.255 +        DiagnosticCollector<JavaFileObject> diagnostics =
  59.256 +                new DiagnosticCollector<JavaFileObject>();
  59.257 +        Helper.compileCode(diagnostics, files);
  59.258 +
  59.259 +        // Test case pass or fail
  59.260 +        boolean ok = false;
  59.261 +
  59.262 +        String errMesg = "";
  59.263 +        int numDiags = diagnostics.getDiagnostics().size();
  59.264 +
  59.265 +        if (numDiags == 0) {
  59.266 +            if (shouldCompile) {
  59.267 +                debugPrint("Test passed, compiled as expected.");
  59.268 +                ok = true;
  59.269 +            } else {
  59.270 +                errMesg = "Test failed, compiled unexpectedly.";
  59.271 +                ok = false;
  59.272 +            }
  59.273 +        } else {
  59.274 +            if (shouldCompile) {
  59.275 +                // did not compile
  59.276 +                errMesg = "Test failed, did not compile.";
  59.277 +                ok = false;
  59.278 +            } else {
  59.279 +                // Error in compilation as expected
  59.280 +                String expectedErrKey = "compiler.err.invalid.repeatable." +
  59.281 +                        "annotation.incompatible.target";
  59.282 +                for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
  59.283 +                    if((d.getKind() == Diagnostic.Kind.ERROR) &&
  59.284 +                        d.getCode().contains(expectedErrKey)) {
  59.285 +                        // Error message as expected
  59.286 +                        debugPrint("Error message as expected.");
  59.287 +                        ok = true;
  59.288 +                        break;
  59.289 +                    } else {
  59.290 +                        // error message is incorrect
  59.291 +                        ok = false;
  59.292 +                    }
  59.293 +                }
  59.294 +                if (!ok) {
  59.295 +                    errMesg = "Incorrect error received when compiling " +
  59.296 +                        className + ", expected: " + expectedErrKey;
  59.297 +                }
  59.298 +            }
  59.299 +        }
  59.300 +
  59.301 +        if(!ok) {
  59.302 +            error(errMesg);
  59.303 +            for (Diagnostic<?> d : diagnostics.getDiagnostics())
  59.304 +                System.out.println(" Diags: " + d);
  59.305 +        }
  59.306 +        return ok;
  59.307 +    }
  59.308 +
  59.309 +    private void debugPrint(String string) {
  59.310 +        if(DEBUG)
  59.311 +            System.out.println(string);
  59.312 +    }
  59.313 +
  59.314 +    // Create src code and corresponding JavaFileObjects
  59.315 +    private Iterable<? extends JavaFileObject> getFileList(String className,
  59.316 +            Set<String> baseAnnoTarget, Set<String> conAnnoTarget,
  59.317 +            boolean shouldCompile) {
  59.318 +
  59.319 +        String srcContent = "";
  59.320 +        String pkgInfoContent = "";
  59.321 +        String template = Helper.template;
  59.322 +        String baseTarget = "", conTarget = "";
  59.323 +
  59.324 +        String target = Helper.ContentVars.TARGET.getVal();
  59.325 +        if(baseAnnoTarget != null) {
  59.326 +            baseTarget = target.replace("#VAL", baseAnnoTarget.toString())
  59.327 +                                  .replace("[", "{").replace("]", "}");
  59.328 +        }
  59.329 +        if(conAnnoTarget != null) {
  59.330 +            conTarget = target.replace("#VAL", conAnnoTarget.toString())
  59.331 +                                 .replace("[", "{").replace("]", "}");
  59.332 +        }
  59.333 +
  59.334 +        String annoData = Helper.ContentVars.IMPORTSTMTS.getVal() +
  59.335 +                          conTarget +
  59.336 +                          Helper.ContentVars.CONTAINER.getVal() +
  59.337 +                          baseTarget +
  59.338 +                          Helper.ContentVars.REPEATABLE.getVal() +
  59.339 +                          Helper.ContentVars.BASE.getVal();
  59.340 +
  59.341 +        JavaFileObject pkgInfoFile = null;
  59.342 +
  59.343 +        /*
  59.344 +         *  If shouldCompile = true and no @Target is specified for container annotation,
  59.345 +         *  then all 8 ElementType enum constants are applicable as targets for
  59.346 +         *  container annotation.
  59.347 +         */
  59.348 +        if(shouldCompile && conAnnoTarget == null) {
  59.349 +            //conAnnoTarget = new HashSet<String>(Arrays.asList(targetVals));
  59.350 +            conAnnoTarget = getDefaultTargetSet();
  59.351 +        }
  59.352 +
  59.353 +        if(shouldCompile) {
  59.354 +            boolean isPkgCasePresent = new ArrayList<String>(conAnnoTarget).contains("ElementType.PACKAGE");
  59.355 +            String repeatableAnno = Helper.ContentVars.BASEANNO.getVal() + " " + Helper.ContentVars.BASEANNO.getVal();
  59.356 +            for(String s: conAnnoTarget) {
  59.357 +                s = s.replace("ElementType.","");
  59.358 +                String replaceStr = "/*"+s+"*/";
  59.359 +                if(s.equalsIgnoreCase("PACKAGE")) {
  59.360 +                    //Create packageInfo file
  59.361 +                    String pkgInfoName = TESTPKG + "." + "package-info";
  59.362 +                    pkgInfoContent = repeatableAnno + "\npackage " + TESTPKG + ";" + annoData;
  59.363 +                    pkgInfoFile = Helper.getFile(pkgInfoName, pkgInfoContent);
  59.364 +                } else {
  59.365 +                    template = template.replace(replaceStr, repeatableAnno);
  59.366 +                    //srcContent = template.replace("#ClassName",className);
  59.367 +                    if(!isPkgCasePresent) {
  59.368 +                        srcContent = template.replace("/*ANNODATA*/", annoData).replace("#ClassName",className);
  59.369 +                    } else {
  59.370 +                        replaceStr = "/*PACKAGE*/";
  59.371 +                        srcContent = template.replace(replaceStr, "package " + TESTPKG + ";")
  59.372 +                                     .replace("#ClassName", className);
  59.373 +                    }
  59.374 +                }
  59.375 +            }
  59.376 +        } else {
  59.377 +            // For invalid cases, compilation should fail at declaration site
  59.378 +            template = "class #ClassName {}";
  59.379 +            srcContent = annoData + template.replace("#ClassName",className);
  59.380 +        }
  59.381 +        JavaFileObject srcFile = Helper.getFile(className, srcContent);
  59.382 +        Iterable<? extends JavaFileObject> files = null;
  59.383 +        if(pkgInfoFile != null)
  59.384 +            files = Arrays.asList(pkgInfoFile,srcFile);
  59.385 +        else
  59.386 +            files = Arrays.asList(srcFile);
  59.387 +        return files;
  59.388 +    }
  59.389 +
  59.390 +    private Set<String> getDefaultTargetSet() {
  59.391 +        Set<String> defaultSet = new HashSet<>();
  59.392 +        int ctr = 0;
  59.393 +        for(String s : targetVals) {
  59.394 +            if(ctr++ < DEFAULT_TARGET_CNT) {
  59.395 +                defaultSet.add(s);
  59.396 +            }
  59.397 +        }
  59.398 +        return defaultSet;
  59.399 +    }
  59.400 +
  59.401 +    private boolean isValidSubSet(Set<String> baseAnnoTarget, Set<String> conAnnoTarget) {
  59.402 +        /*
  59.403 +         *  RULE 1: conAnnoTarget should be a subset of baseAnnoTarget
  59.404 +         *  RULE 2: For empty @Target ({}) - annotation cannot be applied anywhere
  59.405 +         *         - Empty sets for both is valid
  59.406 +         *         - Empty baseTarget set is invalid with non-empty conTarget set
  59.407 +         *         - Non-empty baseTarget set is valid with empty conTarget set
  59.408 +         *  RULE 3: For no @Target specified - annotation can be applied to any JDK 7 targets
  59.409 +         *         - No @Target for both is valid
  59.410 +         *         - No @Target for baseTarget set with @Target conTarget set is valid
  59.411 +         *         - @Target for baseTarget set with no @Target for conTarget is invalid
  59.412 +         */
  59.413 +
  59.414 +
  59.415 +        /* If baseAnno has no @Target, Foo can be either applied to @Target specified for container annotation
  59.416 +         * else will be applicable for all default targets if no @Target is present for container annotation.
  59.417 +         * In both cases, the set will be a valid set with no @Target for base annotation
  59.418 +         */
  59.419 +        if(baseAnnoTarget == null) {
  59.420 +            if(conAnnoTarget == null) return true;
  59.421 +            return !(conAnnoTarget.contains("ElementType.TYPE_USE") || conAnnoTarget.contains("ElementType.TYPE_PARAMETER"));
  59.422 +        }
  59.423 +
  59.424 +        Set<String> tempBaseSet = new HashSet<>(baseAnnoTarget);
  59.425 +        // If BaseAnno has TYPE, then ANNOTATION_TYPE is allowed by default
  59.426 +        if(baseAnnoTarget.contains("ElementType.TYPE")) {
  59.427 +            tempBaseSet.add("ElementType.ANNOTATION_TYPE");
  59.428 +        }
  59.429 +
  59.430 +        /*
  59.431 +         * If containerAnno has no @Target, only valid case if baseAnnoTarget has all targets defined
  59.432 +         * else invalid set
  59.433 +         */
  59.434 +        if(conAnnoTarget == null) {
  59.435 +            return (tempBaseSet.containsAll(getDefaultTargetSet()));
  59.436 +        }
  59.437 +
  59.438 +        // At this point, neither conAnnoTarget or baseAnnoTarget are null
  59.439 +        if(conAnnoTarget.size() == 0) return true;
  59.440 +
  59.441 +        // At this point, conAnnoTarget is non-empty
  59.442 +        if (baseAnnoTarget.size() == 0) return false;
  59.443 +
  59.444 +        // At this point, neither conAnnoTarget or baseAnnoTarget are empty
  59.445 +        return tempBaseSet.containsAll(conAnnoTarget);
  59.446 +    }
  59.447 +
  59.448 +    void error(String msg) {
  59.449 +        System.out.println("ERROR: " + msg);
  59.450 +        errors++;
  59.451 +    }
  59.452 +
  59.453 +    // Lists the start and end range for the given set of target vals
  59.454 +    void showGroups() {
  59.455 +        //Group 1: All target set combinations ( 0 to 1048575 ) including empty @Target sets => @Target({})
  59.456 +        int grpEnd1 = (int)Math.pow(2, 2*targetVals.length) - 1;
  59.457 +        System.out.println("[Group 1]: 0 - " + grpEnd1);
  59.458 +
  59.459 +        //Group 2: @Target not defined for base annotation ( 1048576 - 1049599 ).
  59.460 +        System.out.print("[Group 2]: " + (grpEnd1 + 1) + " - ");
  59.461 +        int grpEnd2 = grpEnd1 + 1 + (int)Math.pow(2, targetVals.length) - 1;
  59.462 +        System.out.println(grpEnd2);
  59.463 +
  59.464 +        //Group 3: @Target not defined for container annotation ( 1049600 - 1050623 ).
  59.465 +        System.out.print("[Group 3]: " + (grpEnd2 + 1) + " - ");
  59.466 +        int grpEnd3 = grpEnd2 + 1 + (int)Math.pow(2, targetVals.length) - 1;
  59.467 +        System.out.println(grpEnd3);
  59.468 +
  59.469 +        //Group 4: @Target not defined for both base and container annotations ( 1050624 ).
  59.470 +        System.out.println("[Group 4]: " + (grpEnd3 + 1));
  59.471 +    }
  59.472 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/combo/TestCaseGenerator.java	Sun Feb 17 16:44:55 2013 -0500
    60.3 @@ -0,0 +1,191 @@
    60.4 +/*
    60.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + *
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.
   60.11 + *
   60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.15 + * version 2 for more details (a copy is included in the LICENSE file that
   60.16 + * accompanied this code).
   60.17 + *
   60.18 + * You should have received a copy of the GNU General Public License version
   60.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.21 + *
   60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.23 + * or visit www.oracle.com if you need additional information or have any
   60.24 + * questions.
   60.25 + */
   60.26 +
   60.27 +import java.util.ArrayList;
   60.28 +import java.util.HashSet;
   60.29 +import java.util.List;
   60.30 +import java.util.Random;
   60.31 +
   60.32 +/* System properties:
   60.33 + * NumberOfTests, TestMode, and TestCaseNum are mutually exclusive
   60.34 + * TestSeed will be used only with NumberOfTests or TestMode, otherwise it will be ignored
   60.35 + * -DNumberOfTests=[0 to 2^20+2^11+1]
   60.36 + * -DTestMode=[FULL|DEFAULT]
   60.37 + * -DTestSeed=[seedNumber]
   60.38 + * -DTestCaseNum=[0 to 2^20+2^11+1]
   60.39 + */
   60.40 +public class TestCaseGenerator {
   60.41 +    // Total number of tests to be run
   60.42 +    int numberOfTests = -1;
   60.43 +    //Single test case
   60.44 +    int testCaseNum = -1;
   60.45 +    //Seed used to generate test cases
   60.46 +    int testSeed;
   60.47 +
   60.48 +    int maxTestNum;
   60.49 +    Random randNum;
   60.50 +
   60.51 +    // used in getNextTestCase
   60.52 +    int curTestNum;
   60.53 +    int testCompletedCount;
   60.54 +    HashSet<Integer> uniqueTestSet;
   60.55 +
   60.56 +    static final int DEFAULT_TEST_COUNT = 250;
   60.57 +
   60.58 +    /*
   60.59 +     *  Get parameter values from command line to set numberOfTests, testCaseNum,
   60.60 +     *  and testSeed
   60.61 +     */
   60.62 +    public TestCaseGenerator(int maxTestNum) {
   60.63 +        this.maxTestNum = maxTestNum;
   60.64 +
   60.65 +        // Set values for variables based on input from command line
   60.66 +
   60.67 +        // TestMode system property
   60.68 +        String testModeVal = System.getProperty("TestMode");
   60.69 +        if(testModeVal != null && !testModeVal.isEmpty()) {
   60.70 +            switch (testModeVal.toUpperCase()) {
   60.71 +            case "FULL":
   60.72 +                numberOfTests = maxTestNum;
   60.73 +                break;
   60.74 +            case "DEFAULT":
   60.75 +                numberOfTests = DEFAULT_TEST_COUNT;
   60.76 +                break;
   60.77 +            default:
   60.78 +                System.out.println("Invalid property value " + testModeVal +
   60.79 +                        " for numberOfTests. Possible range: 0 to " +
   60.80 +                        maxTestNum + ". Ignoring property");
   60.81 +                numberOfTests = -1;
   60.82 +            }
   60.83 +        }
   60.84 +
   60.85 +        // NumberOfTests system property
   60.86 +        String numTestsStr = System.getProperty("NumberOfTests");
   60.87 +        if(numTestsStr != null && !numTestsStr.isEmpty()) {
   60.88 +            int numTests = -1;
   60.89 +            try {
   60.90 +                numTests = Integer.parseInt(numTestsStr);
   60.91 +                if (numTests < 0 || numTests > maxTestNum) {
   60.92 +                    throw new NumberFormatException();
   60.93 +                }
   60.94 +            } catch(NumberFormatException nfe) {
   60.95 +                System.out.println("Invalid NumberOfTests property value " +
   60.96 +                        numTestsStr + ". Possible range: 0 to " + maxTestNum +
   60.97 +                        "Reset to default: " + DEFAULT_TEST_COUNT);
   60.98 +                numTests = DEFAULT_TEST_COUNT;
   60.99 +            }
  60.100 +
  60.101 +            if (numberOfTests != -1 && numTests != -1) {
  60.102 +                System.out.println("TestMode and NumberOfTests cannot be set together. Ignoring TestMode.");
  60.103 +            }
  60.104 +            numberOfTests = numTests;
  60.105 +        }
  60.106 +
  60.107 +        // TestSeed system property
  60.108 +        String seedVal = System.getProperty("TestSeed");
  60.109 +        if(seedVal != null && !seedVal.isEmpty()) {
  60.110 +            try {
  60.111 +                testSeed = Integer.parseInt(seedVal);
  60.112 +            } catch(NumberFormatException nfe) {
  60.113 +                Random srand = new Random();
  60.114 +                testSeed = srand.nextInt();
  60.115 +            }
  60.116 +        } else {
  60.117 +            Random srand = new Random();
  60.118 +            testSeed = srand.nextInt();
  60.119 +        }
  60.120 +
  60.121 +        // TestCaseNum system property
  60.122 +        String testNumStr = System.getProperty("TestCaseNum");
  60.123 +        if(testNumStr != null && !testNumStr.isEmpty()) {
  60.124 +            try {
  60.125 +                testCaseNum = Integer.parseInt(testNumStr);
  60.126 +                if (testCaseNum < 0 || testCaseNum > maxTestNum) {
  60.127 +                    throw new NumberFormatException();
  60.128 +                }
  60.129 +            } catch(NumberFormatException nfe) {
  60.130 +                System.out.println("Invalid TestCaseNumber property value " +
  60.131 +                        testNumStr + ". Possible value in range: 0 to " +
  60.132 +                        maxTestNum + ". Defaulting to last test case.");
  60.133 +                testCaseNum = maxTestNum;
  60.134 +            }
  60.135 +
  60.136 +            if ( numberOfTests != -1) {
  60.137 +                System.out.println("TestMode or NumberOfTests cannot be set along with TestCaseNum. Ignoring TestCaseNumber.");
  60.138 +                testCaseNum = -1;
  60.139 +            }
  60.140 +        }
  60.141 +
  60.142 +        if (numberOfTests == -1 && testCaseNum == -1) {
  60.143 +            numberOfTests = DEFAULT_TEST_COUNT;
  60.144 +            System.out.println("Setting TestMode to default, will run " + numberOfTests + "tests.");
  60.145 +        }
  60.146 +
  60.147 +        /*
  60.148 +         *  By this point in code, we will have:
  60.149 +         *  - testSeed: as per TestSeed or a Random one
  60.150 +         *  - numberOfTests to run or -1 to denote not set
  60.151 +         *  - testCaseNum to run or -1 to denote not set
  60.152 +         */
  60.153 +
  60.154 +        /*
  60.155 +         * If numberOfTests = maxTestNum, all tests are to be run,
  60.156 +         * so no randNum will be required
  60.157 +         */
  60.158 +        if (numberOfTests != -1 && numberOfTests < maxTestNum) {
  60.159 +            System.out.println("Seed = " + testSeed);
  60.160 +            randNum = new Random(testSeed);
  60.161 +            uniqueTestSet = new HashSet<>();
  60.162 +        }
  60.163 +
  60.164 +        testCompletedCount = 0;
  60.165 +        // to be used to keep sequential count when running all tests
  60.166 +        curTestNum = 0;
  60.167 +    }
  60.168 +
  60.169 +    /*
  60.170 +     * returns next test case number to run
  60.171 +     * returns -1 when there are no more tests to run
  60.172 +     */
  60.173 +    public int getNextTestCase() {
  60.174 +        if (testCaseNum != -1) {
  60.175 +            int nextTC = testCaseNum;
  60.176 +            testCaseNum = -1;
  60.177 +            return nextTC;
  60.178 +        }
  60.179 +        if (++testCompletedCount <= numberOfTests) {
  60.180 +            if (numberOfTests == maxTestNum) {
  60.181 +                //all the tests need to be run, so just return
  60.182 +                //next test case sequentially
  60.183 +                return curTestNum++;
  60.184 +            } else {
  60.185 +                int nextTC = -1;
  60.186 +                // Ensuring unique test are run
  60.187 +                while(!uniqueTestSet.add(nextTC = randNum.nextInt(maxTestNum))) {
  60.188 +                }
  60.189 +                return nextTC;
  60.190 +            }
  60.191 +        }
  60.192 +        return -1;
  60.193 +    }
  60.194 +}
    61.1 --- a/test/tools/javac/annotations/typeAnnotations/TargetTypes.java	Mon Feb 04 18:08:53 2013 -0500
    61.2 +++ b/test/tools/javac/annotations/typeAnnotations/TargetTypes.java	Sun Feb 17 16:44:55 2013 -0500
    61.3 @@ -1,5 +1,5 @@
    61.4  /*
    61.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    61.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    61.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.8   *
    61.9   * This code is free software; you can redistribute it and/or modify it
    62.1 --- a/test/tools/javac/annotations/typeAnnotations/TypeProcOnly.java	Mon Feb 04 18:08:53 2013 -0500
    62.2 +++ b/test/tools/javac/annotations/typeAnnotations/TypeProcOnly.java	Sun Feb 17 16:44:55 2013 -0500
    62.3 @@ -1,5 +1,5 @@
    62.4  /*
    62.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    62.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    62.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.8   *
    62.9   * This code is free software; you can redistribute it and/or modify it
    63.1 --- a/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java	Mon Feb 04 18:08:53 2013 -0500
    63.2 +++ b/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java	Sun Feb 17 16:44:55 2013 -0500
    63.3 @@ -1,5 +1,5 @@
    63.4  /*
    63.5 - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
    63.6 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    63.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.8   *
    63.9   * This code is free software; you can redistribute it and/or modify it
    64.1 --- a/test/tools/javac/annotations/typeAnnotations/api/ArrayCreationTree.java	Mon Feb 04 18:08:53 2013 -0500
    64.2 +++ b/test/tools/javac/annotations/typeAnnotations/api/ArrayCreationTree.java	Sun Feb 17 16:44:55 2013 -0500
    64.3 @@ -1,5 +1,5 @@
    64.4  /*
    64.5 - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
    64.6 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    64.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.8   *
    64.9   * This code is free software; you can redistribute it and/or modify it
    65.1 --- a/test/tools/javac/annotations/typeAnnotations/api/ArrayPositionConsistency.java	Mon Feb 04 18:08:53 2013 -0500
    65.2 +++ b/test/tools/javac/annotations/typeAnnotations/api/ArrayPositionConsistency.java	Sun Feb 17 16:44:55 2013 -0500
    65.3 @@ -1,5 +1,5 @@
    65.4  /*
    65.5 - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
    65.6 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    65.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.8   *
    65.9   * This code is free software; you can redistribute it and/or modify it
    66.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java	Mon Feb 04 18:08:53 2013 -0500
    66.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java	Sun Feb 17 16:44:55 2013 -0500
    66.3 @@ -1,5 +1,5 @@
    66.4  /*
    66.5 - * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
    66.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    66.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.8   *
    66.9   * This code is free software; you can redistribute it and/or modify it
    67.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java	Mon Feb 04 18:08:53 2013 -0500
    67.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java	Sun Feb 17 16:44:55 2013 -0500
    67.3 @@ -1,5 +1,5 @@
    67.4  /*
    67.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    67.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    67.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.8   *
    67.9   * This code is free software; you can redistribute it and/or modify it
   67.10 @@ -174,22 +174,20 @@
   67.11  
   67.12              String sourceBase = new String("@Retention("+retentn+")\n" +
   67.13              "@Target({TYPE_USE,_OTHER_})\n" +
   67.14 -            "@ContainedBy( AC.class )\n" +
   67.15 +            "@Repeatable( AC.class )\n" +
   67.16              "@interface A { }\n\n" +
   67.17  
   67.18              "@Retention("+retentn+")\n" +
   67.19              "@Target({TYPE_USE,_OTHER_})\n" +
   67.20 -            "@ContainerFor(A.class)\n" +
   67.21              "@interface AC { A[] value(); }\n\n" +
   67.22  
   67.23              "@Retention("+retentn+")\n" +
   67.24              "@Target({TYPE_USE,_OTHER_})\n" +
   67.25 -            "@ContainedBy( BC.class )\n" +
   67.26 +            "@Repeatable( BC.class )\n" +
   67.27              "@interface B { }\n\n" +
   67.28  
   67.29              "@Retention("+retentn+")\n" +
   67.30              "@Target({TYPE_USE,_OTHER_})\n" +
   67.31 -            "@ContainerFor(B.class)\n" +
   67.32              "@interface BC { B[] value(); } \n\n" +
   67.33  
   67.34              "@Retention("+retentn+")\n" +
   67.35 @@ -198,12 +196,11 @@
   67.36  
   67.37              "@Retention("+retentn+")\n" +
   67.38              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   67.39 -            "@ContainedBy(DC.class)\n" +
   67.40 +            "@Repeatable(DC.class)\n" +
   67.41              "@interface D { }\n\n" +
   67.42  
   67.43              "@Retention("+retentn+")\n" +
   67.44              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   67.45 -            "@ContainerFor(D.class) \n" +
   67.46              "@interface DC { D[] value(); }\n\n");
   67.47  
   67.48          // Test case sources with sample generated source.
    68.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java	Mon Feb 04 18:08:53 2013 -0500
    68.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java	Sun Feb 17 16:44:55 2013 -0500
    68.3 @@ -1,5 +1,5 @@
    68.4  /*
    68.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    68.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    68.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.8   *
    68.9   * This code is free software; you can redistribute it and/or modify it
   68.10 @@ -171,32 +171,29 @@
   68.11  
   68.12              String sourceBase = new String("@Retention("+retentn+")\n" +
   68.13              "@Target({TYPE_USE,_OTHER_})\n" +
   68.14 -            "@ContainedBy( AC.class )\n" +
   68.15 +            "@Repeatable( AC.class )\n" +
   68.16              "@interface A { }\n\n" +
   68.17  
   68.18              "@Retention("+retentn+")\n" +
   68.19              "@Target({TYPE_USE,_OTHER_})\n" +
   68.20 -            "@ContainerFor(A.class)\n" +
   68.21              "@interface AC { A[] value(); }\n\n" +
   68.22  
   68.23              "@Retention("+retentn+")\n" +
   68.24              "@Target({TYPE_USE,_OTHER_})\n" +
   68.25 -            "@ContainedBy( BC.class )\n" +
   68.26 +            "@Repeatable( BC.class )\n" +
   68.27              "@interface B { }\n\n" +
   68.28  
   68.29              "@Retention("+retentn+")\n" +
   68.30              "@Target({TYPE_USE,_OTHER_})\n" +
   68.31 -            "@ContainerFor(B.class)\n" +
   68.32              "@interface BC { B[] value(); } \n\n" +
   68.33  
   68.34              "@Retention("+retentn+")\n" +
   68.35              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   68.36 -            "@ContainedBy(DC.class)\n" +
   68.37 +            "@Repeatable(DC.class)\n" +
   68.38              "@interface D { }\n\n" +
   68.39  
   68.40              "@Retention("+retentn+")\n" +
   68.41              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   68.42 -            "@ContainerFor(D.class) \n" +
   68.43              "@interface DC { D[] value(); }\n\n");
   68.44  
   68.45          // Test case sources with sample generated source
    69.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java	Mon Feb 04 18:08:53 2013 -0500
    69.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java	Sun Feb 17 16:44:55 2013 -0500
    69.3 @@ -1,5 +1,5 @@
    69.4  /*
    69.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    69.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    69.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.8   *
    69.9   * This code is free software; you can redistribute it and/or modify it
    70.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java	Mon Feb 04 18:08:53 2013 -0500
    70.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java	Sun Feb 17 16:44:55 2013 -0500
    70.3 @@ -1,5 +1,5 @@
    70.4  /*
    70.5 - * Copyright (c) 2008 Oracle and/or its affiliates. All rights reserved.
    70.6 + * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    70.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.8   *
    70.9   * This code is free software; you can redistribute it and/or modify it
    71.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java	Mon Feb 04 18:08:53 2013 -0500
    71.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java	Sun Feb 17 16:44:55 2013 -0500
    71.3 @@ -1,5 +1,5 @@
    71.4  /*
    71.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    71.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    71.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.8   *
    71.9   * This code is free software; you can redistribute it and/or modify it
    72.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java	Mon Feb 04 18:08:53 2013 -0500
    72.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java	Sun Feb 17 16:44:55 2013 -0500
    72.3 @@ -1,5 +1,5 @@
    72.4  /*
    72.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    72.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    72.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.8   *
    72.9   * This code is free software; you can redistribute it and/or modify it
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/LazyConstantValue.java	Sun Feb 17 16:44:55 2013 -0500
    73.3 @@ -0,0 +1,44 @@
    73.4 +/*
    73.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    73.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    73.7 + *
    73.8 + * This code is free software; you can redistribute it and/or modify it
    73.9 + * under the terms of the GNU General Public License version 2 only, as
   73.10 + * published by the Free Software Foundation.
   73.11 + *
   73.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   73.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   73.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   73.15 + * version 2 for more details (a copy is included in the LICENSE file that
   73.16 + * accompanied this code).
   73.17 + *
   73.18 + * You should have received a copy of the GNU General Public License version
   73.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   73.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   73.21 + *
   73.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   73.23 + * or visit www.oracle.com if you need additional information or have any
   73.24 + * questions.
   73.25 + */
   73.26 +
   73.27 +/*
   73.28 + * @test
   73.29 + * @bug 8008077
   73.30 + * @summary Type annotations in a lazy constant need to be attributed
   73.31 + *   in the correct order.
   73.32 + * @author Werner Dietl
   73.33 + * @compile LazyConstantValue.java
   73.34 + */
   73.35 +
   73.36 +import java.lang.annotation.*;
   73.37 +
   73.38 +class ClassA {
   73.39 +    Object o = ClassB.lcv;
   73.40 +}
   73.41 +
   73.42 +class ClassB {
   73.43 +    static final String[] lcv = new @TA String[0];
   73.44 +}
   73.45 +
   73.46 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
   73.47 +@interface TA {}
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeVariable.java	Sun Feb 17 16:44:55 2013 -0500
    74.3 @@ -0,0 +1,43 @@
    74.4 +/*
    74.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    74.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    74.7 + *
    74.8 + * This code is free software; you can redistribute it and/or modify it
    74.9 + * under the terms of the GNU General Public License version 2 only, as
   74.10 + * published by the Free Software Foundation.
   74.11 + *
   74.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   74.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   74.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   74.15 + * version 2 for more details (a copy is included in the LICENSE file that
   74.16 + * accompanied this code).
   74.17 + *
   74.18 + * You should have received a copy of the GNU General Public License version
   74.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   74.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   74.21 + *
   74.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   74.23 + * or visit www.oracle.com if you need additional information or have any
   74.24 + * questions.
   74.25 + */
   74.26 +
   74.27 +/*
   74.28 + * @test
   74.29 + * @bug 8008077
   74.30 + * @summary Type annotations on a type variable, where the bound of
   74.31 + *   the type variable is also annotated, need to be processed correctly.
   74.32 + * @author Werner Dietl
   74.33 + * @compile TypeVariable.java
   74.34 + */
   74.35 +
   74.36 +import java.lang.annotation.*;
   74.37 +
   74.38 +class TypeVariable {
   74.39 +    <TV extends  @TA Object> TV cast(TV p) {
   74.40 +        return (@TA TV) p;
   74.41 +    }
   74.42 +}
   74.43 +
   74.44 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
   74.45 +@interface TA {}
   74.46 +
    75.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/VoidGenericMethod.java	Mon Feb 04 18:08:53 2013 -0500
    75.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/VoidGenericMethod.java	Sun Feb 17 16:44:55 2013 -0500
    75.3 @@ -21,6 +21,8 @@
    75.4   * questions.
    75.5   */
    75.6  
    75.7 +import java.lang.annotation.*;
    75.8 +
    75.9  /*
   75.10   * @test
   75.11   * @bug 6843077 8006775
   75.12 @@ -29,7 +31,8 @@
   75.13   * @compile/fail VoidGenericMethod.java
   75.14   */
   75.15  class VoidGenericMethod {
   75.16 -  public <T> @A void method() { }
   75.17 +  public @A <T> void method() { }
   75.18  }
   75.19  
   75.20 +@Target(ElementType.TYPE_USE)
   75.21  @interface A { }
    76.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/target/DotClass.java	Mon Feb 04 18:08:53 2013 -0500
    76.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/target/DotClass.java	Sun Feb 17 16:44:55 2013 -0500
    76.3 @@ -1,13 +1,5 @@
    76.4 -import static java.lang.annotation.ElementType.TYPE;
    76.5 -import static java.lang.annotation.ElementType.TYPE_PARAMETER;
    76.6 -import static java.lang.annotation.ElementType.TYPE_USE;
    76.7 -
    76.8 -import java.lang.annotation.Retention;
    76.9 -import java.lang.annotation.RetentionPolicy;
   76.10 -import java.lang.annotation.Target;
   76.11 -
   76.12  /*
   76.13 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
   76.14 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   76.15   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   76.16   *
   76.17   * This code is free software; you can redistribute it and/or modify it
   76.18 @@ -36,6 +28,14 @@
   76.19   * @compile/fail/ref=DotClass.out -XDrawDiagnostics DotClass.java
   76.20   */
   76.21  
   76.22 +import java.lang.annotation.Retention;
   76.23 +import java.lang.annotation.RetentionPolicy;
   76.24 +import java.lang.annotation.Target;
   76.25 +
   76.26 +import static java.lang.annotation.ElementType.TYPE;
   76.27 +import static java.lang.annotation.ElementType.TYPE_PARAMETER;
   76.28 +import static java.lang.annotation.ElementType.TYPE_USE;
   76.29 +
   76.30  @Target({TYPE_USE, TYPE_PARAMETER, TYPE})
   76.31  @Retention(RetentionPolicy.RUNTIME)
   76.32  @interface A {}
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Lambda.java	Sun Feb 17 16:44:55 2013 -0500
    77.3 @@ -0,0 +1,59 @@
    77.4 +/*
    77.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 + *
    77.8 + * This code is free software; you can redistribute it and/or modify it
    77.9 + * under the terms of the GNU General Public License version 2 only, as
   77.10 + * published by the Free Software Foundation.
   77.11 + *
   77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 + * version 2 for more details (a copy is included in the LICENSE file that
   77.16 + * accompanied this code).
   77.17 + *
   77.18 + * You should have received a copy of the GNU General Public License version
   77.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 + *
   77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 + * or visit www.oracle.com if you need additional information or have any
   77.24 + * questions.
   77.25 + */
   77.26 +
   77.27 +/*
   77.28 + * @test
   77.29 + * @bug 8008077
   77.30 + * @summary new type annotation location: lambda expressions
   77.31 + * @compile Lambda.java
   77.32 + * @author Werner Dietl
   77.33 + */
   77.34 +
   77.35 +import java.lang.annotation.*;
   77.36 +
   77.37 +public class Lambda {
   77.38 +
   77.39 +    interface LambdaInt {
   77.40 +        <S, T> void generic(S p1, T p2);
   77.41 +    }
   77.42 +
   77.43 +    static class LambdaImpl implements LambdaInt {
   77.44 +        <S, T> LambdaImpl(S p1, T p2) {}
   77.45 +        public <S, T> void generic(S p1, T p2) {}
   77.46 +    }
   77.47 +
   77.48 +    LambdaInt getMethodRefTA(LambdaImpl r) {
   77.49 +        return r::<@TA Object, @TB Object>generic;
   77.50 +    }
   77.51 +
   77.52 +    LambdaInt getConstructorRefTA() {
   77.53 +        return LambdaImpl::<@TA Object, @TB Object>new;
   77.54 +    }
   77.55 +
   77.56 +}
   77.57 +
   77.58 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
   77.59 +@interface TA { }
   77.60 +
   77.61 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
   77.62 +@interface TB { }
    78.1 --- a/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.java	Mon Feb 04 18:08:53 2013 -0500
    78.2 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.java	Sun Feb 17 16:44:55 2013 -0500
    78.3 @@ -120,7 +120,6 @@
    78.4  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
    78.5  @interface RTA { }
    78.6  
    78.7 -@ContainerFor(RTA.class)
    78.8  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
    78.9  @interface RTAs {
   78.10      RTA[] value();
    79.1 --- a/test/tools/javac/annotations/typeAnnotations/newlocations/Varargs.java	Mon Feb 04 18:08:53 2013 -0500
    79.2 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Varargs.java	Sun Feb 17 16:44:55 2013 -0500
    79.3 @@ -1,6 +1,5 @@
    79.4 -
    79.5  /*
    79.6 - * Copyright (c) 2008 Oracle and/or its affiliates. All rights reserved.
    79.7 + * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    79.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    79.9   *
   79.10   * This code is free software; you can redistribute it and/or modify it
   79.11 @@ -22,8 +21,6 @@
   79.12   * questions.
   79.13   */
   79.14  
   79.15 -import java.lang.annotation.*;
   79.16 -
   79.17  /*
   79.18   * @test
   79.19   * @summary test acceptance of varargs annotations
   79.20 @@ -31,6 +28,8 @@
   79.21   * @compile Varargs.java
   79.22   */
   79.23  
   79.24 +import java.lang.annotation.*;
   79.25 +
   79.26  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
   79.27  @interface A {}
   79.28  
    80.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/PackageProcessor.java	Mon Feb 04 18:08:53 2013 -0500
    80.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/PackageProcessor.java	Sun Feb 17 16:44:55 2013 -0500
    80.3 @@ -1,5 +1,5 @@
    80.4  /*
    80.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    80.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    80.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    80.8   *
    80.9   * This code is free software; you can redistribute it and/or modify it
    81.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/Anno.java	Mon Feb 04 18:08:53 2013 -0500
    81.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/Anno.java	Sun Feb 17 16:44:55 2013 -0500
    81.3 @@ -1,5 +1,5 @@
    81.4  /*
    81.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    81.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    81.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    81.8   *
    81.9   * This code is free software; you can redistribute it and/or modify it
    82.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/MyClass.java	Mon Feb 04 18:08:53 2013 -0500
    82.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/MyClass.java	Sun Feb 17 16:44:55 2013 -0500
    82.3 @@ -1,5 +1,5 @@
    82.4  /*
    82.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    82.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    82.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    82.8   *
    82.9   * This code is free software; you can redistribute it and/or modify it
    83.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/package-info.java	Mon Feb 04 18:08:53 2013 -0500
    83.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/package-info.java	Sun Feb 17 16:44:55 2013 -0500
    83.3 @@ -1,5 +1,5 @@
    83.4  /*
    83.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    83.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    83.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.8   *
    83.9   * This code is free software; you can redistribute it and/or modify it
    84.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java	Mon Feb 04 18:08:53 2013 -0500
    84.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java	Sun Feb 17 16:44:55 2013 -0500
    84.3 @@ -1,5 +1,5 @@
    84.4  /*
    84.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    84.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    84.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.8   *
    84.9   * This code is free software; you can redistribute it and/or modify it
    85.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java	Mon Feb 04 18:08:53 2013 -0500
    85.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java	Sun Feb 17 16:44:55 2013 -0500
    85.3 @@ -1,5 +1,5 @@
    85.4  /*
    85.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    85.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    85.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    85.8   *
    85.9   * This code is free software; you can redistribute it and/or modify it
    86.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java	Mon Feb 04 18:08:53 2013 -0500
    86.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java	Sun Feb 17 16:44:55 2013 -0500
    86.3 @@ -1,5 +1,5 @@
    86.4  /*
    86.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
    86.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    86.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    86.8   *
    86.9   * This code is free software; you can redistribute it and/or modify it
    87.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Mon Feb 04 18:08:53 2013 -0500
    87.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Sun Feb 17 16:44:55 2013 -0500
    87.3 @@ -1,5 +1,5 @@
    87.4  /*
    87.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    87.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
    87.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    87.8   *
    87.9   * This code is free software; you can redistribute it and/or modify it
   87.10 @@ -241,8 +241,8 @@
   87.11          sb.append("\n@Repeatable(RTAs.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTA {}");
   87.12          sb.append("\n@Repeatable(RTBs.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTB {}");
   87.13  
   87.14 -        sb.append("\n@ContainerFor(RTA.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTAs { RTA[] value(); }");
   87.15 -        sb.append("\n@ContainerFor(RTB.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTBs { RTB[] value(); }");
   87.16 +        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTAs { RTA[] value(); }");
   87.17 +        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTBs { RTB[] value(); }");
   87.18  
   87.19          sb.append("\n@Target(value={ElementType.TYPE,ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.CONSTRUCTOR,ElementType.LOCAL_VARIABLE})");
   87.20          sb.append("\n@interface Decl {}");
    88.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java	Mon Feb 04 18:08:53 2013 -0500
    88.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java	Sun Feb 17 16:44:55 2013 -0500
    88.3 @@ -1,5 +1,5 @@
    88.4  /*
    88.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    88.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    88.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    88.8   *
    88.9   * This code is free software; you can redistribute it and/or modify it
    89.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java	Mon Feb 04 18:08:53 2013 -0500
    89.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java	Sun Feb 17 16:44:55 2013 -0500
    89.3 @@ -1,5 +1,5 @@
    89.4  /*
    89.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    89.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    89.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.8   *
    89.9   * This code is free software; you can redistribute it and/or modify it
    90.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java	Mon Feb 04 18:08:53 2013 -0500
    90.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java	Sun Feb 17 16:44:55 2013 -0500
    90.3 @@ -1,5 +1,5 @@
    90.4  /*
    90.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
    90.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    90.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    90.8   *
    90.9   * This code is free software; you can redistribute it and/or modify it
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java	Sun Feb 17 16:44:55 2013 -0500
    91.3 @@ -0,0 +1,262 @@
    91.4 +/*
    91.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    91.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    91.7 + *
    91.8 + * This code is free software; you can redistribute it and/or modify it
    91.9 + * under the terms of the GNU General Public License version 2 only, as
   91.10 + * published by the Free Software Foundation.
   91.11 + *
   91.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   91.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   91.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   91.15 + * version 2 for more details (a copy is included in the LICENSE file that
   91.16 + * accompanied this code).
   91.17 + *
   91.18 + * You should have received a copy of the GNU General Public License version
   91.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   91.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   91.21 + *
   91.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   91.23 + * or visit www.oracle.com if you need additional information or have any
   91.24 + * questions.
   91.25 + */
   91.26 +
   91.27 +/*
   91.28 + * @test
   91.29 + * @bug 8008077
   91.30 + * @summary Test population of reference info for lambda expressions
   91.31 + * @compile -g Driver.java ReferenceInfoUtil.java Lambda.java
   91.32 + * @run main Driver Lambda
   91.33 + * @author Werner Dietl
   91.34 + */
   91.35 +
   91.36 +import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
   91.37 +
   91.38 +public class Lambda {
   91.39 +
   91.40 +    @TADescriptions({
   91.41 +        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
   91.42 +                offset = ReferenceInfoUtil.IGNORE_VALUE),
   91.43 +        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
   91.44 +                offset = ReferenceInfoUtil.IGNORE_VALUE)
   91.45 +    })
   91.46 +    public String returnMethodRef1() {
   91.47 +        return
   91.48 +                "class Lambda {" +
   91.49 +                "  public String getName() { return \"Lambda!\"; }" +
   91.50 +                "}" +
   91.51 +
   91.52 +                "class Test {" +
   91.53 +                "  java.util.function.Function<Lambda, String> lambda() {" +
   91.54 +                "    return @TA @TB Lambda::getName;" +
   91.55 +                "  }" +
   91.56 +                "}";
   91.57 +    }
   91.58 +
   91.59 +    @TADescriptions({
   91.60 +        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
   91.61 +                offset = ReferenceInfoUtil.IGNORE_VALUE),
   91.62 +        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
   91.63 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
   91.64 +                genericLocation = { 3, 0 }),
   91.65 +        @TADescription(annotation = "TC", type = METHOD_REFERENCE,
   91.66 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
   91.67 +                genericLocation = { 3, 0 }),
   91.68 +        @TADescription(annotation = "TD", type = METHOD_REFERENCE,
   91.69 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
   91.70 +                genericLocation = { 3, 1 }),
   91.71 +        @TADescription(annotation = "TE", type = METHOD_REFERENCE,
   91.72 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
   91.73 +                genericLocation = { 3, 1 })
   91.74 +    })
   91.75 +    public String returnMethodRef2() {
   91.76 +        return
   91.77 +                "class Lambda<S, T> {" +
   91.78 +                "  public String getName() { return \"Lambda!\"; }" +
   91.79 +                "}" +
   91.80 +
   91.81 +                "class Test {" +
   91.82 +                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
   91.83 +                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::getName;" +
   91.84 +                "  }" +
   91.85 +                "}";
   91.86 +    }
   91.87 +
   91.88 +    @TADescriptions({
   91.89 +        @TADescription(annotation = "CTA", type = METHOD_REFERENCE,
   91.90 +                offset = ReferenceInfoUtil.IGNORE_VALUE),
   91.91 +        @TADescription(annotation = "CTB", type = METHOD_REFERENCE,
   91.92 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
   91.93 +                genericLocation = { 3, 0 }),
   91.94 +        @TADescription(annotation = "CTC", type = METHOD_REFERENCE,
   91.95 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
   91.96 +                genericLocation = { 3, 1 })
   91.97 +    })
   91.98 +    public String returnMethodRef3() {
   91.99 +        return
  91.100 +                "class Lambda<S, T> {" +
  91.101 +                "  public String getName() { return \"Lambda!\"; }" +
  91.102 +                "}" +
  91.103 +
  91.104 +                "@Target(ElementType.TYPE_USE)" +
  91.105 +                "@interface CTA {" +
  91.106 +                "  String value();" +
  91.107 +                "}" +
  91.108 +
  91.109 +                "@Target(ElementType.TYPE_USE)" +
  91.110 +                "@interface CTB {" +
  91.111 +                "  int age();" +
  91.112 +                "}" +
  91.113 +
  91.114 +                "@Target(ElementType.TYPE_USE)" +
  91.115 +                "@interface CTC {" +
  91.116 +                "  String name();" +
  91.117 +                "}" +
  91.118 +
  91.119 +                "class Test {" +
  91.120 +                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
  91.121 +                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::getName;" +
  91.122 +                "  }" +
  91.123 +                "}";
  91.124 +    }
  91.125 +
  91.126 +
  91.127 +    @TADescriptions({
  91.128 +        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
  91.129 +                offset = ReferenceInfoUtil.IGNORE_VALUE),
  91.130 +        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
  91.131 +                offset = ReferenceInfoUtil.IGNORE_VALUE)
  91.132 +    })
  91.133 +    public String returnConstructorRef1() {
  91.134 +        return
  91.135 +                "class Lambda {" +
  91.136 +                "  Lambda() { }" +
  91.137 +                "}" +
  91.138 +
  91.139 +                "class Test {" +
  91.140 +                "  Runnable lambda() {" +
  91.141 +                "    return @TA @TB Lambda::new;" +
  91.142 +                "  }" +
  91.143 +                "}";
  91.144 +    }
  91.145 +
  91.146 +    @TADescriptions({
  91.147 +        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
  91.148 +                offset = ReferenceInfoUtil.IGNORE_VALUE),
  91.149 +        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
  91.150 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.151 +                genericLocation = { 3, 0 }),
  91.152 +        @TADescription(annotation = "TC", type = CONSTRUCTOR_REFERENCE,
  91.153 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.154 +                genericLocation = { 3, 0 }),
  91.155 +        @TADescription(annotation = "TD", type = CONSTRUCTOR_REFERENCE,
  91.156 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.157 +                genericLocation = { 3, 1 }),
  91.158 +        @TADescription(annotation = "TE", type = CONSTRUCTOR_REFERENCE,
  91.159 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.160 +                genericLocation = { 3, 1 })
  91.161 +    })
  91.162 +    public String returnConstructorRef2() {
  91.163 +        return
  91.164 +                "class Lambda<S, T> {" +
  91.165 +                "  Lambda() { }" +
  91.166 +                "}" +
  91.167 +
  91.168 +                "class Test {" +
  91.169 +                "  Runnable lambda() {" +
  91.170 +                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::new;" +
  91.171 +                "  }" +
  91.172 +                "}";
  91.173 +    }
  91.174 +
  91.175 +    @TADescriptions({
  91.176 +        @TADescription(annotation = "CTA", type = CONSTRUCTOR_REFERENCE,
  91.177 +                offset = ReferenceInfoUtil.IGNORE_VALUE),
  91.178 +        @TADescription(annotation = "CTB", type = CONSTRUCTOR_REFERENCE,
  91.179 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.180 +                genericLocation = { 3, 0 }),
  91.181 +        @TADescription(annotation = "CTC", type = CONSTRUCTOR_REFERENCE,
  91.182 +                offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.183 +                genericLocation = { 3, 1 })
  91.184 +    })
  91.185 +    public String returnConstructorRef3() {
  91.186 +        return
  91.187 +                "class Lambda<S, T> {" +
  91.188 +                "  Lambda() { }" +
  91.189 +                "}" +
  91.190 +
  91.191 +                "@Target(ElementType.TYPE_USE)" +
  91.192 +                "@interface CTA {" +
  91.193 +                "  String value();" +
  91.194 +                "}" +
  91.195 +
  91.196 +                "@Target(ElementType.TYPE_USE)" +
  91.197 +                "@interface CTB {" +
  91.198 +                "  int age();" +
  91.199 +                "}" +
  91.200 +
  91.201 +                "@Target(ElementType.TYPE_USE)" +
  91.202 +                "@interface CTC {" +
  91.203 +                "  String name();" +
  91.204 +                "}" +
  91.205 +
  91.206 +                "class Test {" +
  91.207 +                "  Runnable lambda() {" +
  91.208 +                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::new;" +
  91.209 +                "  }" +
  91.210 +                "}";
  91.211 +    }
  91.212 +
  91.213 +
  91.214 +    @TADescriptions({
  91.215 +        @TADescription(annotation = "TA", type = METHOD_REFERENCE_TYPE_ARGUMENT,
  91.216 +                 offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.217 +                 typeIndex = 0),
  91.218 +        @TADescription(annotation = "TB", type = METHOD_REFERENCE_TYPE_ARGUMENT,
  91.219 +                 offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.220 +                 typeIndex = 1)
  91.221 +    })
  91.222 +    public String returnMethodRefTA1() {
  91.223 +        return
  91.224 +                "interface Lambda {" +
  91.225 +                "  <S, T> void generic(S p1, T p2);" +
  91.226 +                "}" +
  91.227 +
  91.228 +                "class LambdaImpl implements Lambda {" +
  91.229 +                "  public <S, T> void generic(S p1, T p2) {}" +
  91.230 +                "}" +
  91.231 +
  91.232 +                "class Test {" +
  91.233 +                "  Lambda lambda(LambdaImpl r) {" +
  91.234 +                "    return r::<@TA Object, @TB Object>generic;" +
  91.235 +                "  }" +
  91.236 +                "}";
  91.237 +    }
  91.238 +
  91.239 +    @TADescriptions({
  91.240 +        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
  91.241 +                 offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.242 +                 typeIndex = 0),
  91.243 +        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
  91.244 +                 offset = ReferenceInfoUtil.IGNORE_VALUE,
  91.245 +                 typeIndex = 1)
  91.246 +    })
  91.247 +    public String returnConstructorRefTA2() {
  91.248 +        return
  91.249 +                "interface Lambda {" +
  91.250 +                "  <S, T> void generic(S p1, T p2);" +
  91.251 +                "}" +
  91.252 +
  91.253 +                "class LambdaImpl implements Lambda {" +
  91.254 +                "  <S, T> LambdaImpl(S p1, T p2) {}" +
  91.255 +                "  public <S, T> void generic(S p1, T p2) {}" +
  91.256 +                "}" +
  91.257 +
  91.258 +                "class Test {" +
  91.259 +                "  Lambda lambda() {" +
  91.260 +                "    return LambdaImpl::<@TA Object, @TB Object>new;" +
  91.261 +                "  }" +
  91.262 +                "}";
  91.263 +    }
  91.264 +
  91.265 +}
    92.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java	Mon Feb 04 18:08:53 2013 -0500
    92.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java	Sun Feb 17 16:44:55 2013 -0500
    92.3 @@ -1,5 +1,5 @@
    92.4  /*
    92.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    92.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    92.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    92.8   *
    92.9   * This code is free software; you can redistribute it and/or modify it
   92.10 @@ -93,6 +93,28 @@
   92.11      }
   92.12  
   92.13      @TADescriptions({
   92.14 +        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
   92.15 +                genericLocation = { 0, 0 }, paramIndex = 1),
   92.16 +        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
   92.17 +                genericLocation = { 0, 0 }, paramIndex = 1)
   92.18 +    })
   92.19 +    public String methodParamAsArray2() {
   92.20 +        return "void test(Object b, @TA @TB String [] a) { }";
   92.21 +    }
   92.22 +
   92.23 +    @TADescriptions({
   92.24 +        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
   92.25 +                genericLocation = { 0, 0 }, paramIndex = 1),
   92.26 +        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
   92.27 +                genericLocation = { 0, 0 }, paramIndex = 1),
   92.28 +        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
   92.29 +                genericLocation = { 0, 0 }, paramIndex = 1)
   92.30 +    })
   92.31 +    public String methodParamAsArray3() {
   92.32 +        return "void test(Object b, @TA @TB @TC String [] a) { }";
   92.33 +    }
   92.34 +
   92.35 +    @TADescriptions({
   92.36          @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
   92.37          @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
   92.38                  genericLocation = { 0, 0 }, paramIndex = 1),
    93.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java	Mon Feb 04 18:08:53 2013 -0500
    93.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java	Sun Feb 17 16:44:55 2013 -0500
    93.3 @@ -1,5 +1,5 @@
    93.4  /*
    93.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    93.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    93.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    93.8   *
    93.9   * This code is free software; you can redistribute it and/or modify it
    94.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java	Mon Feb 04 18:08:53 2013 -0500
    94.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java	Sun Feb 17 16:44:55 2013 -0500
    94.3 @@ -1,5 +1,5 @@
    94.4  /*
    94.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    94.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    94.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    94.8   *
    94.9   * This code is free software; you can redistribute it and/or modify it
    95.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java	Mon Feb 04 18:08:53 2013 -0500
    95.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java	Sun Feb 17 16:44:55 2013 -0500
    95.3 @@ -1,5 +1,5 @@
    95.4  /*
    95.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    95.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    95.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    95.8   *
    95.9   * This code is free software; you can redistribute it and/or modify it
    96.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java	Mon Feb 04 18:08:53 2013 -0500
    96.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java	Sun Feb 17 16:44:55 2013 -0500
    96.3 @@ -1,5 +1,5 @@
    96.4  /*
    96.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    96.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    96.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    96.8   *
    96.9   * This code is free software; you can redistribute it and/or modify it
    97.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java	Mon Feb 04 18:08:53 2013 -0500
    97.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java	Sun Feb 17 16:44:55 2013 -0500
    97.3 @@ -1,5 +1,5 @@
    97.4  /*
    97.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    97.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    97.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    97.8   *
    97.9   * This code is free software; you can redistribute it and/or modify it
    98.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java	Mon Feb 04 18:08:53 2013 -0500
    98.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java	Sun Feb 17 16:44:55 2013 -0500
    98.3 @@ -1,5 +1,5 @@
    98.4  /*
    98.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
    98.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    98.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    98.8   *
    98.9   * This code is free software; you can redistribute it and/or modify it
    99.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java	Mon Feb 04 18:08:53 2013 -0500
    99.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java	Sun Feb 17 16:44:55 2013 -0500
    99.3 @@ -1,5 +1,5 @@
    99.4  /*
    99.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    99.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    99.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    99.8   *
    99.9   * This code is free software; you can redistribute it and/or modify it
   100.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ReferenceInfoUtil.java	Mon Feb 04 18:08:53 2013 -0500
   100.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ReferenceInfoUtil.java	Sun Feb 17 16:44:55 2013 -0500
   100.3 @@ -1,5 +1,5 @@
   100.4  /*
   100.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
   100.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   100.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   100.8   *
   100.9   * This code is free software; you can redistribute it and/or modify it
   101.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java	Mon Feb 04 18:08:53 2013 -0500
   101.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java	Sun Feb 17 16:44:55 2013 -0500
   101.3 @@ -1,5 +1,5 @@
   101.4  /*
   101.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
   101.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   101.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   101.8   *
   101.9   * This code is free software; you can redistribute it and/or modify it
   102.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java	Mon Feb 04 18:08:53 2013 -0500
   102.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java	Sun Feb 17 16:44:55 2013 -0500
   102.3 @@ -1,5 +1,5 @@
   102.4  /*
   102.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
   102.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   102.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   102.8   *
   102.9   * This code is free software; you can redistribute it and/or modify it
  102.10 @@ -31,118 +31,170 @@
  102.11   */
  102.12  public class TypeCasts {
  102.13  
  102.14 -    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.15 +    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.16 +            typeIndex = 0)
  102.17      public String returnObject() {
  102.18          return "Object returnObject() { return (@TA String)null; }";
  102.19      }
  102.20  
  102.21      @TADescriptions({
  102.22 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
  102.23 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.24 +                typeIndex = 0),
  102.25          @TADescription(annotation = "TB", type = CAST,
  102.26 -                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
  102.27 +                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.28 +                typeIndex = 0),
  102.29          @TADescription(annotation = "TC", type = CAST,
  102.30 -                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.31 +                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.32 +                typeIndex = 0)
  102.33      })
  102.34      public String returnObjectArray() {
  102.35          return "Object returnObjectArray() { return (@TC String @TA [] @TB [])null; }";
  102.36      }
  102.37  
  102.38      @TADescriptions({
  102.39 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
  102.40 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.41 +                typeIndex = 0),
  102.42          @TADescription(annotation = "TB", type = CAST,
  102.43 -                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.44 +                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.45 +                typeIndex = 0)
  102.46      })
  102.47      public String returnObjectGeneric() {
  102.48          return "Object returnObjectGeneric() { return (@TA List<@TB String>)null; }";
  102.49      }
  102.50  
  102.51 -    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.52 +    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.53 +            typeIndex = 0)
  102.54      public String returnPrim() {
  102.55          return "Object returnPrim() { return (@TA int)0; }";
  102.56      }
  102.57  
  102.58      @TADescriptions({
  102.59 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
  102.60 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.61 +                typeIndex = 0),
  102.62          @TADescription(annotation = "TB", type = CAST,
  102.63 -                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.64 +                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.65 +                typeIndex = 0)
  102.66      })
  102.67      public String returnPrimArray() {
  102.68          return "Object returnPrimArray() { return (@TB int @TA [])null; }";
  102.69      }
  102.70  
  102.71 -    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.72 +    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.73 +            typeIndex = 0)
  102.74      public String initObject() {
  102.75          return "void initObject() { Object a =  (@TA String)null; }";
  102.76      }
  102.77  
  102.78      @TADescriptions({
  102.79 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
  102.80 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.81 +                typeIndex = 0),
  102.82          @TADescription(annotation = "TB", type = CAST,
  102.83 -                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.84 +                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.85 +                typeIndex = 0)
  102.86      })
  102.87      public String initObjectArray() {
  102.88          return "void initObjectArray() { Object a = (@TB String @TA [])null; }";
  102.89      }
  102.90  
  102.91      @TADescriptions({
  102.92 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
  102.93 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.94 +                typeIndex = 0),
  102.95          @TADescription(annotation = "TB", type = CAST,
  102.96 -                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
  102.97 +                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
  102.98 +                typeIndex = 0)
  102.99      })
 102.100      public String initObjectGeneric() {
 102.101          return "void initObjectGeneric() { Object a = (@TA List<@TB String>)null; }";
 102.102      }
 102.103  
 102.104 -    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
 102.105 +    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.106 +            typeIndex = 0)
 102.107      public String initPrim() {
 102.108          return "void initPrim() { Object a =  (@TA int)0; }";
 102.109      }
 102.110  
 102.111      @TADescriptions({
 102.112 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
 102.113 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.114 +                typeIndex = 0),
 102.115          @TADescription(annotation = "TB", type = CAST,
 102.116 -                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
 102.117 +                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.118 +                typeIndex = 0)
 102.119      })
 102.120      public String initPrimArray() {
 102.121          return "void initPrimArray() { Object a = (@TB int @TA [])null; }";
 102.122      }
 102.123  
 102.124 -    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
 102.125 +    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.126 +            typeIndex = 0)
 102.127      public String eqtestObject() {
 102.128          return "void eqtestObject() { if (null == (@TA String)null); }";
 102.129      }
 102.130  
 102.131      @TADescriptions({
 102.132 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
 102.133 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.134 +                typeIndex = 0),
 102.135          @TADescription(annotation = "TB", type = CAST,
 102.136 -                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
 102.137 +                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.138 +                typeIndex = 0)
 102.139      })
 102.140      public String eqtestObjectArray() {
 102.141          return "void eqtestObjectArray() { if (null == (@TB String @TA [])null); }";
 102.142      }
 102.143  
 102.144      @TADescriptions({
 102.145 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
 102.146 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.147 +                typeIndex = 0),
 102.148          @TADescription(annotation = "TB", type = CAST,
 102.149 -                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
 102.150 +                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.151 +                typeIndex = 0)
 102.152      })
 102.153      public String eqtestObjectGeneric() {
 102.154          return "void eqtestObjectGeneric() { if (null == (@TA List<@TB String >)null); }";
 102.155      }
 102.156  
 102.157 -    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
 102.158 +    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.159 +            typeIndex = 0)
 102.160      // compiler optimizes away compile time constants casts
 102.161      public String eqtestPrim() {
 102.162          return "void eqtestPrim(int a) { if (0 == (@TA int)a); }";
 102.163      }
 102.164  
 102.165      @TADescriptions({
 102.166 -        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
 102.167 +        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.168 +                typeIndex = 0),
 102.169          @TADescription(annotation = "TB", type = CAST,
 102.170 -                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
 102.171 +                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
 102.172 +                typeIndex = 0)
 102.173      })
 102.174      public String eqtestPrimArray() {
 102.175          return "void eqtestPrimArray() { if (null == (@TB int @TA [])null); }";
 102.176      }
 102.177  
 102.178 +    @TADescriptions({
 102.179 +        @TADescription(annotation = "TA", type = CAST,
 102.180 +                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 0),
 102.181 +        @TADescription(annotation = "TB", type = CAST,
 102.182 +                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1),
 102.183 +        @TADescription(annotation = "TC", type = CAST,
 102.184 +                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1,
 102.185 +                genericLocation = {3, 0})
 102.186 +    })
 102.187 +    public String intersection1() {
 102.188 +        return "void intersection() { Object o = (@TA String & @TB Comparable<@TC String>) null; }";
 102.189 +    }
 102.190 +
 102.191 +    @TADescriptions({
 102.192 +        @TADescription(annotation = "TA", type = CAST,
 102.193 +                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 0),
 102.194 +        @TADescription(annotation = "TB", type = CAST,
 102.195 +                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1),
 102.196 +        @TADescription(annotation = "TC", type = CAST,
 102.197 +                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1,
 102.198 +                genericLocation = {3, 0}),
 102.199 +        @TADescription(annotation = "TD", type = CAST,
 102.200 +                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 2),
 102.201 +    })
 102.202 +    public String intersection2() {
 102.203 +        return "void intersection() { Object o = (@TA String & @TB Comparable<@TC String> & @TD CharSequence) null; }";
 102.204 +    }
 102.205  }
   103.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java	Mon Feb 04 18:08:53 2013 -0500
   103.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java	Sun Feb 17 16:44:55 2013 -0500
   103.3 @@ -1,5 +1,5 @@
   103.4  /*
   103.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
   103.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   103.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   103.8   *
   103.9   * This code is free software; you can redistribute it and/or modify it
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/test/tools/javac/api/8007344/Test.java	Sun Feb 17 16:44:55 2013 -0500
   104.3 @@ -0,0 +1,229 @@
   104.4 +/*
   104.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   104.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   104.7 + *
   104.8 + * This code is free software; you can redistribute it and/or modify it
   104.9 + * under the terms of the GNU General Public License version 2 only, as
  104.10 + * published by the Free Software Foundation.
  104.11 + *
  104.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  104.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  104.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  104.15 + * version 2 for more details (a copy is included in the LICENSE file that
  104.16 + * accompanied this code).
  104.17 + *
  104.18 + * You should have received a copy of the GNU General Public License version
  104.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  104.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  104.21 + *
  104.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  104.23 + * or visit www.oracle.com if you need additional information or have any
  104.24 + * questions.
  104.25 + */
  104.26 +
  104.27 +/*
  104.28 + * @test
  104.29 + * @bug 8007344
  104.30 + * @summary javac may not make tree end positions and/or doc comments
  104.31 + *          available to processors and listeners
  104.32 + * @library /tools/javac/lib
  104.33 + * @build JavacTestingAbstractProcessor
  104.34 + * @run main Test
  104.35 + */
  104.36 +
  104.37 +import java.io.File;
  104.38 +import java.io.PrintWriter;
  104.39 +import java.util.Arrays;
  104.40 +import java.util.Set;
  104.41 +
  104.42 +import javax.annotation.processing.RoundEnvironment;
  104.43 +import javax.lang.model.element.Element;
  104.44 +import javax.lang.model.element.TypeElement;
  104.45 +import javax.tools.JavaFileObject;
  104.46 +import javax.tools.StandardJavaFileManager;
  104.47 +import javax.tools.StandardLocation;
  104.48 +
  104.49 +import com.sun.source.doctree.DocCommentTree;
  104.50 +import com.sun.source.tree.*;
  104.51 +import com.sun.source.util.DocTrees;
  104.52 +import com.sun.source.util.JavacTask;
  104.53 +import com.sun.source.util.SourcePositions;
  104.54 +import com.sun.source.util.TaskEvent;
  104.55 +import com.sun.source.util.TaskListener;
  104.56 +import com.sun.source.util.TreePath;
  104.57 +import com.sun.source.util.TreePathScanner;
  104.58 +import com.sun.tools.javac.api.JavacTool;
  104.59 +import com.sun.tools.javac.tree.JCTree;
  104.60 +import com.sun.tools.javac.tree.Pretty;
  104.61 +import com.sun.tools.javac.util.Position;
  104.62 +
  104.63 +/** Doc comment: Test */
  104.64 +public class Test {
  104.65 +    public static final int EXPECT_DOC_COMMENTS = 3;
  104.66 +
  104.67 +    /** Doc comment: main */
  104.68 +    public static void main(String... args) throws Exception {
  104.69 +        PrintWriter out = new PrintWriter(System.err);
  104.70 +        try {
  104.71 +            new Test(out).run();
  104.72 +        } finally {
  104.73 +            out.flush();
  104.74 +        }
  104.75 +    }
  104.76 +
  104.77 +    PrintWriter out;
  104.78 +    int errors;
  104.79 +
  104.80 +    Test(PrintWriter out) {
  104.81 +        this.out = out;
  104.82 +    }
  104.83 +
  104.84 +    /** Doc comment: run */
  104.85 +    void run() throws Exception {
  104.86 +        File testSrc = new File(System.getProperty("test.src"));
  104.87 +        File thisFile = new File(testSrc, getClass().getName() + ".java");
  104.88 +        JavacTool javac = JavacTool.create();
  104.89 +        StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
  104.90 +        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
  104.91 +        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile);
  104.92 +        testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
  104.93 +        testTaskListener(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
  104.94 +
  104.95 +        if (errors > 0)
  104.96 +            throw new Exception(errors + " errors occurred");
  104.97 +    }
  104.98 +
  104.99 +    void testAnnoProcessor(JavacTool javac, StandardJavaFileManager fm,
 104.100 +            Iterable<? extends JavaFileObject> files, PrintWriter out,
 104.101 +            int expectedDocComments) {
 104.102 +        out.println("Test annotation processor");
 104.103 +        JavacTask task = javac.getTask(out, fm, null, null, null, files);
 104.104 +        AnnoProc ap = new AnnoProc(DocTrees.instance(task));
 104.105 +        task.setProcessors(Arrays.asList(ap));
 104.106 +        task.call();
 104.107 +        ap.checker.checkDocComments(expectedDocComments);
 104.108 +    }
 104.109 +
 104.110 +    void testTaskListener(JavacTool javac, StandardJavaFileManager fm,
 104.111 +            Iterable<? extends JavaFileObject> files, PrintWriter out,
 104.112 +            int expectedDocComments) {
 104.113 +        out.println("Test task listener");
 104.114 +        JavacTask task = javac.getTask(out, fm, null, null, null, files);
 104.115 +        TaskListnr tl = new TaskListnr(DocTrees.instance(task));
 104.116 +        task.addTaskListener(tl);
 104.117 +        task.call();
 104.118 +        tl.checker.checkDocComments(expectedDocComments);
 104.119 +    }
 104.120 +
 104.121 +    void error(String msg) {
 104.122 +        out.println("Error: " + msg);
 104.123 +        errors++;
 104.124 +    }
 104.125 +
 104.126 +    class AnnoProc extends JavacTestingAbstractProcessor {
 104.127 +        Checker checker;
 104.128 +
 104.129 +        AnnoProc(DocTrees trees) {
 104.130 +            checker = new Checker(trees);
 104.131 +        }
 104.132 +
 104.133 +        @Override
 104.134 +        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
 104.135 +            for (Element e : roundEnv.getRootElements()) {
 104.136 +                checker.scan(checker.trees.getPath(e), null);
 104.137 +            }
 104.138 +            return true;
 104.139 +        }
 104.140 +    }
 104.141 +
 104.142 +    class TaskListnr implements TaskListener {
 104.143 +        Checker checker;
 104.144 +
 104.145 +        TaskListnr(DocTrees trees) {
 104.146 +            checker = new Checker(trees);
 104.147 +        }
 104.148 +
 104.149 +        public void started(TaskEvent e) {
 104.150 +            if (e.getKind() == TaskEvent.Kind.ANALYZE)
 104.151 +                checker.scan(new TreePath(e.getCompilationUnit()), null);
 104.152 +        }
 104.153 +
 104.154 +        public void finished(TaskEvent e) {
 104.155 +        }
 104.156 +    }
 104.157 +
 104.158 +    class Checker extends TreePathScanner<Void,Void> {
 104.159 +        DocTrees trees;
 104.160 +        SourcePositions srcPosns;
 104.161 +
 104.162 +        int docComments = 0;
 104.163 +
 104.164 +        Checker(DocTrees trees) {
 104.165 +            this.trees = trees;
 104.166 +            srcPosns = trees.getSourcePositions();
 104.167 +        }
 104.168 +
 104.169 +        @Override
 104.170 +        public Void scan(Tree tree, Void ignore) {
 104.171 +            if (tree != null) {
 104.172 +                switch (tree.getKind()) {
 104.173 +                    // HACK: Workaround 8007350
 104.174 +                    // Some tree nodes do not have endpos set
 104.175 +                    case ASSIGNMENT:
 104.176 +                    case BLOCK:
 104.177 +                    case IDENTIFIER:
 104.178 +                    case METHOD_INVOCATION:
 104.179 +                        break;
 104.180 +
 104.181 +                    default:
 104.182 +                        checkEndPos(getCurrentPath().getCompilationUnit(), tree);
 104.183 +                }
 104.184 +            }
 104.185 +            return super.scan(tree, ignore);
 104.186 +        }
 104.187 +
 104.188 +        @Override
 104.189 +        public Void visitClass(ClassTree tree, Void ignore) {
 104.190 +            checkComment();
 104.191 +            return super.visitClass(tree, ignore);
 104.192 +        }
 104.193 +
 104.194 +        @Override
 104.195 +        public Void visitMethod(MethodTree tree, Void ignore) {
 104.196 +            checkComment();
 104.197 +            return super.visitMethod(tree, ignore);
 104.198 +        }
 104.199 +
 104.200 +        @Override
 104.201 +        public Void visitVariable(VariableTree tree, Void ignore) {
 104.202 +            checkComment();
 104.203 +            return super.visitVariable(tree, ignore);
 104.204 +        }
 104.205 +
 104.206 +        void checkComment() {
 104.207 +            DocCommentTree dc = trees.getDocCommentTree(getCurrentPath());
 104.208 +            if (dc != null) {
 104.209 +                out.println("comment: " + dc.toString().replaceAll("\\s+", " "));
 104.210 +                docComments++;
 104.211 +            }
 104.212 +        }
 104.213 +
 104.214 +        void checkEndPos(CompilationUnitTree unit, Tree tree) {
 104.215 +            long sp = srcPosns.getStartPosition(unit, tree);
 104.216 +            long ep = srcPosns.getEndPosition(unit, tree);
 104.217 +            if (sp >= 0 && ep == Position.NOPOS) {
 104.218 +                error("endpos not set for " + tree.getKind()
 104.219 +                        + " " + Pretty.toSimpleString(((JCTree) tree))
 104.220 +                        +", start:" + sp);
 104.221 +            }
 104.222 +        }
 104.223 +
 104.224 +        void checkDocComments(int expected) {
 104.225 +            if (docComments != expected) {
 104.226 +                error("Unexpected number of doc comments received: "
 104.227 +                        + docComments + ", expected: " + expected);
 104.228 +            }
 104.229 +        }
 104.230 +
 104.231 +    }
 104.232 +}
   105.1 --- a/test/tools/javac/api/T6306137.java	Mon Feb 04 18:08:53 2013 -0500
   105.2 +++ b/test/tools/javac/api/T6306137.java	Sun Feb 17 16:44:55 2013 -0500
   105.3 @@ -1,5 +1,5 @@
   105.4  /*
   105.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
   105.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
   105.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   105.8   *
   105.9   * This code is free software; you can redistribute it and/or modify it
  105.10 @@ -25,10 +25,9 @@
  105.11   * @test
  105.12   * @bug     6306137
  105.13   * @summary JSR 199: encoding option doesn't affect standard file manager
  105.14 + * @compile -encoding utf-8 T6306137.java
  105.15 + * @run main T6306137
  105.16   * @author  Peter von der Ahé
  105.17 - * @ignore
  105.18 - *    Need to make the contentCache in JavacFileManager be aware of changes to the encoding.
  105.19 - *    Need to propogate -source (and -encoding?) down to the JavacFileManager
  105.20   */
  105.21  
  105.22  import java.io.File;
   106.1 --- a/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Mon Feb 04 18:08:53 2013 -0500
   106.2 +++ b/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Sun Feb 17 16:44:55 2013 -0500
   106.3 @@ -23,7 +23,6 @@
   106.4  
   106.5  /*
   106.6   * @test
   106.7 - * @ignore awaits for VM support
   106.8   * @summary  check that javac does not generate bridge methods for defaults
   106.9   */
  106.10  
   107.1 --- a/test/tools/javac/diags/examples/CantApplyDiamond1.java	Mon Feb 04 18:08:53 2013 -0500
   107.2 +++ b/test/tools/javac/diags/examples/CantApplyDiamond1.java	Sun Feb 17 16:44:55 2013 -0500
   107.3 @@ -1,5 +1,5 @@
   107.4  /*
   107.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   107.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   107.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   107.8   *
   107.9   * This code is free software; you can redistribute it and/or modify it
  107.10 @@ -23,7 +23,7 @@
  107.11  
  107.12  // key: compiler.err.prob.found.req
  107.13  // key: compiler.misc.cant.apply.diamond.1
  107.14 -// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
  107.15 +// key: compiler.misc.incompatible.eq.upper.bounds
  107.16  // key: compiler.misc.diamond
  107.17  
  107.18  class CantApplyDiamond1<X> {
   108.1 --- a/test/tools/javac/diags/examples/InferredDoNotConformToEq.java	Mon Feb 04 18:08:53 2013 -0500
   108.2 +++ b/test/tools/javac/diags/examples/InferredDoNotConformToEq.java	Sun Feb 17 16:44:55 2013 -0500
   108.3 @@ -1,5 +1,5 @@
   108.4  /*
   108.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   108.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   108.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   108.8   *
   108.9   * This code is free software; you can redistribute it and/or modify it
  108.10 @@ -23,6 +23,7 @@
  108.11  
  108.12  // key: compiler.err.cant.apply.symbol
  108.13  // key: compiler.misc.inferred.do.not.conform.to.eq.bounds
  108.14 +// options: -source 7 -Xlint:-options
  108.15  
  108.16  import java.util.*;
  108.17  
   109.1 --- a/test/tools/javac/diags/examples/InferredDoNotConformToUpper.java	Mon Feb 04 18:08:53 2013 -0500
   109.2 +++ b/test/tools/javac/diags/examples/InferredDoNotConformToUpper.java	Sun Feb 17 16:44:55 2013 -0500
   109.3 @@ -1,5 +1,5 @@
   109.4  /*
   109.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   109.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   109.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   109.8   *
   109.9   * This code is free software; you can redistribute it and/or modify it
  109.10 @@ -23,6 +23,7 @@
  109.11  
  109.12  // key: compiler.err.cant.apply.symbol
  109.13  // key: compiler.misc.inferred.do.not.conform.to.upper.bounds
  109.14 +// options: -source 7 -Xlint:-options
  109.15  
  109.16  import java.util.*;
  109.17  
   110.1 --- a/test/tools/javac/diags/examples/WhereFreshTvar.java	Mon Feb 04 18:08:53 2013 -0500
   110.2 +++ b/test/tools/javac/diags/examples/WhereFreshTvar.java	Sun Feb 17 16:44:55 2013 -0500
   110.3 @@ -1,5 +1,5 @@
   110.4  /*
   110.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   110.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   110.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   110.8   *
   110.9   * This code is free software; you can redistribute it and/or modify it
  110.10 @@ -24,7 +24,7 @@
  110.11  // key: compiler.misc.where.fresh.typevar
  110.12  // key: compiler.misc.where.description.typevar
  110.13  // key: compiler.err.prob.found.req
  110.14 -// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
  110.15 +// key: compiler.misc.inconvertible.types
  110.16  // options: -XDdiags=where,simpleNames
  110.17  // run: simple
  110.18  
  110.19 @@ -33,5 +33,5 @@
  110.20  class WhereFreshTvar {
  110.21      <T extends List<T>> T m() {}
  110.22  
  110.23 -    { List<String> ls = m(); }
  110.24 +    { Object o = (List<String>)m(); }
  110.25  }
   111.1 --- a/test/tools/javac/generics/7015430/T7015430.out	Mon Feb 04 18:08:53 2013 -0500
   111.2 +++ b/test/tools/javac/generics/7015430/T7015430.out	Sun Feb 17 16:44:55 2013 -0500
   111.3 @@ -1,14 +1,14 @@
   111.4 -T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
   111.5 +T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
   111.6  T7015430.java:41:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   111.7  T7015430.java:50:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   111.8  T7015430.java:50:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   111.9 -T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
  111.10 +T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
  111.11  T7015430.java:68:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
  111.12  T7015430.java:77:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
  111.13  T7015430.java:77:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
  111.14  T7015430.java:104:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
  111.15  T7015430.java:104:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
  111.16 -T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
  111.17 +T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
  111.18  T7015430.java:113:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
  111.19  T7015430.java:41:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
  111.20  T7015430.java:68:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   112.1 --- a/test/tools/javac/generics/7151802/T7151802.out	Mon Feb 04 18:08:53 2013 -0500
   112.2 +++ b/test/tools/javac/generics/7151802/T7151802.out	Sun Feb 17 16:44:55 2013 -0500
   112.3 @@ -1,5 +1,5 @@
   112.4  T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
   112.5 -T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<Z>
   112.6 +T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.Object>
   112.7  T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
   112.8  T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
   112.9  T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>
   113.1 --- a/test/tools/javac/generics/diamond/neg/Neg06.out	Mon Feb 04 18:08:53 2013 -0500
   113.2 +++ b/test/tools/javac/generics/diamond/neg/Neg06.out	Sun Feb 17 16:44:55 2013 -0500
   113.3 @@ -1,2 +1,2 @@
   113.4 -Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))
   113.5 +Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
   113.6  1 error
   114.1 --- a/test/tools/javac/generics/inference/6278587/T6278587Neg.java	Mon Feb 04 18:08:53 2013 -0500
   114.2 +++ b/test/tools/javac/generics/inference/6278587/T6278587Neg.java	Sun Feb 17 16:44:55 2013 -0500
   114.3 @@ -1,5 +1,5 @@
   114.4  /*
   114.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
   114.6 + * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
   114.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   114.8   *
   114.9   * This code is free software; you can redistribute it and/or modify it
  114.10 @@ -23,10 +23,11 @@
  114.11  
  114.12  /*
  114.13   * @test
  114.14 - * @bug     6278587
  114.15 + * @bug     6278587 8007464
  114.16   * @summary Inference broken for subtypes of subtypes of F-bounded types
  114.17   * @author  Peter von der Ah\u00e9
  114.18 - * @compile/fail T6278587Neg.java
  114.19 + * @compile/fail -source 7 T6278587Neg.java
  114.20 + * @compile T6278587Neg.java
  114.21   */
  114.22  
  114.23  public abstract class T6278587Neg {
   115.1 --- a/test/tools/javac/generics/inference/6638712/T6638712d.out	Mon Feb 04 18:08:53 2013 -0500
   115.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712d.out	Sun Feb 17 16:44:55 2013 -0500
   115.3 @@ -1,2 +1,2 @@
   115.4 -T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.String, java.lang.Integer)
   115.5 +T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.incompatible.eq.lower.bounds: U, java.lang.String, java.lang.Integer)
   115.6  1 error
   116.1 --- a/test/tools/javac/generics/inference/6638712/T6638712e.out	Mon Feb 04 18:08:53 2013 -0500
   116.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712e.out	Sun Feb 17 16:44:55 2013 -0500
   116.3 @@ -1,2 +1,2 @@
   116.4 -T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Boolean,java.lang.Object)
   116.5 +T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Boolean,java.lang.Object)
   116.6  1 error
   117.1 --- a/test/tools/javac/generics/inference/7154127/T7154127.java	Mon Feb 04 18:08:53 2013 -0500
   117.2 +++ b/test/tools/javac/generics/inference/7154127/T7154127.java	Sun Feb 17 16:44:55 2013 -0500
   117.3 @@ -1,8 +1,9 @@
   117.4  /**
   117.5   * @test /nodynamiccopyright/
   117.6 - * @bug 7154127
   117.7 + * @bug 7154127 8007464
   117.8   * @summary Inference cleanup: remove bound check analysis from visitors in Types.java
   117.9 - * @compile/fail/ref=T7154127.out -XDrawDiagnostics T7154127.java
  117.10 + * @compile/fail/ref=T7154127.out -Xlint:-options -source 7 -XDrawDiagnostics T7154127.java
  117.11 + * @compile T7154127.java
  117.12   */
  117.13  class T7154127 {
  117.14  
   118.1 --- a/test/tools/javac/generics/inference/7154127/T7154127.out	Mon Feb 04 18:08:53 2013 -0500
   118.2 +++ b/test/tools/javac/generics/inference/7154127/T7154127.out	Sun Feb 17 16:44:55 2013 -0500
   118.3 @@ -1,2 +1,2 @@
   118.4 -T7154127.java:19:49: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: Y, T7154127.D,T7154127.B<U>)
   118.5 +T7154127.java:20:49: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.bounds: Y, T7154127.B<U>,T7154127.D)
   118.6  1 error
   119.1 --- a/test/tools/javac/generics/inference/7177306/T7177306a.out	Mon Feb 04 18:08:53 2013 -0500
   119.2 +++ b/test/tools/javac/generics/inference/7177306/T7177306a.out	Sun Feb 17 16:44:55 2013 -0500
   119.3 @@ -1,4 +1,4 @@
   119.4 -T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<E>
   119.5 +T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<java.lang.Object>
   119.6  T7177306a.java:13:33: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.List<E>, java.util.List, kindname.class, T7177306a
   119.7  T7177306a.java:13:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7177306a, T7177306a<java.lang.Object>
   119.8  - compiler.err.warnings.and.werror
   120.1 --- a/test/tools/javac/generics/inference/7177306/T7177306e.java	Mon Feb 04 18:08:53 2013 -0500
   120.2 +++ b/test/tools/javac/generics/inference/7177306/T7177306e.java	Sun Feb 17 16:44:55 2013 -0500
   120.3 @@ -1,8 +1,9 @@
   120.4  /**
   120.5   * @test /nodynamiccopyright/
   120.6 - * @bug 7177306
   120.7 + * @bug 7177306 8007464
   120.8   * @summary Regression: unchecked method call does not erase return type
   120.9 - * @compile/fail/ref=T7177306e.out -XDrawDiagnostics T7177306e.java
  120.10 + * @compile/fail/ref=T7177306e.out -source 7 -Xlint:-options -XDrawDiagnostics T7177306e.java
  120.11 + * @compile/fail T7177306e.java
  120.12   */
  120.13  
  120.14  import java.util.List;
   121.1 --- a/test/tools/javac/generics/inference/7177306/T7177306e.out	Mon Feb 04 18:08:53 2013 -0500
   121.2 +++ b/test/tools/javac/generics/inference/7177306/T7177306e.out	Sun Feb 17 16:44:55 2013 -0500
   121.3 @@ -1,2 +1,2 @@
   121.4 -T7177306e.java:15:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
   121.5 +T7177306e.java:16:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
   121.6  1 error
   122.1 --- a/test/tools/javac/generics/odersky/BadTest4.java	Mon Feb 04 18:08:53 2013 -0500
   122.2 +++ b/test/tools/javac/generics/odersky/BadTest4.java	Sun Feb 17 16:44:55 2013 -0500
   122.3 @@ -23,11 +23,12 @@
   122.4  
   122.5  /*
   122.6   * @test
   122.7 - * @ bug
   122.8 + * @bug 8007464
   122.9   * @summary Negative regression test from odersky
  122.10   * @author odersky
  122.11   *
  122.12 - * @compile/fail  BadTest4.java
  122.13 + * @compile/fail -source 7 BadTest4.java
  122.14 + * @compile BadTest4.java
  122.15   */
  122.16  
  122.17  class BadTest4 {
   123.1 --- a/test/tools/javac/lambda/LambdaCapture06.java	Mon Feb 04 18:08:53 2013 -0500
   123.2 +++ b/test/tools/javac/lambda/LambdaCapture06.java	Sun Feb 17 16:44:55 2013 -0500
   123.3 @@ -23,7 +23,6 @@
   123.4  
   123.5  /*
   123.6   * @test
   123.7 - * @ignore investigate as to whether code generation fails
   123.8   * @bug 8003280
   123.9   * @summary Add lambda tests
  123.10   *  Compiler crash when local inner class nested inside lambda captures local variables from enclosing scope
   124.1 --- a/test/tools/javac/lambda/LambdaExpr15.java	Mon Feb 04 18:08:53 2013 -0500
   124.2 +++ b/test/tools/javac/lambda/LambdaExpr15.java	Sun Feb 17 16:44:55 2013 -0500
   124.3 @@ -23,7 +23,6 @@
   124.4  
   124.5  /*
   124.6   * @test
   124.7 - * @ignore investigate as to whether code generation fails
   124.8   * @bug 8003280
   124.9   * @summary Add lambda tests
  124.10   *  check that nested inner class in statement lambdas don't get corrupted return statements
   125.1 --- a/test/tools/javac/lambda/TargetType14.out	Mon Feb 04 18:08:53 2013 -0500
   125.2 +++ b/test/tools/javac/lambda/TargetType14.out	Sun Feb 17 16:44:55 2013 -0500
   125.3 @@ -1,2 +1,2 @@
   125.4 -TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer, java.lang.String)
   125.5 +TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.lower.bounds: X, java.lang.Integer, java.lang.String)
   125.6  1 error
   126.1 --- a/test/tools/javac/lambda/TargetType20.java	Mon Feb 04 18:08:53 2013 -0500
   126.2 +++ b/test/tools/javac/lambda/TargetType20.java	Sun Feb 17 16:44:55 2013 -0500
   126.3 @@ -1,10 +1,33 @@
   126.4  /*
   126.5 - * @test /nodynamiccopyright/
   126.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   126.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   126.8 + *
   126.9 + * This code is free software; you can redistribute it and/or modify it
  126.10 + * under the terms of the GNU General Public License version 2 only, as
  126.11 + * published by the Free Software Foundation.
  126.12 + *
  126.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  126.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  126.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  126.16 + * version 2 for more details (a copy is included in the LICENSE file that
  126.17 + * accompanied this code).
  126.18 + *
  126.19 + * You should have received a copy of the GNU General Public License version
  126.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  126.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  126.22 + *
  126.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  126.24 + * or visit www.oracle.com if you need additional information or have any
  126.25 + * questions.
  126.26 + */
  126.27 +
  126.28 +/*
  126.29 + * @test
  126.30   * @bug 8003280
  126.31   * @summary Add lambda tests
  126.32   *  complex case of lambda return type that depends on generic method
  126.33   *          inference variable
  126.34 - * @compile/fail/ref=TargetType20.out -XDrawDiagnostics TargetType20.java
  126.35 + * @compile -XDrawDiagnostics TargetType20.java
  126.36   */
  126.37  import java.util.*;
  126.38  
   127.1 --- a/test/tools/javac/lambda/TargetType20.out	Mon Feb 04 18:08:53 2013 -0500
   127.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   127.3 @@ -1,2 +0,0 @@
   127.4 -TargetType20.java:19:10: compiler.err.cant.apply.symbol: kindname.method, call, TargetType20.SAM2<Z>,TargetType20.SAM2<Z>, @428,@459, kindname.class, TargetType20.Test, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.String, java.lang.String,java.lang.Object)
   127.5 -1 error
   128.1 --- a/test/tools/javac/lambda/TargetType28.out	Mon Feb 04 18:08:53 2013 -0500
   128.2 +++ b/test/tools/javac/lambda/TargetType28.out	Sun Feb 17 16:44:55 2013 -0500
   128.3 @@ -1,3 +1,2 @@
   128.4 -TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Number, java.lang.Number,java.lang.String)
   128.5 -TargetType28.java:21:33: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Number, java.lang.Number,java.lang.Integer)
   128.6 -2 errors
   128.7 +TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String,X, java.lang.Object,java.lang.Number)
   128.8 +1 error
   129.1 --- a/test/tools/javac/lambda/TargetType50.java	Mon Feb 04 18:08:53 2013 -0500
   129.2 +++ b/test/tools/javac/lambda/TargetType50.java	Sun Feb 17 16:44:55 2013 -0500
   129.3 @@ -1,9 +1,32 @@
   129.4  /*
   129.5 - * @test /nodynamiccopyright/
   129.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   129.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   129.8 + *
   129.9 + * This code is free software; you can redistribute it and/or modify it
  129.10 + * under the terms of the GNU General Public License version 2 only, as
  129.11 + * published by the Free Software Foundation.
  129.12 + *
  129.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  129.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  129.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  129.16 + * version 2 for more details (a copy is included in the LICENSE file that
  129.17 + * accompanied this code).
  129.18 + *
  129.19 + * You should have received a copy of the GNU General Public License version
  129.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  129.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  129.22 + *
  129.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  129.24 + * or visit www.oracle.com if you need additional information or have any
  129.25 + * questions.
  129.26 + */
  129.27 +
  129.28 +/*
  129.29 + * @test
  129.30   * @bug 8003280
  129.31   * @summary Add lambda tests
  129.32   *  bad stuck check for method reference leads to javac crash
  129.33 - * @compile/fail/ref=TargetType50.out -XDrawDiagnostics TargetType50.java
  129.34 + * @compile TargetType50.java
  129.35   */
  129.36  import java.util.*;
  129.37  
  129.38 @@ -17,7 +40,7 @@
  129.39          static <Z> Sink<Z> make() { return null; }
  129.40      }
  129.41  
  129.42 -    <Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) {  }
  129.43 +    <Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) { return null; }
  129.44  
  129.45      void test() {
  129.46          List<?> l1 = m(Sink::new);
   130.1 --- a/test/tools/javac/lambda/TargetType50.out	Mon Feb 04 18:08:53 2013 -0500
   130.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   130.3 @@ -1,3 +0,0 @@
   130.4 -TargetType50.java:25:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: TargetType50.Sink<java.lang.Object>, TargetType50.Sink<java.lang.String>)
   130.5 -TargetType50.java:26:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: TargetType50.Sink<java.lang.Object>, TargetType50.Sink<java.lang.String>)
   130.6 -2 errors
   131.1 --- a/test/tools/javac/lambda/TargetType51.java	Mon Feb 04 18:08:53 2013 -0500
   131.2 +++ b/test/tools/javac/lambda/TargetType51.java	Sun Feb 17 16:44:55 2013 -0500
   131.3 @@ -23,7 +23,9 @@
   131.4  
   131.5  /*
   131.6   * @test
   131.7 - * @summary smoke test for combinator-like stuck analysis
   131.8 + * @bug 8005244
   131.9 + * @summary Implement overload resolution as per latest spec EDR
  131.10 + *          smoke test for combinator-like stuck analysis
  131.11   * @author  Maurizio Cimadamore
  131.12   * @compile TargetType51.java
  131.13   */
   132.1 --- a/test/tools/javac/lambda/TargetType52.java	Mon Feb 04 18:08:53 2013 -0500
   132.2 +++ b/test/tools/javac/lambda/TargetType52.java	Sun Feb 17 16:44:55 2013 -0500
   132.3 @@ -1,6 +1,8 @@
   132.4  /*
   132.5   * @test /nodynamiccopyright/
   132.6 - * @summary uncatched sam conversion failure exception lead to javac crash
   132.7 + * @bug 8005244
   132.8 + * @summary Implement overload resolution as per latest spec EDR
   132.9 + *          uncatched sam conversion failure exception lead to javac crash
  132.10   * @compile/fail/ref=TargetType52.out -XDrawDiagnostics TargetType52.java
  132.11   */
  132.12  class TargetType52 {
   133.1 --- a/test/tools/javac/lambda/TargetType52.out	Mon Feb 04 18:08:53 2013 -0500
   133.2 +++ b/test/tools/javac/lambda/TargetType52.out	Sun Feb 17 16:44:55 2013 -0500
   133.3 @@ -1,2 +1,2 @@
   133.4 -TargetType52.java:15:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @444, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
   133.5 +TargetType52.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @525, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
   133.6  1 error
   134.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   134.2 +++ b/test/tools/javac/lambda/TargetType53.java	Sun Feb 17 16:44:55 2013 -0500
   134.3 @@ -0,0 +1,47 @@
   134.4 +/*
   134.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   134.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   134.7 + *
   134.8 + * This code is free software; you can redistribute it and/or modify it
   134.9 + * under the terms of the GNU General Public License version 2 only, as
  134.10 + * published by the Free Software Foundation.
  134.11 + *
  134.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  134.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  134.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  134.15 + * version 2 for more details (a copy is included in the LICENSE file that
  134.16 + * accompanied this code).
  134.17 + *
  134.18 + * You should have received a copy of the GNU General Public License version
  134.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  134.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  134.21 + *
  134.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  134.23 + * or visit www.oracle.com if you need additional information or have any
  134.24 + * questions.
  134.25 + */
  134.26 +
  134.27 +/*
  134.28 + * @test
  134.29 + * @bug 8007464
  134.30 + * @summary Add graph inference support
  134.31 + *          smoke test for graph inference
  134.32 + * @ignore  awaits stream API: 800NNNN
  134.33 + * @compile TargetType53.java
  134.34 + */
  134.35 +import java.util.*;
  134.36 +import java.util.stream.*;
  134.37 +import java.util.function.*;
  134.38 +
  134.39 +class TargetType53 {
  134.40 +
  134.41 +    <P> List<List<P>> perm(List<P> l) { return null; }
  134.42 +
  134.43 +    void g(List<List<UnaryOperator<IntStream>>> l) { }
  134.44 +
  134.45 +    void test() {
  134.46 +        List<List<UnaryOperator<IntStream>>> l =
  134.47 +            perm(Arrays.asList(s -> s.sorted()));
  134.48 +        g(perm(Arrays.asList(s -> s.sorted())));
  134.49 +    }
  134.50 +}
   135.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   135.2 +++ b/test/tools/javac/lambda/TargetType54.java	Sun Feb 17 16:44:55 2013 -0500
   135.3 @@ -0,0 +1,45 @@
   135.4 +/*
   135.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   135.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   135.7 + *
   135.8 + * This code is free software; you can redistribute it and/or modify it
   135.9 + * under the terms of the GNU General Public License version 2 only, as
  135.10 + * published by the Free Software Foundation.
  135.11 + *
  135.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  135.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  135.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  135.15 + * version 2 for more details (a copy is included in the LICENSE file that
  135.16 + * accompanied this code).
  135.17 + *
  135.18 + * You should have received a copy of the GNU General Public License version
  135.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  135.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  135.21 + *
  135.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  135.23 + * or visit www.oracle.com if you need additional information or have any
  135.24 + * questions.
  135.25 + */
  135.26 +
  135.27 +/*
  135.28 + * @test
  135.29 + * @bug 8007464
  135.30 + * @summary Add graph inference support
  135.31 + *          smoke test for graph inference
  135.32 + * @ignore  awaits stream API: 800NNNN
  135.33 + * @compile TargetType54.java
  135.34 + */
  135.35 +import java.util.stream.*;
  135.36 +import java.util.*;
  135.37 +import static java.util.stream.Collectors.*;
  135.38 +
  135.39 +class TargetType54 {
  135.40 +    void test(Stream<Integer> si) {
  135.41 +        List<Integer> l1 = si.collect(toList());
  135.42 +        List<Integer> l2 = si.collect(toCollection(ArrayList::new));
  135.43 +        m(si.collect(toList()));
  135.44 +        m(si.collect(toCollection(ArrayList::new)));
  135.45 +    }
  135.46 +
  135.47 +    void m(List<Integer> l) { }
  135.48 +}
   136.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   136.2 +++ b/test/tools/javac/lambda/TargetType55.java	Sun Feb 17 16:44:55 2013 -0500
   136.3 @@ -0,0 +1,42 @@
   136.4 +/*
   136.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   136.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   136.7 + *
   136.8 + * This code is free software; you can redistribute it and/or modify it
   136.9 + * under the terms of the GNU General Public License version 2 only, as
  136.10 + * published by the Free Software Foundation.
  136.11 + *
  136.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  136.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  136.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  136.15 + * version 2 for more details (a copy is included in the LICENSE file that
  136.16 + * accompanied this code).
  136.17 + *
  136.18 + * You should have received a copy of the GNU General Public License version
  136.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  136.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  136.21 + *
  136.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  136.23 + * or visit www.oracle.com if you need additional information or have any
  136.24 + * questions.
  136.25 + */
  136.26 +
  136.27 +/*
  136.28 + * @test
  136.29 + * @bug 8007464
  136.30 + * @summary Add graph inference
  136.31 + *          support smoke test for graph inference
  136.32 + * @compile TargetType55.java
  136.33 + */
  136.34 +import java.util.function.*;
  136.35 +
  136.36 +class TargetType55  {
  136.37 +
  136.38 +    <R> void m(Function<Integer, R> collector) { }
  136.39 +
  136.40 +    <T, D> Function<T, Integer> g(D d, BinaryOperator<D> reducer) { return null; }
  136.41 +
  136.42 +    public void test() {
  136.43 +        m(g((Integer)null, (x,y)->1));
  136.44 +    }
  136.45 +}
   137.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   137.2 +++ b/test/tools/javac/lambda/TargetType56.java	Sun Feb 17 16:44:55 2013 -0500
   137.3 @@ -0,0 +1,40 @@
   137.4 +/*
   137.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   137.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   137.7 + *
   137.8 + * This code is free software; you can redistribute it and/or modify it
   137.9 + * under the terms of the GNU General Public License version 2 only, as
  137.10 + * published by the Free Software Foundation.
  137.11 + *
  137.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  137.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  137.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  137.15 + * version 2 for more details (a copy is included in the LICENSE file that
  137.16 + * accompanied this code).
  137.17 + *
  137.18 + * You should have received a copy of the GNU General Public License version
  137.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  137.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  137.21 + *
  137.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  137.23 + * or visit www.oracle.com if you need additional information or have any
  137.24 + * questions.
  137.25 + */
  137.26 +
  137.27 +/*
  137.28 + * @test
  137.29 + * @bug 8007464
  137.30 + * @summary Add graph inference support
  137.31 + *          smoke test for graph inference
  137.32 + * @compile TargetType56.java
  137.33 + */
  137.34 +class TargetType56 {
  137.35 +    <Z> Z m(Z z) { return null; }
  137.36 +
  137.37 +    void test() {
  137.38 +        double d1 = m(1);
  137.39 +        double d2 = m((Integer)null);
  137.40 +        double d3 = m(m(1));
  137.41 +        double d4 = m(m((Integer)null));
  137.42 +    }
  137.43 +}
   138.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   138.2 +++ b/test/tools/javac/lambda/TargetType57.java	Sun Feb 17 16:44:55 2013 -0500
   138.3 @@ -0,0 +1,20 @@
   138.4 +/*
   138.5 + * @test /nodynamiccopyright/
   138.6 + * @bug 8007464
   138.7 + * @summary Add graph inference support
   138.8 + *          more smoke tests for graph inference
   138.9 + * @compile/fail/ref=TargetType57.out -XDrawDiagnostics TargetType57.java
  138.10 + */
  138.11 +import java.util.*;
  138.12 +import java.util.function.*;
  138.13 +
  138.14 +class TargetType57 {
  138.15 +
  138.16 +    void test(List<Integer> list) {
  138.17 +        m(list, s -> s.intValue(), s -> s.nonExistentMethod());
  138.18 +    }
  138.19 +
  138.20 +    <U, R, S_IN, S_OUT> R m(List<S_IN> list,
  138.21 +                        Function<S_IN, S_OUT> f1,
  138.22 +                        Function<S_OUT, R> f2) { return null; }
  138.23 +}
   139.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   139.2 +++ b/test/tools/javac/lambda/TargetType57.out	Sun Feb 17 16:44:55 2013 -0500
   139.3 @@ -0,0 +1,2 @@
   139.4 +TargetType57.java:14:42: compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location.1: kindname.variable, s, java.lang.Integer)
   139.5 +1 error
   140.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   140.2 +++ b/test/tools/javac/lambda/TargetType58.java	Sun Feb 17 16:44:55 2013 -0500
   140.3 @@ -0,0 +1,46 @@
   140.4 +/*
   140.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   140.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   140.7 + *
   140.8 + * This code is free software; you can redistribute it and/or modify it
   140.9 + * under the terms of the GNU General Public License version 2 only, as
  140.10 + * published by the Free Software Foundation.
  140.11 + *
  140.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  140.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  140.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  140.15 + * version 2 for more details (a copy is included in the LICENSE file that
  140.16 + * accompanied this code).
  140.17 + *
  140.18 + * You should have received a copy of the GNU General Public License version
  140.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  140.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  140.21 + *
  140.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  140.23 + * or visit www.oracle.com if you need additional information or have any
  140.24 + * questions.
  140.25 + */
  140.26 +
  140.27 +/*
  140.28 + * @test
  140.29 + * @bug 8007464
  140.30 + * @summary Add graph inference support
  140.31 + *          more smoke tests for graph inference
  140.32 + * @ignore  awaits stream API: 800NNNN
  140.33 + * @compile TargetType58.java
  140.34 + */
  140.35 +import java.util.*;
  140.36 +import java.util.function.*;
  140.37 +import java.util.stream.*;
  140.38 +
  140.39 +class TargetType58 {
  140.40 +
  140.41 +    void test(List<Integer> li) {
  140.42 +        g(li, s -> s.substream(200), Collections.emptyList());
  140.43 +    }
  140.44 +
  140.45 +    <T, U, S_OUT extends Stream<U>,
  140.46 +            I extends Iterable<U>> Collection<U> g(Collection<T> coll, Function<Stream<T>, S_OUT> f, I i) {
  140.47 +        return null;
  140.48 +    }
  140.49 +}
   141.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   141.2 +++ b/test/tools/javac/lambda/TargetType59.java	Sun Feb 17 16:44:55 2013 -0500
   141.3 @@ -0,0 +1,49 @@
   141.4 +/*
   141.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   141.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   141.7 + *
   141.8 + * This code is free software; you can redistribute it and/or modify it
   141.9 + * under the terms of the GNU General Public License version 2 only, as
  141.10 + * published by the Free Software Foundation.
  141.11 + *
  141.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  141.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  141.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  141.15 + * version 2 for more details (a copy is included in the LICENSE file that
  141.16 + * accompanied this code).
  141.17 + *
  141.18 + * You should have received a copy of the GNU General Public License version
  141.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  141.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  141.21 + *
  141.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  141.23 + * or visit www.oracle.com if you need additional information or have any
  141.24 + * questions.
  141.25 + */
  141.26 +
  141.27 +/*
  141.28 + * @test
  141.29 + * @bug 8007464
  141.30 + * @summary Add graph inference support
  141.31 + *          more smoke tests for graph inference
  141.32 + * @ignore  awaits stream API: 800NNNN
  141.33 + * @compile TargetType59.java
  141.34 + */
  141.35 +import java.util.*;
  141.36 +import java.util.function.*;
  141.37 +import java.util.stream.*;
  141.38 +
  141.39 +class TargetType59 {
  141.40 +
  141.41 +    <T, R> Collector<T, R> m(Supplier<? extends R> supplier, BiConsumer<R, T> accumulator) {
  141.42 +        return null;
  141.43 +    }
  141.44 +
  141.45 +    <T, C extends Collection<T>> Collector<T,C> test1(Supplier<C> collectionFactory) {
  141.46 +        return m(collectionFactory, Collection::add);
  141.47 +    }
  141.48 +
  141.49 +    Collector<String, StringBuilder> test2(Supplier<StringBuilder> sb) {
  141.50 +        return m(sb, StringBuilder::append);
  141.51 +    }
  141.52 +}
   142.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   142.2 +++ b/test/tools/javac/lambda/TargetType61.java	Sun Feb 17 16:44:55 2013 -0500
   142.3 @@ -0,0 +1,47 @@
   142.4 +/*
   142.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   142.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   142.7 + *
   142.8 + * This code is free software; you can redistribute it and/or modify it
   142.9 + * under the terms of the GNU General Public License version 2 only, as
  142.10 + * published by the Free Software Foundation.
  142.11 + *
  142.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  142.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  142.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  142.15 + * version 2 for more details (a copy is included in the LICENSE file that
  142.16 + * accompanied this code).
  142.17 + *
  142.18 + * You should have received a copy of the GNU General Public License version
  142.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  142.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  142.21 + *
  142.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  142.23 + * or visit www.oracle.com if you need additional information or have any
  142.24 + * questions.
  142.25 + */
  142.26 +
  142.27 +/*
  142.28 + * @test
  142.29 + * @bug 8007464
  142.30 + * @summary Add graph inference support
  142.31 + *          check that new wildcards inference strategy doesn't run into 7190296
  142.32 + * @compile TargetType61.java
  142.33 + */
  142.34 +class TargetType61 {
  142.35 +
  142.36 +    interface Stream<T> {
  142.37 +        void forEach(Sink<? super T> sink);
  142.38 +    }
  142.39 +
  142.40 +    interface Sink<T> {
  142.41 +        void put(T t);
  142.42 +    }
  142.43 +
  142.44 +    public boolean add(CharSequence s) { return false; }
  142.45 +
  142.46 +    public void addAll(Stream<? extends CharSequence> stream) {
  142.47 +        stream.forEach(this::add);
  142.48 +        stream.forEach(e -> { add(e); });
  142.49 +    }
  142.50 +}
   143.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   143.2 +++ b/test/tools/javac/lambda/TargetType62.java	Sun Feb 17 16:44:55 2013 -0500
   143.3 @@ -0,0 +1,46 @@
   143.4 +/*
   143.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   143.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   143.7 + *
   143.8 + * This code is free software; you can redistribute it and/or modify it
   143.9 + * under the terms of the GNU General Public License version 2 only, as
  143.10 + * published by the Free Software Foundation.
  143.11 + *
  143.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  143.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  143.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  143.15 + * version 2 for more details (a copy is included in the LICENSE file that
  143.16 + * accompanied this code).
  143.17 + *
  143.18 + * You should have received a copy of the GNU General Public License version
  143.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  143.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  143.21 + *
  143.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  143.23 + * or visit www.oracle.com if you need additional information or have any
  143.24 + * questions.
  143.25 + */
  143.26 +
  143.27 +/*
  143.28 + * @test
  143.29 + * @bug 8007464
  143.30 + * @summary Add graph inference support
  143.31 + *          check that new wildcards inference strategy doesn't run into 7190296
  143.32 + * @ignore  awaits stream API: 800NNNN
  143.33 + * @compile TargetType62.java
  143.34 + */
  143.35 +import java.util.*;
  143.36 +import java.util.function.*;
  143.37 +import java.util.stream.*;
  143.38 +
  143.39 +class TargetType61 {
  143.40 +
  143.41 +    Collector test(Function<Integer, Integer> classifier) {
  143.42 +        return g(classifier, TreeMap::new, m(HashSet::new));
  143.43 +    }
  143.44 +
  143.45 +    <R> Collector<Integer, R> m(Supplier<R> s) { return null; }
  143.46 +
  143.47 +    <T, K, D, M extends Map<K, D>>
  143.48 +            Collector<T, M> g(Function<T, K> classifier, Supplier<M> mapFactory, Collector<T, D> downstream) { return null; }
  143.49 +}
   144.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   144.2 +++ b/test/tools/javac/lib/DPrinter.java	Sun Feb 17 16:44:55 2013 -0500
   144.3 @@ -0,0 +1,1332 @@
   144.4 +/*
   144.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   144.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   144.7 + *
   144.8 + * This code is free software; you can redistribute it and/or modify it
   144.9 + * under the terms of the GNU General Public License version 2 only, as
  144.10 + * published by the Free Software Foundation.
  144.11 + *
  144.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  144.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  144.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  144.15 + * version 2 for more details (a copy is included in the LICENSE file that
  144.16 + * accompanied this code).
  144.17 + *
  144.18 + * You should have received a copy of the GNU General Public License version
  144.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  144.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  144.21 + *
  144.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  144.23 + * or visit www.oracle.com if you need additional information or have any
  144.24 + * questions.
  144.25 + */
  144.26 +
  144.27 +import java.io.File;
  144.28 +import java.io.IOException;
  144.29 +import java.io.PrintWriter;
  144.30 +import java.lang.reflect.Field;
  144.31 +import java.util.ArrayList;
  144.32 +import java.util.Arrays;
  144.33 +import java.util.Collection;
  144.34 +import java.util.EnumSet;
  144.35 +import java.util.HashMap;
  144.36 +import java.util.List;
  144.37 +import java.util.Locale;
  144.38 +import java.util.Map;
  144.39 +import java.util.Set;
  144.40 +
  144.41 +import javax.lang.model.element.Name;
  144.42 +import javax.lang.model.element.TypeElement;
  144.43 +import javax.tools.FileObject;
  144.44 +import javax.tools.JavaCompiler;
  144.45 +import javax.tools.JavaFileObject;
  144.46 +import javax.tools.StandardJavaFileManager;
  144.47 +import javax.tools.StandardLocation;
  144.48 +import javax.tools.ToolProvider;
  144.49 +
  144.50 +import com.sun.source.util.JavacTask;
  144.51 +import com.sun.source.util.TaskEvent;
  144.52 +import com.sun.source.util.TaskListener;
  144.53 +import com.sun.source.util.Trees;
  144.54 +import com.sun.tools.javac.api.JavacTrees;
  144.55 +import com.sun.tools.javac.code.Annotations;
  144.56 +import com.sun.tools.javac.code.Attribute;
  144.57 +import com.sun.tools.javac.code.Flags;
  144.58 +import com.sun.tools.javac.code.Kinds;
  144.59 +import com.sun.tools.javac.code.Printer;
  144.60 +import com.sun.tools.javac.code.Scope;
  144.61 +import com.sun.tools.javac.code.Scope.CompoundScope;
  144.62 +import com.sun.tools.javac.code.Symbol;
  144.63 +import com.sun.tools.javac.code.Symbol.*;
  144.64 +import com.sun.tools.javac.code.Type;
  144.65 +import com.sun.tools.javac.code.Type.*;
  144.66 +import com.sun.tools.javac.code.TypeTag;
  144.67 +import com.sun.tools.javac.tree.JCTree;
  144.68 +import com.sun.tools.javac.tree.JCTree.*;
  144.69 +import com.sun.tools.javac.tree.Pretty;
  144.70 +import com.sun.tools.javac.tree.TreeInfo;
  144.71 +import com.sun.tools.javac.tree.TreeScanner;
  144.72 +import com.sun.tools.javac.util.Assert;
  144.73 +import com.sun.tools.javac.util.Context;
  144.74 +import com.sun.tools.javac.util.Log;
  144.75 +
  144.76 +
  144.77 +/**
  144.78 + * Debug printer for javac internals, for when toString() just isn't enough.
  144.79 + *
  144.80 + * <p>
  144.81 + * The printer provides an API to generate structured views of javac objects,
  144.82 + * such as AST nodes, symbol, types and annotations. Various aspects of the
  144.83 + * output can be configured, such as whether to show nulls, empty lists, or
  144.84 + * a compressed representation of the source code. Visitors are used to walk
  144.85 + * object hierarchies, and can be replaced with custom visitors if the default
  144.86 + * visitors are not flexible enough.
  144.87 + *
  144.88 + * <p>
  144.89 + * In general, nodes are printed with an initial line identifying the node
  144.90 + * followed by indented lines for the child nodes. Currently, graphs are
  144.91 + * represented by printing a spanning subtree.
  144.92 + *
  144.93 + * <p>
  144.94 + * The printer can be accessed via a simple command-line utility,
  144.95 + * which makes it easy to see the internal representation of source code,
  144.96 + * such as simple test programs, during the compilation pipeline.
  144.97 + *
  144.98 + *  <p><b>This is NOT part of any supported API.
  144.99 + *  If you write code that depends on this, you do so at your own risk.
 144.100 + *  This code and its internal interfaces are subject to change or
 144.101 + *  deletion without notice.</b>
 144.102 + */
 144.103 +
 144.104 +public class DPrinter {
 144.105 +    protected final PrintWriter out;
 144.106 +    protected final Trees trees;
 144.107 +    protected Printer printer;
 144.108 +    protected boolean showEmptyItems = true;
 144.109 +    protected boolean showNulls = true;
 144.110 +    protected boolean showPositions = false;
 144.111 +    protected boolean showSrc;
 144.112 +    protected boolean showTreeSymbols;
 144.113 +    protected boolean showTreeTypes;
 144.114 +    protected int maxSrcLength = 32;
 144.115 +    protected Locale locale = Locale.getDefault();
 144.116 +    protected static final String NULL = "#null";
 144.117 +
 144.118 +    // <editor-fold defaultstate="collapsed" desc="Configuration">
 144.119 +
 144.120 +    public static DPrinter instance(Context context) {
 144.121 +        DPrinter dp = context.get(DPrinter.class);
 144.122 +        if (dp == null) {
 144.123 +            dp = new DPrinter(context);
 144.124 +        }
 144.125 +        return dp;
 144.126 +
 144.127 +    }
 144.128 +
 144.129 +    protected DPrinter(Context context) {
 144.130 +        context.put(DPrinter.class, this);
 144.131 +        out = context.get(Log.outKey);
 144.132 +        trees = JavacTrees.instance(context);
 144.133 +    }
 144.134 +
 144.135 +    public DPrinter(PrintWriter out, Trees trees) {
 144.136 +        this.out = out;
 144.137 +        this.trees = trees;
 144.138 +    }
 144.139 +
 144.140 +    public DPrinter emptyItems(boolean showEmptyItems) {
 144.141 +        this.showEmptyItems = showEmptyItems;
 144.142 +        return this;
 144.143 +    }
 144.144 +
 144.145 +    public DPrinter nulls(boolean showNulls) {
 144.146 +        this.showNulls = showNulls;
 144.147 +        return this;
 144.148 +    }
 144.149 +
 144.150 +    public DPrinter positions(boolean showPositions) {
 144.151 +        this.showPositions = showPositions;
 144.152 +        return this;
 144.153 +    }
 144.154 +
 144.155 +    public DPrinter source(boolean showSrc) {
 144.156 +        this.showSrc = showSrc;
 144.157 +        return this;
 144.158 +    }
 144.159 +
 144.160 +    public DPrinter source(int maxSrcLength) {
 144.161 +        this.showSrc = true;
 144.162 +        this.maxSrcLength = maxSrcLength;
 144.163 +        return this;
 144.164 +    }
 144.165 +
 144.166 +    public DPrinter treeSymbols(boolean showTreeSymbols) {
 144.167 +        this.showTreeSymbols = showTreeSymbols;
 144.168 +        return this;
 144.169 +    }
 144.170 +
 144.171 +    public DPrinter treeTypes(boolean showTreeTypes) {
 144.172 +        this.showTreeTypes = showTreeTypes;
 144.173 +        return this;
 144.174 +    }
 144.175 +
 144.176 +    public DPrinter typeSymbolPrinter(Printer p) {
 144.177 +        printer = p;
 144.178 +        return this;
 144.179 +    }
 144.180 +
 144.181 +    // </editor-fold>
 144.182 +
 144.183 +    // <editor-fold defaultstate="collapsed" desc="Printing">
 144.184 +
 144.185 +    protected enum Details {
 144.186 +        /** A one-line non-recursive summary */
 144.187 +        SUMMARY,
 144.188 +        /** Multi-line, possibly recursive. */
 144.189 +        FULL
 144.190 +    };
 144.191 +
 144.192 +    public void printAnnotations(String label, Annotations annotations) {
 144.193 +        printAnnotations(label, annotations, Details.FULL);
 144.194 +    }
 144.195 +
 144.196 +    protected void printAnnotations(String label, Annotations annotations, Details details) {
 144.197 +        if (annotations == null) {
 144.198 +            printNull(label);
 144.199 +        } else {
 144.200 +            // no SUMMARY format currently available to use
 144.201 +
 144.202 +            // use reflection to get at private fields
 144.203 +            Object DECL_NOT_STARTED = getField(null, Annotations.class, "DECL_NOT_STARTED");
 144.204 +            Object DECL_IN_PROGRESS = getField(null, Annotations.class, "DECL_IN_PROGRESS");
 144.205 +            Object attributes = getField(annotations, Annotations.class, "attributes");
 144.206 +            Object type_attributes = getField(annotations, Annotations.class, "type_attributes");
 144.207 +
 144.208 +            if (!showEmptyItems) {
 144.209 +                if (attributes instanceof List && ((List) attributes).isEmpty()
 144.210 +                        && attributes != DECL_NOT_STARTED
 144.211 +                        && attributes != DECL_IN_PROGRESS
 144.212 +                        && type_attributes instanceof List && ((List) type_attributes).isEmpty())
 144.213 +                    return;
 144.214 +            }
 144.215 +
 144.216 +            printString(label, hashString(annotations));
 144.217 +
 144.218 +            indent(+1);
 144.219 +            if (attributes == DECL_NOT_STARTED)
 144.220 +                printString("attributes", "DECL_NOT_STARTED");
 144.221 +            else if (attributes == DECL_IN_PROGRESS)
 144.222 +                printString("attributes", "DECL_IN_PROGRESS");
 144.223 +            else if (attributes instanceof List)
 144.224 +                printList("attributes", (List) attributes);
 144.225 +            else
 144.226 +                printObject("attributes", attributes, Details.SUMMARY);
 144.227 +
 144.228 +            if (attributes instanceof List)
 144.229 +                printList("type_attributes", (List) type_attributes);
 144.230 +            else
 144.231 +                printObject("type_attributes", type_attributes, Details.SUMMARY);
 144.232 +            indent(-1);
 144.233 +        }
 144.234 +    }
 144.235 +
 144.236 +    public void printAttribute(String label, Attribute attr) {
 144.237 +        if (attr == null) {
 144.238 +            printNull(label);
 144.239 +        } else {
 144.240 +            printString(label, attr.getClass().getSimpleName());
 144.241 +
 144.242 +            indent(+1);
 144.243 +            attr.accept(attrVisitor);
 144.244 +            indent(-1);
 144.245 +        }
 144.246 +    }
 144.247 +
 144.248 +    public void printFileObject(String label, FileObject fo) {
 144.249 +        if (fo == null) {
 144.250 +            printNull(label);
 144.251 +        } else {
 144.252 +            printString(label, fo.getName());
 144.253 +        }
 144.254 +    }
 144.255 +
 144.256 +    protected <T> void printImplClass(T item, Class<? extends T> stdImplClass) {
 144.257 +        if (item.getClass() != stdImplClass)
 144.258 +            printString("impl", item.getClass().getName());
 144.259 +    }
 144.260 +
 144.261 +    public void printInt(String label, int i) {
 144.262 +        printString(label, String.valueOf(i));
 144.263 +    }
 144.264 +
 144.265 +    public void printList(String label, List<?> list) {
 144.266 +        if (list == null) {
 144.267 +             printNull(label);
 144.268 +        } else if (!list.isEmpty() || showEmptyItems) {
 144.269 +            printString(label, "[" + list.size() + "]");
 144.270 +
 144.271 +            indent(+1);
 144.272 +            int i = 0;
 144.273 +            for (Object item: list) {
 144.274 +                printObject(String.valueOf(i++), item, Details.FULL);
 144.275 +            }
 144.276 +            indent(-1);
 144.277 +        }
 144.278 +    }
 144.279 +
 144.280 +    public void printName(String label, Name name) {
 144.281 +        if (name == null) {
 144.282 +            printNull(label);
 144.283 +        } else {
 144.284 +            printString(label, name.toString());
 144.285 +        }
 144.286 +    }
 144.287 +
 144.288 +    public void printNull(String label) {
 144.289 +        if (showNulls)
 144.290 +            printString(label, NULL);
 144.291 +    }
 144.292 +
 144.293 +    protected void printObject(String label, Object item, Details details) {
 144.294 +        if (item == null) {
 144.295 +            printNull(label);
 144.296 +        } else if (item instanceof Attribute) {
 144.297 +            printAttribute(label, (Attribute) item);
 144.298 +        } else if (item instanceof Symbol) {
 144.299 +            printSymbol(label, (Symbol) item, details);
 144.300 +        } else if (item instanceof Type) {
 144.301 +            printType(label, (Type) item, details);
 144.302 +        } else if (item instanceof JCTree) {
 144.303 +            printTree(label, (JCTree) item);
 144.304 +        } else if (item instanceof List) {
 144.305 +            printList(label, (List) item);
 144.306 +        } else if (item instanceof Name) {
 144.307 +            printName(label, (Name) item);
 144.308 +        } else {
 144.309 +            printString(label, String.valueOf(item));
 144.310 +        }
 144.311 +    }
 144.312 +
 144.313 +    public void printScope(String label, Scope scope) {
 144.314 +        printScope(label, scope, Details.FULL);
 144.315 +    }
 144.316 +
 144.317 +    public void printScope(String label, Scope scope, Details details) {
 144.318 +        if (scope == null) {
 144.319 +            printNull(label);
 144.320 +        } else {
 144.321 +            switch (details) {
 144.322 +                case SUMMARY: {
 144.323 +                    indent();
 144.324 +                    out.print(label);
 144.325 +                    out.print(": [");
 144.326 +                    String sep = "";
 144.327 +                    for (Symbol sym: scope.getElements()) {
 144.328 +                        out.print(sep);
 144.329 +                        out.print(sym.name);
 144.330 +                        sep = ",";
 144.331 +                    }
 144.332 +                    out.println("]");
 144.333 +                    break;
 144.334 +                }
 144.335 +
 144.336 +                case FULL: {
 144.337 +                    indent();
 144.338 +                    out.println(label);
 144.339 +
 144.340 +                    indent(+1);
 144.341 +                    printImplClass(scope, Scope.class);
 144.342 +                    printSymbol("owner", scope.owner, Details.SUMMARY);
 144.343 +                    printScope("next", scope.next, Details.SUMMARY);
 144.344 +                    printObject("shared", getField(scope, Scope.class, "shared"), Details.SUMMARY);
 144.345 +                    if (scope instanceof CompoundScope) {
 144.346 +                        printObject("subScopes",
 144.347 +                                getField(scope, CompoundScope.class, "subScopes"),
 144.348 +                                Details.FULL);
 144.349 +                    } else {
 144.350 +                        for (Symbol sym : scope.getElements()) {
 144.351 +                            printSymbol(sym.name.toString(), sym, Details.SUMMARY);
 144.352 +                        }
 144.353 +                    }
 144.354 +                    indent(-1);
 144.355 +                    break;
 144.356 +                }
 144.357 +            }
 144.358 +        }
 144.359 +    }
 144.360 +
 144.361 +    public void printSource(String label, JCTree tree) {
 144.362 +        printString(label, Pretty.toSimpleString(tree, maxSrcLength));
 144.363 +    }
 144.364 +
 144.365 +    public void printString(String label, String text) {
 144.366 +        indent();
 144.367 +        out.print(label);
 144.368 +        out.print(": ");
 144.369 +        out.print(text);
 144.370 +        out.println();
 144.371 +    }
 144.372 +
 144.373 +    public void printSymbol(String label, Symbol symbol) {
 144.374 +        printSymbol(label, symbol, Details.FULL);
 144.375 +    }
 144.376 +
 144.377 +    protected void printSymbol(String label, Symbol sym, Details details) {
 144.378 +        if (sym == null) {
 144.379 +            printNull(label);
 144.380 +        } else {
 144.381 +            switch (details) {
 144.382 +            case SUMMARY:
 144.383 +                printString(label, toString(sym));
 144.384 +                break;
 144.385 +
 144.386 +            case FULL:
 144.387 +                indent();
 144.388 +                out.print(label);
 144.389 +                out.println(": " +
 144.390 +                        info(sym.getClass(),
 144.391 +                            String.format("0x%x--%s", sym.kind, Kinds.kindName(sym)),
 144.392 +                            sym.getKind())
 144.393 +                        + " " + sym.name
 144.394 +                        + " " + hashString(sym));
 144.395 +
 144.396 +                indent(+1);
 144.397 +                if (showSrc) {
 144.398 +                    JCTree tree = (JCTree) trees.getTree(sym);
 144.399 +                    if (tree != null)
 144.400 +                        printSource("src", tree);
 144.401 +                }
 144.402 +                printString("flags", String.format("0x%x--%s",
 144.403 +                        sym.flags_field, Flags.toString(sym.flags_field)));
 144.404 +                printObject("completer", sym.completer, Details.SUMMARY); // what if too long?
 144.405 +                printSymbol("owner", sym.owner, Details.SUMMARY);
 144.406 +                printType("type", sym.type, Details.SUMMARY);
 144.407 +                printType("erasure", sym.erasure_field, Details.SUMMARY);
 144.408 +                sym.accept(symVisitor, null);
 144.409 +                printAnnotations("annotations", sym.annotations, Details.SUMMARY);
 144.410 +                indent(-1);
 144.411 +            }
 144.412 +        }
 144.413 +    }
 144.414 +
 144.415 +    protected String toString(Symbol sym) {
 144.416 +        return (printer != null) ? printer.visit(sym, locale) : String.valueOf(sym);
 144.417 +    }
 144.418 +
 144.419 +    protected void printTree(String label, JCTree tree) {
 144.420 +        if (tree == null) {
 144.421 +            printNull(label);
 144.422 +        } else {
 144.423 +            indent();
 144.424 +            String ext;
 144.425 +            try {
 144.426 +                ext = tree.getKind().name();
 144.427 +            } catch (Throwable t) {
 144.428 +                ext = "n/a";
 144.429 +            }
 144.430 +            out.print(label + ": " + info(tree.getClass(), tree.getTag(), ext));
 144.431 +            if (showPositions) {
 144.432 +                // We can always get start position, but to get end position
 144.433 +                // and/or line+offset, we would need a JCCompilationUnit
 144.434 +                out.print(" pos:" + tree.pos);
 144.435 +            }
 144.436 +            if (showTreeTypes && tree.type != null)
 144.437 +                out.print(" type:" + toString(tree.type));
 144.438 +            Symbol sym;
 144.439 +            if (showTreeSymbols && (sym = TreeInfo.symbolFor(tree)) != null)
 144.440 +                out.print(" sym:" + toString(sym));
 144.441 +            out.println();
 144.442 +
 144.443 +            indent(+1);
 144.444 +            if (showSrc) {
 144.445 +                indent();
 144.446 +                out.println("src: " + Pretty.toSimpleString(tree, maxSrcLength));
 144.447 +            }
 144.448 +            tree.accept(treeVisitor);
 144.449 +            indent(-1);
 144.450 +        }
 144.451 +    }
 144.452 +
 144.453 +    public void printType(String label, Type type) {
 144.454 +        printType(label, type, Details.FULL);
 144.455 +    }
 144.456 +
 144.457 +    protected void printType(String label, Type type, Details details) {
 144.458 +        if (type == null)
 144.459 +            printNull(label);
 144.460 +        else {
 144.461 +            switch (details) {
 144.462 +                case SUMMARY:
 144.463 +                    printString(label, toString(type));
 144.464 +                    break;
 144.465 +
 144.466 +                case FULL:
 144.467 +                    indent();
 144.468 +                    out.print(label);
 144.469 +                    out.println(": " + info(type.getClass(), type.getTag(), type.getKind())
 144.470 +                            + " " + hashString(type));
 144.471 +
 144.472 +                    indent(+1);
 144.473 +                    printSymbol("tsym", type.tsym, Details.SUMMARY);
 144.474 +                    printObject("constValue", type.constValue(), Details.SUMMARY);
 144.475 +                    type.accept(typeVisitor, null);
 144.476 +                    indent(-1);
 144.477 +            }
 144.478 +        }
 144.479 +    }
 144.480 +
 144.481 +    protected String toString(Type type) {
 144.482 +        return (printer != null) ? printer.visit(type, locale) : String.valueOf(type);
 144.483 +    }
 144.484 +
 144.485 +    protected String hashString(Object obj) {
 144.486 +        return String.format("#%x", obj.hashCode());
 144.487 +    }
 144.488 +
 144.489 +    protected String info(Class<?> clazz, Object internal, Object external) {
 144.490 +        return String.format("%s,%s,%s", clazz.getSimpleName(), internal, external);
 144.491 +    }
 144.492 +
 144.493 +    private int indent = 0;
 144.494 +
 144.495 +    protected void indent() {
 144.496 +        for (int i = 0; i < indent; i++) {
 144.497 +            out.print("  ");
 144.498 +        }
 144.499 +    }
 144.500 +
 144.501 +    protected void indent(int n) {
 144.502 +        indent += n;
 144.503 +    }
 144.504 +
 144.505 +    protected Object getField(Object o, Class<?> clazz, String name) {
 144.506 +        try {
 144.507 +            Field f = clazz.getDeclaredField(name);
 144.508 +            boolean prev = f.isAccessible();
 144.509 +            f.setAccessible(true);
 144.510 +            try {
 144.511 +                return f.get(o);
 144.512 +            } finally {
 144.513 +                f.setAccessible(prev);
 144.514 +            }
 144.515 +        } catch (ReflectiveOperationException e) {
 144.516 +            return e;
 144.517 +        } catch (SecurityException e) {
 144.518 +            return e;
 144.519 +        }
 144.520 +    }
 144.521 +
 144.522 +    // </editor-fold>
 144.523 +
 144.524 +    // <editor-fold defaultstate="collapsed" desc="JCTree visitor methods">
 144.525 +
 144.526 +    protected JCTree.Visitor treeVisitor = new TreeVisitor();
 144.527 +
 144.528 +    /**
 144.529 +     * Default visitor class for JCTree (AST) objects.
 144.530 +     */
 144.531 +    public class TreeVisitor extends JCTree.Visitor {
 144.532 +        @Override
 144.533 +        public void visitTopLevel(JCCompilationUnit tree) {
 144.534 +            printList("packageAnnotations", tree.packageAnnotations);
 144.535 +            printTree("pid", tree.pid);
 144.536 +            printList("defs", tree.defs);
 144.537 +        }
 144.538 +
 144.539 +        @Override
 144.540 +        public void visitImport(JCImport tree) {
 144.541 +            printTree("qualid", tree.qualid);
 144.542 +        }
 144.543 +
 144.544 +        @Override
 144.545 +        public void visitClassDef(JCClassDecl tree) {
 144.546 +            printName("name", tree.name);
 144.547 +            printTree("mods", tree.mods);
 144.548 +            printList("typarams", tree.typarams);
 144.549 +            printTree("extending", tree.extending);
 144.550 +            printList("implementing", tree.implementing);
 144.551 +            printList("defs", tree.defs);
 144.552 +        }
 144.553 +
 144.554 +        @Override
 144.555 +        public void visitMethodDef(JCMethodDecl tree) {
 144.556 +            printName("name", tree.name);
 144.557 +            printTree("mods", tree.mods);
 144.558 +            printTree("restype", tree.restype);
 144.559 +            printList("typarams", tree.typarams);
 144.560 +            printTree("recvparam", tree.recvparam);
 144.561 +            printList("params", tree.params);
 144.562 +            printList("thrown", tree.thrown);
 144.563 +            printTree("defaultValue", tree.defaultValue);
 144.564 +            printTree("body", tree.body);
 144.565 +        }
 144.566 +
 144.567 +        @Override
 144.568 +        public void visitVarDef(JCVariableDecl tree) {
 144.569 +            printName("name", tree.name);
 144.570 +            printTree("mods", tree.mods);
 144.571 +            printTree("vartype", tree.vartype);
 144.572 +            printTree("init", tree.init);
 144.573 +        }
 144.574 +
 144.575 +        @Override
 144.576 +        public void visitSkip(JCSkip tree) {
 144.577 +        }
 144.578 +
 144.579 +        @Override
 144.580 +        public void visitBlock(JCBlock tree) {
 144.581 +            printList("stats", tree.stats);
 144.582 +        }
 144.583 +
 144.584 +        @Override
 144.585 +        public void visitDoLoop(JCDoWhileLoop tree) {
 144.586 +            printTree("body", tree.body);
 144.587 +            printTree("cond", tree.cond);
 144.588 +        }
 144.589 +
 144.590 +        @Override
 144.591 +        public void visitWhileLoop(JCWhileLoop tree) {
 144.592 +            printTree("cond", tree.cond);
 144.593 +            printTree("body", tree.body);
 144.594 +        }
 144.595 +
 144.596 +        @Override
 144.597 +        public void visitForLoop(JCForLoop tree) {
 144.598 +            printList("init", tree.init);
 144.599 +            printTree("cond", tree.cond);
 144.600 +            printList("step", tree.step);
 144.601 +            printTree("body", tree.body);
 144.602 +        }
 144.603 +
 144.604 +        @Override
 144.605 +        public void visitForeachLoop(JCEnhancedForLoop tree) {
 144.606 +            printTree("var", tree.var);
 144.607 +            printTree("expr", tree.expr);
 144.608 +            printTree("body", tree.body);
 144.609 +        }
 144.610 +
 144.611 +        @Override
 144.612 +        public void visitLabelled(JCLabeledStatement tree) {
 144.613 +            printTree("body", tree.body);
 144.614 +        }
 144.615 +
 144.616 +        @Override
 144.617 +        public void visitSwitch(JCSwitch tree) {
 144.618 +            printTree("selector", tree.selector);
 144.619 +            printList("cases", tree.cases);
 144.620 +        }
 144.621 +
 144.622 +        @Override
 144.623 +        public void visitCase(JCCase tree) {
 144.624 +            printTree("pat", tree.pat);
 144.625 +            printList("stats", tree.stats);
 144.626 +        }
 144.627 +
 144.628 +        @Override
 144.629 +        public void visitSynchronized(JCSynchronized tree) {
 144.630 +            printTree("lock", tree.lock);
 144.631 +            printTree("body", tree.body);
 144.632 +        }
 144.633 +
 144.634 +        @Override
 144.635 +        public void visitTry(JCTry tree) {
 144.636 +            printList("resources", tree.resources);
 144.637 +            printTree("body", tree.body);
 144.638 +            printList("catchers", tree.catchers);
 144.639 +            printTree("finalizer", tree.finalizer);
 144.640 +        }
 144.641 +
 144.642 +        @Override
 144.643 +        public void visitCatch(JCCatch tree) {
 144.644 +            printTree("param", tree.param);
 144.645 +            printTree("body", tree.body);
 144.646 +        }
 144.647 +
 144.648 +        @Override
 144.649 +        public void visitConditional(JCConditional tree) {
 144.650 +            printTree("cond", tree.cond);
 144.651 +            printTree("truepart", tree.truepart);
 144.652 +            printTree("falsepart", tree.falsepart);
 144.653 +        }
 144.654 +
 144.655 +        @Override
 144.656 +        public void visitIf(JCIf tree) {
 144.657 +            printTree("cond", tree.cond);
 144.658 +            printTree("thenpart", tree.thenpart);
 144.659 +            printTree("elsepart", tree.elsepart);
 144.660 +        }
 144.661 +
 144.662 +        @Override
 144.663 +        public void visitExec(JCExpressionStatement tree) {
 144.664 +            printTree("expr", tree.expr);
 144.665 +        }
 144.666 +
 144.667 +        @Override
 144.668 +        public void visitBreak(JCBreak tree) {
 144.669 +            printName("label", tree.label);
 144.670 +        }
 144.671 +
 144.672 +        @Override
 144.673 +        public void visitContinue(JCContinue tree) {
 144.674 +            printName("label", tree.label);
 144.675 +        }
 144.676 +
 144.677 +        @Override
 144.678 +        public void visitReturn(JCReturn tree) {
 144.679 +            printTree("expr", tree.expr);
 144.680 +        }
 144.681 +
 144.682 +        @Override
 144.683 +        public void visitThrow(JCThrow tree) {
 144.684 +            printTree("expr", tree.expr);
 144.685 +        }
 144.686 +
 144.687 +        @Override
 144.688 +        public void visitAssert(JCAssert tree) {
 144.689 +            printTree("cond", tree.cond);
 144.690 +            printTree("detail", tree.detail);
 144.691 +        }
 144.692 +
 144.693 +        @Override
 144.694 +        public void visitApply(JCMethodInvocation tree) {
 144.695 +            printList("typeargs", tree.typeargs);
 144.696 +            printTree("meth", tree.meth);
 144.697 +            printList("args", tree.args);
 144.698 +        }
 144.699 +
 144.700 +        @Override
 144.701 +        public void visitNewClass(JCNewClass tree) {
 144.702 +            printTree("encl", tree.encl);
 144.703 +            printList("typeargs", tree.typeargs);
 144.704 +            printTree("clazz", tree.clazz);
 144.705 +            printList("args", tree.args);
 144.706 +            printTree("def", tree.def);
 144.707 +        }
 144.708 +
 144.709 +        @Override
 144.710 +        public void visitNewArray(JCNewArray tree) {
 144.711 +            printList("annotations", tree.annotations);
 144.712 +            printTree("elemtype", tree.elemtype);
 144.713 +            printList("dims", tree.dims);
 144.714 +            printList("dimAnnotations", tree.dimAnnotations);
 144.715 +            printList("elems", tree.elems);
 144.716 +        }
 144.717 +
 144.718 +        @Override
 144.719 +        public void visitLambda(JCLambda tree) {
 144.720 +            printTree("body", tree.body);
 144.721 +            printList("params", tree.params);
 144.722 +        }
 144.723 +
 144.724 +        @Override
 144.725 +        public void visitParens(JCParens tree) {
 144.726 +            printTree("expr", tree.expr);
 144.727 +        }
 144.728 +
 144.729 +        @Override
 144.730 +        public void visitAssign(JCAssign tree) {
 144.731 +            printTree("lhs", tree.lhs);
 144.732 +            printTree("rhs", tree.rhs);
 144.733 +        }
 144.734 +
 144.735 +        @Override
 144.736 +        public void visitAssignop(JCAssignOp tree) {
 144.737 +            printTree("lhs", tree.lhs);
 144.738 +            printTree("rhs", tree.rhs);
 144.739 +        }
 144.740 +
 144.741 +        @Override
 144.742 +        public void visitUnary(JCUnary tree) {
 144.743 +            printTree("arg", tree.arg);
 144.744 +        }
 144.745 +
 144.746 +        @Override
 144.747 +        public void visitBinary(JCBinary tree) {
 144.748 +            printTree("lhs", tree.lhs);
 144.749 +            printTree("rhs", tree.rhs);
 144.750 +        }
 144.751 +
 144.752 +        @Override
 144.753 +        public void visitTypeCast(JCTypeCast tree) {
 144.754 +            printTree("clazz", tree.clazz);
 144.755 +            printTree("expr", tree.expr);
 144.756 +        }
 144.757 +
 144.758 +        @Override
 144.759 +        public void visitTypeTest(JCInstanceOf tree) {
 144.760 +            printTree("expr", tree.expr);
 144.761 +            printTree("clazz", tree.clazz);
 144.762 +        }
 144.763 +
 144.764 +        @Override
 144.765 +        public void visitIndexed(JCArrayAccess tree) {
 144.766 +            printTree("indexed", tree.indexed);
 144.767 +            printTree("index", tree.index);
 144.768 +        }
 144.769 +
 144.770 +        @Override
 144.771 +        public void visitSelect(JCFieldAccess tree) {
 144.772 +            printTree("selected", tree.selected);
 144.773 +        }
 144.774 +
 144.775 +        @Override
 144.776 +        public void visitReference(JCMemberReference tree) {
 144.777 +            printTree("expr", tree.expr);
 144.778 +            printList("typeargs", tree.typeargs);
 144.779 +        }
 144.780 +
 144.781 +        @Override
 144.782 +        public void visitIdent(JCIdent tree) {
 144.783 +            printName("name", tree.name);
 144.784 +        }
 144.785 +
 144.786 +        @Override
 144.787 +        public void visitLiteral(JCLiteral tree) {
 144.788 +            printString("value", Pretty.toSimpleString(tree, 32));
 144.789 +        }
 144.790 +
 144.791 +        @Override
 144.792 +        public void visitTypeIdent(JCPrimitiveTypeTree tree) {
 144.793 +            printString("typetag", tree.typetag.name());
 144.794 +        }
 144.795 +
 144.796 +        @Override
 144.797 +        public void visitTypeArray(JCArrayTypeTree tree) {
 144.798 +            printTree("elemtype", tree.elemtype);
 144.799 +        }
 144.800 +
 144.801 +        @Override
 144.802 +        public void visitTypeApply(JCTypeApply tree) {
 144.803 +            printTree("clazz", tree.clazz);
 144.804 +            printList("arguments", tree.arguments);
 144.805 +        }
 144.806 +
 144.807 +        @Override
 144.808 +        public void visitTypeUnion(JCTypeUnion tree) {
 144.809 +            printList("alternatives", tree.alternatives);
 144.810 +        }
 144.811 +
 144.812 +        @Override
 144.813 +        public void visitTypeIntersection(JCTypeIntersection tree) {
 144.814 +            printList("bounds", tree.bounds);
 144.815 +        }
 144.816 +
 144.817 +        @Override
 144.818 +        public void visitTypeParameter(JCTypeParameter tree) {
 144.819 +            printName("name", tree.name);
 144.820 +            printList("annotations", tree.annotations);
 144.821 +            printList("bounds", tree.bounds);
 144.822 +        }
 144.823 +
 144.824 +        @Override
 144.825 +        public void visitWildcard(JCWildcard tree) {
 144.826 +            printTree("kind", tree.kind);
 144.827 +            printTree("inner", tree.inner);
 144.828 +        }
 144.829 +
 144.830 +        @Override
 144.831 +        public void visitTypeBoundKind(TypeBoundKind tree) {
 144.832 +            printString("kind", tree.kind.name());
 144.833 +        }
 144.834 +
 144.835 +        @Override
 144.836 +        public void visitModifiers(JCModifiers tree) {
 144.837 +            printList("annotations", tree.annotations);
 144.838 +            printString("flags", String.valueOf(Flags.asFlagSet(tree.flags)));
 144.839 +        }
 144.840 +
 144.841 +        @Override
 144.842 +        public void visitAnnotation(JCAnnotation tree) {
 144.843 +            printTree("annotationType", tree.annotationType);
 144.844 +            printList("args", tree.args);
 144.845 +        }
 144.846 +
 144.847 +        @Override
 144.848 +        public void visitAnnotatedType(JCAnnotatedType tree) {
 144.849 +            printList("annotations", tree.annotations);
 144.850 +            printTree("underlyingType", tree.underlyingType);
 144.851 +        }
 144.852 +
 144.853 +        @Override
 144.854 +        public void visitErroneous(JCErroneous tree) {
 144.855 +            printList("errs", tree.errs);
 144.856 +        }
 144.857 +
 144.858 +        @Override
 144.859 +        public void visitLetExpr(LetExpr tree) {
 144.860 +            printList("defs", tree.defs);
 144.861 +            printTree("expr", tree.expr);
 144.862 +        }
 144.863 +
 144.864 +        @Override
 144.865 +        public void visitTree(JCTree tree) {
 144.866 +            Assert.error();
 144.867 +        }
 144.868 +    }
 144.869 +
 144.870 +    // </editor-fold>
 144.871 +
 144.872 +    // <editor-fold defaultstate="collapsed" desc="Symbol visitor">
 144.873 +
 144.874 +    protected Symbol.Visitor<Void,Void> symVisitor = new SymbolVisitor();
 144.875 +
 144.876 +    /**
 144.877 +     * Default visitor class for Symbol objects.
 144.878 +     * Note: each visitXYZ method ends by calling the corresponding
 144.879 +     * visit method for its superclass.
 144.880 +     */
 144.881 +    class SymbolVisitor implements Symbol.Visitor<Void,Void> {
 144.882 +        @Override
 144.883 +        public Void visitClassSymbol(ClassSymbol sym, Void ignore) {
 144.884 +            printName("fullname", sym.fullname);
 144.885 +            printName("flatname", sym.flatname);
 144.886 +            printScope("members", sym.members_field);
 144.887 +            printFileObject("sourcefile", sym.sourcefile);
 144.888 +            printFileObject("classfile", sym.classfile);
 144.889 +            // trans-local?
 144.890 +            // pool?
 144.891 +            return visitTypeSymbol(sym, null);
 144.892 +        }
 144.893 +
 144.894 +        @Override
 144.895 +        public Void visitMethodSymbol(MethodSymbol sym, Void ignore) {
 144.896 +            // code
 144.897 +            printList("params", sym.params);
 144.898 +            printList("savedParameterNames", sym.savedParameterNames);
 144.899 +            return visitSymbol(sym, null);
 144.900 +        }
 144.901 +
 144.902 +        @Override
 144.903 +        public Void visitPackageSymbol(PackageSymbol sym, Void ignore) {
 144.904 +            printName("fullname", sym.fullname);
 144.905 +            printScope("members", sym.members_field);
 144.906 +            printSymbol("package-info", sym.package_info, Details.SUMMARY);
 144.907 +            return visitTypeSymbol(sym, null);
 144.908 +        }
 144.909 +
 144.910 +        @Override
 144.911 +        public Void visitOperatorSymbol(OperatorSymbol sym, Void ignore) {
 144.912 +            printInt("opcode", sym.opcode);
 144.913 +            return visitMethodSymbol(sym, null);
 144.914 +        }
 144.915 +
 144.916 +        @Override
 144.917 +        public Void visitVarSymbol(VarSymbol sym, Void ignore) {
 144.918 +            printInt("pos", sym.pos);
 144.919 +            printInt("adm", sym.adr);
 144.920 +            // data is a private field, and the standard accessors may
 144.921 +            // mutate it as part of lazy evaluation. Therefore, use
 144.922 +            // reflection to get the raw data.
 144.923 +            printObject("data", getField(sym, VarSymbol.class, "data"), Details.SUMMARY);
 144.924 +            return visitSymbol(sym, null);
 144.925 +        }
 144.926 +
 144.927 +        @Override
 144.928 +        public Void visitTypeSymbol(TypeSymbol sym, Void ignore) {
 144.929 +            return visitSymbol(sym, null);
 144.930 +        }
 144.931 +
 144.932 +        @Override
 144.933 +        public Void visitSymbol(Symbol sym, Void ignore) {
 144.934 +            return null;
 144.935 +        }
 144.936 +    }
 144.937 +
 144.938 +    // </editor-fold>
 144.939 +
 144.940 +    // <editor-fold defaultstate="collapsed" desc="Type visitor">
 144.941 +
 144.942 +    protected Type.Visitor<Void,Void> typeVisitor = new TypeVisitor();
 144.943 +
 144.944 +    /**
 144.945 +     * Default visitor class for Type objects.
 144.946 +     * Note: each visitXYZ method ends by calling the corresponding
 144.947 +     * visit method for its superclass.
 144.948 +     */
 144.949 +    public class TypeVisitor implements Type.Visitor<Void,Void> {
 144.950 +        public Void visitAnnotatedType(AnnotatedType type, Void ignore) {
 144.951 +            printList("typeAnnotations", type.typeAnnotations);
 144.952 +            printType("underlyingType", type.underlyingType, Details.FULL);
 144.953 +            return visitType(type, null);
 144.954 +        }
 144.955 +
 144.956 +        public Void visitArrayType(ArrayType type, Void ignore) {
 144.957 +            printType("elemType", type.elemtype, Details.FULL);
 144.958 +            return visitType(type, null);
 144.959 +        }
 144.960 +
 144.961 +        public Void visitCapturedType(CapturedType type, Void ignore) {
 144.962 +            printType("wildcard", type.wildcard, Details.FULL);
 144.963 +            return visitTypeVar(type, null);
 144.964 +        }
 144.965 +
 144.966 +        public Void visitClassType(ClassType type, Void ignore) {
 144.967 +            printType("outer", type.getEnclosingType(), Details.SUMMARY);
 144.968 +            printList("typarams", type.typarams_field);
 144.969 +            printList("allparams", type.allparams_field);
 144.970 +            printType("supertype", type.supertype_field, Details.SUMMARY);
 144.971 +            printList("interfaces", type.interfaces_field);
 144.972 +            printList("allinterfaces", type.all_interfaces_field);
 144.973 +            return visitType(type, null);
 144.974 +        }
 144.975 +
 144.976 +        public Void visitErrorType(ErrorType type, Void ignore) {
 144.977 +            printType("originalType", type.getOriginalType(), Details.FULL);
 144.978 +            return visitClassType(type, null);
 144.979 +        }
 144.980 +
 144.981 +        public Void visitForAll(ForAll type, Void ignore) {
 144.982 +            printList("tvars", type.tvars);
 144.983 +            return visitDelegatedType(type);
 144.984 +        }
 144.985 +
 144.986 +        public Void visitMethodType(MethodType type, Void ignore) {
 144.987 +            printList("argtypes", type.argtypes);
 144.988 +            printType("restype", type.restype, Details.FULL);
 144.989 +            printList("thrown", type.thrown);
 144.990 +            return visitType(type, null);
 144.991 +        }
 144.992 +
 144.993 +        public Void visitPackageType(PackageType type, Void ignore) {
 144.994 +            return visitType(type, null);
 144.995 +        }
 144.996 +
 144.997 +        public Void visitTypeVar(TypeVar type, Void ignore) {
 144.998 +            // For TypeVars (and not subtypes), the bound should always be
 144.999 +            // null or bot. So, only print the bound for subtypes of TypeVar,
144.1000 +            // or if the bound is (erroneously) not null or bot.
144.1001 +            if (!type.hasTag(TypeTag.TYPEVAR)
144.1002 +                    || !(type.bound == null || type.bound.hasTag(TypeTag.BOT))) {
144.1003 +                printType("bound", type.bound, Details.FULL);
144.1004 +            }
144.1005 +            printType("lower", type.lower, Details.FULL);
144.1006 +            return visitType(type, null);
144.1007 +        }
144.1008 +
144.1009 +        public Void visitUndetVar(UndetVar type, Void ignore) {
144.1010 +            for (UndetVar.InferenceBound ib: UndetVar.InferenceBound.values())
144.1011 +                printList("bounds." + ib, type.getBounds(ib));
144.1012 +            printInt("declaredCount", type.declaredCount);
144.1013 +            printType("inst", type.inst, Details.SUMMARY);
144.1014 +            return visitDelegatedType(type);
144.1015 +        }
144.1016 +
144.1017 +        public Void visitWildcardType(WildcardType type, Void ignore) {
144.1018 +            printType("type", type.type, Details.SUMMARY);
144.1019 +            printString("kind", type.kind.name());
144.1020 +            printType("bound", type.bound, Details.SUMMARY);
144.1021 +            return visitType(type, null);
144.1022 +        }
144.1023 +
144.1024 +        protected Void visitDelegatedType(DelegatedType type) {
144.1025 +            printType("qtype", type.qtype, Details.FULL);
144.1026 +            return visitType(type, null);
144.1027 +        }
144.1028 +
144.1029 +        public Void visitType(Type type, Void ignore) {
144.1030 +            return null;
144.1031 +        }
144.1032 +    }
144.1033 +
144.1034 +    // </editor-fold>
144.1035 +
144.1036 +    // <editor-fold defaultstate="collapsed" desc="Attribute (annotations) visitor">
144.1037 +
144.1038 +    protected Attribute.Visitor attrVisitor = new AttributeVisitor();
144.1039 +
144.1040 +    /**
144.1041 +     * Default visitor class for Attribute (annotation) objects.
144.1042 +     */
144.1043 +    public class AttributeVisitor implements Attribute.Visitor {
144.1044 +
144.1045 +        public void visitConstant(Attribute.Constant a) {
144.1046 +            printObject("value", a.value, Details.SUMMARY);
144.1047 +            visitAttribute(a);
144.1048 +        }
144.1049 +
144.1050 +        public void visitClass(Attribute.Class a) {
144.1051 +            printObject("classType", a.classType, Details.SUMMARY);
144.1052 +            visitAttribute(a);
144.1053 +        }
144.1054 +
144.1055 +        public void visitCompound(Attribute.Compound a) {
144.1056 +            if (a instanceof Attribute.TypeCompound) {
144.1057 +                Attribute.TypeCompound ta = (Attribute.TypeCompound) a;
144.1058 +                // consider a custom printer?
144.1059 +                printObject("position", ta.position, Details.SUMMARY);
144.1060 +            }
144.1061 +            printObject("synthesized", a.isSynthesized(), Details.SUMMARY);
144.1062 +            printList("values", a.values);
144.1063 +            visitAttribute(a);
144.1064 +        }
144.1065 +
144.1066 +        public void visitArray(Attribute.Array a) {
144.1067 +            printList("values", Arrays.asList(a.values));
144.1068 +            visitAttribute(a);
144.1069 +        }
144.1070 +
144.1071 +        public void visitEnum(Attribute.Enum a) {
144.1072 +            printSymbol("value", a.value, Details.SUMMARY);
144.1073 +            visitAttribute(a);
144.1074 +        }
144.1075 +
144.1076 +        public void visitError(Attribute.Error a) {
144.1077 +            visitAttribute(a);
144.1078 +        }
144.1079 +
144.1080 +        public void visitAttribute(Attribute a) {
144.1081 +            printType("type", a.type, Details.SUMMARY);
144.1082 +        }
144.1083 +
144.1084 +    }
144.1085 +    // </editor-fold>
144.1086 +
144.1087 +    // <editor-fold defaultstate="collapsed" desc="Utility front end">
144.1088 +
144.1089 +    /**
144.1090 +     * Utility class to invoke DPrinter from the command line.
144.1091 +     */
144.1092 +    static class Main {
144.1093 +        public static void main(String... args) throws IOException {
144.1094 +            Main m = new Main();
144.1095 +            PrintWriter out = new PrintWriter(System.out);
144.1096 +            try {
144.1097 +                if (args.length == 0)
144.1098 +                    m.usage(out);
144.1099 +                else
144.1100 +                    m.run(out, args);
144.1101 +            } finally {
144.1102 +                out.flush();
144.1103 +            }
144.1104 +        }
144.1105 +
144.1106 +        void usage(PrintWriter out) {
144.1107 +            out.println("Usage:");
144.1108 +            out.println("  java " + Main.class.getName() + " mode [options] [javac-options]");
144.1109 +            out.print("where mode is one of: ");
144.1110 +            String sep = "";
144.1111 +            for (Handler h: getHandlers().values()) {
144.1112 +                out.print(sep);
144.1113 +                out.print(h.name);
144.1114 +                sep = ", ";
144.1115 +            }
144.1116 +            out.println();
144.1117 +            out.println("and where options include:");
144.1118 +            out.println("  -before PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
144.1119 +            out.println("  -after PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
144.1120 +            out.println("  -showPositions");
144.1121 +            out.println("  -showSource");
144.1122 +            out.println("  -showTreeSymbols");
144.1123 +            out.println("  -showTreeTypes");
144.1124 +            out.println("  -hideEmptyItems");
144.1125 +            out.println("  -hideNulls");
144.1126 +        }
144.1127 +
144.1128 +        void run(PrintWriter out, String... args) throws IOException {
144.1129 +            JavaCompiler c = ToolProvider.getSystemJavaCompiler();
144.1130 +            StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
144.1131 +
144.1132 +            // DPrinter options
144.1133 +            final Set<TaskEvent.Kind> before = EnumSet.noneOf(TaskEvent.Kind.class);
144.1134 +            final Set<TaskEvent.Kind> after = EnumSet.noneOf(TaskEvent.Kind.class);
144.1135 +            boolean showPositions = false;
144.1136 +            boolean showSource = false;
144.1137 +            boolean showTreeSymbols = false;
144.1138 +            boolean showTreeTypes = false;
144.1139 +            boolean showEmptyItems = true;
144.1140 +            boolean showNulls = true;
144.1141 +
144.1142 +            // javac options
144.1143 +            Collection<String> options = new ArrayList<String>();
144.1144 +            Collection<File> files = new ArrayList<File>();
144.1145 +            String classpath = null;
144.1146 +            String classoutdir = null;
144.1147 +
144.1148 +            final Handler h = getHandlers().get(args[0]);
144.1149 +            if (h == null)
144.1150 +                throw new IllegalArgumentException(args[0]);
144.1151 +
144.1152 +            for (int i = 1; i < args.length; i++) {
144.1153 +                String arg = args[i];
144.1154 +                if (arg.equals("-before") && i + 1 < args.length) {
144.1155 +                    before.add(getKind(args[++i]));
144.1156 +                } else if (arg.equals("-after") && i + 1 < args.length) {
144.1157 +                    after.add(getKind(args[++i]));
144.1158 +                } else if (arg.equals("-showPositions")) {
144.1159 +                    showPositions = true;
144.1160 +                } else if (arg.equals("-showSource")) {
144.1161 +                    showSource = true;
144.1162 +                } else if (arg.equals("-showTreeSymbols")) {
144.1163 +                    showTreeSymbols = true;
144.1164 +                } else if (arg.equals("-showTreeTypes")) {
144.1165 +                    showTreeTypes = true;
144.1166 +                } else if (arg.equals("-hideEmptyLists")) {
144.1167 +                    showEmptyItems = false;
144.1168 +                } else if (arg.equals("-hideNulls")) {
144.1169 +                    showNulls = false;
144.1170 +                } else if (arg.equals("-classpath") && i + 1 < args.length) {
144.1171 +                    classpath = args[++i];
144.1172 +                } else if (arg.equals("-d") && i + 1 < args.length) {
144.1173 +                    classoutdir = args[++i];
144.1174 +                } else if (arg.startsWith("-")) {
144.1175 +                    int n = c.isSupportedOption(arg);
144.1176 +                    if (n < 0) throw new IllegalArgumentException(arg);
144.1177 +                    options.add(arg);
144.1178 +                    while (n > 0) options.add(args[++i]);
144.1179 +                } else if (arg.endsWith(".java")) {
144.1180 +                    files.add(new File(arg));
144.1181 +                }
144.1182 +            }
144.1183 +
144.1184 +            if (classoutdir != null) {
144.1185 +                fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(classoutdir)));
144.1186 +            }
144.1187 +
144.1188 +            if (classpath != null) {
144.1189 +                Collection<File> path = new ArrayList<File>();
144.1190 +                for (String p: classpath.split(File.pathSeparator)) {
144.1191 +                    if (p.isEmpty()) continue;
144.1192 +                    File f = new File(p);
144.1193 +                    if (f.exists()) path.add(f);
144.1194 +                }
144.1195 +                fm.setLocation(StandardLocation.CLASS_PATH, path);
144.1196 +            }
144.1197 +            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
144.1198 +
144.1199 +            JavacTask task = (JavacTask) c.getTask(out, fm, null, options, null, fos);
144.1200 +            final Trees trees = Trees.instance(task);
144.1201 +
144.1202 +            final DPrinter dprinter = new DPrinter(out, trees);
144.1203 +            dprinter.source(showSource)
144.1204 +                    .emptyItems(showEmptyItems)
144.1205 +                    .nulls(showNulls)
144.1206 +                    .positions(showPositions)
144.1207 +                    .treeSymbols(showTreeSymbols)
144.1208 +                    .treeTypes(showTreeTypes);
144.1209 +
144.1210 +            if (before.isEmpty() && after.isEmpty()) {
144.1211 +                if (h.name.equals("trees") && !showTreeSymbols && !showTreeTypes)
144.1212 +                    after.add(TaskEvent.Kind.PARSE);
144.1213 +                else
144.1214 +                    after.add(TaskEvent.Kind.ANALYZE);
144.1215 +            }
144.1216 +
144.1217 +            task.addTaskListener(new TaskListener() {
144.1218 +                public void started(TaskEvent e) {
144.1219 +                    if (before.contains(e.getKind()))
144.1220 +                        handle(e);
144.1221 +                }
144.1222 +
144.1223 +                public void finished(TaskEvent e) {
144.1224 +                    if (after.contains(e.getKind()))
144.1225 +                        handle(e);
144.1226 +                }
144.1227 +
144.1228 +                private void handle(TaskEvent e) {
144.1229 +                     switch (e.getKind()) {
144.1230 +                         case PARSE:
144.1231 +                         case ENTER:
144.1232 +                             h.handle(e.getSourceFile().getName(),
144.1233 +                                     (JCTree) e.getCompilationUnit(),
144.1234 +                                     dprinter);
144.1235 +                             break;
144.1236 +
144.1237 +                         default:
144.1238 +                             TypeElement elem = e.getTypeElement();
144.1239 +                             h.handle(elem.toString(),
144.1240 +                                     (JCTree) trees.getTree(elem),
144.1241 +                                     dprinter);
144.1242 +                             break;
144.1243 +                     }
144.1244 +                }
144.1245 +            });
144.1246 +
144.1247 +            task.call();
144.1248 +        }
144.1249 +
144.1250 +        TaskEvent.Kind getKind(String s) {
144.1251 +            return TaskEvent.Kind.valueOf(s.toUpperCase());
144.1252 +        }
144.1253 +
144.1254 +        static protected abstract class Handler {
144.1255 +            final String name;
144.1256 +            Handler(String name) {
144.1257 +                this.name = name;
144.1258 +            }
144.1259 +            abstract void handle(String label, JCTree tree, DPrinter dprinter);
144.1260 +        }
144.1261 +
144.1262 +        Map<String,Handler> getHandlers() {
144.1263 +            Map<String,Handler> map = new HashMap<String, Handler>();
144.1264 +            for (Handler h: defaultHandlers) {
144.1265 +                map.put(h.name, h);
144.1266 +            }
144.1267 +            return map;
144.1268 +        }
144.1269 +
144.1270 +        protected final Handler[] defaultHandlers = {
144.1271 +            new Handler("trees") {
144.1272 +                @Override
144.1273 +                void handle(String name, JCTree tree, DPrinter dprinter) {
144.1274 +                    dprinter.printTree(name, tree);
144.1275 +                    dprinter.out.println();
144.1276 +                }
144.1277 +            },
144.1278 +
144.1279 +            new Handler("symbols") {
144.1280 +                @Override
144.1281 +                void handle(String name, JCTree tree, final DPrinter dprinter) {
144.1282 +                    TreeScanner ds = new TreeScanner() {
144.1283 +                        @Override
144.1284 +                        public void visitClassDef(JCClassDecl tree) {
144.1285 +                            visitDecl(tree, tree.sym);
144.1286 +                            super.visitClassDef(tree);
144.1287 +                        }
144.1288 +
144.1289 +                        @Override
144.1290 +                        public void visitMethodDef(JCMethodDecl tree) {
144.1291 +                            visitDecl(tree, tree.sym);
144.1292 +                            super.visitMethodDef(tree);
144.1293 +                        }
144.1294 +
144.1295 +                        @Override
144.1296 +                        public void visitVarDef(JCVariableDecl tree) {
144.1297 +                            visitDecl(tree, tree.sym);
144.1298 +                            super.visitVarDef(tree);
144.1299 +                        }
144.1300 +
144.1301 +                        void visitDecl(JCTree tree, Symbol sym) {
144.1302 +                            dprinter.printSymbol(sym.name.toString(), sym);
144.1303 +                            dprinter.out.println();
144.1304 +                        }
144.1305 +                    };
144.1306 +                    ds.scan(tree);
144.1307 +                }
144.1308 +            },
144.1309 +
144.1310 +            new Handler("types") {
144.1311 +                @Override
144.1312 +                void handle(String name, JCTree tree, final DPrinter dprinter) {
144.1313 +                    TreeScanner ts = new TreeScanner() {
144.1314 +                        @Override
144.1315 +                        public void scan(JCTree tree) {
144.1316 +                            if (tree == null) {
144.1317 +                                return;
144.1318 +                            }
144.1319 +                            if (tree.type != null) {
144.1320 +                                String label = Pretty.toSimpleString(tree);
144.1321 +                                dprinter.printType(label, tree.type);
144.1322 +                                dprinter.out.println();
144.1323 +                            }
144.1324 +                            super.scan(tree);
144.1325 +                        }
144.1326 +                    };
144.1327 +                    ts.scan(tree);
144.1328 +                }
144.1329 +            }
144.1330 +        };
144.1331 +    }
144.1332 +
144.1333 +    // </editor-fold>
144.1334 +
144.1335 +}
   145.1 --- a/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java	Mon Feb 04 18:08:53 2013 -0500
   145.2 +++ b/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java	Sun Feb 17 16:44:55 2013 -0500
   145.3 @@ -41,14 +41,20 @@
   145.4   *
   145.5   * If the property is not set the class will use a heuristic to determine the
   145.6   * maximum number of threads that can be fired to execute a given test.
   145.7 + *
   145.8 + * This code will have to be revisited if jprt starts using concurrency for
   145.9 + * for running jtreg tests.
  145.10   */
  145.11  public abstract class JavacTestingAbstractThreadedTest {
  145.12  
  145.13 +    protected static AtomicInteger numberOfThreads = new AtomicInteger();
  145.14 +
  145.15      protected static int getThreadPoolSize() {
  145.16          Integer testConc = Integer.getInteger("test.concurrency");
  145.17          if (testConc != null) return testConc;
  145.18          int cores = Runtime.getRuntime().availableProcessors();
  145.19 -        return Math.max(2, Math.min(8, cores / 2));
  145.20 +        numberOfThreads.set(Math.max(2, Math.min(8, cores / 2)));
  145.21 +        return numberOfThreads.get();
  145.22      }
  145.23  
  145.24      protected static void checkAfterExec() throws InterruptedException {
  145.25 @@ -82,11 +88,18 @@
  145.26          } else if (printCheckCount) {
  145.27              outWriter.println("Total check executed: " + checkCount.get());
  145.28          }
  145.29 +        /*
  145.30 +         * This output is for supporting debugging. It does not mean that a given
  145.31 +         * test had executed that number of threads concurrently. The value printed
  145.32 +         * here is the maximum possible amount.
  145.33 +         */
  145.34          closePrinters();
  145.35          if (printAll) {
  145.36              System.out.println(errSWriter.toString());
  145.37              System.out.println(outSWriter.toString());
  145.38          }
  145.39 +        System.out.println("Total number of threads in thread pool: " +
  145.40 +                numberOfThreads.get());
  145.41      }
  145.42  
  145.43      protected static void closePrinters() {
   146.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   146.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/ElementRepAnnoTester.java	Sun Feb 17 16:44:55 2013 -0500
   146.3 @@ -0,0 +1,555 @@
   146.4 +/*
   146.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   146.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   146.7 + *
   146.8 + * This code is free software; you can redistribute it and/or modify it
   146.9 + * under the terms of the GNU General Public License version 2 only, as
  146.10 + * published by the Free Software Foundation.
  146.11 + *
  146.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  146.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  146.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  146.15 + * version 2 for more details (a copy is included in the LICENSE file that
  146.16 + * accompanied this code).
  146.17 + *
  146.18 + * You should have received a copy of the GNU General Public License version
  146.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  146.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  146.21 + *
  146.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  146.23 + * or visit www.oracle.com if you need additional information or have any
  146.24 + * questions.
  146.25 + */
  146.26 +
  146.27 +import java.lang.annotation.Annotation;
  146.28 +import java.util.Arrays;
  146.29 +import java.util.EnumSet;
  146.30 +import java.util.List;
  146.31 +import java.util.Set;
  146.32 +import javax.annotation.processing.*;
  146.33 +import javax.lang.model.element.*;
  146.34 +import javax.lang.model.type.MirroredTypeException;
  146.35 +import javax.lang.model.type.TypeMirror;
  146.36 +import javax.lang.model.util.Elements;
  146.37 +
  146.38 +public class ElementRepAnnoTester extends JavacTestingAbstractProcessor {
  146.39 +    // All methods to test.
  146.40 +    final EnumSet<TestMethod> ALL_TEST_METHODS = EnumSet.allOf(TestMethod.class);
  146.41 +    int count = 0;
  146.42 +    int error = 0;
  146.43 +
  146.44 +    public boolean process(Set<? extends TypeElement> annotations,
  146.45 +            RoundEnvironment roundEnv) {
  146.46 +        if (!roundEnv.processingOver()) {
  146.47 +            List<String> superClass = Arrays.asList("A", "B", "C", "D", "E",
  146.48 +                    "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P");
  146.49 +            // Go through all test classes
  146.50 +            for (Element element : roundEnv.getRootElements()) {
  146.51 +                // For now, no testing super classes (TODO)
  146.52 +                if (element.getKind() == ElementKind.CLASS
  146.53 +                        && !superClass.contains(element.getSimpleName().toString())) {
  146.54 +                    // Compare expected and actual values from methods.
  146.55 +                    checkAnnoValues(element, ALL_TEST_METHODS);
  146.56 +                    // Now, look for enclosed elements in test classes.
  146.57 +                    for (Element elements : element.getEnclosedElements()) {
  146.58 +                        // Look for Methods annotations.
  146.59 +                        if (elements.getKind() == ElementKind.METHOD
  146.60 +                                && elements.getSimpleName().toString().equals("testMethod")) {
  146.61 +                            checkAnnoValues(elements, ALL_TEST_METHODS);
  146.62 +                        }
  146.63 +                        // Look for Field annotations.
  146.64 +                        if (elements.getKind() == ElementKind.FIELD
  146.65 +                                && elements.getSimpleName().toString().equals("testField")) {
  146.66 +                            checkAnnoValues(elements, ALL_TEST_METHODS);
  146.67 +                        }
  146.68 +                    }
  146.69 +                }
  146.70 +            }
  146.71 +
  146.72 +            if (error != 0) {
  146.73 +                System.out.println("Total tests : " + count);
  146.74 +                System.out.println("Total test failures : " + error);
  146.75 +                throw new RuntimeException();
  146.76 +            } else {
  146.77 +                System.out.println("ALL TESTS PASSED. " + count);
  146.78 +            }
  146.79 +        }
  146.80 +        return true;
  146.81 +    }
  146.82 +
  146.83 +    enum TestMethod {
  146.84 +        getAnnotation,
  146.85 +        getAnnotationsByType,
  146.86 +        getAllAnnotationMirrors,
  146.87 +        getAnnotationMirrors
  146.88 +    }
  146.89 +
  146.90 +    protected void checkAnnoValues(Element element, EnumSet<TestMethod> testMethods) {
  146.91 +        boolean baseAnnoPresent = false;
  146.92 +        boolean conAnnoPresent = false;
  146.93 +        ExpectedBase eb = null;
  146.94 +        ExpectedContainer ec = null;
  146.95 +        // Getting the expected values to compare with.
  146.96 +        eb = element.getAnnotation(ExpectedBase.class);
  146.97 +        ec = element.getAnnotation(ExpectedContainer.class);
  146.98 +
  146.99 +        if (eb == null) {
 146.100 +            System.out.println("Did not find ExpectedBase Annotation in  "
 146.101 +                    + element.getSimpleName().toString() + ", Test will exit");
 146.102 +            throw new RuntimeException();
 146.103 +        }
 146.104 +        if (ec == null) {
 146.105 +            System.out.println("Did not find ExpectedContainer Annotation in "
 146.106 +                    + element.getSimpleName().toString() + " Test will exit");
 146.107 +            throw new RuntimeException();
 146.108 +        }
 146.109 +        // Look if all test cases have ExpectedBase and ExpectedContainer values().
 146.110 +        TypeMirror valueBase = null;
 146.111 +        TypeMirror valueCon = null;
 146.112 +
 146.113 +        try {
 146.114 +            eb.value();
 146.115 +        } catch (MirroredTypeException mte) {
 146.116 +            valueBase = mte.getTypeMirror();
 146.117 +        }
 146.118 +
 146.119 +        try {
 146.120 +            ec.value();
 146.121 +        } catch (MirroredTypeException mte1) {
 146.122 +            valueCon = mte1.getTypeMirror();
 146.123 +        }
 146.124 +
 146.125 +        String expectedBaseAnno = valueBase.toString();
 146.126 +        String expectedConAnno = valueCon.toString();
 146.127 +
 146.128 +        if (!expectedBaseAnno.equals("java.lang.annotation.Annotation")) {
 146.129 +            baseAnnoPresent = true;
 146.130 +        }
 146.131 +        if (!expectedConAnno.equalsIgnoreCase("java.lang.annotation.Annotation")) {
 146.132 +            conAnnoPresent = true;
 146.133 +        }
 146.134 +
 146.135 +        // Look into TestMethod and compare method's output with expected values.
 146.136 +        for (TestMethod testMethod : testMethods) {
 146.137 +            boolean isBasePass = true;
 146.138 +            boolean isConPass = true;
 146.139 +
 146.140 +            switch (testMethod) {
 146.141 +                case getAnnotation:
 146.142 +                    if (baseAnnoPresent) {
 146.143 +                        count++;
 146.144 +                        Annotation actualAnno = getAnnotationBase(element);
 146.145 +                        String expectedAnno = eb.getAnnotation();
 146.146 +                        isBasePass = compareAnnotation(actualAnno, expectedAnno);
 146.147 +                    }
 146.148 +                    if (conAnnoPresent) {
 146.149 +                        count++;
 146.150 +                        Annotation actualAnno = getAnnotationContainer(element);
 146.151 +                        String expectedAnno = ec.getAnnotation();
 146.152 +                        isConPass = compareAnnotation(actualAnno, expectedAnno);
 146.153 +                    }
 146.154 +                    if (!isBasePass || !isConPass) {
 146.155 +                        System.out.println("FAIL in " + element.getSimpleName()
 146.156 +                                + "-" + element.getKind()
 146.157 +                                + " method: getAnnotation(class <T>)");
 146.158 +                        error++;
 146.159 +                    }
 146.160 +                    break;
 146.161 +
 146.162 +                case getAnnotationMirrors:
 146.163 +                    if (baseAnnoPresent) {
 146.164 +                        count++;
 146.165 +                        List<? extends AnnotationMirror> actualDeclAnnos =
 146.166 +                                element.getAnnotationMirrors();
 146.167 +                        String[] expectedAnnos = eb.getAnnotationMirrors();
 146.168 +                        isBasePass = compareArrVals(actualDeclAnnos, expectedAnnos);
 146.169 +                    }
 146.170 +                    if (conAnnoPresent) {
 146.171 +                        isConPass = true;
 146.172 +                    }
 146.173 +                    if (!isBasePass || !isConPass) {
 146.174 +                        System.out.println("FAIL in " + element.getSimpleName()
 146.175 +                                + "-" + element.getKind()
 146.176 +                                + " method: getAnnotationMirrors()");
 146.177 +                        error++;
 146.178 +                    }
 146.179 +                    break;
 146.180 +
 146.181 +                case getAnnotationsByType:
 146.182 +                    if (baseAnnoPresent) {
 146.183 +                        count++;
 146.184 +                        Annotation[] actualAnnosArgs = getAnnotationsBase(element);
 146.185 +                        String[] expectedAnnos = eb.getAnnotationsByType();
 146.186 +                        isBasePass = compareArrVals(actualAnnosArgs, expectedAnnos);
 146.187 +                    }
 146.188 +                    if (conAnnoPresent) {
 146.189 +                        count++;
 146.190 +                        Annotation[] actualAnnosArgs = getAnnotationsContainer(element);
 146.191 +                        String[] expectedAnnos = ec.getAnnotationsByType();
 146.192 +                        isConPass = compareArrVals(actualAnnosArgs, expectedAnnos);
 146.193 +                    }
 146.194 +                    if (!isBasePass || !isConPass) {
 146.195 +                        System.out.println("FAIL in " + element.getSimpleName()
 146.196 +                                + "-" + element.getKind()
 146.197 +                                + " method: getAnnotationsByType(class <T>)");
 146.198 +                        error++;
 146.199 +                    }
 146.200 +                    break;
 146.201 +
 146.202 +                case getAllAnnotationMirrors:
 146.203 +                    if (baseAnnoPresent) {
 146.204 +                        count++;
 146.205 +                        Elements elements = processingEnv.getElementUtils();
 146.206 +                        List<? extends AnnotationMirror> actualAnnosMirrors =
 146.207 +                                elements.getAllAnnotationMirrors(element);
 146.208 +                        String[] expectedAnnos = eb.getAllAnnotationMirrors();
 146.209 +                        isBasePass = compareArrVals(actualAnnosMirrors, expectedAnnos);
 146.210 +                    }
 146.211 +                    if (conAnnoPresent) {
 146.212 +                        isConPass = true;
 146.213 +                    }
 146.214 +                    if (!isBasePass || !isConPass) {
 146.215 +                        System.out.println("FAIL in " + element.getSimpleName()
 146.216 +                                + "-" + element.getKind()
 146.217 +                                + " method: getAllAnnotationMirrors(e)");
 146.218 +                        error++;
 146.219 +                    }
 146.220 +                    break;
 146.221 +            }
 146.222 +        }
 146.223 +    }
 146.224 +    // Sort tests to be run with different anno processors.
 146.225 +    final List<String> singularAnno = Arrays.asList(
 146.226 +            "SingularBasicTest"
 146.227 +            );
 146.228 +    final List<String> singularInheritedAnno = Arrays.asList(
 146.229 +            "SingularInheritedATest"
 146.230 +            );
 146.231 +    final List<String> repeatableAnno = Arrays.asList(
 146.232 +            "RepeatableBasicTest",
 146.233 +            "MixRepeatableAndOfficialContainerBasicTest",
 146.234 +            "OfficialContainerBasicTest",
 146.235 +            "RepeatableOfficialContainerBasicTest"
 146.236 +            );
 146.237 +    final List<String> repeatableInheritedAnno = Arrays.asList(
 146.238 +            "RepeatableInheritedTest",
 146.239 +            "RepeatableOverrideATest",
 146.240 +            "RepeatableOverrideBTest",
 146.241 +            "OfficialContainerInheritedTest",
 146.242 +            "MixRepeatableAndOfficialContainerInheritedA1Test",
 146.243 +            "MixRepeatableAndOfficialContainerInheritedB1Test",
 146.244 +            "MixRepeatableAndOfficialContainerInheritedA2Test",
 146.245 +            "MixRepeatableAndOfficialContainerInheritedB2Test"
 146.246 +            );
 146.247 +    final List<String> repeatableContainerInheritedAnno = Arrays.asList(
 146.248 +            "RepeatableOfficialContainerInheritedTest"
 146.249 +            );
 146.250 +    final List<String> unofficialAnno = Arrays.asList(
 146.251 +            "UnofficialContainerBasicTest",
 146.252 +            "MixSingularAndUnofficialContainerBasicTest"
 146.253 +            );
 146.254 +    final List<String> unofficialInheritedAnno = Arrays.asList(
 146.255 +            "UnofficialContainerInheritedTest",
 146.256 +            "SingularInheritedBTest",
 146.257 +            "MixSingularAndUnofficialContainerInheritedA1Test",
 146.258 +            "MixSingularAndUnofficialContainerInheritedB1Test",
 146.259 +            "MixSingularAndUnofficialContainerInheritedA2Test",
 146.260 +            "MixSingularAndUnofficialContainerInheritedB2Test"
 146.261 +            );
 146.262 +    // Respective container annotation for the different test cases to test.
 146.263 +    final List<String> repeatableAnnoContainer = repeatableAnno;
 146.264 +    final List<String> repeatableInheritedAnnoContainer = repeatableInheritedAnno;
 146.265 +    final List<String> repeatableContainerInheritedAnnoContainer =
 146.266 +            repeatableContainerInheritedAnno;
 146.267 +    final List<String> unofficialAnnoContainer = unofficialAnno;
 146.268 +    final List<String> unofficialInheritedAnnoContainer = unofficialInheritedAnno;
 146.269 +
 146.270 +    // Variables to verify if all test cases have been run.
 146.271 +    private Annotation specialAnno = new Annotation() {
 146.272 +       @Override
 146.273 +        public Class annotationType() {
 146.274 +            return null;
 146.275 +        }
 146.276 +    };
 146.277 +    private Annotation[] specialAnnoArray = new Annotation[1];
 146.278 +    private List<AnnotationMirror> specialAnnoMirrors =
 146.279 +            new java.util.ArrayList<AnnotationMirror>(2);
 146.280 +
 146.281 +    private Annotation getAnnotationBase(Element e) {
 146.282 +        Annotation actualAnno = specialAnno;
 146.283 +
 146.284 +        if (singularAnno.contains(
 146.285 +                e.getEnclosingElement().toString())
 146.286 +                || singularAnno.contains(
 146.287 +                e.getSimpleName().toString())
 146.288 +                || unofficialAnno.contains(
 146.289 +                e.getEnclosingElement().toString())
 146.290 +                || unofficialAnno.contains(
 146.291 +                e.getSimpleName().toString())) {
 146.292 +            actualAnno = e.getAnnotation(Foo.class);
 146.293 +        }
 146.294 +        if (singularInheritedAnno.contains(
 146.295 +                e.getEnclosingElement().toString())
 146.296 +                || singularInheritedAnno.contains(
 146.297 +                e.getSimpleName().toString())
 146.298 +                || unofficialInheritedAnno.contains(
 146.299 +                e.getEnclosingElement().toString())
 146.300 +                || unofficialInheritedAnno.contains(
 146.301 +                e.getSimpleName().toString())) {
 146.302 +            actualAnno = e.getAnnotation(FooInherited.class);
 146.303 +        }
 146.304 +        if (repeatableAnno.contains(
 146.305 +                e.getEnclosingElement().toString())
 146.306 +                || repeatableAnno.contains(
 146.307 +                e.getSimpleName().toString())) {
 146.308 +            actualAnno = e.getAnnotation(Bar.class);
 146.309 +        }
 146.310 +        if (repeatableInheritedAnno.contains(
 146.311 +                e.getEnclosingElement().toString())
 146.312 +                || repeatableInheritedAnno.contains(
 146.313 +                e.getSimpleName().toString())) {
 146.314 +            actualAnno = e.getAnnotation(BarInherited.class);
 146.315 +        }
 146.316 +        if (repeatableContainerInheritedAnno.contains(
 146.317 +                e.getEnclosingElement().toString())
 146.318 +                || repeatableContainerInheritedAnno.contains(
 146.319 +                e.getSimpleName().toString())) {
 146.320 +            actualAnno = e.getAnnotation(BarInheritedContainer.class);
 146.321 +        }
 146.322 +        return actualAnno;
 146.323 +    }
 146.324 +
 146.325 +    private Annotation getAnnotationContainer(Element e) {
 146.326 +        Annotation actualAnno = specialAnno;
 146.327 +
 146.328 +        if (repeatableAnnoContainer.contains(
 146.329 +                e.getEnclosingElement().toString())
 146.330 +                || repeatableAnnoContainer.contains(
 146.331 +                e.getSimpleName().toString())) {
 146.332 +            actualAnno = e.getAnnotation(BarContainer.class);
 146.333 +        }
 146.334 +        if (repeatableInheritedAnnoContainer.contains(
 146.335 +                e.getEnclosingElement().toString())
 146.336 +                || repeatableInheritedAnnoContainer.contains(
 146.337 +                e.getSimpleName().toString())) {
 146.338 +            actualAnno = e.getAnnotation(BarInheritedContainer.class);
 146.339 +        }
 146.340 +        if (repeatableContainerInheritedAnnoContainer.contains(
 146.341 +                e.getEnclosingElement().toString())
 146.342 +                || repeatableContainerInheritedAnnoContainer.contains(
 146.343 +                e.getSimpleName().toString())) {
 146.344 +            actualAnno = e.getAnnotation(BarInheritedContainerContainer.class);
 146.345 +        }
 146.346 +        if (unofficialAnnoContainer.contains(
 146.347 +                e.getEnclosingElement().toString())
 146.348 +                || unofficialAnnoContainer.contains(
 146.349 +                e.getSimpleName().toString())) {
 146.350 +            actualAnno = e.getAnnotation(UnofficialContainer.class);
 146.351 +        }
 146.352 +        if (unofficialInheritedAnnoContainer.contains(
 146.353 +                e.getEnclosingElement().toString())
 146.354 +                || unofficialInheritedAnnoContainer.contains(
 146.355 +                e.getSimpleName().toString())) {
 146.356 +            actualAnno = e.getAnnotation(UnofficialInheritedContainer.class);
 146.357 +        }
 146.358 +        return actualAnno;
 146.359 +    }
 146.360 +
 146.361 +    private Annotation[] getAnnotationsBase(Element e) {
 146.362 +        Annotation[] actualAnnosArgs = specialAnnoArray;
 146.363 +
 146.364 +        if (singularAnno.contains(
 146.365 +                e.getEnclosingElement().toString())
 146.366 +                || singularAnno.contains(
 146.367 +                e.getSimpleName().toString())
 146.368 +                || unofficialAnno.contains(
 146.369 +                e.getEnclosingElement().toString())
 146.370 +                || unofficialAnno.contains(
 146.371 +                e.getSimpleName().toString())) {
 146.372 +            actualAnnosArgs = e.getAnnotationsByType(Foo.class);
 146.373 +        }
 146.374 +        if (singularInheritedAnno.contains(
 146.375 +                e.getEnclosingElement().toString())
 146.376 +                || singularInheritedAnno.contains(
 146.377 +                e.getSimpleName().toString())
 146.378 +                || unofficialInheritedAnno.contains(
 146.379 +                e.getEnclosingElement().toString())
 146.380 +                || unofficialInheritedAnno.contains(
 146.381 +                e.getSimpleName().toString())) {
 146.382 +            actualAnnosArgs = e.getAnnotationsByType(FooInherited.class);
 146.383 +        }
 146.384 +        if (repeatableAnno.contains(
 146.385 +                e.getEnclosingElement().toString())
 146.386 +                || repeatableAnno.contains(
 146.387 +                e.getSimpleName().toString())) {
 146.388 +            actualAnnosArgs = e.getAnnotationsByType(Bar.class);
 146.389 +        }
 146.390 +        if (repeatableInheritedAnno.contains(
 146.391 +                e.getEnclosingElement().toString())
 146.392 +                || repeatableInheritedAnno.contains(
 146.393 +                e.getSimpleName().toString())) {
 146.394 +            actualAnnosArgs = e.getAnnotationsByType(BarInherited.class);
 146.395 +        }
 146.396 +        if (repeatableContainerInheritedAnno.contains(
 146.397 +                e.getEnclosingElement().toString())
 146.398 +                || repeatableContainerInheritedAnno.contains(
 146.399 +                e.getSimpleName().toString())) {
 146.400 +            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainer.class);
 146.401 +        }
 146.402 +        return actualAnnosArgs;
 146.403 +    }
 146.404 +
 146.405 +    private Annotation[] getAnnotationsContainer(Element e) {
 146.406 +        Annotation[] actualAnnosArgs = specialAnnoArray;
 146.407 +
 146.408 +        if (repeatableAnnoContainer.contains(
 146.409 +                e.getEnclosingElement().toString())
 146.410 +                || repeatableAnnoContainer.contains(
 146.411 +                e.getSimpleName().toString())) {
 146.412 +            actualAnnosArgs = e.getAnnotationsByType(BarContainer.class);
 146.413 +        }
 146.414 +        if (repeatableInheritedAnnoContainer.contains(
 146.415 +                e.getEnclosingElement().toString())
 146.416 +                || repeatableInheritedAnnoContainer.contains(
 146.417 +                e.getSimpleName().toString())) {
 146.418 +            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainer.class);
 146.419 +        }
 146.420 +        if (repeatableContainerInheritedAnnoContainer.contains(
 146.421 +                e.getEnclosingElement().toString())
 146.422 +                || repeatableContainerInheritedAnnoContainer.contains(
 146.423 +                e.getSimpleName().toString())) {
 146.424 +            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainerContainer.class);
 146.425 +        }
 146.426 +        if (unofficialAnnoContainer.contains(
 146.427 +                e.getEnclosingElement().toString())
 146.428 +                || unofficialAnnoContainer.contains(
 146.429 +                e.getSimpleName().toString())) {
 146.430 +            actualAnnosArgs = e.getAnnotationsByType(UnofficialContainer.class);
 146.431 +        }
 146.432 +        if (unofficialInheritedAnnoContainer.contains(
 146.433 +                e.getEnclosingElement().toString())
 146.434 +                || unofficialInheritedAnnoContainer.contains(
 146.435 +                e.getSimpleName().toString())) {
 146.436 +            actualAnnosArgs = e.getAnnotationsByType(UnofficialInheritedContainer.class);
 146.437 +        }
 146.438 +        return actualAnnosArgs;
 146.439 +    }
 146.440 +
 146.441 +    // Array comparison: Length should be same and all expected values
 146.442 +    // should be present in actualAnnos[].
 146.443 +    private boolean compareArrVals(Annotation[] actualAnnos, String[] expectedAnnos) {
 146.444 +        // Look if test case was run.
 146.445 +        if (actualAnnos == specialAnnoArray) {
 146.446 +            return false; // no testcase matches
 146.447 +        }
 146.448 +        if (actualAnnos.length != expectedAnnos.length) {
 146.449 +            System.out.println("Length not same. "
 146.450 +                    + " actualAnnos length = " + actualAnnos.length
 146.451 +                    + " expectedAnnos length = " + expectedAnnos.length);
 146.452 +            printArrContents(actualAnnos);
 146.453 +            printArrContents(expectedAnnos);
 146.454 +            return false;
 146.455 +        } else {
 146.456 +            int i = 0;
 146.457 +            String[] actualArr = new String[actualAnnos.length];
 146.458 +            for (Annotation a : actualAnnos) {
 146.459 +                actualArr[i++] = a.toString();
 146.460 +            }
 146.461 +            List<String> actualList = Arrays.asList(actualArr);
 146.462 +            List<String> expectedList = Arrays.asList(expectedAnnos);
 146.463 +
 146.464 +            if (!actualList.containsAll(expectedList)) {
 146.465 +                System.out.println("Array values are not same");
 146.466 +                printArrContents(actualAnnos);
 146.467 +                printArrContents(expectedAnnos);
 146.468 +                return false;
 146.469 +            }
 146.470 +        }
 146.471 +        return true;
 146.472 +    }
 146.473 +
 146.474 +    // Array comparison: Length should be same and all expected values
 146.475 +    // should be present in actualAnnos List<?>.
 146.476 +    private boolean compareArrVals(List<? extends AnnotationMirror> actualAnnos,
 146.477 +            String[] expectedAnnos) {
 146.478 +        // Look if test case was run.
 146.479 +        if (actualAnnos == specialAnnoMirrors) {
 146.480 +            return false; //no testcase run
 146.481 +        }
 146.482 +        if (actualAnnos.size() != expectedAnnos.length) {
 146.483 +            System.out.println("Length not same. "
 146.484 +                    + " actualAnnos length = " + actualAnnos.size()
 146.485 +                    + " expectedAnnos length = " + expectedAnnos.length);
 146.486 +            printArrContents(actualAnnos);
 146.487 +            printArrContents(expectedAnnos);
 146.488 +            return false;
 146.489 +        } else {
 146.490 +            int i = 0;
 146.491 +            String[] actualArr = new String[actualAnnos.size()];
 146.492 +            String annoTypeName = "";
 146.493 +            for (AnnotationMirror annotationMirror : actualAnnos) {
 146.494 +                if (annotationMirror.getAnnotationType().toString().contains("Expected")) {
 146.495 +                    annoTypeName = annotationMirror.getAnnotationType().toString();
 146.496 +                } else {
 146.497 +                     annoTypeName = annotationMirror.toString();
 146.498 +                }
 146.499 +                actualArr[i++] = annoTypeName;
 146.500 +            }
 146.501 +            List<String> actualList = Arrays.asList(actualArr);
 146.502 +            List<String> expectedList = Arrays.asList(expectedAnnos);
 146.503 +
 146.504 +            if (!actualList.containsAll(expectedList)) {
 146.505 +                System.out.println("Array values are not same");
 146.506 +                printArrContents(actualAnnos);
 146.507 +                printArrContents(expectedAnnos);
 146.508 +                return false;
 146.509 +            }
 146.510 +        }
 146.511 +        return true;
 146.512 +    }
 146.513 +
 146.514 +    private void printArrContents(Annotation[] actualAnnos) {
 146.515 +        for (Annotation a : actualAnnos) {
 146.516 +            System.out.println("actualAnnos values = " + a);
 146.517 +        }
 146.518 +    }
 146.519 +
 146.520 +    private void printArrContents(String[] expectedAnnos) {
 146.521 +        for (String s : expectedAnnos) {
 146.522 +            System.out.println("expectedAnnos values =  " + s);
 146.523 +        }
 146.524 +    }
 146.525 +
 146.526 +    private void printArrContents(List<? extends AnnotationMirror> actualAnnos) {
 146.527 +        for (AnnotationMirror annotationMirror : actualAnnos) {
 146.528 +            System.out.println("actualAnnos values = " + annotationMirror);
 146.529 +        }
 146.530 +    }
 146.531 +
 146.532 +    private boolean compareAnnotation(Annotation actualAnno, String expectedAnno) {
 146.533 +        //String actualAnnoName = "";
 146.534 +        boolean isSame = true;
 146.535 +        // Look if test case was run.
 146.536 +        if (actualAnno == specialAnno) {
 146.537 +            return false; //no testcase run
 146.538 +        }
 146.539 +        if (actualAnno != null) {
 146.540 +            if (!actualAnno.toString().equalsIgnoreCase(expectedAnno)) {
 146.541 +                System.out.println("Anno did not match. "
 146.542 +                        + " expectedAnno = " + expectedAnno
 146.543 +                        + " actualAnno = " + actualAnno);
 146.544 +                isSame = false;
 146.545 +            } else {
 146.546 +                isSame = true;
 146.547 +            }
 146.548 +        } else {
 146.549 +            if (expectedAnno.compareToIgnoreCase("null") == 0) {
 146.550 +                isSame = true;
 146.551 +            } else {
 146.552 +                System.out.println("Actual anno is null");
 146.553 +                isSame = false;
 146.554 +            }
 146.555 +        }
 146.556 +        return isSame;
 146.557 +    }
 146.558 +}
   147.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   147.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java	Sun Feb 17 16:44:55 2013 -0500
   147.3 @@ -0,0 +1,119 @@
   147.4 +/*
   147.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   147.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   147.7 + *
   147.8 + * This code is free software; you can redistribute it and/or modify it
   147.9 + * under the terms of the GNU General Public License version 2 only, as
  147.10 + * published by the Free Software Foundation.
  147.11 + *
  147.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  147.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  147.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  147.15 + * version 2 for more details (a copy is included in the LICENSE file that
  147.16 + * accompanied this code).
  147.17 + *
  147.18 + * You should have received a copy of the GNU General Public License version
  147.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  147.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  147.21 + *
  147.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  147.23 + * or visit www.oracle.com if you need additional information or have any
  147.24 + * questions.
  147.25 + */
  147.26 +
  147.27 +/*
  147.28 + * @test
  147.29 + * @bug     8004822
  147.30 + * @author  mnunez
  147.31 + * @summary Language model api test basics for repeating annotations
  147.32 + * @library /tools/javac/lib
  147.33 + * @library supportingAnnotations
  147.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  147.35 + * @compile -processor ElementRepAnnoTester -proc:only
  147.36 + * MixRepeatableAndOfficialContainerBasicTest.java
  147.37 + */
  147.38 +
  147.39 +@ExpectedBase(
  147.40 +        value = Bar.class,
  147.41 +        getAnnotation = "@Bar(value=0)",
  147.42 +        getAnnotationsByType = {
  147.43 +            "@Bar(value=0)",
  147.44 +            "@Bar(value=1)",
  147.45 +            "@Bar(value=2)"
  147.46 +        },
  147.47 +        getAllAnnotationMirrors = {
  147.48 +            "@Bar(0)",
  147.49 +            "@BarContainer({@Bar(1), @Bar(2)})",
  147.50 +            "ExpectedBase",
  147.51 +            "ExpectedContainer"
  147.52 +        },
  147.53 +        getAnnotationMirrors = {
  147.54 +            "@Bar(0)",
  147.55 +            "@BarContainer({@Bar(1), @Bar(2)})",
  147.56 +            "ExpectedBase",
  147.57 +            "ExpectedContainer"
  147.58 +        })
  147.59 +@ExpectedContainer(
  147.60 +        value = BarContainer.class,
  147.61 +        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
  147.62 +        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
  147.63 +@Bar(value = 0)
  147.64 +@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
  147.65 +class MixRepeatableAndOfficialContainerBasicTest {
  147.66 +
  147.67 +    @ExpectedBase(
  147.68 +            value = Bar.class,
  147.69 +            getAnnotation = "@Bar(value=0)",
  147.70 +            getAnnotationsByType = {
  147.71 +                "@Bar(value=0)",
  147.72 +                "@Bar(value=1)",
  147.73 +                "@Bar(value=2)"
  147.74 +            },
  147.75 +            getAllAnnotationMirrors = {
  147.76 +                "@Bar(0)",
  147.77 +                "@BarContainer({@Bar(1), @Bar(2)})",
  147.78 +                "ExpectedBase",
  147.79 +                "ExpectedContainer"
  147.80 +            },
  147.81 +            getAnnotationMirrors = {
  147.82 +                "@Bar(0)",
  147.83 +                "@BarContainer({@Bar(1), @Bar(2)})",
  147.84 +                "ExpectedBase",
  147.85 +                "ExpectedContainer"
  147.86 +            })
  147.87 +    @ExpectedContainer(
  147.88 +            value = BarContainer.class,
  147.89 +            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
  147.90 +            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
  147.91 +    @Bar(value = 0)
  147.92 +    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
  147.93 +    int testField = 0;
  147.94 +
  147.95 +    @ExpectedBase(
  147.96 +            value = Bar.class,
  147.97 +            getAnnotation = "@Bar(value=0)",
  147.98 +            getAnnotationsByType = {
  147.99 +                "@Bar(value=0)",
 147.100 +                "@Bar(value=1)",
 147.101 +                "@Bar(value=2)"
 147.102 +            },
 147.103 +            getAllAnnotationMirrors = {
 147.104 +                "@Bar(0)",
 147.105 +                "@BarContainer({@Bar(1), @Bar(2)})",
 147.106 +                "ExpectedBase",
 147.107 +                "ExpectedContainer"
 147.108 +            },
 147.109 +            getAnnotationMirrors = {
 147.110 +                "@Bar(0)",
 147.111 +                "@BarContainer({@Bar(1), @Bar(2)})",
 147.112 +                "ExpectedBase",
 147.113 +                "ExpectedContainer"
 147.114 +            })
 147.115 +    @ExpectedContainer(
 147.116 +            value = BarContainer.class,
 147.117 +            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
 147.118 +            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
 147.119 +    @Bar(value = 0)
 147.120 +    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
 147.121 +    void testMethod() {}
 147.122 +   }
   148.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   148.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java	Sun Feb 17 16:44:55 2013 -0500
   148.3 @@ -0,0 +1,65 @@
   148.4 +/*
   148.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   148.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   148.7 + *
   148.8 + * This code is free software; you can redistribute it and/or modify it
   148.9 + * under the terms of the GNU General Public License version 2 only, as
  148.10 + * published by the Free Software Foundation.
  148.11 + *
  148.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  148.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  148.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  148.15 + * version 2 for more details (a copy is included in the LICENSE file that
  148.16 + * accompanied this code).
  148.17 + *
  148.18 + * You should have received a copy of the GNU General Public License version
  148.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  148.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  148.21 + *
  148.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  148.23 + * or visit www.oracle.com if you need additional information or have any
  148.24 + * questions.
  148.25 + */
  148.26 +
  148.27 +/*
  148.28 + * @ignore
  148.29 + * @test
  148.30 + * @bug     8004822
  148.31 + * @author  mnunez
  148.32 + * @summary Language model api test basics for repeating annotations
  148.33 + * @library /tools/javac/lib
  148.34 + * @library supportingAnnotations
  148.35 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  148.36 + * @compile -processor ElementRepAnnoTester -proc:only
  148.37 + * MixRepeatableAndOfficialContainerInheritedA1Test.java
  148.38 + */
  148.39 +
  148.40 +@BarInherited(value = 0)
  148.41 +class E {}
  148.42 +
  148.43 +@ExpectedBase(
  148.44 +        value = BarInherited.class,
  148.45 +        getAnnotation = "@BarInherited(value=0)",
  148.46 +        getAnnotationsByType = {
  148.47 +            "@BarInherited(value=1)",
  148.48 +            "@BarInherited(value=2)"
  148.49 +        },
  148.50 +        getAllAnnotationMirrors = {
  148.51 +            "@BarInherited(0)",
  148.52 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  148.53 +            "ExpectedBase",
  148.54 +            "ExpectedContainer"
  148.55 +        },
  148.56 +        getAnnotationMirrors = {
  148.57 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  148.58 +            "ExpectedBase",
  148.59 +            "ExpectedContainer"
  148.60 +        })
  148.61 +@ExpectedContainer(
  148.62 +        value = BarInheritedContainer.class,
  148.63 +        getAnnotation = "@BarInheritedContainer("
  148.64 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  148.65 +        getAnnotationsByType = {"@BarInheritedContainer("
  148.66 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  148.67 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
  148.68 +class MixRepeatableAndOfficialContainerInheritedA1Test extends E {}
   149.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   149.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java	Sun Feb 17 16:44:55 2013 -0500
   149.3 @@ -0,0 +1,67 @@
   149.4 +/*
   149.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   149.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   149.7 + *
   149.8 + * This code is free software; you can redistribute it and/or modify it
   149.9 + * under the terms of the GNU General Public License version 2 only, as
  149.10 + * published by the Free Software Foundation.
  149.11 + *
  149.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  149.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  149.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  149.15 + * version 2 for more details (a copy is included in the LICENSE file that
  149.16 + * accompanied this code).
  149.17 + *
  149.18 + * You should have received a copy of the GNU General Public License version
  149.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  149.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  149.21 + *
  149.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  149.23 + * or visit www.oracle.com if you need additional information or have any
  149.24 + * questions.
  149.25 + */
  149.26 +
  149.27 +/*
  149.28 + * @test
  149.29 + * @bug     8004822
  149.30 + * @author  mnunez
  149.31 + * @summary Language model api test basics for repeating annotations
  149.32 + * @library /tools/javac/lib
  149.33 + * @library supportingAnnotations
  149.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  149.35 + * @compile -processor ElementRepAnnoTester -proc:only
  149.36 + * MixRepeatableAndOfficialContainerInheritedA2Test.java
  149.37 + */
  149.38 +
  149.39 +@BarInherited(value = 0)
  149.40 +class N {}
  149.41 +
  149.42 +@ExpectedBase(
  149.43 +        value = BarInherited.class,
  149.44 +        getAnnotation = "@BarInherited(value=3)",
  149.45 +        getAnnotationsByType = {
  149.46 +            "@BarInherited(value=1)",
  149.47 +            "@BarInherited(value=2)",
  149.48 +            "@BarInherited(value=3)"
  149.49 +        },
  149.50 +        getAllAnnotationMirrors = {
  149.51 +            "@BarInherited(3)",
  149.52 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  149.53 +            "ExpectedBase",
  149.54 +            "ExpectedContainer"
  149.55 +        },
  149.56 +        getAnnotationMirrors = {
  149.57 +            "@BarInherited(3)",
  149.58 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  149.59 +            "ExpectedBase",
  149.60 +            "ExpectedContainer"
  149.61 +        })
  149.62 +@ExpectedContainer(
  149.63 +        value = BarInheritedContainer.class,
  149.64 +        getAnnotation = "@BarInheritedContainer("
  149.65 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  149.66 +        getAnnotationsByType = {"@BarInheritedContainer("
  149.67 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  149.68 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
  149.69 +@BarInherited(value = 3)
  149.70 +class MixRepeatableAndOfficialContainerInheritedA2Test extends N {}
   150.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   150.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java	Sun Feb 17 16:44:55 2013 -0500
   150.3 @@ -0,0 +1,62 @@
   150.4 +/*
   150.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   150.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   150.7 + *
   150.8 + * This code is free software; you can redistribute it and/or modify it
   150.9 + * under the terms of the GNU General Public License version 2 only, as
  150.10 + * published by the Free Software Foundation.
  150.11 + *
  150.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  150.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  150.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  150.15 + * version 2 for more details (a copy is included in the LICENSE file that
  150.16 + * accompanied this code).
  150.17 + *
  150.18 + * You should have received a copy of the GNU General Public License version
  150.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  150.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  150.21 + *
  150.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  150.23 + * or visit www.oracle.com if you need additional information or have any
  150.24 + * questions.
  150.25 + */
  150.26 +
  150.27 +/*
  150.28 + * @ignore
  150.29 + * @test
  150.30 + * @bug     8004822
  150.31 + * @author  mnunez
  150.32 + * @summary Language model api test basics for repeating annotations
  150.33 + * @library /tools/javac/lib
  150.34 + * @library supportingAnnotations
  150.35 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  150.36 + * @compile -processor ElementRepAnnoTester -proc:only
  150.37 + * MixRepeatableAndOfficialContainerInheritedB1Test.java
  150.38 + */
  150.39 +
  150.40 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
  150.41 +class M {}
  150.42 +
  150.43 +@ExpectedBase(
  150.44 +        value = BarInherited.class,
  150.45 +        getAnnotation = "@BarInherited(value=0)",
  150.46 +        getAnnotationsByType = {"@BarInherited(value=0)"},
  150.47 +        getAllAnnotationMirrors = {
  150.48 +            "@BarInherited(0)",
  150.49 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  150.50 +            "ExpectedBase",
  150.51 +            "ExpectedContainer"
  150.52 +        },
  150.53 +        getAnnotationMirrors = {
  150.54 +            "@BarInherited(0)",
  150.55 +            "ExpectedBase",
  150.56 +            "ExpectedContainer"
  150.57 +        })
  150.58 +@ExpectedContainer(
  150.59 +        value = BarInheritedContainer.class,
  150.60 +        getAnnotation = "@BarInheritedContainer("
  150.61 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  150.62 +        getAnnotationsByType = {"@BarInheritedContainer("
  150.63 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  150.64 +@BarInherited(value = 0)
  150.65 +class MixRepeatableAndOfficialContainerInheritedB1Test extends M {}
   151.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   151.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java	Sun Feb 17 16:44:55 2013 -0500
   151.3 @@ -0,0 +1,63 @@
   151.4 +/*
   151.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   151.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   151.7 + *
   151.8 + * This code is free software; you can redistribute it and/or modify it
   151.9 + * under the terms of the GNU General Public License version 2 only, as
  151.10 + * published by the Free Software Foundation.
  151.11 + *
  151.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  151.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  151.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  151.15 + * version 2 for more details (a copy is included in the LICENSE file that
  151.16 + * accompanied this code).
  151.17 + *
  151.18 + * You should have received a copy of the GNU General Public License version
  151.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  151.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  151.21 + *
  151.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  151.23 + * or visit www.oracle.com if you need additional information or have any
  151.24 + * questions.
  151.25 + */
  151.26 +
  151.27 +/*
  151.28 + * @ignore
  151.29 + * @test
  151.30 + * @bug     8004822
  151.31 + * @author  mnunez
  151.32 + * @summary Language model api test basics for repeating annotations
  151.33 + * @library /tools/javac/lib
  151.34 + * @library supportingAnnotations
  151.35 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  151.36 + * @compile -processor ElementRepAnnoTester -proc:only
  151.37 + * MixRepeatableAndOfficialContainerInheritedB2Test.java
  151.38 + */
  151.39 +
  151.40 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
  151.41 +@BarInherited(value = 3)
  151.42 +class H {}
  151.43 +
  151.44 +@ExpectedBase(
  151.45 +        value = BarInherited.class,
  151.46 +        getAnnotation = "@BarInherited(value=0)",
  151.47 +        getAnnotationsByType = {"@BarInherited(value=0)"},
  151.48 +        getAllAnnotationMirrors = {
  151.49 +            "@BarInherited(0)",
  151.50 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  151.51 +            "ExpectedBase",
  151.52 +            "ExpectedContainer"
  151.53 +        },
  151.54 +        getAnnotationMirrors = {
  151.55 +            "@BarInherited(0)",
  151.56 +            "ExpectedBase",
  151.57 +            "ExpectedContainer"
  151.58 +        })
  151.59 +@ExpectedContainer(
  151.60 +        value = BarInheritedContainer.class,
  151.61 +        getAnnotation = "@BarInheritedContainer("
  151.62 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  151.63 +        getAnnotationsByType = {"@BarInheritedContainer("
  151.64 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  151.65 +@BarInherited(value = 0)
  151.66 +class MixRepeatableAndOfficialContainerInheritedB2Test extends H {}
   152.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   152.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java	Sun Feb 17 16:44:55 2013 -0500
   152.3 @@ -0,0 +1,112 @@
   152.4 +/*
   152.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   152.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   152.7 + *
   152.8 + * This code is free software; you can redistribute it and/or modify it
   152.9 + * under the terms of the GNU General Public License version 2 only, as
  152.10 + * published by the Free Software Foundation.
  152.11 + *
  152.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  152.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  152.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  152.15 + * version 2 for more details (a copy is included in the LICENSE file that
  152.16 + * accompanied this code).
  152.17 + *
  152.18 + * You should have received a copy of the GNU General Public License version
  152.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  152.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  152.21 + *
  152.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  152.23 + * or visit www.oracle.com if you need additional information or have any
  152.24 + * questions.
  152.25 + */
  152.26 +
  152.27 +/*
  152.28 + * @test
  152.29 + * @bug     8004822
  152.30 + * @author  mnunez
  152.31 + * @summary Language model api test basics for repeating annotations
  152.32 + * @library /tools/javac/lib
  152.33 + * @library supportingAnnotations
  152.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  152.35 + * @compile -processor ElementRepAnnoTester -proc:only MixSingularAndUnofficialContainerBasicTest.java
  152.36 + */
  152.37 +
  152.38 +@ExpectedBase(
  152.39 +        value = Foo.class,
  152.40 +        getAnnotation = "@Foo(value=0)",
  152.41 +        getAnnotationsByType = {"@Foo(value=0)"},
  152.42 +        getAllAnnotationMirrors = {
  152.43 +            "@Foo(0)",
  152.44 +            "@UnofficialContainer({@Foo(1), @Foo(2)})",
  152.45 +            "ExpectedBase",
  152.46 +            "ExpectedContainer"
  152.47 +        },
  152.48 +        getAnnotationMirrors = {
  152.49 +            "@Foo(0)",
  152.50 +            "@UnofficialContainer({@Foo(1), @Foo(2)})",
  152.51 +            "ExpectedBase",
  152.52 +            "ExpectedContainer"
  152.53 +        })
  152.54 +@ExpectedContainer(
  152.55 +        value = UnofficialContainer.class,
  152.56 +        getAnnotation = "@UnofficialContainer("
  152.57 +        + "value=[@Foo(value=1), @Foo(value=2)])",
  152.58 +        getAnnotationsByType = {"@UnofficialContainer("
  152.59 +                + "value=[@Foo(value=1), @Foo(value=2)])"})
  152.60 +@Foo(value = 0)
  152.61 +@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
  152.62 +class MixSingularAndUnofficialContainerBasicTest {
  152.63 +
  152.64 +    @ExpectedBase(
  152.65 +            value = Foo.class,
  152.66 +            getAnnotation = "@Foo(value=0)",
  152.67 +            getAnnotationsByType = {"@Foo(value=0)"},
  152.68 +            getAllAnnotationMirrors = {
  152.69 +                "@Foo(0)",
  152.70 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
  152.71 +                "ExpectedBase",
  152.72 +                "ExpectedContainer"
  152.73 +            },
  152.74 +            getAnnotationMirrors = {
  152.75 +                "@Foo(0)",
  152.76 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
  152.77 +                "ExpectedBase",
  152.78 +                "ExpectedContainer"
  152.79 +            })
  152.80 +    @ExpectedContainer(
  152.81 +            value = UnofficialContainer.class,
  152.82 +            getAnnotation = "@UnofficialContainer("
  152.83 +            + "value=[@Foo(value=1), @Foo(value=2)])",
  152.84 +            getAnnotationsByType = {"@UnofficialContainer("
  152.85 +                    + "value=[@Foo(value=1), @Foo(value=2)])"})
  152.86 +    @Foo(value = 0)
  152.87 +    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
  152.88 +    int testField = 0;
  152.89 +
  152.90 +    @ExpectedBase(
  152.91 +            value = Foo.class,
  152.92 +            getAnnotation = "@Foo(value=0)",
  152.93 +            getAnnotationsByType = {"@Foo(value=0)"},
  152.94 +            getAllAnnotationMirrors = {
  152.95 +                "@Foo(0)",
  152.96 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
  152.97 +                "ExpectedBase",
  152.98 +                "ExpectedContainer"
  152.99 +            },
 152.100 +            getAnnotationMirrors = {
 152.101 +                "@Foo(0)",
 152.102 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
 152.103 +                "ExpectedBase",
 152.104 +                "ExpectedContainer"
 152.105 +            })
 152.106 +    @ExpectedContainer(
 152.107 +            value = UnofficialContainer.class,
 152.108 +            getAnnotation = "@UnofficialContainer("
 152.109 +            + "value=[@Foo(value=1), @Foo(value=2)])",
 152.110 +            getAnnotationsByType = {"@UnofficialContainer("
 152.111 +                    + "value=[@Foo(value=1), @Foo(value=2)])"})
 152.112 +    @Foo(value = 0)
 152.113 +    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
 152.114 +    void testMethod() {}
 152.115 +}
   153.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   153.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java	Sun Feb 17 16:44:55 2013 -0500
   153.3 @@ -0,0 +1,61 @@
   153.4 +/*
   153.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   153.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   153.7 + *
   153.8 + * This code is free software; you can redistribute it and/or modify it
   153.9 + * under the terms of the GNU General Public License version 2 only, as
  153.10 + * published by the Free Software Foundation.
  153.11 + *
  153.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  153.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  153.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  153.15 + * version 2 for more details (a copy is included in the LICENSE file that
  153.16 + * accompanied this code).
  153.17 + *
  153.18 + * You should have received a copy of the GNU General Public License version
  153.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  153.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  153.21 + *
  153.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  153.23 + * or visit www.oracle.com if you need additional information or have any
  153.24 + * questions.
  153.25 + */
  153.26 +
  153.27 +/*
  153.28 + * @test
  153.29 + * @bug     8004822
  153.30 + * @author  mnunez
  153.31 + * @summary Language model api test basics for repeating annotations
  153.32 + * @library /tools/javac/lib
  153.33 + * @library supportingAnnotations
  153.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  153.35 + * @compile -processor ElementRepAnnoTester -proc:only
  153.36 + * MixSingularAndUnofficialContainerInheritedA1Test.java
  153.37 + */
  153.38 +
  153.39 +@FooInherited(value = 0)
  153.40 +class L {}
  153.41 +
  153.42 +@ExpectedBase(
  153.43 +        value = FooInherited.class,
  153.44 +        getAnnotation = "@FooInherited(value=0)",
  153.45 +        getAnnotationsByType = {"@FooInherited(value=0)"},
  153.46 +        getAllAnnotationMirrors = {
  153.47 +            "@FooInherited(0)",
  153.48 +            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
  153.49 +            "ExpectedBase",
  153.50 +            "ExpectedContainer"
  153.51 +        },
  153.52 +        getAnnotationMirrors = {
  153.53 +            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
  153.54 +            "ExpectedBase",
  153.55 +            "ExpectedContainer"
  153.56 +        })
  153.57 +@ExpectedContainer(
  153.58 +        value = UnofficialInheritedContainer.class,
  153.59 +        getAnnotation = "@UnofficialInheritedContainer("
  153.60 +        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
  153.61 +        getAnnotationsByType = {"@UnofficialInheritedContainer("
  153.62 +                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
  153.63 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
  153.64 +class MixSingularAndUnofficialContainerInheritedA1Test extends L {}
   154.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   154.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java	Sun Feb 17 16:44:55 2013 -0500
   154.3 @@ -0,0 +1,63 @@
   154.4 +/*
   154.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   154.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   154.7 + *
   154.8 + * This code is free software; you can redistribute it and/or modify it
   154.9 + * under the terms of the GNU General Public License version 2 only, as
  154.10 + * published by the Free Software Foundation.
  154.11 + *
  154.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  154.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  154.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  154.15 + * version 2 for more details (a copy is included in the LICENSE file that
  154.16 + * accompanied this code).
  154.17 + *
  154.18 + * You should have received a copy of the GNU General Public License version
  154.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  154.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  154.21 + *
  154.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  154.23 + * or visit www.oracle.com if you need additional information or have any
  154.24 + * questions.
  154.25 + */
  154.26 +
  154.27 +/*
  154.28 + * @test
  154.29 + * @bug     8004822
  154.30 + * @author  mnunez
  154.31 + * @summary Language model api test basics for repeating annotations
  154.32 + * @library /tools/javac/lib
  154.33 + * @library supportingAnnotations
  154.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  154.35 + * @compile -processor ElementRepAnnoTester -proc:only
  154.36 + * MixSingularAndUnofficialContainerInheritedA2Test.java
  154.37 + */
  154.38 +
  154.39 +@FooInherited(value = 0)
  154.40 +class K {}
  154.41 +
  154.42 +@ExpectedBase(
  154.43 +        value = FooInherited.class,
  154.44 +        getAnnotation = "@FooInherited(value=3)",
  154.45 +        getAnnotationsByType = {"@FooInherited(value=3)"},
  154.46 +        getAllAnnotationMirrors = {
  154.47 +            "@FooInherited(3)",
  154.48 +            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
  154.49 +            "ExpectedBase",
  154.50 +            "ExpectedContainer"
  154.51 +        },
  154.52 +        getAnnotationMirrors = {
  154.53 +            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
  154.54 +            "@FooInherited(3)",
  154.55 +            "ExpectedBase",
  154.56 +            "ExpectedContainer"
  154.57 +        })
  154.58 +@ExpectedContainer(
  154.59 +        value = UnofficialInheritedContainer.class,
  154.60 +        getAnnotation = "@UnofficialInheritedContainer("
  154.61 +        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
  154.62 +        getAnnotationsByType = {"@UnofficialInheritedContainer("
  154.63 +                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
  154.64 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
  154.65 +@FooInherited(value = 3)
  154.66 +class MixSingularAndUnofficialContainerInheritedA2Test extends K {}
   155.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   155.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java	Sun Feb 17 16:44:55 2013 -0500
   155.3 @@ -0,0 +1,61 @@
   155.4 +/*
   155.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   155.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   155.7 + *
   155.8 + * This code is free software; you can redistribute it and/or modify it
   155.9 + * under the terms of the GNU General Public License version 2 only, as
  155.10 + * published by the Free Software Foundation.
  155.11 + *
  155.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  155.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  155.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  155.15 + * version 2 for more details (a copy is included in the LICENSE file that
  155.16 + * accompanied this code).
  155.17 + *
  155.18 + * You should have received a copy of the GNU General Public License version
  155.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  155.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  155.21 + *
  155.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  155.23 + * or visit www.oracle.com if you need additional information or have any
  155.24 + * questions.
  155.25 + */
  155.26 +
  155.27 +/*
  155.28 + * @test
  155.29 + * @bug     8004822
  155.30 + * @author  mnunez
  155.31 + * @summary Language model api test basics for repeating annotations
  155.32 + * @library /tools/javac/lib
  155.33 + * @library supportingAnnotations
  155.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  155.35 + * @compile -processor ElementRepAnnoTester -proc:only
  155.36 + * MixSingularAndUnofficialContainerInheritedB1Test.java
  155.37 + */
  155.38 +
  155.39 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)})
  155.40 +class J {}
  155.41 +
  155.42 +@ExpectedBase(
  155.43 +        value = FooInherited.class,
  155.44 +        getAnnotation = "@FooInherited(value=0)",
  155.45 +        getAnnotationsByType = {"@FooInherited(value=0)"},
  155.46 +        getAllAnnotationMirrors = {
  155.47 +            "@FooInherited(0)",
  155.48 +            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
  155.49 +            "ExpectedBase",
  155.50 +            "ExpectedContainer"
  155.51 +        },
  155.52 +        getAnnotationMirrors = {
  155.53 +            "@FooInherited(0)",
  155.54 +            "ExpectedBase",
  155.55 +            "ExpectedContainer"
  155.56 +        })
  155.57 +@ExpectedContainer(
  155.58 +        value = UnofficialInheritedContainer.class,
  155.59 +        getAnnotation = "@UnofficialInheritedContainer("
  155.60 +        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
  155.61 +        getAnnotationsByType = {"@UnofficialInheritedContainer("
  155.62 +                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
  155.63 +@FooInherited(value = 0)
  155.64 +class MixSingularAndUnofficialContainerInheritedB1Test extends J {}
   156.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   156.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java	Sun Feb 17 16:44:55 2013 -0500
   156.3 @@ -0,0 +1,62 @@
   156.4 +/*
   156.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   156.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   156.7 + *
   156.8 + * This code is free software; you can redistribute it and/or modify it
   156.9 + * under the terms of the GNU General Public License version 2 only, as
  156.10 + * published by the Free Software Foundation.
  156.11 + *
  156.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  156.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  156.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  156.15 + * version 2 for more details (a copy is included in the LICENSE file that
  156.16 + * accompanied this code).
  156.17 + *
  156.18 + * You should have received a copy of the GNU General Public License version
  156.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  156.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  156.21 + *
  156.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  156.23 + * or visit www.oracle.com if you need additional information or have any
  156.24 + * questions.
  156.25 + */
  156.26 +
  156.27 +/*
  156.28 + * @test
  156.29 + * @bug     8004822
  156.30 + * @author  mnunez
  156.31 + * @summary Language model api test basics for repeating annotations
  156.32 + * @library /tools/javac/lib
  156.33 + * @library supportingAnnotations
  156.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  156.35 + * @compile -processor ElementRepAnnoTester -proc:only
  156.36 + * MixSingularAndUnofficialContainerInheritedB2Test.java
  156.37 + */
  156.38 +
  156.39 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
  156.40 +@FooInherited(value = 3)
  156.41 +class G {}
  156.42 +
  156.43 +@ExpectedBase(
  156.44 +        value = FooInherited.class,
  156.45 +        getAnnotation = "@FooInherited(value=0)",
  156.46 +        getAnnotationsByType = {"@FooInherited(value=0)"},
  156.47 +        getAllAnnotationMirrors = {
  156.48 +            "@FooInherited(0)",
  156.49 +            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
  156.50 +            "ExpectedBase",
  156.51 +            "ExpectedContainer"
  156.52 +        },
  156.53 +        getAnnotationMirrors = {
  156.54 +            "@FooInherited(0)",
  156.55 +            "ExpectedBase",
  156.56 +            "ExpectedContainer"
  156.57 +        })
  156.58 +@ExpectedContainer(
  156.59 +        value = UnofficialInheritedContainer.class,
  156.60 +        getAnnotation = "@UnofficialInheritedContainer("
  156.61 +        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
  156.62 +        getAnnotationsByType = {"@UnofficialInheritedContainer("
  156.63 +                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
  156.64 +@FooInherited(value = 0)
  156.65 +class MixSingularAndUnofficialContainerInheritedB2Test extends G{}
   157.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   157.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java	Sun Feb 17 16:44:55 2013 -0500
   157.3 @@ -0,0 +1,106 @@
   157.4 +/*
   157.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   157.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   157.7 + *
   157.8 + * This code is free software; you can redistribute it and/or modify it
   157.9 + * under the terms of the GNU General Public License version 2 only, as
  157.10 + * published by the Free Software Foundation.
  157.11 + *
  157.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  157.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  157.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  157.15 + * version 2 for more details (a copy is included in the LICENSE file that
  157.16 + * accompanied this code).
  157.17 + *
  157.18 + * You should have received a copy of the GNU General Public License version
  157.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  157.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  157.21 + *
  157.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  157.23 + * or visit www.oracle.com if you need additional information or have any
  157.24 + * questions.
  157.25 + */
  157.26 +
  157.27 +/*
  157.28 + * @test
  157.29 + * @bug     8004822
  157.30 + * @author  mnunez
  157.31 + * @summary Language model api test basics for repeating annotations
  157.32 + * @library /tools/javac/lib
  157.33 + * @library supportingAnnotations
  157.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  157.35 + * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerBasicTest.java
  157.36 + */
  157.37 +
  157.38 +@ExpectedBase(
  157.39 +        value = Bar.class,
  157.40 +        getAnnotation = "null",
  157.41 +        getAnnotationsByType = {
  157.42 +            "@Bar(value=1)",
  157.43 +            "@Bar(value=2)"
  157.44 +        },
  157.45 +        getAllAnnotationMirrors = {
  157.46 +            "@BarContainer({@Bar(1), @Bar(2)})",
  157.47 +            "ExpectedBase",
  157.48 +            "ExpectedContainer"
  157.49 +        },
  157.50 +        getAnnotationMirrors = {
  157.51 +            "@BarContainer({@Bar(1), @Bar(2)})",
  157.52 +            "ExpectedBase",
  157.53 +            "ExpectedContainer"
  157.54 +        })
  157.55 +@ExpectedContainer(
  157.56 +        value = BarContainer.class,
  157.57 +        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
  157.58 +        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
  157.59 +@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
  157.60 +class OfficialContainerBasicTest {
  157.61 +
  157.62 +    @ExpectedBase(
  157.63 +            value = Bar.class,
  157.64 +            getAnnotation = "null",
  157.65 +            getAnnotationsByType = {
  157.66 +                "@Bar(value=1)",
  157.67 +                "@Bar(value=2)"
  157.68 +            },
  157.69 +            getAllAnnotationMirrors = {
  157.70 +                "@BarContainer({@Bar(1), @Bar(2)})",
  157.71 +                "ExpectedBase",
  157.72 +                "ExpectedContainer"
  157.73 +            },
  157.74 +            getAnnotationMirrors = {
  157.75 +                "@BarContainer({@Bar(1), @Bar(2)})",
  157.76 +                "ExpectedBase",
  157.77 +                "ExpectedContainer"
  157.78 +            })
  157.79 +    @ExpectedContainer(
  157.80 +            value = BarContainer.class,
  157.81 +            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
  157.82 +            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
  157.83 +    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
  157.84 +    int testField = 0;
  157.85 +
  157.86 +    @ExpectedBase(
  157.87 +            value = Bar.class,
  157.88 +            getAnnotation = "null",
  157.89 +            getAnnotationsByType = {
  157.90 +                "@Bar(value=1)",
  157.91 +                "@Bar(value=2)"
  157.92 +            },
  157.93 +            getAllAnnotationMirrors = {
  157.94 +                "@BarContainer({@Bar(1), @Bar(2)})",
  157.95 +                "ExpectedBase",
  157.96 +                "ExpectedContainer"
  157.97 +            },
  157.98 +            getAnnotationMirrors = {
  157.99 +                "@BarContainer({@Bar(1), @Bar(2)})",
 157.100 +                "ExpectedBase",
 157.101 +                "ExpectedContainer"
 157.102 +            })
 157.103 +    @ExpectedContainer(
 157.104 +            value = BarContainer.class,
 157.105 +            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
 157.106 +            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
 157.107 +    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
 157.108 +    void testMethod() {}
 157.109 +}
   158.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   158.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java	Sun Feb 17 16:44:55 2013 -0500
   158.3 @@ -0,0 +1,60 @@
   158.4 +/*
   158.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   158.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   158.7 + *
   158.8 + * This code is free software; you can redistribute it and/or modify it
   158.9 + * under the terms of the GNU General Public License version 2 only, as
  158.10 + * published by the Free Software Foundation.
  158.11 + *
  158.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  158.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  158.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  158.15 + * version 2 for more details (a copy is included in the LICENSE file that
  158.16 + * accompanied this code).
  158.17 + *
  158.18 + * You should have received a copy of the GNU General Public License version
  158.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  158.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  158.21 + *
  158.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  158.23 + * or visit www.oracle.com if you need additional information or have any
  158.24 + * questions.
  158.25 + */
  158.26 +
  158.27 +/*
  158.28 + * @test
  158.29 + * @bug     8004822
  158.30 + * @author  mnunez
  158.31 + * @summary Language model api test basics for repeating annotations
  158.32 + * @library /tools/javac/lib
  158.33 + * @library supportingAnnotations
  158.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  158.35 + * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerInheritedTest.java
  158.36 + */
  158.37 +
  158.38 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
  158.39 +class D {}
  158.40 +
  158.41 +@ExpectedBase(
  158.42 +        value = BarInherited.class,
  158.43 +        getAnnotation = "null",
  158.44 +        getAnnotationsByType = {
  158.45 +            "@BarInherited(value=1)",
  158.46 +            "@BarInherited(value=2)"
  158.47 +        },
  158.48 +        getAllAnnotationMirrors = {
  158.49 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  158.50 +            "ExpectedBase",
  158.51 +            "ExpectedContainer"
  158.52 +        },
  158.53 +        getAnnotationMirrors = {
  158.54 +            "ExpectedBase",
  158.55 +            "ExpectedContainer"
  158.56 +        })
  158.57 +@ExpectedContainer(
  158.58 +        value = BarInheritedContainer.class,
  158.59 +        getAnnotation = "@BarInheritedContainer("
  158.60 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  158.61 +        getAnnotationsByType = {"@BarInheritedContainer("
  158.62 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  158.63 +class OfficialContainerInheritedTest extends D {}
   159.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   159.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java	Sun Feb 17 16:44:55 2013 -0500
   159.3 @@ -0,0 +1,109 @@
   159.4 +/*
   159.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   159.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   159.7 + *
   159.8 + * This code is free software; you can redistribute it and/or modify it
   159.9 + * under the terms of the GNU General Public License version 2 only, as
  159.10 + * published by the Free Software Foundation.
  159.11 + *
  159.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  159.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  159.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  159.15 + * version 2 for more details (a copy is included in the LICENSE file that
  159.16 + * accompanied this code).
  159.17 + *
  159.18 + * You should have received a copy of the GNU General Public License version
  159.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  159.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  159.21 + *
  159.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  159.23 + * or visit www.oracle.com if you need additional information or have any
  159.24 + * questions.
  159.25 + */
  159.26 +
  159.27 +/*
  159.28 + * @test
  159.29 + * @bug     8004822
  159.30 + * @author  mnunez
  159.31 + * @summary Language model api test basics for repeating annotations
  159.32 + * @library /tools/javac/lib
  159.33 + * @library supportingAnnotations
  159.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  159.35 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableBasicTest.java
  159.36 + */
  159.37 +
  159.38 +@ExpectedBase(
  159.39 +        value = Bar.class,
  159.40 +        getAnnotation = "null",
  159.41 +        getAnnotationsByType = {
  159.42 +            "@Bar(value=1)",
  159.43 +            "@Bar(value=2)"
  159.44 +        },
  159.45 +        getAllAnnotationMirrors = {
  159.46 +            "@BarContainer({@Bar(1), @Bar(2)})",
  159.47 +            "ExpectedBase",
  159.48 +            "ExpectedContainer"
  159.49 +        },
  159.50 +        getAnnotationMirrors = {
  159.51 +            "@BarContainer({@Bar(1), @Bar(2)})",
  159.52 +            "ExpectedBase",
  159.53 +            "ExpectedContainer"
  159.54 +        })
  159.55 +@ExpectedContainer(
  159.56 +        value = BarContainer.class,
  159.57 +        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
  159.58 +        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
  159.59 +@Bar(value = 1)
  159.60 +@Bar(value = 2)
  159.61 +class RepeatableBasicTest {
  159.62 +
  159.63 +    @ExpectedBase(
  159.64 +            value = Bar.class,
  159.65 +            getAnnotation = "null",
  159.66 +            getAnnotationsByType = {
  159.67 +                "@Bar(value=1)",
  159.68 +                "@Bar(value=2)"
  159.69 +            },
  159.70 +            getAllAnnotationMirrors = {
  159.71 +                "@BarContainer({@Bar(1), @Bar(2)})",
  159.72 +                "ExpectedBase",
  159.73 +                "ExpectedContainer"
  159.74 +            },
  159.75 +            getAnnotationMirrors = {
  159.76 +                "@BarContainer({@Bar(1), @Bar(2)})",
  159.77 +                "ExpectedBase",
  159.78 +                "ExpectedContainer"
  159.79 +            })
  159.80 +    @ExpectedContainer(
  159.81 +            value = BarContainer.class,
  159.82 +            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
  159.83 +            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
  159.84 +    @Bar(value = 1)
  159.85 +    @Bar(value = 2)
  159.86 +    int testField = 0;
  159.87 +
  159.88 +    @ExpectedBase(
  159.89 +            value = Bar.class,
  159.90 +            getAnnotation = "null",
  159.91 +            getAnnotationsByType = {
  159.92 +                "@Bar(value=1)",
  159.93 +                "@Bar(value=2)"
  159.94 +            },
  159.95 +            getAllAnnotationMirrors = {
  159.96 +                "@BarContainer({@Bar(1), @Bar(2)})",
  159.97 +                "ExpectedBase",
  159.98 +                "ExpectedContainer"
  159.99 +            },
 159.100 +            getAnnotationMirrors = {
 159.101 +                "@BarContainer({@Bar(1), @Bar(2)})",
 159.102 +                "ExpectedBase",
 159.103 +                "ExpectedContainer"
 159.104 +            })
 159.105 +    @ExpectedContainer(
 159.106 +            value = BarContainer.class,
 159.107 +            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
 159.108 +            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
 159.109 +    @Bar(value = 1)
 159.110 +    @Bar(value = 2)
 159.111 +    void testMethod() {}
 159.112 +}
   160.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   160.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java	Sun Feb 17 16:44:55 2013 -0500
   160.3 @@ -0,0 +1,61 @@
   160.4 +/*
   160.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   160.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   160.7 + *
   160.8 + * This code is free software; you can redistribute it and/or modify it
   160.9 + * under the terms of the GNU General Public License version 2 only, as
  160.10 + * published by the Free Software Foundation.
  160.11 + *
  160.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  160.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  160.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  160.15 + * version 2 for more details (a copy is included in the LICENSE file that
  160.16 + * accompanied this code).
  160.17 + *
  160.18 + * You should have received a copy of the GNU General Public License version
  160.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  160.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  160.21 + *
  160.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  160.23 + * or visit www.oracle.com if you need additional information or have any
  160.24 + * questions.
  160.25 + */
  160.26 +
  160.27 +/*
  160.28 + * @test
  160.29 + * @bug     8004822
  160.30 + * @author  mnunez
  160.31 + * @summary Language model api test basics for repeating annotations
  160.32 + * @library /tools/javac/lib
  160.33 + * @library supportingAnnotations
  160.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  160.35 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableInheritedTest.java
  160.36 + */
  160.37 +
  160.38 +@BarInherited(value = 1)
  160.39 +@BarInherited(value = 2)
  160.40 +class I {}
  160.41 +
  160.42 +@ExpectedBase(
  160.43 +        value = BarInherited.class,
  160.44 +        getAnnotation = "null",
  160.45 +        getAnnotationsByType = {
  160.46 +            "@BarInherited(value=1)",
  160.47 +            "@BarInherited(value=2)"
  160.48 +        },
  160.49 +        getAllAnnotationMirrors = {
  160.50 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  160.51 +            "ExpectedBase",
  160.52 +            "ExpectedContainer"
  160.53 +        },
  160.54 +        getAnnotationMirrors = {
  160.55 +            "ExpectedBase",
  160.56 +            "ExpectedContainer"
  160.57 +        })
  160.58 +@ExpectedContainer(
  160.59 +        value = BarInheritedContainer.class,
  160.60 +        getAnnotation = "@BarInheritedContainer("
  160.61 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  160.62 +        getAnnotationsByType = {"@BarInheritedContainer("
  160.63 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  160.64 +class RepeatableInheritedTest extends I {}
   161.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   161.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java	Sun Feb 17 16:44:55 2013 -0500
   161.3 @@ -0,0 +1,106 @@
   161.4 +/*
   161.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   161.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   161.7 + *
   161.8 + * This code is free software; you can redistribute it and/or modify it
   161.9 + * under the terms of the GNU General Public License version 2 only, as
  161.10 + * published by the Free Software Foundation.
  161.11 + *
  161.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  161.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  161.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  161.15 + * version 2 for more details (a copy is included in the LICENSE file that
  161.16 + * accompanied this code).
  161.17 + *
  161.18 + * You should have received a copy of the GNU General Public License version
  161.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  161.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  161.21 + *
  161.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  161.23 + * or visit www.oracle.com if you need additional information or have any
  161.24 + * questions.
  161.25 + */
  161.26 +
  161.27 +/*
  161.28 + * @test
  161.29 + * @bug     8004822
  161.30 + * @author  mnunez
  161.31 + * @summary Language model api test basics for repeating annotations
  161.32 + * @library /tools/javac/lib
  161.33 + * @library supportingAnnotations
  161.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  161.35 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableOfficialContainerBasicTest.java
  161.36 + */
  161.37 +
  161.38 +@ExpectedBase(
  161.39 +        value = Bar.class,
  161.40 +        getAnnotation = "null",
  161.41 +        getAnnotationsByType = {},
  161.42 +        getAllAnnotationMirrors = {
  161.43 +            "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
  161.44 +            "ExpectedBase",
  161.45 +            "ExpectedContainer"
  161.46 +        },
  161.47 +        getAnnotationMirrors = {
  161.48 +            "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
  161.49 +            "ExpectedBase",
  161.50 +            "ExpectedContainer"
  161.51 +        })
  161.52 +@ExpectedContainer(
  161.53 +        value = BarContainer.class,
  161.54 +        getAnnotation = "null",
  161.55 +        getAnnotationsByType = {
  161.56 +            "@BarContainer(value=[@Bar(value=1)])",
  161.57 +            "@BarContainer(value=[@Bar(value=2)])"})
  161.58 +@BarContainer(value = {@Bar(value = 1)})
  161.59 +@BarContainer(value = {@Bar(value = 2)})
  161.60 +class RepeatableOfficialContainerBasicTest {
  161.61 +
  161.62 +    @ExpectedBase(
  161.63 +            value = Bar.class,
  161.64 +            getAnnotation = "null",
  161.65 +            getAnnotationsByType = {},
  161.66 +            getAllAnnotationMirrors = {
  161.67 +                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
  161.68 +                "ExpectedBase",
  161.69 +                "ExpectedContainer"
  161.70 +            },
  161.71 +            getAnnotationMirrors = {
  161.72 +                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
  161.73 +                "ExpectedBase",
  161.74 +                "ExpectedContainer"
  161.75 +            })
  161.76 +    @ExpectedContainer(
  161.77 +            value = BarContainer.class,
  161.78 +            getAnnotation = "null",
  161.79 +            getAnnotationsByType = {
  161.80 +                "@BarContainer(value=[@Bar(value=1)])",
  161.81 +                "@BarContainer(value=[@Bar(value=2)])"})
  161.82 +    @BarContainer(value = {@Bar(value = 1)})
  161.83 +    @BarContainer(value = {@Bar(value = 2)})
  161.84 +    int testField = 0;
  161.85 +
  161.86 +    @ExpectedBase(
  161.87 +            value = Bar.class,
  161.88 +            getAnnotation = "null",
  161.89 +            getAnnotationsByType = {},
  161.90 +            getAllAnnotationMirrors = {
  161.91 +                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
  161.92 +                "ExpectedBase",
  161.93 +                "ExpectedContainer"
  161.94 +            },
  161.95 +            getAnnotationMirrors = {
  161.96 +                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
  161.97 +                "ExpectedBase",
  161.98 +                "ExpectedContainer"
  161.99 +            })
 161.100 +    @ExpectedContainer(
 161.101 +            value = BarContainer.class,
 161.102 +            getAnnotation = "null",
 161.103 +            getAnnotationsByType = {
 161.104 +                "@BarContainer(value=[@Bar(value=1)])",
 161.105 +                "@BarContainer(value=[@Bar(value=2)])"})
 161.106 +    @BarContainer(value = {@Bar(value = 1)})
 161.107 +    @BarContainer(value = {@Bar(value = 2)})
 161.108 +    void testMethod() {}
 161.109 +}
   162.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   162.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java	Sun Feb 17 16:44:55 2013 -0500
   162.3 @@ -0,0 +1,66 @@
   162.4 +/*
   162.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   162.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   162.7 + *
   162.8 + * This code is free software; you can redistribute it and/or modify it
   162.9 + * under the terms of the GNU General Public License version 2 only, as
  162.10 + * published by the Free Software Foundation.
  162.11 + *
  162.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  162.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  162.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  162.15 + * version 2 for more details (a copy is included in the LICENSE file that
  162.16 + * accompanied this code).
  162.17 + *
  162.18 + * You should have received a copy of the GNU General Public License version
  162.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  162.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  162.21 + *
  162.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  162.23 + * or visit www.oracle.com if you need additional information or have any
  162.24 + * questions.
  162.25 + */
  162.26 +
  162.27 +/*
  162.28 + * @test
  162.29 + * @bug     8004822
  162.30 + * @author  mnunez
  162.31 + * @summary Language model api test basics for repeating annotations
  162.32 + * @library /tools/javac/lib
  162.33 + * @library supportingAnnotations
  162.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  162.35 + * @compile -processor ElementRepAnnoTester -proc:only
  162.36 + * RepeatableOfficialContainerInheritedTest.java
  162.37 + */
  162.38 +
  162.39 +@BarInheritedContainer(value = {@BarInherited(value = 1)})
  162.40 +@BarInheritedContainer(value = {@BarInherited(value = 2)})
  162.41 +class O {}
  162.42 +
  162.43 +@ExpectedBase(
  162.44 +        value = BarInheritedContainer.class,
  162.45 +        getAnnotation = "null",
  162.46 +        getAnnotationsByType = {
  162.47 +            "@BarInheritedContainer(value=[@BarInherited(value=1)])",
  162.48 +            "@BarInheritedContainer(value=[@BarInherited(value=2)])"
  162.49 +        },
  162.50 +        getAllAnnotationMirrors = {
  162.51 +            "@BarInheritedContainerContainer("
  162.52 +                + "{@BarInheritedContainer({@BarInherited(1)}),"
  162.53 +                + " @BarInheritedContainer({@BarInherited(2)})})",
  162.54 +                "ExpectedBase",
  162.55 +                "ExpectedContainer"
  162.56 +        },
  162.57 +        getAnnotationMirrors = {
  162.58 +            "ExpectedBase",
  162.59 +            "ExpectedContainer"
  162.60 +        })
  162.61 +@ExpectedContainer(
  162.62 +        value = BarInheritedContainerContainer.class,
  162.63 +        getAnnotation = "@BarInheritedContainerContainer("
  162.64 +        + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
  162.65 +        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])",
  162.66 +        getAnnotationsByType = {"@BarInheritedContainerContainer("
  162.67 +                + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
  162.68 +        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])"})
  162.69 +class RepeatableOfficialContainerInheritedTest extends O {}
   163.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   163.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java	Sun Feb 17 16:44:55 2013 -0500
   163.3 @@ -0,0 +1,62 @@
   163.4 +/*
   163.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   163.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   163.7 + *
   163.8 + * This code is free software; you can redistribute it and/or modify it
   163.9 + * under the terms of the GNU General Public License version 2 only, as
  163.10 + * published by the Free Software Foundation.
  163.11 + *
  163.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  163.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  163.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  163.15 + * version 2 for more details (a copy is included in the LICENSE file that
  163.16 + * accompanied this code).
  163.17 + *
  163.18 + * You should have received a copy of the GNU General Public License version
  163.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  163.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  163.21 + *
  163.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  163.23 + * or visit www.oracle.com if you need additional information or have any
  163.24 + * questions.
  163.25 + */
  163.26 +
  163.27 +/*
  163.28 + * @ignore
  163.29 + * @test
  163.30 + * @bug     8004822
  163.31 + * @author  mnunez
  163.32 + * @summary Language model api test basics for repeating annotations
  163.33 + * @library /tools/javac/lib
  163.34 + * @library supportingAnnotations
  163.35 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  163.36 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideATest.java
  163.37 + */
  163.38 +
  163.39 +@BarInherited(value = 1)
  163.40 +@BarInherited(value = 2)
  163.41 +class B {}
  163.42 +
  163.43 +@ExpectedBase(
  163.44 +        value = BarInherited.class,
  163.45 +        getAnnotation = "@BarInherited(value=3)",
  163.46 +        getAnnotationsByType = {"@BarInherited(value=3)"},
  163.47 +        getAllAnnotationMirrors = {
  163.48 +            "@BarInherited(3)",
  163.49 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  163.50 +            "ExpectedBase",
  163.51 +            "ExpectedContainer"
  163.52 +        },
  163.53 +        getAnnotationMirrors = {
  163.54 +            "@BarInherited(3)",
  163.55 +            "ExpectedBase",
  163.56 +            "ExpectedContainer"
  163.57 +        })
  163.58 +@ExpectedContainer(
  163.59 +        value = BarInheritedContainer.class,
  163.60 +        getAnnotation = "@BarInheritedContainer("
  163.61 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  163.62 +        getAnnotationsByType = {"@BarInheritedContainer("
  163.63 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  163.64 +@BarInherited(value = 3)
  163.65 +class RepeatableOverrideATest extends B {}
   164.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   164.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java	Sun Feb 17 16:44:55 2013 -0500
   164.3 @@ -0,0 +1,65 @@
   164.4 +/*
   164.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   164.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   164.7 + *
   164.8 + * This code is free software; you can redistribute it and/or modify it
   164.9 + * under the terms of the GNU General Public License version 2 only, as
  164.10 + * published by the Free Software Foundation.
  164.11 + *
  164.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  164.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  164.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  164.15 + * version 2 for more details (a copy is included in the LICENSE file that
  164.16 + * accompanied this code).
  164.17 + *
  164.18 + * You should have received a copy of the GNU General Public License version
  164.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  164.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  164.21 + *
  164.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  164.23 + * or visit www.oracle.com if you need additional information or have any
  164.24 + * questions.
  164.25 + */
  164.26 +
  164.27 +/*
  164.28 + * @ignore
  164.29 + * @test
  164.30 + * @bug     8004822
  164.31 + * @author  mnunez
  164.32 + * @summary Language model api test basics for repeating annotations
  164.33 + * @library /tools/javac/lib
  164.34 + * @library supportingAnnotations
  164.35 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  164.36 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideBTest.java
  164.37 + */
  164.38 +
  164.39 +@BarInherited(value = 0)
  164.40 +class C {}
  164.41 +
  164.42 +@ExpectedBase(
  164.43 +        value = BarInherited.class,
  164.44 +        getAnnotation = "@BarInherited(value=0)",
  164.45 +        getAnnotationsByType = {
  164.46 +            "@BarInherited(value=1)",
  164.47 +            "@BarInherited(value=2)"
  164.48 +        },
  164.49 +        getAllAnnotationMirrors = {
  164.50 +            "@BarInherited(0)",
  164.51 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  164.52 +            "ExpectedBase",
  164.53 +            "ExpectedContainer"
  164.54 +        },
  164.55 +        getAnnotationMirrors = {
  164.56 +            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
  164.57 +            "ExpectedBase",
  164.58 +            "ExpectedContainer"
  164.59 +        })
  164.60 +@ExpectedContainer(
  164.61 +        value = BarInheritedContainer.class,
  164.62 +        getAnnotation = "@BarInheritedContainer("
  164.63 +        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
  164.64 +        getAnnotationsByType = {"@BarInheritedContainer("
  164.65 +                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
  164.66 +@BarInherited(value = 1)
  164.67 +@BarInherited(value = 2)
  164.68 +class RepeatableOverrideBTest extends C {}
   165.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   165.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularBasicTest.java	Sun Feb 17 16:44:55 2013 -0500
   165.3 @@ -0,0 +1,89 @@
   165.4 +/*
   165.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   165.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   165.7 + *
   165.8 + * This code is free software; you can redistribute it and/or modify it
   165.9 + * under the terms of the GNU General Public License version 2 only, as
  165.10 + * published by the Free Software Foundation.
  165.11 + *
  165.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  165.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  165.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  165.15 + * version 2 for more details (a copy is included in the LICENSE file that
  165.16 + * accompanied this code).
  165.17 + *
  165.18 + * You should have received a copy of the GNU General Public License version
  165.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  165.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  165.21 + *
  165.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  165.23 + * or visit www.oracle.com if you need additional information or have any
  165.24 + * questions.
  165.25 + */
  165.26 +
  165.27 +/*
  165.28 + * @test
  165.29 + * @bug     8004822
  165.30 + * @author  mnunez
  165.31 + * @summary Language model api test basics for repeating annotations
  165.32 + * @library /tools/javac/lib
  165.33 + * @library supportingAnnotations
  165.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  165.35 + * @compile -processor ElementRepAnnoTester -proc:only SingularBasicTest.java
  165.36 + */
  165.37 +
  165.38 +@ExpectedBase(
  165.39 +        value = Foo.class,
  165.40 +        getAnnotation = "@Foo(value=0)",
  165.41 +        getAnnotationsByType = {"@Foo(value=0)"},
  165.42 +        getAllAnnotationMirrors = {
  165.43 +            "@Foo(0)",
  165.44 +            "ExpectedBase",
  165.45 +            "ExpectedContainer"
  165.46 +        },
  165.47 +        getAnnotationMirrors = {
  165.48 +            "@Foo(0)",
  165.49 +            "ExpectedBase",
  165.50 +            "ExpectedContainer"
  165.51 +        })
  165.52 +@ExpectedContainer
  165.53 +@Foo(value = 0)
  165.54 +public class SingularBasicTest {
  165.55 +
  165.56 +    @ExpectedBase(
  165.57 +            value = Foo.class,
  165.58 +            getAnnotation = "@Foo(value=0)",
  165.59 +            getAnnotationsByType = {"@Foo(value=0)"},
  165.60 +            getAllAnnotationMirrors = {
  165.61 +                "@Foo(0)",
  165.62 +                "ExpectedBase",
  165.63 +                "ExpectedContainer"
  165.64 +            },
  165.65 +            getAnnotationMirrors = {
  165.66 +                "@Foo(0)",
  165.67 +                "ExpectedBase",
  165.68 +                "ExpectedContainer"
  165.69 +            })
  165.70 +    @ExpectedContainer
  165.71 +    @Foo(value = 0)
  165.72 +    int testField = 0;
  165.73 +
  165.74 +    @ExpectedBase(
  165.75 +            value = Foo.class,
  165.76 +            getAnnotation = "@Foo(value=0)",
  165.77 +            getAnnotationsByType = {"@Foo(value=0)"},
  165.78 +            getAllAnnotationMirrors = {
  165.79 +                "@Foo(0)",
  165.80 +                "ExpectedBase",
  165.81 +                "ExpectedContainer"
  165.82 +            },
  165.83 +            getAnnotationMirrors = {
  165.84 +                "@Foo(0)",
  165.85 +                "ExpectedBase",
  165.86 +                "ExpectedContainer"
  165.87 +            })
  165.88 +    @ExpectedContainer
  165.89 +    @Foo(value = 0)
  165.90 +    void testMethod() {
  165.91 +    }
  165.92 +}
   166.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   166.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedATest.java	Sun Feb 17 16:44:55 2013 -0500
   166.3 @@ -0,0 +1,52 @@
   166.4 +/*
   166.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   166.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   166.7 + *
   166.8 + * This code is free software; you can redistribute it and/or modify it
   166.9 + * under the terms of the GNU General Public License version 2 only, as
  166.10 + * published by the Free Software Foundation.
  166.11 + *
  166.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  166.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  166.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  166.15 + * version 2 for more details (a copy is included in the LICENSE file that
  166.16 + * accompanied this code).
  166.17 + *
  166.18 + * You should have received a copy of the GNU General Public License version
  166.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  166.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  166.21 + *
  166.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  166.23 + * or visit www.oracle.com if you need additional information or have any
  166.24 + * questions.
  166.25 + */
  166.26 +
  166.27 +/*
  166.28 + * @test
  166.29 + * @bug     8004822
  166.30 + * @author  mnunez
  166.31 + * @summary Language model api test basics for repeating annotations
  166.32 + * @library /tools/javac/lib
  166.33 + * @library supportingAnnotations
  166.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  166.35 + * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedATest.java
  166.36 + */
  166.37 +
  166.38 +@FooInherited(value = 0)
  166.39 +class A {}
  166.40 +
  166.41 +@ExpectedBase(
  166.42 +        value = FooInherited.class,
  166.43 +        getAnnotation = "@FooInherited(value=0)",
  166.44 +        getAnnotationsByType = {"@FooInherited(value=0)"},
  166.45 +        getAllAnnotationMirrors = {
  166.46 +            "@FooInherited(0)",
  166.47 +            "ExpectedBase",
  166.48 +            "ExpectedContainer"
  166.49 +        },
  166.50 +        getAnnotationMirrors = {
  166.51 +            "ExpectedBase",
  166.52 +            "ExpectedContainer"
  166.53 +        })
  166.54 +@ExpectedContainer
  166.55 +class SingularInheritedATest extends A {}
   167.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   167.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedBTest.java	Sun Feb 17 16:44:55 2013 -0500
   167.3 @@ -0,0 +1,57 @@
   167.4 +/*
   167.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   167.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   167.7 + *
   167.8 + * This code is free software; you can redistribute it and/or modify it
   167.9 + * under the terms of the GNU General Public License version 2 only, as
  167.10 + * published by the Free Software Foundation.
  167.11 + *
  167.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  167.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  167.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  167.15 + * version 2 for more details (a copy is included in the LICENSE file that
  167.16 + * accompanied this code).
  167.17 + *
  167.18 + * You should have received a copy of the GNU General Public License version
  167.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  167.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  167.21 + *
  167.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  167.23 + * or visit www.oracle.com if you need additional information or have any
  167.24 + * questions.
  167.25 + */
  167.26 +
  167.27 +/*
  167.28 + * @test
  167.29 + * @bug     8004822
  167.30 + * @author  mnunez
  167.31 + * @summary Language model api test basics for repeating annotations
  167.32 + * @library /tools/javac/lib
  167.33 + * @library supportingAnnotations
  167.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  167.35 + * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedBTest.java
  167.36 + */
  167.37 +
  167.38 +@FooInherited(value = 1)
  167.39 +class P {}
  167.40 +
  167.41 +@ExpectedBase(
  167.42 +        value = FooInherited.class,
  167.43 +        getAnnotation = "@FooInherited(value=2)",
  167.44 +        getAnnotationsByType = {"@FooInherited(value=2)"},
  167.45 +        getAllAnnotationMirrors = {
  167.46 +            "@FooInherited(2)",
  167.47 +            "ExpectedBase",
  167.48 +            "ExpectedContainer"
  167.49 +        },
  167.50 +        getAnnotationMirrors = {
  167.51 +            "@FooInherited(2)",
  167.52 +            "ExpectedBase",
  167.53 +            "ExpectedContainer"
  167.54 +        })
  167.55 +@ExpectedContainer(
  167.56 +        value = UnofficialInheritedContainer.class,
  167.57 +        getAnnotation = "null",
  167.58 +        getAnnotationsByType = {})
  167.59 +@FooInherited(value = 2)
  167.60 +class SingularInheritedBTest extends P {}
   168.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   168.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java	Sun Feb 17 16:44:55 2013 -0500
   168.3 @@ -0,0 +1,97 @@
   168.4 +/*
   168.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   168.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   168.7 + *
   168.8 + * This code is free software; you can redistribute it and/or modify it
   168.9 + * under the terms of the GNU General Public License version 2 only, as
  168.10 + * published by the Free Software Foundation.
  168.11 + *
  168.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  168.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  168.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  168.15 + * version 2 for more details (a copy is included in the LICENSE file that
  168.16 + * accompanied this code).
  168.17 + *
  168.18 + * You should have received a copy of the GNU General Public License version
  168.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  168.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  168.21 + *
  168.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  168.23 + * or visit www.oracle.com if you need additional information or have any
  168.24 + * questions.
  168.25 + */
  168.26 +
  168.27 +/*
  168.28 + * @test
  168.29 + * @bug     8004822
  168.30 + * @author  mnunez
  168.31 + * @summary Language model api test basics for repeating annotations
  168.32 + * @library /tools/javac/lib
  168.33 + * @library supportingAnnotations
  168.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  168.35 + * @compile -processor ElementRepAnnoTester -proc:only UnofficialContainerBasicTest.java
  168.36 + */
  168.37 +
  168.38 +@ExpectedBase(
  168.39 +        value = Foo.class,
  168.40 +        getAnnotation = "null",
  168.41 +        getAnnotationsByType = {},
  168.42 +        getAllAnnotationMirrors = {
  168.43 +            "@UnofficialContainer({@Foo(1), @Foo(2)})",
  168.44 +            "ExpectedBase",
  168.45 +            "ExpectedContainer"
  168.46 +        },
  168.47 +        getAnnotationMirrors = {
  168.48 +            "@UnofficialContainer({@Foo(1), @Foo(2)})",
  168.49 +            "ExpectedBase",
  168.50 +            "ExpectedContainer"
  168.51 +        })
  168.52 +@ExpectedContainer(
  168.53 +        value = UnofficialContainer.class,
  168.54 +        getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
  168.55 +        getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
  168.56 +@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
  168.57 +class UnofficialContainerBasicTest {
  168.58 +
  168.59 +    @ExpectedBase(
  168.60 +            value = Foo.class,
  168.61 +            getAnnotation = "null",
  168.62 +            getAnnotationsByType = {},
  168.63 +            getAllAnnotationMirrors = {
  168.64 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
  168.65 +                "ExpectedBase",
  168.66 +                "ExpectedContainer"
  168.67 +            },
  168.68 +            getAnnotationMirrors = {
  168.69 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
  168.70 +                "ExpectedBase",
  168.71 +                "ExpectedContainer"
  168.72 +            })
  168.73 +    @ExpectedContainer(
  168.74 +            value = UnofficialContainer.class,
  168.75 +            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
  168.76 +            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
  168.77 +    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
  168.78 +    int testField = 0;
  168.79 +
  168.80 +    @ExpectedBase(
  168.81 +            value = Foo.class,
  168.82 +            getAnnotation = "null",
  168.83 +            getAnnotationsByType = {},
  168.84 +            getAllAnnotationMirrors = {
  168.85 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
  168.86 +                "ExpectedBase",
  168.87 +                "ExpectedContainer"
  168.88 +            },
  168.89 +            getAnnotationMirrors = {
  168.90 +                "@UnofficialContainer({@Foo(1), @Foo(2)})",
  168.91 +                "ExpectedBase",
  168.92 +                "ExpectedContainer"
  168.93 +            })
  168.94 +    @ExpectedContainer(
  168.95 +            value = UnofficialContainer.class,
  168.96 +            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
  168.97 +            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
  168.98 +    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
  168.99 +    void testMethod() {}
 168.100 +}
   169.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   169.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java	Sun Feb 17 16:44:55 2013 -0500
   169.3 @@ -0,0 +1,58 @@
   169.4 +/*
   169.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   169.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   169.7 + *
   169.8 + * This code is free software; you can redistribute it and/or modify it
   169.9 + * under the terms of the GNU General Public License version 2 only, as
  169.10 + * published by the Free Software Foundation.
  169.11 + *
  169.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  169.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  169.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  169.15 + * version 2 for more details (a copy is included in the LICENSE file that
  169.16 + * accompanied this code).
  169.17 + *
  169.18 + * You should have received a copy of the GNU General Public License version
  169.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  169.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  169.21 + *
  169.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  169.23 + * or visit www.oracle.com if you need additional information or have any
  169.24 + * questions.
  169.25 + */
  169.26 +
  169.27 +/*
  169.28 + * @test
  169.29 + * @bug     8004822
  169.30 + * @author  mnunez
  169.31 + * @summary Language model api test basics for repeating annotations
  169.32 + * @library /tools/javac/lib
  169.33 + * @library supportingAnnotations
  169.34 + * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  169.35 + * @compile -processor ElementRepAnnoTester -proc:only
  169.36 + * UnofficialContainerInheritedTest.java
  169.37 + */
  169.38 +
  169.39 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)})
  169.40 +class F {}
  169.41 +
  169.42 +@ExpectedBase(
  169.43 +        value = FooInherited.class,
  169.44 +        getAnnotation = "null",
  169.45 +        getAnnotationsByType = {},
  169.46 +        getAllAnnotationMirrors = {
  169.47 +            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
  169.48 +            "ExpectedBase",
  169.49 +            "ExpectedContainer"
  169.50 +        },
  169.51 +        getAnnotationMirrors = {
  169.52 +            "ExpectedBase",
  169.53 +            "ExpectedContainer"
  169.54 +        })
  169.55 +@ExpectedContainer(
  169.56 +        value = UnofficialInheritedContainer.class,
  169.57 +        getAnnotation = "@UnofficialInheritedContainer("
  169.58 +        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
  169.59 +        getAnnotationsByType = {"@UnofficialInheritedContainer("
  169.60 +                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
  169.61 +class UnofficialContainerInheritedTest extends F {}
   170.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   170.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Bar.java	Sun Feb 17 16:44:55 2013 -0500
   170.3 @@ -0,0 +1,32 @@
   170.4 +/*
   170.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   170.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   170.7 + *
   170.8 + * This code is free software; you can redistribute it and/or modify it
   170.9 + * under the terms of the GNU General Public License version 2 only, as
  170.10 + * published by the Free Software Foundation.
  170.11 + *
  170.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  170.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  170.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  170.15 + * version 2 for more details (a copy is included in the LICENSE file that
  170.16 + * accompanied this code).
  170.17 + *
  170.18 + * You should have received a copy of the GNU General Public License version
  170.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  170.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  170.21 + *
  170.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  170.23 + * or visit www.oracle.com if you need additional information or have any
  170.24 + * questions.
  170.25 + */
  170.26 +
  170.27 +import java.lang.annotation.*;
  170.28 +import java.lang.annotation.Retention;
  170.29 +import java.lang.annotation.RetentionPolicy;
  170.30 +
  170.31 +@Retention(RetentionPolicy.RUNTIME)
  170.32 +@Repeatable(BarContainer.class)
  170.33 +public @interface Bar {
  170.34 +    int value();
  170.35 +}
   171.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   171.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainer.java	Sun Feb 17 16:44:55 2013 -0500
   171.3 @@ -0,0 +1,32 @@
   171.4 +/*
   171.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   171.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   171.7 + *
   171.8 + * This code is free software; you can redistribute it and/or modify it
   171.9 + * under the terms of the GNU General Public License version 2 only, as
  171.10 + * published by the Free Software Foundation.
  171.11 + *
  171.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  171.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  171.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  171.15 + * version 2 for more details (a copy is included in the LICENSE file that
  171.16 + * accompanied this code).
  171.17 + *
  171.18 + * You should have received a copy of the GNU General Public License version
  171.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  171.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  171.21 + *
  171.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  171.23 + * or visit www.oracle.com if you need additional information or have any
  171.24 + * questions.
  171.25 + */
  171.26 +
  171.27 +import java.lang.annotation.*;
  171.28 +import java.lang.annotation.Retention;
  171.29 +import java.lang.annotation.RetentionPolicy;
  171.30 +
  171.31 +@Retention(RetentionPolicy.RUNTIME)
  171.32 +@Repeatable(BarContainerContainer.class)
  171.33 +public @interface BarContainer {
  171.34 +    Bar[] value();
  171.35 +}
   172.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   172.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainerContainer.java	Sun Feb 17 16:44:55 2013 -0500
   172.3 @@ -0,0 +1,32 @@
   172.4 +/*
   172.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   172.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   172.7 + *
   172.8 + * This code is free software; you can redistribute it and/or modify it
   172.9 + * under the terms of the GNU General Public License version 2 only, as
  172.10 + * published by the Free Software Foundation.
  172.11 + *
  172.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  172.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  172.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  172.15 + * version 2 for more details (a copy is included in the LICENSE file that
  172.16 + * accompanied this code).
  172.17 + *
  172.18 + * You should have received a copy of the GNU General Public License version
  172.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  172.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  172.21 + *
  172.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  172.23 + * or visit www.oracle.com if you need additional information or have any
  172.24 + * questions.
  172.25 + */
  172.26 +
  172.27 +import java.lang.annotation.*;
  172.28 +import java.lang.annotation.Retention;
  172.29 +import java.lang.annotation.RetentionPolicy;
  172.30 +
  172.31 +@Retention(RetentionPolicy.RUNTIME)
  172.32 +@Inherited
  172.33 +public @interface BarContainerContainer {
  172.34 +    BarContainer[] value();
  172.35 +}
   173.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   173.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInherited.java	Sun Feb 17 16:44:55 2013 -0500
   173.3 @@ -0,0 +1,33 @@
   173.4 +/*
   173.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   173.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   173.7 + *
   173.8 + * This code is free software; you can redistribute it and/or modify it
   173.9 + * under the terms of the GNU General Public License version 2 only, as
  173.10 + * published by the Free Software Foundation.
  173.11 + *
  173.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  173.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  173.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  173.15 + * version 2 for more details (a copy is included in the LICENSE file that
  173.16 + * accompanied this code).
  173.17 + *
  173.18 + * You should have received a copy of the GNU General Public License version
  173.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  173.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  173.21 + *
  173.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  173.23 + * or visit www.oracle.com if you need additional information or have any
  173.24 + * questions.
  173.25 + */
  173.26 +
  173.27 +import java.lang.annotation.*;
  173.28 +import java.lang.annotation.Retention;
  173.29 +import java.lang.annotation.RetentionPolicy;
  173.30 +
  173.31 +@Retention(RetentionPolicy.RUNTIME)
  173.32 +@Inherited
  173.33 +@Repeatable(BarInheritedContainer.class)
  173.34 +public @interface BarInherited {
  173.35 +    int value();
  173.36 +}
   174.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   174.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainer.java	Sun Feb 17 16:44:55 2013 -0500
   174.3 @@ -0,0 +1,33 @@
   174.4 +/*
   174.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   174.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   174.7 + *
   174.8 + * This code is free software; you can redistribute it and/or modify it
   174.9 + * under the terms of the GNU General Public License version 2 only, as
  174.10 + * published by the Free Software Foundation.
  174.11 + *
  174.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  174.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  174.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  174.15 + * version 2 for more details (a copy is included in the LICENSE file that
  174.16 + * accompanied this code).
  174.17 + *
  174.18 + * You should have received a copy of the GNU General Public License version
  174.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  174.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  174.21 + *
  174.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  174.23 + * or visit www.oracle.com if you need additional information or have any
  174.24 + * questions.
  174.25 + */
  174.26 +
  174.27 +import java.lang.annotation.*;
  174.28 +import java.lang.annotation.Retention;
  174.29 +import java.lang.annotation.RetentionPolicy;
  174.30 +
  174.31 +@Retention(RetentionPolicy.RUNTIME)
  174.32 +@Inherited
  174.33 +@Repeatable(BarInheritedContainerContainer.class)
  174.34 +public @interface BarInheritedContainer {
  174.35 +    BarInherited[] value();
  174.36 +}
   175.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   175.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainerContainer.java	Sun Feb 17 16:44:55 2013 -0500
   175.3 @@ -0,0 +1,32 @@
   175.4 +/*
   175.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   175.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   175.7 + *
   175.8 + * This code is free software; you can redistribute it and/or modify it
   175.9 + * under the terms of the GNU General Public License version 2 only, as
  175.10 + * published by the Free Software Foundation.
  175.11 + *
  175.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  175.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  175.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  175.15 + * version 2 for more details (a copy is included in the LICENSE file that
  175.16 + * accompanied this code).
  175.17 + *
  175.18 + * You should have received a copy of the GNU General Public License version
  175.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  175.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  175.21 + *
  175.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  175.23 + * or visit www.oracle.com if you need additional information or have any
  175.24 + * questions.
  175.25 + */
  175.26 +
  175.27 +import java.lang.annotation.*;
  175.28 +import java.lang.annotation.Retention;
  175.29 +import java.lang.annotation.RetentionPolicy;
  175.30 +
  175.31 +@Retention(RetentionPolicy.RUNTIME)
  175.32 +@Inherited
  175.33 +public @interface BarInheritedContainerContainer {
  175.34 +    BarInheritedContainer[] value();
  175.35 +}
   176.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   176.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedBase.java	Sun Feb 17 16:44:55 2013 -0500
   176.3 @@ -0,0 +1,36 @@
   176.4 +/*
   176.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   176.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   176.7 + *
   176.8 + * This code is free software; you can redistribute it and/or modify it
   176.9 + * under the terms of the GNU General Public License version 2 only, as
  176.10 + * published by the Free Software Foundation.
  176.11 + *
  176.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  176.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  176.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  176.15 + * version 2 for more details (a copy is included in the LICENSE file that
  176.16 + * accompanied this code).
  176.17 + *
  176.18 + * You should have received a copy of the GNU General Public License version
  176.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  176.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  176.21 + *
  176.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  176.23 + * or visit www.oracle.com if you need additional information or have any
  176.24 + * questions.
  176.25 + */
  176.26 +
  176.27 +import java.lang.annotation.Annotation;
  176.28 +import java.lang.annotation.Retention;
  176.29 +import java.lang.annotation.RetentionPolicy;
  176.30 +
  176.31 +@Retention(RetentionPolicy.RUNTIME)
  176.32 +public @interface ExpectedBase {
  176.33 +    Class<? extends Annotation> value() default Annotation.class;
  176.34 +    String getAnnotation() default "";
  176.35 +    String[] getAllAnnotationMirrors() default {};
  176.36 +    String[] getAnnotationMirrors() default {};
  176.37 +    // Java SE 8 methods.
  176.38 +    String[] getAnnotationsByType() default {};
  176.39 +}
   177.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   177.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedContainer.java	Sun Feb 17 16:44:55 2013 -0500
   177.3 @@ -0,0 +1,34 @@
   177.4 +/*
   177.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   177.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   177.7 + *
   177.8 + * This code is free software; you can redistribute it and/or modify it
   177.9 + * under the terms of the GNU General Public License version 2 only, as
  177.10 + * published by the Free Software Foundation.
  177.11 + *
  177.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  177.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  177.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  177.15 + * version 2 for more details (a copy is included in the LICENSE file that
  177.16 + * accompanied this code).
  177.17 + *
  177.18 + * You should have received a copy of the GNU General Public License version
  177.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  177.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  177.21 + *
  177.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  177.23 + * or visit www.oracle.com if you need additional information or have any
  177.24 + * questions.
  177.25 + */
  177.26 +
  177.27 +import java.lang.annotation.Annotation;
  177.28 +import java.lang.annotation.Retention;
  177.29 +import java.lang.annotation.RetentionPolicy;
  177.30 +
  177.31 +@Retention(RetentionPolicy.RUNTIME)
  177.32 +public @interface ExpectedContainer {
  177.33 +    Class<? extends Annotation> value() default Annotation.class;
  177.34 +    String getAnnotation() default "";
  177.35 +    // Java SE 8 methods.
  177.36 +    String[] getAnnotationsByType() default {};
  177.37 +    }
   178.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   178.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Foo.java	Sun Feb 17 16:44:55 2013 -0500
   178.3 @@ -0,0 +1,30 @@
   178.4 +/*
   178.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   178.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   178.7 + *
   178.8 + * This code is free software; you can redistribute it and/or modify it
   178.9 + * under the terms of the GNU General Public License version 2 only, as
  178.10 + * published by the Free Software Foundation.
  178.11 + *
  178.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  178.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  178.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  178.15 + * version 2 for more details (a copy is included in the LICENSE file that
  178.16 + * accompanied this code).
  178.17 + *
  178.18 + * You should have received a copy of the GNU General Public License version
  178.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  178.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  178.21 + *
  178.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  178.23 + * or visit www.oracle.com if you need additional information or have any
  178.24 + * questions.
  178.25 + */
  178.26 +
  178.27 +import java.lang.annotation.Retention;
  178.28 +import java.lang.annotation.RetentionPolicy;
  178.29 +
  178.30 +@Retention(RetentionPolicy.RUNTIME)
  178.31 +public @interface Foo {
  178.32 +    int value();
  178.33 +}
   179.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   179.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/FooInherited.java	Sun Feb 17 16:44:55 2013 -0500
   179.3 @@ -0,0 +1,32 @@
   179.4 +/*
   179.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   179.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   179.7 + *
   179.8 + * This code is free software; you can redistribute it and/or modify it
   179.9 + * under the terms of the GNU General Public License version 2 only, as
  179.10 + * published by the Free Software Foundation.
  179.11 + *
  179.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  179.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  179.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  179.15 + * version 2 for more details (a copy is included in the LICENSE file that
  179.16 + * accompanied this code).
  179.17 + *
  179.18 + * You should have received a copy of the GNU General Public License version
  179.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  179.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  179.21 + *
  179.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  179.23 + * or visit www.oracle.com if you need additional information or have any
  179.24 + * questions.
  179.25 + */
  179.26 +
  179.27 +import java.lang.annotation.*;
  179.28 +import java.lang.annotation.Retention;
  179.29 +import java.lang.annotation.RetentionPolicy;
  179.30 +
  179.31 +@Retention(RetentionPolicy.RUNTIME)
  179.32 +@Inherited
  179.33 +public @interface FooInherited {
  179.34 +    int value();
  179.35 +}
   180.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   180.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialContainer.java	Sun Feb 17 16:44:55 2013 -0500
   180.3 @@ -0,0 +1,30 @@
   180.4 +/*
   180.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   180.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   180.7 + *
   180.8 + * This code is free software; you can redistribute it and/or modify it
   180.9 + * under the terms of the GNU General Public License version 2 only, as
  180.10 + * published by the Free Software Foundation.
  180.11 + *
  180.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  180.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  180.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  180.15 + * version 2 for more details (a copy is included in the LICENSE file that
  180.16 + * accompanied this code).
  180.17 + *
  180.18 + * You should have received a copy of the GNU General Public License version
  180.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  180.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  180.21 + *
  180.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  180.23 + * or visit www.oracle.com if you need additional information or have any
  180.24 + * questions.
  180.25 + */
  180.26 +
  180.27 +import java.lang.annotation.Retention;
  180.28 +import java.lang.annotation.RetentionPolicy;
  180.29 +
  180.30 +@Retention(RetentionPolicy.RUNTIME)
  180.31 +public @interface UnofficialContainer {
  180.32 +    Foo[] value();
  180.33 +}
   181.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   181.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialInheritedContainer.java	Sun Feb 17 16:44:55 2013 -0500
   181.3 @@ -0,0 +1,32 @@
   181.4 +/*
   181.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   181.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   181.7 + *
   181.8 + * This code is free software; you can redistribute it and/or modify it
   181.9 + * under the terms of the GNU General Public License version 2 only, as
  181.10 + * published by the Free Software Foundation.
  181.11 + *
  181.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  181.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  181.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  181.15 + * version 2 for more details (a copy is included in the LICENSE file that
  181.16 + * accompanied this code).
  181.17 + *
  181.18 + * You should have received a copy of the GNU General Public License version
  181.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  181.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  181.21 + *
  181.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  181.23 + * or visit www.oracle.com if you need additional information or have any
  181.24 + * questions.
  181.25 + */
  181.26 +
  181.27 +import java.lang.annotation.*;
  181.28 +import java.lang.annotation.Retention;
  181.29 +import java.lang.annotation.RetentionPolicy;
  181.30 +
  181.31 +@Retention(RetentionPolicy.RUNTIME)
  181.32 +@Inherited
  181.33 +public @interface UnofficialInheritedContainer {
  181.34 +    FooInherited[] value();
  181.35 +}
   182.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   182.2 +++ b/test/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java	Sun Feb 17 16:44:55 2013 -0500
   182.3 @@ -0,0 +1,115 @@
   182.4 +/*
   182.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   182.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   182.7 + *
   182.8 + * This code is free software; you can redistribute it and/or modify it
   182.9 + * under the terms of the GNU General Public License version 2 only, as
  182.10 + * published by the Free Software Foundation.
  182.11 + *
  182.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  182.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  182.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  182.15 + * version 2 for more details (a copy is included in the LICENSE file that
  182.16 + * accompanied this code).
  182.17 + *
  182.18 + * You should have received a copy of the GNU General Public License version
  182.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  182.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  182.21 + *
  182.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  182.23 + * or visit www.oracle.com if you need additional information or have any
  182.24 + * questions.
  182.25 + */
  182.26 +
  182.27 +/*
  182.28 + * @test
  182.29 + * @bug 8007574
  182.30 + * @summary Test Elements.isFunctionalInterface
  182.31 + * @author  Joseph D. Darcy
  182.32 + * @library /tools/javac/lib
  182.33 + * @build   JavacTestingAbstractProcessor TestIsFunctionalInterface
  182.34 + * @compile -processor TestIsFunctionalInterface TestIsFunctionalInterface.java
  182.35 + */
  182.36 +
  182.37 +import java.util.Set;
  182.38 +import javax.annotation.processing.*;
  182.39 +import javax.lang.model.SourceVersion;
  182.40 +import static javax.lang.model.SourceVersion.*;
  182.41 +import javax.lang.model.element.*;
  182.42 +import javax.lang.model.util.*;
  182.43 +import static javax.lang.model.util.ElementFilter.*;
  182.44 +import static javax.tools.Diagnostic.Kind.*;
  182.45 +import static javax.tools.StandardLocation.*;
  182.46 +import java.io.*;
  182.47 +
  182.48 +/**
  182.49 + * Test basic workings of Elements.isFunctionalInterface
  182.50 + */
  182.51 +public class TestIsFunctionalInterface extends JavacTestingAbstractProcessor {
  182.52 +    private int count = 0;
  182.53 +    public boolean process(Set<? extends TypeElement> annotations,
  182.54 +                           RoundEnvironment roundEnv) {
  182.55 +        if (!roundEnv.processingOver()) {
  182.56 +            for(TypeElement type : typesIn(roundEnv.getElementsAnnotatedWith(ExpectedIsFunInt.class))) {
  182.57 +                count++;
  182.58 +                System.out.println(type);
  182.59 +                if (elements.isFunctionalInterface(type) !=
  182.60 +                    type.getAnnotation(ExpectedIsFunInt.class).value()) {
  182.61 +                    messager.printMessage(ERROR,
  182.62 +                                          "Mismatch between expected and computed isFunctionalInterface",
  182.63 +                                          type);
  182.64 +                }
  182.65 +            }
  182.66 +        } else {
  182.67 +            if (count <= 0)
  182.68 +                messager.printMessage(ERROR, "No types with ExpectedIsFunInt processed.");
  182.69 +            }
  182.70 +    return true;
  182.71 +    }
  182.72 +}
  182.73 +
  182.74 +@interface ExpectedIsFunInt {
  182.75 +    boolean value();
  182.76 +}
  182.77 +
  182.78 +// Examples below from the lambda specification documents.
  182.79 +
  182.80 +@ExpectedIsFunInt(false) // Equals is already an implicit member
  182.81 +interface Foo1 { boolean equals(Object obj); }
  182.82 +
  182.83 +@ExpectedIsFunInt(true) // Bar has one abstract non-Object method
  182.84 +interface Bar1 extends Foo1 { int compare(String o1, String o2); }
  182.85 +
  182.86 +
  182.87 +@ExpectedIsFunInt(true) // Comparator has one abstract non-Object method
  182.88 +interface LocalComparator<T> {
  182.89 + boolean equals(Object obj);
  182.90 + int compare(T o1, T o2);
  182.91 +}
  182.92 +
  182.93 +@ExpectedIsFunInt(false) // Method Object.clone is not public
  182.94 +interface Foo2 {
  182.95 +  int m();
  182.96 +  Object clone();
  182.97 +}
  182.98 +
  182.99 +interface X1 { int m(Iterable<String> arg); }
 182.100 +interface Y1 { int m(Iterable<String> arg); }
 182.101 +@ExpectedIsFunInt(true) // Two methods, but they have the same signature
 182.102 +interface Z1 extends X1, Y1 {}
 182.103 +
 182.104 +interface X2 { Iterable m(Iterable<String> arg); }
 182.105 +interface Y2 { Iterable<String> m(Iterable arg); }
 182.106 +@ExpectedIsFunInt(true) // Y.m is a subsignature & return-type-substitutable
 182.107 +interface Z2 extends X2, Y2 {}
 182.108 +
 182.109 +interface Action<T> {
 182.110 +    T doit();
 182.111 +}
 182.112 +@ExpectedIsFunInt(true)
 182.113 +interface LocalExecutor { <T> T execute(Action<T> a); }
 182.114 +
 182.115 +interface X5 { <T> T execute(Action<T> a); }
 182.116 +interface Y5 { <S> S execute(Action<S> a); }
 182.117 +@ExpectedIsFunInt(true) // Functional: signatures are "the same"
 182.118 +interface Exec5 extends X5, Y5 {}
   183.1 --- a/test/tools/javadoc/api/basic/RunTest.java	Mon Feb 04 18:08:53 2013 -0500
   183.2 +++ b/test/tools/javadoc/api/basic/RunTest.java	Sun Feb 17 16:44:55 2013 -0500
   183.3 @@ -1,5 +1,5 @@
   183.4  /*
   183.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   183.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   183.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   183.8   *
   183.9   * This code is free software; you can redistribute it and/or modify it
  183.10 @@ -23,7 +23,7 @@
  183.11  
  183.12  /*
  183.13   * @test
  183.14 - * @bug 6493690
  183.15 + * @bug 6493690 8007490
  183.16   * @summary javadoc should have a javax.tools.Tool service provider
  183.17   * @build APITest
  183.18   * @run main RunTest
  183.19 @@ -31,6 +31,7 @@
  183.20  
  183.21  import java.io.ByteArrayOutputStream;
  183.22  import java.io.File;
  183.23 +import java.io.PrintStream;
  183.24  import javax.tools.DocumentationTool;
  183.25  import javax.tools.ToolProvider;
  183.26  
  183.27 @@ -46,7 +47,7 @@
  183.28       * Verify that run method can be invoked.
  183.29       */
  183.30      @Test
  183.31 -    public void testRun() throws Exception {
  183.32 +    public void testRunOK() throws Exception {
  183.33          File testSrc = new File(System.getProperty("test.src"));
  183.34          File srcFile = new File(testSrc, "pkg/C.java");
  183.35          File outDir = getOutDir();
  183.36 @@ -77,7 +78,7 @@
  183.37       * Verify that run method can be invoked.
  183.38       */
  183.39      @Test
  183.40 -    public void testRun2() throws Exception {
  183.41 +    public void testRunFail() throws Exception {
  183.42          File outDir = getOutDir();
  183.43          String badfile = "badfile.java";
  183.44          String[] args = { "-d", outDir.getPath(), badfile };
  183.45 @@ -100,5 +101,48 @@
  183.46          }
  183.47      }
  183.48  
  183.49 +    /**
  183.50 +     * Verify that null args are accepted.
  183.51 +     */
  183.52 +    @Test
  183.53 +    public void testNullArgs() throws Exception {
  183.54 +        File testSrc = new File(System.getProperty("test.src"));
  183.55 +        File srcFile = new File(testSrc, "pkg/C.java");
  183.56 +        File outDir = getOutDir();
  183.57 +        String[] args = { "-d", outDir.getPath(), srcFile.getPath() };
  183.58 +
  183.59 +        ByteArrayOutputStream stdout = new ByteArrayOutputStream();
  183.60 +        PrintStream prevStdout = System.out;
  183.61 +        System.setOut(new PrintStream(stdout));
  183.62 +
  183.63 +        ByteArrayOutputStream stderr = new ByteArrayOutputStream();
  183.64 +        PrintStream prevStderr = System.err;
  183.65 +        System.setErr(new PrintStream(stderr));
  183.66 +
  183.67 +        int rc ;
  183.68 +        try {
  183.69 +            DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
  183.70 +            rc = tool.run(null, null, null, args);
  183.71 +        } finally {
  183.72 +            System.setOut(prevStdout);
  183.73 +            System.setErr(prevStderr);
  183.74 +        }
  183.75 +
  183.76 +        System.err.println("stdout >>" + stdout.toString() + "<<");
  183.77 +        System.err.println("stderr >>" + stderr.toString() + "<<");
  183.78 +
  183.79 +        if (rc == 0) {
  183.80 +            System.err.println("call succeeded");
  183.81 +            checkFiles(outDir, standardExpectFiles);
  183.82 +            String out = stdout.toString();
  183.83 +            for (String f: standardExpectFiles) {
  183.84 +                String f1 = f.replace('/', File.separatorChar);
  183.85 +                if (f1.endsWith(".html") && !out.contains(f1))
  183.86 +                    error("expected string not found: " + f1);
  183.87 +            }
  183.88 +        } else {
  183.89 +            error("call failed");
  183.90 +        }
  183.91 +    }
  183.92  }
  183.93  
   184.1 --- a/test/tools/javadoc/doclint/DocLintTest.java	Mon Feb 04 18:08:53 2013 -0500
   184.2 +++ b/test/tools/javadoc/doclint/DocLintTest.java	Sun Feb 17 16:44:55 2013 -0500
   184.3 @@ -23,7 +23,7 @@
   184.4  
   184.5  /*
   184.6   * @test
   184.7 - * @bug 8004834
   184.8 + * @bug 8004834 8007610
   184.9   * @summary Add doclint support into javadoc
  184.10   */
  184.11  
  184.12 @@ -157,6 +157,10 @@
  184.13                  Main.Result.OK,
  184.14                  EnumSet.of(Message.DL_WRN12));
  184.15  
  184.16 +        test(Arrays.asList(rawDiags, "-private"),
  184.17 +                Main.Result.ERROR,
  184.18 +                EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
  184.19 +
  184.20          test(Arrays.asList(rawDiags, "-Xdoclint:syntax", "-private"),
  184.21                  Main.Result.ERROR,
  184.22                  EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
   185.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   185.2 +++ b/test/tools/javap/8006334/JavapTaskCtorFailWithNPE.java	Sun Feb 17 16:44:55 2013 -0500
   185.3 @@ -0,0 +1,85 @@
   185.4 +/*
   185.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   185.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   185.7 + *
   185.8 + * This code is free software; you can redistribute it and/or modify it
   185.9 + * under the terms of the GNU General Public License version 2 only, as
  185.10 + * published by the Free Software Foundation.
  185.11 + *
  185.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  185.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  185.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  185.15 + * version 2 for more details (a copy is included in the LICENSE file that
  185.16 + * accompanied this code).
  185.17 + *
  185.18 + * You should have received a copy of the GNU General Public License version
  185.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  185.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  185.21 + *
  185.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  185.23 + * or visit www.oracle.com if you need additional information or have any
  185.24 + * questions.
  185.25 + */
  185.26 +
  185.27 +/*
  185.28 + * @test
  185.29 + * @bug 8006334
  185.30 + * @summary javap: JavapTask constructor breaks with null pointer exception if
  185.31 + * parameter options is null
  185.32 + */
  185.33 +
  185.34 +import java.io.File;
  185.35 +import java.util.Arrays;
  185.36 +import java.io.PrintWriter;
  185.37 +import java.io.StringWriter;
  185.38 +import java.util.List;
  185.39 +import java.util.Locale;
  185.40 +import javax.tools.Diagnostic;
  185.41 +import javax.tools.DiagnosticCollector;
  185.42 +import javax.tools.JavaFileManager;
  185.43 +import javax.tools.JavaFileObject;
  185.44 +import com.sun.tools.javap.JavapFileManager;
  185.45 +import com.sun.tools.javap.JavapTask;
  185.46 +
  185.47 +public class JavapTaskCtorFailWithNPE {
  185.48 +
  185.49 +    //we will also check the output just to confirm that we get the expected one
  185.50 +    private static final String expOutput =
  185.51 +        "Compiled from \"JavapTaskCtorFailWithNPE.java\"\n" +
  185.52 +        "public class JavapTaskCtorFailWithNPE {\n" +
  185.53 +        "  public JavapTaskCtorFailWithNPE();\n" +
  185.54 +        "  public static void main(java.lang.String[]);\n" +
  185.55 +        "}\n";
  185.56 +
  185.57 +    public static void main(String[] args) {
  185.58 +        new JavapTaskCtorFailWithNPE().run();
  185.59 +    }
  185.60 +
  185.61 +    private void run() {
  185.62 +        File classToCheck = new File(System.getProperty("test.classes"),
  185.63 +            getClass().getSimpleName() + ".class");
  185.64 +
  185.65 +        DiagnosticCollector<JavaFileObject> dc =
  185.66 +                new DiagnosticCollector<JavaFileObject>();
  185.67 +        StringWriter sw = new StringWriter();
  185.68 +        PrintWriter pw = new PrintWriter(sw);
  185.69 +        JavaFileManager fm = JavapFileManager.create(dc, pw);
  185.70 +        JavapTask t = new JavapTask(pw, fm, dc, null,
  185.71 +                Arrays.asList(classToCheck.getPath()));
  185.72 +        boolean ok = t.run();
  185.73 +        if (!ok)
  185.74 +            throw new Error("javap failed unexpectedly");
  185.75 +
  185.76 +        List<Diagnostic<? extends JavaFileObject>> diags = dc.getDiagnostics();
  185.77 +        for (Diagnostic<? extends JavaFileObject> d: diags) {
  185.78 +            if (d.getKind() == Diagnostic.Kind.ERROR)
  185.79 +                throw new AssertionError(d.getMessage(Locale.ENGLISH));
  185.80 +        }
  185.81 +        String lineSep = System.getProperty("line.separator");
  185.82 +        String out = sw.toString().replace(lineSep, "\n");
  185.83 +        if (!out.equals(expOutput)) {
  185.84 +            throw new AssertionError("The output is not equal to the one expected");
  185.85 +        }
  185.86 +    }
  185.87 +
  185.88 +}

mercurial