Merge

Mon, 14 Feb 2011 16:31:21 -0800

author
lana
date
Mon, 14 Feb 2011 16:31:21 -0800
changeset 860
2cbaa43eb075
parent 836
03e7fc380090
parent 859
56b77a38618c
child 864
7a98db8cbfce

Merge

test/tools/javac/TryWithResources/TwrInference.java file | annotate | diff | comparison | revisions
test/tools/javac/TryWithResources/TwrIntersection.java file | annotate | diff | comparison | revisions
test/tools/javac/TryWithResources/TwrIntersection02.java file | annotate | diff | comparison | revisions
test/tools/javac/TryWithResources/TwrIntersection02.out file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Thu Feb 10 16:24:51 2011 -0800
     1.2 +++ b/make/build.xml	Mon Feb 14 16:31:21 2011 -0800
     1.3 @@ -1,6 +1,6 @@
     1.4  <?xml version="1.0" encoding="UTF-8"?>
     1.5  <!--
     1.6 - Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
     1.7 + Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
     1.8   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9  
    1.10   This code is free software; you can redistribute it and/or modify it
    1.11 @@ -331,7 +331,7 @@
    1.12              executable="${dist.bin.dir}/javac"
    1.13              srcdir="test/tools/javac/diags"
    1.14              destdir="${build.dir}/diag-examples/classes"
    1.15 -            includes="Example.java,FileManager.java,HTMLWriter.java,RunExamples.java"
    1.16 +            includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java"
    1.17              sourcepath=""
    1.18              classpath="${dist.lib.dir}/javac.jar"
    1.19              includeAntRuntime="no"
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java	Mon Feb 14 16:31:21 2011 -0800
     2.3 @@ -0,0 +1,95 @@
     2.4 +/*
     2.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Oracle designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Oracle in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.25 + * or visit www.oracle.com if you need additional information or have any
    2.26 + * questions.
    2.27 + */
    2.28 +
    2.29 +package com.sun.tools.javac.code;
    2.30 +
    2.31 +import java.util.HashMap;
    2.32 +import java.util.Map;
    2.33 +
    2.34 +import com.sun.tools.javac.util.Assert;
    2.35 +import com.sun.tools.javac.util.Context;
    2.36 +import com.sun.tools.javac.util.ListBuffer;
    2.37 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
    2.38 +
    2.39 +/**
    2.40 + *
    2.41 + * <p><b>This is NOT part of any supported API.
    2.42 + * If you write code that depends on this, you do so at your own risk.
    2.43 + * This code and its internal interfaces are subject to change or
    2.44 + * deletion without notice.</b>
    2.45 + */
    2.46 +public class DeferredLintHandler {
    2.47 +    protected static final Context.Key<DeferredLintHandler> deferredLintHandlerKey =
    2.48 +        new Context.Key<DeferredLintHandler>();
    2.49 +
    2.50 +    public static DeferredLintHandler instance(Context context) {
    2.51 +        DeferredLintHandler instance = context.get(deferredLintHandlerKey);
    2.52 +        if (instance == null)
    2.53 +            instance = new DeferredLintHandler(context);
    2.54 +        return instance;
    2.55 +    }
    2.56 +
    2.57 +    protected DeferredLintHandler(Context context) {
    2.58 +        context.put(deferredLintHandlerKey, this);
    2.59 +    }
    2.60 +
    2.61 +    private DeferredLintHandler() {}
    2.62 +
    2.63 +    public interface LintLogger {
    2.64 +        void report();
    2.65 +    }
    2.66 +
    2.67 +    private DiagnosticPosition currentPos;
    2.68 +    private Map<DiagnosticPosition, ListBuffer<LintLogger>> loggersQueue = new HashMap<DiagnosticPosition, ListBuffer<LintLogger>>();
    2.69 +
    2.70 +    public void report(LintLogger logger) {
    2.71 +        ListBuffer<LintLogger> loggers = loggersQueue.get(currentPos);
    2.72 +        Assert.checkNonNull(loggers);
    2.73 +        loggers.append(logger);
    2.74 +    }
    2.75 +
    2.76 +    public void flush(DiagnosticPosition pos) {
    2.77 +        ListBuffer<LintLogger> loggers = loggersQueue.get(pos);
    2.78 +        if (loggers != null) {
    2.79 +            for (LintLogger lintLogger : loggers) {
    2.80 +                lintLogger.report();
    2.81 +            }
    2.82 +            loggersQueue.remove(pos);
    2.83 +        }
    2.84 +    }
    2.85 +
    2.86 +    public DeferredLintHandler setPos(DiagnosticPosition currentPos) {
    2.87 +        this.currentPos = currentPos;
    2.88 +        loggersQueue.put(currentPos, ListBuffer.<LintLogger>lb());
    2.89 +        return this;
    2.90 +    }
    2.91 +
    2.92 +    public static final DeferredLintHandler immediateHandler = new DeferredLintHandler() {
    2.93 +        @Override
    2.94 +        public void report(LintLogger logger) {
    2.95 +            logger.report();
    2.96 +        }
    2.97 +    };
    2.98 +}
     3.1 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Feb 10 16:24:51 2011 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Mon Feb 14 16:31:21 2011 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -237,7 +237,7 @@
    3.11  
    3.12      /**
    3.13       * Flag that marks a signature-polymorphic invoke method.
    3.14 -     * (These occur inside java.dyn.MethodHandle.)
    3.15 +     * (These occur inside java.lang.invoke.MethodHandle.)
    3.16       */
    3.17      public static final long POLYMORPHIC_SIGNATURE = 1L<<40;
    3.18  
    3.19 @@ -252,6 +252,11 @@
    3.20       */
    3.21      public static final long EFFECTIVELY_FINAL = 1L<<42;
    3.22  
    3.23 +    /**
    3.24 +     * Flag that marks non-override equivalent methods with the same signature
    3.25 +     */
    3.26 +    public static final long CLASH = 1L<<43;
    3.27 +
    3.28      /** Modifier masks.
    3.29       */
    3.30      public static final int
     4.1 --- a/src/share/classes/com/sun/tools/javac/code/Printer.java	Thu Feb 10 16:24:51 2011 -0800
     4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java	Mon Feb 14 16:31:21 2011 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -106,7 +106,7 @@
    4.11      }
    4.12  
    4.13      /**
    4.14 -     * * Get a localized string represenation for all the symbols in the input list.
    4.15 +     * * Get a localized string representation for all the symbols in the input list.
    4.16       *
    4.17       * @param ts symbols to be displayed
    4.18       * @param locale the locale in which the string is to be rendered
     5.1 --- a/src/share/classes/com/sun/tools/javac/code/Scope.java	Thu Feb 10 16:24:51 2011 -0800
     5.2 +++ b/src/share/classes/com/sun/tools/javac/code/Scope.java	Mon Feb 14 16:31:21 2011 -0800
     5.3 @@ -72,49 +72,10 @@
     5.4       */
     5.5      int nelems = 0;
     5.6  
     5.7 -    /** A timestamp - useful to quickly check whether a scope has changed or not
     5.8 -     */
     5.9 -    public ScopeCounter scopeCounter;
    5.10 -
    5.11 -    static ScopeCounter dummyCounter = new ScopeCounter() {
    5.12 -        @Override
    5.13 -        public void inc() {
    5.14 -            //do nothing
    5.15 -        }
    5.16 -    };
    5.17 -
    5.18      /** A list of scopes to be notified if items are to be removed from this scope.
    5.19       */
    5.20      List<Scope> listeners = List.nil();
    5.21  
    5.22 -    public static class ScopeCounter {
    5.23 -        protected static final Context.Key<ScopeCounter> scopeCounterKey =
    5.24 -            new Context.Key<ScopeCounter>();
    5.25 -
    5.26 -        public static ScopeCounter instance(Context context) {
    5.27 -            ScopeCounter instance = context.get(scopeCounterKey);
    5.28 -            if (instance == null)
    5.29 -                instance = new ScopeCounter(context);
    5.30 -            return instance;
    5.31 -        }
    5.32 -
    5.33 -        protected ScopeCounter(Context context) {
    5.34 -            context.put(scopeCounterKey, this);
    5.35 -        }
    5.36 -
    5.37 -        private ScopeCounter() {};
    5.38 -
    5.39 -        private long val = 0;
    5.40 -
    5.41 -        public void inc() {
    5.42 -            val++;
    5.43 -        }
    5.44 -
    5.45 -        public long val() {
    5.46 -            return val;
    5.47 -        }
    5.48 -    }
    5.49 -
    5.50      /** Use as a "not-found" result for lookup.
    5.51       * Also used to mark deleted entries in the table.
    5.52       */
    5.53 @@ -126,35 +87,30 @@
    5.54  
    5.55      /** A value for the empty scope.
    5.56       */
    5.57 -    public static final Scope emptyScope = new Scope(null, null, new Entry[]{}, dummyCounter);
    5.58 +    public static final Scope emptyScope = new Scope(null, null, new Entry[]{});
    5.59  
    5.60      /** Construct a new scope, within scope next, with given owner, using
    5.61       *  given table. The table's length must be an exponent of 2.
    5.62       */
    5.63 -    private Scope(Scope next, Symbol owner, Entry[] table, ScopeCounter scopeCounter) {
    5.64 +    private Scope(Scope next, Symbol owner, Entry[] table) {
    5.65          this.next = next;
    5.66          Assert.check(emptyScope == null || owner != null);
    5.67          this.owner = owner;
    5.68          this.table = table;
    5.69          this.hashMask = table.length - 1;
    5.70 -        this.scopeCounter = scopeCounter;
    5.71      }
    5.72  
    5.73      /** Convenience constructor used for dup and dupUnshared. */
    5.74 -    private Scope(Scope next, Symbol owner, Entry[] table) {
    5.75 -        this(next, owner, table, next.scopeCounter);
    5.76 -        this.nelems = next.nelems;
    5.77 +    private Scope(Scope next, Symbol owner, Entry[] table, int nelems) {
    5.78 +        this(next, owner, table);
    5.79 +        this.nelems = nelems;
    5.80      }
    5.81  
    5.82      /** Construct a new scope, within scope next, with given owner,
    5.83       *  using a fresh table of length INITIAL_SIZE.
    5.84       */
    5.85      public Scope(Symbol owner) {
    5.86 -        this(owner, dummyCounter);
    5.87 -    }
    5.88 -
    5.89 -    protected Scope(Symbol owner, ScopeCounter scopeCounter) {
    5.90 -        this(null, owner, new Entry[INITIAL_SIZE], scopeCounter);
    5.91 +        this(null, owner, new Entry[INITIAL_SIZE]);
    5.92      }
    5.93  
    5.94      /** Construct a fresh scope within this scope, with same owner,
    5.95 @@ -172,7 +128,7 @@
    5.96       *  of fresh tables.
    5.97       */
    5.98      public Scope dup(Symbol newOwner) {
    5.99 -        Scope result = new Scope(this, newOwner, this.table);
   5.100 +        Scope result = new Scope(this, newOwner, this.table, this.nelems);
   5.101          shared++;
   5.102          // System.out.println("====> duping scope " + this.hashCode() + " owned by " + newOwner + " to " + result.hashCode());
   5.103          // new Error().printStackTrace(System.out);
   5.104 @@ -184,7 +140,7 @@
   5.105       *  the table of its outer scope.
   5.106       */
   5.107      public Scope dupUnshared() {
   5.108 -        return new Scope(this, this.owner, this.table.clone());
   5.109 +        return new Scope(this, this.owner, this.table.clone(), this.nelems);
   5.110      }
   5.111  
   5.112      /** Remove all entries of this scope from its table, if shared
   5.113 @@ -263,7 +219,6 @@
   5.114          Entry e = makeEntry(sym, old, elems, s, origin);
   5.115          table[hash] = e;
   5.116          elems = e;
   5.117 -        scopeCounter.inc();
   5.118      }
   5.119  
   5.120      Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) {
   5.121 @@ -278,8 +233,6 @@
   5.122          Entry e = lookup(sym.name);
   5.123          if (e.scope == null) return;
   5.124  
   5.125 -        scopeCounter.inc();
   5.126 -
   5.127          // remove e from table and shadowed list;
   5.128          int i = getIndex(sym.name);
   5.129          Entry te = table[i];
   5.130 @@ -559,7 +512,7 @@
   5.131          public static final Entry[] emptyTable = new Entry[0];
   5.132  
   5.133          public DelegatedScope(Scope outer) {
   5.134 -            super(outer, outer.owner, emptyTable, outer.scopeCounter);
   5.135 +            super(outer, outer.owner, emptyTable);
   5.136              delegatee = outer;
   5.137          }
   5.138          public Scope dup() {
   5.139 @@ -585,22 +538,10 @@
   5.140          }
   5.141      }
   5.142  
   5.143 -    /** A class scope, for which a scope counter should be provided */
   5.144 -    public static class ClassScope extends Scope {
   5.145 -
   5.146 -        ClassScope(Scope next, Symbol owner, Entry[] table, ScopeCounter scopeCounter) {
   5.147 -            super(next, owner, table, scopeCounter);
   5.148 -        }
   5.149 -
   5.150 -        public ClassScope(Symbol owner, ScopeCounter scopeCounter) {
   5.151 -            super(owner, scopeCounter);
   5.152 -        }
   5.153 -    }
   5.154 -
   5.155      /** An error scope, for which the owner should be an error symbol. */
   5.156      public static class ErrorScope extends Scope {
   5.157          ErrorScope(Scope next, Symbol errSymbol, Entry[] table) {
   5.158 -            super(next, /*owner=*/errSymbol, table, dummyCounter);
   5.159 +            super(next, /*owner=*/errSymbol, table);
   5.160          }
   5.161          public ErrorScope(Symbol errSymbol) {
   5.162              super(errSymbol);
     6.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Feb 10 16:24:51 2011 -0800
     6.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Feb 14 16:31:21 2011 -0800
     6.3 @@ -729,6 +729,10 @@
     6.4           */
     6.5          public Pool pool;
     6.6  
     6.7 +        /** members closure cache (set by Types.membersClosure)
     6.8 +         */
     6.9 +        Scope membersClosure;
    6.10 +
    6.11          public ClassSymbol(long flags, Name name, Type type, Symbol owner) {
    6.12              super(flags, name, type, owner);
    6.13              this.members_field = null;
    6.14 @@ -961,22 +965,12 @@
    6.15          }
    6.16  
    6.17          public void setLazyConstValue(final Env<AttrContext> env,
    6.18 -                                      final Log log,
    6.19                                        final Attr attr,
    6.20                                        final JCTree.JCExpression initializer)
    6.21          {
    6.22              setData(new Callable<Object>() {
    6.23                  public Object call() {
    6.24 -                    JavaFileObject source = log.useSource(env.toplevel.sourcefile);
    6.25 -                    try {
    6.26 -                        Type itype = attr.attribExpr(initializer, env, type);
    6.27 -                        if (itype.constValue() != null)
    6.28 -                            return attr.coerce(itype, type).constValue();
    6.29 -                        else
    6.30 -                            return null;
    6.31 -                    } finally {
    6.32 -                        log.useSource(source);
    6.33 -                    }
    6.34 +                    return attr.attribLazyConstantValue(env, initializer, type);
    6.35                  }
    6.36              });
    6.37          }
    6.38 @@ -1010,6 +1004,7 @@
    6.39                  try {
    6.40                      data = eval.call();
    6.41                  } catch (Exception ex) {
    6.42 +                    ex.printStackTrace();
    6.43                      throw new AssertionError(ex);
    6.44                  }
    6.45              }
    6.46 @@ -1231,7 +1226,7 @@
    6.47              };
    6.48  
    6.49          public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult, Filter<Symbol> implFilter) {
    6.50 -            MethodSymbol res = types.implementation(this, origin, types, checkResult, implFilter);
    6.51 +            MethodSymbol res = types.implementation(this, origin, checkResult, implFilter);
    6.52              if (res != null)
    6.53                  return res;
    6.54              // if origin is derived from a raw type, we might have missed
     7.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 10 16:24:51 2011 -0800
     7.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Mon Feb 14 16:31:21 2011 -0800
     7.3 @@ -74,7 +74,6 @@
     7.4      public final JCNoType voidType = new JCNoType(TypeTags.VOID);
     7.5  
     7.6      private final Names names;
     7.7 -    private final Scope.ScopeCounter scopeCounter;
     7.8      private final ClassReader reader;
     7.9      private final Target target;
    7.10  
    7.11 @@ -124,7 +123,9 @@
    7.12      public final Type stringBuilderType;
    7.13      public final Type cloneableType;
    7.14      public final Type serializableType;
    7.15 +    public final Type transientMethodHandleType; // transient - 292
    7.16      public final Type methodHandleType;
    7.17 +    public final Type transientPolymorphicSignatureType; // transient - 292
    7.18      public final Type polymorphicSignatureType;
    7.19      public final Type throwableType;
    7.20      public final Type errorType;
    7.21 @@ -341,7 +342,6 @@
    7.22          context.put(symtabKey, this);
    7.23  
    7.24          names = Names.instance(context);
    7.25 -        scopeCounter = Scope.ScopeCounter.instance(context);
    7.26          target = Target.instance(context);
    7.27  
    7.28          // Create the unknown type
    7.29 @@ -388,7 +388,7 @@
    7.30  
    7.31          // Create class to hold all predefined constants and operations.
    7.32          predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
    7.33 -        Scope scope = new Scope.ClassScope(predefClass, scopeCounter);
    7.34 +        Scope scope = new Scope(predefClass);
    7.35          predefClass.members_field = scope;
    7.36  
    7.37          // Enter symbols for basic types.
    7.38 @@ -419,8 +419,10 @@
    7.39          cloneableType = enterClass("java.lang.Cloneable");
    7.40          throwableType = enterClass("java.lang.Throwable");
    7.41          serializableType = enterClass("java.io.Serializable");
    7.42 -        methodHandleType = enterClass("java.dyn.MethodHandle");
    7.43 -        polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature");
    7.44 +        transientMethodHandleType = enterClass("java.dyn.MethodHandle"); // transient - 292
    7.45 +        methodHandleType = enterClass("java.lang.invoke.MethodHandle");
    7.46 +        transientPolymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); // transient - 292
    7.47 +        polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature");
    7.48          errorType = enterClass("java.lang.Error");
    7.49          illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
    7.50          exceptionType = enterClass("java.lang.Exception");
    7.51 @@ -464,6 +466,7 @@
    7.52  
    7.53          synthesizeEmptyInterfaceIfMissing(cloneableType);
    7.54          synthesizeEmptyInterfaceIfMissing(serializableType);
    7.55 +        synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292
    7.56          synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
    7.57          synthesizeBoxTypeIfMissing(doubleType);
    7.58          synthesizeBoxTypeIfMissing(floatType);
    7.59 @@ -478,7 +481,7 @@
    7.60          proprietarySymbol.completer = null;
    7.61          proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
    7.62          proprietarySymbol.erasure_field = proprietaryType;
    7.63 -        proprietarySymbol.members_field = new Scope.ClassScope(proprietarySymbol, scopeCounter);
    7.64 +        proprietarySymbol.members_field = new Scope(proprietarySymbol);
    7.65          proprietaryType.typarams_field = List.nil();
    7.66          proprietaryType.allparams_field = List.nil();
    7.67          proprietaryType.supertype_field = annotationType;
    7.68 @@ -490,7 +493,7 @@
    7.69          ClassType arrayClassType = (ClassType)arrayClass.type;
    7.70          arrayClassType.supertype_field = objectType;
    7.71          arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
    7.72 -        arrayClass.members_field = new Scope.ClassScope(arrayClass, scopeCounter);
    7.73 +        arrayClass.members_field = new Scope(arrayClass);
    7.74          lengthVar = new VarSymbol(
    7.75              PUBLIC | FINAL,
    7.76              names.length,
     8.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 10 16:24:51 2011 -0800
     8.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Feb 14 16:31:21 2011 -0800
     8.3 @@ -36,6 +36,7 @@
     8.4  import com.sun.tools.javac.code.Lint.LintCategory;
     8.5  import com.sun.tools.javac.comp.Check;
     8.6  
     8.7 +import static com.sun.tools.javac.code.Scope.*;
     8.8  import static com.sun.tools.javac.code.Type.*;
     8.9  import static com.sun.tools.javac.code.TypeTags.*;
    8.10  import static com.sun.tools.javac.code.Symbol.*;
    8.11 @@ -70,7 +71,6 @@
    8.12          new Context.Key<Types>();
    8.13  
    8.14      final Symtab syms;
    8.15 -    final Scope.ScopeCounter scopeCounter;
    8.16      final JavacMessages messages;
    8.17      final Names names;
    8.18      final boolean allowBoxing;
    8.19 @@ -91,7 +91,6 @@
    8.20      protected Types(Context context) {
    8.21          context.put(typesKey, this);
    8.22          syms = Symtab.instance(context);
    8.23 -        scopeCounter = Scope.ScopeCounter.instance(context);
    8.24          names = Names.instance(context);
    8.25          allowBoxing = Source.instance(context).allowBoxing();
    8.26          reader = ClassReader.instance(context);
    8.27 @@ -2024,26 +2023,22 @@
    8.28              final MethodSymbol cachedImpl;
    8.29              final Filter<Symbol> implFilter;
    8.30              final boolean checkResult;
    8.31 -            final Scope.ScopeCounter scopeCounter;
    8.32  
    8.33              public Entry(MethodSymbol cachedImpl,
    8.34                      Filter<Symbol> scopeFilter,
    8.35 -                    boolean checkResult,
    8.36 -                    Scope.ScopeCounter scopeCounter) {
    8.37 +                    boolean checkResult) {
    8.38                  this.cachedImpl = cachedImpl;
    8.39                  this.implFilter = scopeFilter;
    8.40                  this.checkResult = checkResult;
    8.41 -                this.scopeCounter = scopeCounter;
    8.42              }
    8.43  
    8.44 -            boolean matches(Filter<Symbol> scopeFilter, boolean checkResult, Scope.ScopeCounter scopeCounter) {
    8.45 +            boolean matches(Filter<Symbol> scopeFilter, boolean checkResult) {
    8.46                  return this.implFilter == scopeFilter &&
    8.47 -                        this.checkResult == checkResult &&
    8.48 -                        this.scopeCounter.val() >= scopeCounter.val();
    8.49 +                        this.checkResult == checkResult;
    8.50              }
    8.51          }
    8.52  
    8.53 -        MethodSymbol get(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter, Scope.ScopeCounter scopeCounter) {
    8.54 +        MethodSymbol get(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter) {
    8.55              SoftReference<Map<TypeSymbol, Entry>> ref_cache = _map.get(ms);
    8.56              Map<TypeSymbol, Entry> cache = ref_cache != null ? ref_cache.get() : null;
    8.57              if (cache == null) {
    8.58 @@ -2052,9 +2047,9 @@
    8.59              }
    8.60              Entry e = cache.get(origin);
    8.61              if (e == null ||
    8.62 -                    !e.matches(implFilter, checkResult, scopeCounter)) {
    8.63 +                    !e.matches(implFilter, checkResult)) {
    8.64                  MethodSymbol impl = implementationInternal(ms, origin, Types.this, checkResult, implFilter);
    8.65 -                cache.put(origin, new Entry(impl, implFilter, checkResult, scopeCounter));
    8.66 +                cache.put(origin, new Entry(impl, implFilter, checkResult));
    8.67                  return impl;
    8.68              }
    8.69              else {
    8.70 @@ -2081,11 +2076,55 @@
    8.71  
    8.72      private ImplementationCache implCache = new ImplementationCache();
    8.73  
    8.74 -    public MethodSymbol implementation(MethodSymbol ms, TypeSymbol origin, Types types, boolean checkResult, Filter<Symbol> implFilter) {
    8.75 -        return implCache.get(ms, origin, checkResult, implFilter, scopeCounter);
    8.76 +    public MethodSymbol implementation(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter) {
    8.77 +        return implCache.get(ms, origin, checkResult, implFilter);
    8.78      }
    8.79      // </editor-fold>
    8.80  
    8.81 +    // <editor-fold defaultstate="collapsed" desc="compute transitive closure of all members in given site">
    8.82 +    public Scope membersClosure(Type site) {
    8.83 +        return membersClosure.visit(site);
    8.84 +    }
    8.85 +
    8.86 +    UnaryVisitor<Scope> membersClosure = new UnaryVisitor<Scope>() {
    8.87 +
    8.88 +        public Scope visitType(Type t, Void s) {
    8.89 +            return null;
    8.90 +        }
    8.91 +
    8.92 +        @Override
    8.93 +        public Scope visitClassType(ClassType t, Void s) {
    8.94 +            ClassSymbol csym = (ClassSymbol)t.tsym;
    8.95 +            if (csym.membersClosure == null) {
    8.96 +                Scope membersClosure = new Scope(csym);
    8.97 +                for (Type i : interfaces(t)) {
    8.98 +                    enterAll(visit(i), membersClosure);
    8.99 +                }
   8.100 +                enterAll(visit(supertype(t)), membersClosure);
   8.101 +                enterAll(csym.members(), membersClosure);
   8.102 +                csym.membersClosure = membersClosure;
   8.103 +            }
   8.104 +            return csym.membersClosure;
   8.105 +        }
   8.106 +
   8.107 +        @Override
   8.108 +        public Scope visitTypeVar(TypeVar t, Void s) {
   8.109 +            return visit(t.getUpperBound());
   8.110 +        }
   8.111 +
   8.112 +        public void enterAll(Scope s, Scope to) {
   8.113 +            if (s == null) return;
   8.114 +            List<Symbol> syms = List.nil();
   8.115 +            for (Scope.Entry e = s.elems ; e != null ; e = e.sibling) {
   8.116 +                syms = syms.prepend(e.sym);
   8.117 +            }
   8.118 +            for (Symbol sym : syms) {
   8.119 +                to.enter(sym);
   8.120 +            }
   8.121 +        }
   8.122 +    };
   8.123 +    // </editor-fold>
   8.124 +
   8.125      /**
   8.126       * Does t have the same arguments as s?  It is assumed that both
   8.127       * types are (possibly polymorphic) method types.  Monomorphic
   8.128 @@ -2259,6 +2298,13 @@
   8.129  
   8.130          @Override
   8.131          public Type visitForAll(ForAll t, Void ignored) {
   8.132 +            if (Type.containsAny(to, t.tvars)) {
   8.133 +                //perform alpha-renaming of free-variables in 't'
   8.134 +                //if 'to' types contain variables that are free in 't'
   8.135 +                List<Type> freevars = newInstances(t.tvars);
   8.136 +                t = new ForAll(freevars,
   8.137 +                        Types.this.subst(t.qtype, t.tvars, freevars));
   8.138 +            }
   8.139              List<Type> tvars1 = substBounds(t.tvars, from, to);
   8.140              Type qtype1 = subst(t.qtype);
   8.141              if (tvars1 == t.tvars && qtype1 == t.qtype) {
     9.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 10 16:24:51 2011 -0800
     9.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Feb 14 16:31:21 2011 -0800
     9.3 @@ -83,6 +83,7 @@
     9.4      final Types types;
     9.5      final JCDiagnostic.Factory diags;
     9.6      final Annotate annotate;
     9.7 +    final DeferredLintHandler deferredLintHandler;
     9.8  
     9.9      public static Attr instance(Context context) {
    9.10          Attr instance = context.get(attrKey);
    9.11 @@ -108,6 +109,7 @@
    9.12          types = Types.instance(context);
    9.13          diags = JCDiagnostic.Factory.instance(context);
    9.14          annotate = Annotate.instance(context);
    9.15 +        deferredLintHandler = DeferredLintHandler.instance(context);
    9.16  
    9.17          Options options = Options.instance(context);
    9.18  
    9.19 @@ -125,7 +127,6 @@
    9.20          findDiamonds = options.get("findDiamond") != null &&
    9.21                   source.allowDiamond();
    9.22          useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
    9.23 -        enableSunApiLintControl = options.isSet("enableSunApiLintControl");
    9.24      }
    9.25  
    9.26      /** Switch: relax some constraints for retrofit mode.
    9.27 @@ -174,12 +175,6 @@
    9.28      boolean useBeforeDeclarationWarning;
    9.29  
    9.30      /**
    9.31 -     * Switch: allow lint infrastructure to control proprietary
    9.32 -     * API warnings.
    9.33 -     */
    9.34 -    boolean enableSunApiLintControl;
    9.35 -
    9.36 -    /**
    9.37       * Switch: allow strings in switch?
    9.38       */
    9.39      boolean allowStringsInSwitch;
    9.40 @@ -581,6 +576,41 @@
    9.41          }
    9.42      }
    9.43  
    9.44 +    /**
    9.45 +     * Attribute a "lazy constant value".
    9.46 +     *  @param env         The env for the const value
    9.47 +     *  @param initializer The initializer for the const value
    9.48 +     *  @param type        The expected type, or null
    9.49 +     *  @see VarSymbol#setlazyConstValue
    9.50 +     */
    9.51 +    public Object attribLazyConstantValue(Env<AttrContext> env,
    9.52 +                                      JCTree.JCExpression initializer,
    9.53 +                                      Type type) {
    9.54 +
    9.55 +        // in case no lint value has been set up for this env, scan up
    9.56 +        // env stack looking for smallest enclosing env for which it is set.
    9.57 +        Env<AttrContext> lintEnv = env;
    9.58 +        while (lintEnv.info.lint == null)
    9.59 +            lintEnv = lintEnv.next;
    9.60 +
    9.61 +        // Having found the enclosing lint value, we can initialize the lint value for this class
    9.62 +        env.info.lint = lintEnv.info.lint.augment(env.info.enclVar.attributes_field, env.info.enclVar.flags());
    9.63 +
    9.64 +        Lint prevLint = chk.setLint(env.info.lint);
    9.65 +        JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
    9.66 +
    9.67 +        try {
    9.68 +            Type itype = attribExpr(initializer, env, type);
    9.69 +            if (itype.constValue() != null)
    9.70 +                return coerce(itype, type).constValue();
    9.71 +            else
    9.72 +                return null;
    9.73 +        } finally {
    9.74 +            env.info.lint = prevLint;
    9.75 +            log.useSource(prevSource);
    9.76 +        }
    9.77 +    }
    9.78 +
    9.79      /** Attribute type reference in an `extends' or `implements' clause.
    9.80       *  Supertypes of anonymous inner classes are usually already attributed.
    9.81       *
    9.82 @@ -672,13 +702,18 @@
    9.83          Lint prevLint = chk.setLint(lint);
    9.84          MethodSymbol prevMethod = chk.setMethod(m);
    9.85          try {
    9.86 +            deferredLintHandler.flush(tree.pos());
    9.87              chk.checkDeprecatedAnnotation(tree.pos(), m);
    9.88  
    9.89              attribBounds(tree.typarams);
    9.90  
    9.91              // If we override any other methods, check that we do so properly.
    9.92              // JLS ???
    9.93 -            chk.checkClashes(tree.pos(), env.enclClass.type, m);
    9.94 +            if (m.isStatic()) {
    9.95 +                chk.checkHideClashes(tree.pos(), env.enclClass.type, m);
    9.96 +            } else {
    9.97 +                chk.checkOverrideClashes(tree.pos(), env.enclClass.type, m);
    9.98 +            }
    9.99              chk.checkOverride(tree, m);
   9.100  
   9.101              // Create a new environment with local scope
   9.102 @@ -814,6 +849,7 @@
   9.103  
   9.104          // Check that the variable's declared type is well-formed.
   9.105          chk.validate(tree.vartype, env);
   9.106 +        deferredLintHandler.flush(tree.pos());
   9.107  
   9.108          try {
   9.109              chk.checkDeprecatedAnnotation(tree.pos(), v);
   9.110 @@ -1959,7 +1995,9 @@
   9.111              tree.pos(), tree.getTag() - JCTree.ASGOffset, env,
   9.112              owntype, operand);
   9.113  
   9.114 -        if (operator.kind == MTH) {
   9.115 +        if (operator.kind == MTH &&
   9.116 +                !owntype.isErroneous() &&
   9.117 +                !operand.isErroneous()) {
   9.118              chk.checkOperator(tree.pos(),
   9.119                                (OperatorSymbol)operator,
   9.120                                tree.getTag() - JCTree.ASGOffset,
   9.121 @@ -1984,7 +2022,8 @@
   9.122              rs.resolveUnaryOperator(tree.pos(), tree.getTag(), env, argtype);
   9.123  
   9.124          Type owntype = types.createErrorType(tree.type);
   9.125 -        if (operator.kind == MTH) {
   9.126 +        if (operator.kind == MTH &&
   9.127 +                !argtype.isErroneous()) {
   9.128              owntype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
   9.129                  ? tree.arg.type
   9.130                  : operator.type.getReturnType();
   9.131 @@ -2020,7 +2059,9 @@
   9.132              rs.resolveBinaryOperator(tree.pos(), tree.getTag(), env, left, right);
   9.133  
   9.134          Type owntype = types.createErrorType(tree.type);
   9.135 -        if (operator.kind == MTH) {
   9.136 +        if (operator.kind == MTH &&
   9.137 +                !left.isErroneous() &&
   9.138 +                !right.isErroneous()) {
   9.139              owntype = operator.type.getReturnType();
   9.140              int opc = chk.checkOperator(tree.lhs.pos(),
   9.141                                          (OperatorSymbol)operator,
   9.142 @@ -2337,7 +2378,6 @@
   9.143                                   int pkind) {
   9.144              DiagnosticPosition pos = tree.pos();
   9.145              Name name = tree.name;
   9.146 -
   9.147              switch (site.tag) {
   9.148              case PACKAGE:
   9.149                  return rs.access(
   9.150 @@ -2543,17 +2583,10 @@
   9.151              // Test (1): emit a `deprecation' warning if symbol is deprecated.
   9.152              // (for constructors, the error was given when the constructor was
   9.153              // resolved)
   9.154 -            if (sym.name != names.init &&
   9.155 -                (sym.flags() & DEPRECATED) != 0 &&
   9.156 -                (env.info.scope.owner.flags() & DEPRECATED) == 0 &&
   9.157 -                sym.outermostClass() != env.info.scope.owner.outermostClass())
   9.158 -                chk.warnDeprecated(tree.pos(), sym);
   9.159 -
   9.160 -            if ((sym.flags() & PROPRIETARY) != 0) {
   9.161 -                if (enableSunApiLintControl)
   9.162 -                  chk.warnSunApi(tree.pos(), "sun.proprietary", sym);
   9.163 -                else
   9.164 -                  log.strictWarning(tree.pos(), "sun.proprietary", sym);
   9.165 +
   9.166 +            if (sym.name != names.init) {
   9.167 +                chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym);
   9.168 +                chk.checkSunAPI(tree.pos(), sym);
   9.169              }
   9.170  
   9.171              // Test (3): if symbol is a variable, check that its type and
   9.172 @@ -3156,7 +3189,7 @@
   9.173                  if (sym == null ||
   9.174                      sym.kind != VAR ||
   9.175                      ((VarSymbol) sym).getConstValue() == null)
   9.176 -                    log.error(l.head.pos(), "icls.cant.have.static.decl", sym.location());
   9.177 +                    log.error(l.head.pos(), "icls.cant.have.static.decl", c);
   9.178              }
   9.179          }
   9.180  
    10.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 10 16:24:51 2011 -0800
    10.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Feb 14 16:31:21 2011 -0800
    10.3 @@ -68,6 +68,7 @@
    10.4      private final boolean skipAnnotations;
    10.5      private boolean warnOnSyntheticConflicts;
    10.6      private boolean suppressAbortOnBadClassFile;
    10.7 +    private boolean enableSunApiLintControl;
    10.8      private final TreeInfo treeinfo;
    10.9  
   10.10      // The set of lint options currently in effect. It is initialized
   10.11 @@ -109,13 +110,13 @@
   10.12          skipAnnotations = options.isSet("skipAnnotations");
   10.13          warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
   10.14          suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
   10.15 +        enableSunApiLintControl = options.isSet("enableSunApiLintControl");
   10.16  
   10.17          Target target = Target.instance(context);
   10.18          syntheticNameChar = target.syntheticNameChar();
   10.19  
   10.20          boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
   10.21          boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
   10.22 -        boolean verboseVarargs = lint.isEnabled(LintCategory.VARARGS);
   10.23          boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
   10.24          boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();
   10.25  
   10.26 @@ -123,10 +124,10 @@
   10.27                  enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
   10.28          uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
   10.29                  enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
   10.30 -        unsafeVarargsHandler = new MandatoryWarningHandler(log, verboseVarargs,
   10.31 -                enforceMandatoryWarnings, "varargs", LintCategory.VARARGS);
   10.32          sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
   10.33                  enforceMandatoryWarnings, "sunapi", null);
   10.34 +
   10.35 +        deferredLintHandler = DeferredLintHandler.immediateHandler;
   10.36      }
   10.37  
   10.38      /** Switch: generics enabled?
   10.39 @@ -166,14 +167,14 @@
   10.40       */
   10.41      private MandatoryWarningHandler uncheckedHandler;
   10.42  
   10.43 -    /** A handler for messages about unchecked or unsafe vararg method decl.
   10.44 -     */
   10.45 -    private MandatoryWarningHandler unsafeVarargsHandler;
   10.46 -
   10.47      /** A handler for messages about using proprietary API.
   10.48       */
   10.49      private MandatoryWarningHandler sunApiHandler;
   10.50  
   10.51 +    /** A handler for deferred lint warnings.
   10.52 +     */
   10.53 +    private DeferredLintHandler deferredLintHandler;
   10.54 +
   10.55  /* *************************************************************************
   10.56   * Errors and Warnings
   10.57   **************************************************************************/
   10.58 @@ -184,6 +185,12 @@
   10.59          return prev;
   10.60      }
   10.61  
   10.62 +    DeferredLintHandler setDeferredLintHandler(DeferredLintHandler newDeferredLintHandler) {
   10.63 +        DeferredLintHandler prev = deferredLintHandler;
   10.64 +        deferredLintHandler = newDeferredLintHandler;
   10.65 +        return prev;
   10.66 +    }
   10.67 +
   10.68      MethodSymbol setMethod(MethodSymbol newMethod) {
   10.69          MethodSymbol prev = method;
   10.70          method = newMethod;
   10.71 @@ -800,8 +807,9 @@
   10.72                  Type actual = types.subst(args.head,
   10.73                      type.tsym.type.getTypeArguments(),
   10.74                      tvars_buf.toList());
   10.75 -                if (!checkExtends(actual, (TypeVar)tvars.head) &&
   10.76 -                        !tvars.head.getUpperBound().isErroneous()) {
   10.77 +                if (!isTypeArgErroneous(actual) &&
   10.78 +                        !tvars.head.getUpperBound().isErroneous() &&
   10.79 +                        !checkExtends(actual, (TypeVar)tvars.head)) {
   10.80                      return args.head;
   10.81                  }
   10.82                  args = args.tail;
   10.83 @@ -814,14 +822,39 @@
   10.84              for (Type arg : types.capture(type).getTypeArguments()) {
   10.85                  if (arg.tag == TYPEVAR &&
   10.86                          arg.getUpperBound().isErroneous() &&
   10.87 -                        !tvars.head.getUpperBound().isErroneous()) {
   10.88 +                        !tvars.head.getUpperBound().isErroneous() &&
   10.89 +                        !isTypeArgErroneous(args.head)) {
   10.90                      return args.head;
   10.91                  }
   10.92                  tvars = tvars.tail;
   10.93 +                args = args.tail;
   10.94              }
   10.95  
   10.96              return null;
   10.97          }
   10.98 +        //where
   10.99 +        boolean isTypeArgErroneous(Type t) {
  10.100 +            return isTypeArgErroneous.visit(t);
  10.101 +        }
  10.102 +
  10.103 +        Types.UnaryVisitor<Boolean> isTypeArgErroneous = new Types.UnaryVisitor<Boolean>() {
  10.104 +            public Boolean visitType(Type t, Void s) {
  10.105 +                return t.isErroneous();
  10.106 +            }
  10.107 +            @Override
  10.108 +            public Boolean visitTypeVar(TypeVar t, Void s) {
  10.109 +                return visit(t.getUpperBound());
  10.110 +            }
  10.111 +            @Override
  10.112 +            public Boolean visitCapturedType(CapturedType t, Void s) {
  10.113 +                return visit(t.getUpperBound()) ||
  10.114 +                        visit(t.getLowerBound());
  10.115 +            }
  10.116 +            @Override
  10.117 +            public Boolean visitWildcardType(WildcardType t, Void s) {
  10.118 +                return visit(t.type);
  10.119 +            }
  10.120 +        };
  10.121  
  10.122      /** Check that given modifiers are legal for given symbol and
  10.123       *  return modifiers together with any implicit modififiers for that symbol.
  10.124 @@ -1094,6 +1127,7 @@
  10.125                      log.error(tree.pos(), "improperly.formed.type.param.missing");
  10.126              }
  10.127          }
  10.128 +
  10.129          public void visitSelectInternal(JCFieldAccess tree) {
  10.130              if (tree.type.tsym.isStatic() &&
  10.131                  tree.selected.type.isParameterized()) {
  10.132 @@ -1463,11 +1497,8 @@
  10.133          }
  10.134  
  10.135          // Warn if a deprecated method overridden by a non-deprecated one.
  10.136 -        if ((other.flags() & DEPRECATED) != 0
  10.137 -            && (m.flags() & DEPRECATED) == 0
  10.138 -            && m.outermostClass() != other.outermostClass()
  10.139 -            && !isDeprecatedOverrideIgnorable(other, origin)) {
  10.140 -            warnDeprecated(TreeInfo.diagnosticPositionFor(m, tree), other);
  10.141 +        if (!isDeprecatedOverrideIgnorable(other, origin)) {
  10.142 +            checkDeprecated(TreeInfo.diagnosticPositionFor(m, tree), m, other);
  10.143          }
  10.144      }
  10.145      // where
  10.146 @@ -1648,7 +1679,7 @@
  10.147                              "(" + types.memberType(t2, s2).getParameterTypes() + ")");
  10.148                          return s2;
  10.149                      }
  10.150 -                } else if (!checkNameClash((ClassSymbol)site.tsym, s1, s2)) {
  10.151 +                } else if (checkNameClash((ClassSymbol)site.tsym, s1, s2)) {
  10.152                      log.error(pos,
  10.153                              "name.clash.same.erasure.no.override",
  10.154                              s1, s1.location(),
  10.155 @@ -1730,18 +1761,10 @@
  10.156      }
  10.157  
  10.158      private boolean checkNameClash(ClassSymbol origin, Symbol s1, Symbol s2) {
  10.159 -        if (s1.kind == MTH &&
  10.160 -                    s1.isInheritedIn(origin, types) &&
  10.161 -                    (s1.flags() & SYNTHETIC) == 0 &&
  10.162 -                    !s2.isConstructor()) {
  10.163 -            Type er1 = s2.erasure(types);
  10.164 -            Type er2 = s1.erasure(types);
  10.165 -            if (types.isSameTypes(er1.getParameterTypes(),
  10.166 -                    er2.getParameterTypes())) {
  10.167 -                    return false;
  10.168 -            }
  10.169 -        }
  10.170 -        return true;
  10.171 +        ClashFilter cf = new ClashFilter(origin.type);
  10.172 +        return (cf.accepts(s1) &&
  10.173 +                cf.accepts(s2) &&
  10.174 +                types.hasSameArgs(s1.erasure(types), s2.erasure(types)));
  10.175      }
  10.176  
  10.177  
  10.178 @@ -2080,52 +2103,82 @@
  10.179       *  @param site The class whose methods are checked.
  10.180       *  @param sym  The method symbol to be checked.
  10.181       */
  10.182 -    void checkClashes(DiagnosticPosition pos, Type site, Symbol sym) {
  10.183 -        List<Type> supertypes = types.closure(site);
  10.184 -        for (List<Type> l = supertypes; l.nonEmpty(); l = l.tail) {
  10.185 -            for (List<Type> m = supertypes; m.nonEmpty(); m = m.tail) {
  10.186 -                checkClashes(pos, l.head, m.head, site, sym);
  10.187 +    void checkOverrideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) {
  10.188 +         ClashFilter cf = new ClashFilter(site);
  10.189 +         //for each method m1 that is a member of 'site'...
  10.190 +         for (Scope.Entry e1 = types.membersClosure(site).lookup(sym.name, cf) ;
  10.191 +                e1.scope != null ; e1 = e1.next(cf)) {
  10.192 +            //...find another method m2 that is overridden (directly or indirectly)
  10.193 +            //by method 'sym' in 'site'
  10.194 +            for (Scope.Entry e2 = types.membersClosure(site).lookup(sym.name, cf) ;
  10.195 +                    e2.scope != null ; e2 = e2.next(cf)) {
  10.196 +                if (e1.sym == e2.sym || !sym.overrides(e2.sym, site.tsym, types, false)) continue;
  10.197 +                //if (i) the signature of 'sym' is not a subsignature of m1 (seen as
  10.198 +                //a member of 'site') and (ii) m1 has the same erasure as m2, issue an error
  10.199 +                if (!types.isSubSignature(sym.type, types.memberType(site, e1.sym)) &&
  10.200 +                        types.hasSameArgs(e1.sym.erasure(types), e2.sym.erasure(types))) {
  10.201 +                    sym.flags_field |= CLASH;
  10.202 +                    String key = e2.sym == sym ?
  10.203 +                            "name.clash.same.erasure.no.override" :
  10.204 +                            "name.clash.same.erasure.no.override.1";
  10.205 +                    log.error(pos,
  10.206 +                            key,
  10.207 +                            sym, sym.location(),
  10.208 +                            e1.sym, e1.sym.location(),
  10.209 +                            e2.sym, e2.sym.location());
  10.210 +                    return;
  10.211 +                }
  10.212              }
  10.213          }
  10.214      }
  10.215  
  10.216 -    /** Reports an error whenever 'sym' seen as a member of type 't1' clashes with
  10.217 -     *  some unrelated method defined in 't2'.
  10.218 +    /** Check that all static methods accessible from 'site' are
  10.219 +     *  mutually compatible (JLS 8.4.8).
  10.220 +     *
  10.221 +     *  @param pos  Position to be used for error reporting.
  10.222 +     *  @param site The class whose methods are checked.
  10.223 +     *  @param sym  The method symbol to be checked.
  10.224       */
  10.225 -    private void checkClashes(DiagnosticPosition pos, Type t1, Type t2, Type site, Symbol s1) {
  10.226 +    void checkHideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) {
  10.227          ClashFilter cf = new ClashFilter(site);
  10.228 -        s1 = ((MethodSymbol)s1).implementedIn(t1.tsym, types);
  10.229 -        if (s1 == null) return;
  10.230 -        Type st1 = types.memberType(site, s1);
  10.231 -        for (Scope.Entry e2 = t2.tsym.members().lookup(s1.name, cf); e2.scope != null; e2 = e2.next(cf)) {
  10.232 -            Symbol s2 = e2.sym;
  10.233 -            if (s1 == s2) continue;
  10.234 -            Type st2 = types.memberType(site, s2);
  10.235 -            if (!types.overrideEquivalent(st1, st2) &&
  10.236 -                    !checkNameClash((ClassSymbol)site.tsym, s1, s2)) {
  10.237 +        //for each method m1 that is a member of 'site'...
  10.238 +        for (Scope.Entry e = types.membersClosure(site).lookup(sym.name, cf) ;
  10.239 +                e.scope != null ; e = e.next(cf)) {
  10.240 +            //if (i) the signature of 'sym' is not a subsignature of m1 (seen as
  10.241 +            //a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error
  10.242 +            if (!types.isSubSignature(sym.type, types.memberType(site, e.sym)) &&
  10.243 +                    types.hasSameArgs(e.sym.erasure(types), sym.erasure(types))) {
  10.244                  log.error(pos,
  10.245 -                        "name.clash.same.erasure.no.override",
  10.246 -                        s1, s1.location(),
  10.247 -                        s2, s2.location());
  10.248 -            }
  10.249 -        }
  10.250 -    }
  10.251 -    //where
  10.252 -    private class ClashFilter implements Filter<Symbol> {
  10.253 +                        "name.clash.same.erasure.no.hide",
  10.254 +                        sym, sym.location(),
  10.255 +                        e.sym, e.sym.location());
  10.256 +                return;
  10.257 +             }
  10.258 +         }
  10.259 +     }
  10.260  
  10.261 -        Type site;
  10.262 +     //where
  10.263 +     private class ClashFilter implements Filter<Symbol> {
  10.264  
  10.265 -        ClashFilter(Type site) {
  10.266 -            this.site = site;
  10.267 -        }
  10.268 +         Type site;
  10.269  
  10.270 -        public boolean accepts(Symbol s) {
  10.271 -            return s.kind == MTH &&
  10.272 -                    (s.flags() & SYNTHETIC) == 0 &&
  10.273 -                    s.isInheritedIn(site.tsym, types) &&
  10.274 -                    !s.isConstructor();
  10.275 -        }
  10.276 -    }
  10.277 +         ClashFilter(Type site) {
  10.278 +             this.site = site;
  10.279 +         }
  10.280 +
  10.281 +         boolean shouldSkip(Symbol s) {
  10.282 +             return (s.flags() & CLASH) != 0 &&
  10.283 +                s.owner == site.tsym;
  10.284 +         }
  10.285 +
  10.286 +         public boolean accepts(Symbol s) {
  10.287 +             return s.kind == MTH &&
  10.288 +                     (s.flags() & SYNTHETIC) == 0 &&
  10.289 +                     !shouldSkip(s) &&
  10.290 +                     s.isInheritedIn(site.tsym, types) &&
  10.291 +                     !s.isConstructor();
  10.292 +         }
  10.293 +     }
  10.294  
  10.295      /** Report a conflict between a user symbol and a synthetic symbol.
  10.296       */
  10.297 @@ -2410,6 +2463,32 @@
  10.298          }
  10.299      }
  10.300  
  10.301 +    void checkDeprecated(final DiagnosticPosition pos, final Symbol other, final Symbol s) {
  10.302 +        if ((s.flags() & DEPRECATED) != 0 &&
  10.303 +                (other.flags() & DEPRECATED) == 0 &&
  10.304 +                s.outermostClass() != other.outermostClass()) {
  10.305 +            deferredLintHandler.report(new DeferredLintHandler.LintLogger() {
  10.306 +                @Override
  10.307 +                public void report() {
  10.308 +                    warnDeprecated(pos, s);
  10.309 +                }
  10.310 +            });
  10.311 +        };
  10.312 +    }
  10.313 +
  10.314 +    void checkSunAPI(final DiagnosticPosition pos, final Symbol s) {
  10.315 +        if ((s.flags() & PROPRIETARY) != 0) {
  10.316 +            deferredLintHandler.report(new DeferredLintHandler.LintLogger() {
  10.317 +                public void report() {
  10.318 +                    if (enableSunApiLintControl)
  10.319 +                      warnSunApi(pos, "sun.proprietary", s);
  10.320 +                    else
  10.321 +                      log.strictWarning(pos, "sun.proprietary", s);
  10.322 +                }
  10.323 +            });
  10.324 +        }
  10.325 +    }
  10.326 +
  10.327  /* *************************************************************************
  10.328   * Check for recursive annotation elements.
  10.329   **************************************************************************/
  10.330 @@ -2535,9 +2614,9 @@
  10.331                         Type right) {
  10.332          if (operator.opcode == ByteCodes.error) {
  10.333              log.error(pos,
  10.334 -                      "operator.cant.be.applied",
  10.335 +                      "operator.cant.be.applied.1",
  10.336                        treeinfo.operatorName(tag),
  10.337 -                      List.of(left, right));
  10.338 +                      left, right);
  10.339          }
  10.340          return operator.opcode;
  10.341      }
  10.342 @@ -2581,21 +2660,35 @@
  10.343          if (sym.owner.name == names.any) return false;
  10.344          for (Scope.Entry e = s.lookup(sym.name); e.scope == s; e = e.next()) {
  10.345              if (sym != e.sym &&
  10.346 -                sym.kind == e.sym.kind &&
  10.347 -                sym.name != names.error &&
  10.348 -                (sym.kind != MTH || types.hasSameArgs(types.erasure(sym.type), types.erasure(e.sym.type)))) {
  10.349 -                if ((sym.flags() & VARARGS) != (e.sym.flags() & VARARGS))
  10.350 +                    (e.sym.flags() & CLASH) == 0 &&
  10.351 +                    sym.kind == e.sym.kind &&
  10.352 +                    sym.name != names.error &&
  10.353 +                    (sym.kind != MTH || types.hasSameArgs(types.erasure(sym.type), types.erasure(e.sym.type)))) {
  10.354 +                if ((sym.flags() & VARARGS) != (e.sym.flags() & VARARGS)) {
  10.355                      varargsDuplicateError(pos, sym, e.sym);
  10.356 -                else if (sym.kind == MTH && !types.overrideEquivalent(sym.type, e.sym.type))
  10.357 +                    return true;
  10.358 +                } else if (sym.kind == MTH && !hasSameSignature(sym.type, e.sym.type)) {
  10.359                      duplicateErasureError(pos, sym, e.sym);
  10.360 -                else
  10.361 +                    sym.flags_field |= CLASH;
  10.362 +                    return true;
  10.363 +                } else {
  10.364                      duplicateError(pos, e.sym);
  10.365 -                return false;
  10.366 +                    return false;
  10.367 +                }
  10.368              }
  10.369          }
  10.370          return true;
  10.371      }
  10.372      //where
  10.373 +        boolean hasSameSignature(Type mt1, Type mt2) {
  10.374 +            if (mt1.tag == FORALL && mt2.tag == FORALL) {
  10.375 +                ForAll fa1 = (ForAll)mt1;
  10.376 +                ForAll fa2 = (ForAll)mt2;
  10.377 +                mt2 = types.subst(fa2, fa2.tvars, fa1.tvars);
  10.378 +            }
  10.379 +            return types.hasSameArgs(mt1.asMethodType(), mt2.asMethodType());
  10.380 +        }
  10.381 +
  10.382      /** Report duplicate declaration error.
  10.383       */
  10.384      void duplicateErasureError(DiagnosticPosition pos, Symbol sym1, Symbol sym2) {
    11.1 --- a/src/share/classes/com/sun/tools/javac/comp/Enter.java	Thu Feb 10 16:24:51 2011 -0800
    11.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Enter.java	Mon Feb 14 16:31:21 2011 -0800
    11.3 @@ -95,7 +95,6 @@
    11.4  
    11.5      Log log;
    11.6      Symtab syms;
    11.7 -    Scope.ScopeCounter scopeCounter;
    11.8      Check chk;
    11.9      TreeMaker make;
   11.10      ClassReader reader;
   11.11 @@ -123,7 +122,6 @@
   11.12          reader = ClassReader.instance(context);
   11.13          make = TreeMaker.instance(context);
   11.14          syms = Symtab.instance(context);
   11.15 -        scopeCounter = Scope.ScopeCounter.instance(context);
   11.16          chk = Check.instance(context);
   11.17          memberEnter = MemberEnter.instance(context);
   11.18          types = Types.instance(context);
   11.19 @@ -192,7 +190,7 @@
   11.20       */
   11.21      public Env<AttrContext> classEnv(JCClassDecl tree, Env<AttrContext> env) {
   11.22          Env<AttrContext> localEnv =
   11.23 -            env.dup(tree, env.info.dup(new Scope.ClassScope(tree.sym, scopeCounter)));
   11.24 +            env.dup(tree, env.info.dup(new Scope(tree.sym)));
   11.25          localEnv.enclClass = tree;
   11.26          localEnv.outer = env;
   11.27          localEnv.info.isSelfCall = false;
   11.28 @@ -328,7 +326,7 @@
   11.29              c.flatname = names.fromString(tree.packge + "." + name);
   11.30              c.sourcefile = tree.sourcefile;
   11.31              c.completer = null;
   11.32 -            c.members_field = new Scope.ClassScope(c, scopeCounter);
   11.33 +            c.members_field = new Scope(c);
   11.34              tree.packge.package_info = c;
   11.35          }
   11.36          classEnter(tree.defs, topEnv);
   11.37 @@ -396,7 +394,7 @@
   11.38          c.completer = memberEnter;
   11.39          c.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, c, tree);
   11.40          c.sourcefile = env.toplevel.sourcefile;
   11.41 -        c.members_field = new Scope.ClassScope(c, scopeCounter);
   11.42 +        c.members_field = new Scope(c);
   11.43  
   11.44          ClassType ct = (ClassType)c.type;
   11.45          if (owner.kind != PCK && (c.flags_field & STATIC) == 0) {
    12.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Feb 10 16:24:51 2011 -0800
    12.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Feb 14 16:31:21 2011 -0800
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -485,11 +485,8 @@
   12.11                  @Override
   12.12                  public Type inst(List<Type> inferred, Types types) throws NoInstanceException {
   12.13                      List<Type> formals = types.subst(mt2.argtypes, tvars, inferred);
   12.14 -                    if (!rs.argumentsAcceptable(capturedArgs, formals,
   12.15 -                           allowBoxing, useVarargs, warn)) {
   12.16 -                      // inferred method is not applicable
   12.17 -                      throw invalidInstanceException.setMessage("inferred.do.not.conform.to.params", formals, argtypes);
   12.18 -                    }
   12.19 +                    // check that actuals conform to inferred formals
   12.20 +                    checkArgumentsAcceptable(env, capturedArgs, formals, allowBoxing, useVarargs, warn);
   12.21                      // check that inferred bounds conform to their bounds
   12.22                      checkWithinBounds(all_tvars,
   12.23                             types.subst(inferredTypes, tvars, inferred), warn);
   12.24 @@ -500,17 +497,27 @@
   12.25              }};
   12.26              return mt2;
   12.27          }
   12.28 -        else if (!rs.argumentsAcceptable(capturedArgs, mt.getParameterTypes(), allowBoxing, useVarargs, warn)) {
   12.29 -            // inferred method is not applicable
   12.30 -            throw invalidInstanceException.setMessage("inferred.do.not.conform.to.params", mt.getParameterTypes(), argtypes);
   12.31 -        }
   12.32          else {
   12.33 +            // check that actuals conform to inferred formals
   12.34 +            checkArgumentsAcceptable(env, capturedArgs, mt.getParameterTypes(), allowBoxing, useVarargs, warn);
   12.35              // return instantiated version of method type
   12.36              return mt;
   12.37          }
   12.38      }
   12.39      //where
   12.40  
   12.41 +        private void checkArgumentsAcceptable(Env<AttrContext> env, List<Type> actuals, List<Type> formals,
   12.42 +                boolean allowBoxing, boolean useVarargs, Warner warn) {
   12.43 +            try {
   12.44 +                rs.checkRawArgumentsAcceptable(env, actuals, formals,
   12.45 +                       allowBoxing, useVarargs, warn);
   12.46 +            }
   12.47 +            catch (Resolve.InapplicableMethodException ex) {
   12.48 +                // inferred method is not applicable
   12.49 +                throw invalidInstanceException.setMessage(ex.getDiagnostic());
   12.50 +            }
   12.51 +        }
   12.52 +
   12.53          /** Try to instantiate argument type `that' to given type `to'.
   12.54           *  If this fails, try to insantiate `that' to `to' where
   12.55           *  every occurrence of a type variable in `tvars' is replaced
    13.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Feb 10 16:24:51 2011 -0800
    13.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Feb 14 16:31:21 2011 -0800
    13.3 @@ -68,7 +68,6 @@
    13.4      private Names names;
    13.5      private Log log;
    13.6      private Symtab syms;
    13.7 -    private Scope.ScopeCounter scopeCounter;
    13.8      private Resolve rs;
    13.9      private Check chk;
   13.10      private Attr attr;
   13.11 @@ -91,7 +90,6 @@
   13.12          names = Names.instance(context);
   13.13          log = Log.instance(context);
   13.14          syms = Symtab.instance(context);
   13.15 -        scopeCounter = Scope.ScopeCounter.instance(context);
   13.16          rs = Resolve.instance(context);
   13.17          chk = Check.instance(context);
   13.18          attr = Attr.instance(context);
   13.19 @@ -571,7 +569,7 @@
   13.20          c.flatname = chk.localClassName(c);
   13.21          c.sourcefile = owner.sourcefile;
   13.22          c.completer = null;
   13.23 -        c.members_field = new Scope.ClassScope(c, scopeCounter);
   13.24 +        c.members_field = new Scope(c);
   13.25          c.flags_field = flags;
   13.26          ClassType ctype = (ClassType) c.type;
   13.27          ctype.supertype_field = syms.objectType;
    14.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Feb 10 16:24:51 2011 -0800
    14.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Mon Feb 14 16:31:21 2011 -0800
    14.3 @@ -67,7 +67,6 @@
    14.4      private final Check chk;
    14.5      private final Attr attr;
    14.6      private final Symtab syms;
    14.7 -    private final Scope.ScopeCounter scopeCounter;
    14.8      private final TreeMaker make;
    14.9      private final ClassReader reader;
   14.10      private final Todo todo;
   14.11 @@ -75,9 +74,9 @@
   14.12      private final Types types;
   14.13      private final JCDiagnostic.Factory diags;
   14.14      private final Target target;
   14.15 +    private final DeferredLintHandler deferredLintHandler;
   14.16  
   14.17      private final boolean skipAnnotations;
   14.18 -    private final boolean allowSimplifiedVarargs;
   14.19  
   14.20      public static MemberEnter instance(Context context) {
   14.21          MemberEnter instance = context.get(memberEnterKey);
   14.22 @@ -94,7 +93,6 @@
   14.23          chk = Check.instance(context);
   14.24          attr = Attr.instance(context);
   14.25          syms = Symtab.instance(context);
   14.26 -        scopeCounter = Scope.ScopeCounter.instance(context);
   14.27          make = TreeMaker.instance(context);
   14.28          reader = ClassReader.instance(context);
   14.29          todo = Todo.instance(context);
   14.30 @@ -102,10 +100,9 @@
   14.31          types = Types.instance(context);
   14.32          diags = JCDiagnostic.Factory.instance(context);
   14.33          target = Target.instance(context);
   14.34 +        deferredLintHandler = DeferredLintHandler.instance(context);
   14.35          Options options = Options.instance(context);
   14.36          skipAnnotations = options.isSet("skipAnnotations");
   14.37 -        Source source = Source.instance(context);
   14.38 -        allowSimplifiedVarargs = source.allowSimplifiedVarargs();
   14.39      }
   14.40  
   14.41      /** A queue for classes whose members still need to be entered into the
   14.42 @@ -571,10 +568,16 @@
   14.43          tree.sym = m;
   14.44          Env<AttrContext> localEnv = methodEnv(tree, env);
   14.45  
   14.46 -        // Compute the method type
   14.47 -        m.type = signature(tree.typarams, tree.params,
   14.48 -                           tree.restype, tree.thrown,
   14.49 -                           localEnv);
   14.50 +        DeferredLintHandler prevLintHandler =
   14.51 +                chk.setDeferredLintHandler(deferredLintHandler.setPos(tree.pos()));
   14.52 +        try {
   14.53 +            // Compute the method type
   14.54 +            m.type = signature(tree.typarams, tree.params,
   14.55 +                               tree.restype, tree.thrown,
   14.56 +                               localEnv);
   14.57 +        } finally {
   14.58 +            chk.setDeferredLintHandler(prevLintHandler);
   14.59 +        }
   14.60  
   14.61          // Set m.params
   14.62          ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>();
   14.63 @@ -618,7 +621,14 @@
   14.64              localEnv = env.dup(tree, env.info.dup());
   14.65              localEnv.info.staticLevel++;
   14.66          }
   14.67 -        attr.attribType(tree.vartype, localEnv);
   14.68 +        DeferredLintHandler prevLintHandler =
   14.69 +                chk.setDeferredLintHandler(deferredLintHandler.setPos(tree.pos()));
   14.70 +        try {
   14.71 +            attr.attribType(tree.vartype, localEnv);
   14.72 +        } finally {
   14.73 +            chk.setDeferredLintHandler(prevLintHandler);
   14.74 +        }
   14.75 +
   14.76          if ((tree.mods.flags & VARARGS) != 0) {
   14.77              //if we are entering a varargs parameter, we need to replace its type
   14.78              //(a plain array type) with the more precise VarargsType --- we need
   14.79 @@ -637,7 +647,7 @@
   14.80              if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS) {
   14.81                  Env<AttrContext> initEnv = getInitEnv(tree, env);
   14.82                  initEnv.info.enclVar = v;
   14.83 -                v.setLazyConstValue(initEnv(tree, initEnv), log, attr, tree.init);
   14.84 +                v.setLazyConstValue(initEnv(tree, initEnv), attr, tree.init);
   14.85              }
   14.86          }
   14.87          if (chk.checkUnique(tree.pos(), v, enclScope)) {
   14.88 @@ -775,10 +785,11 @@
   14.89                  && s.owner.kind != MTH
   14.90                  && types.isSameType(c.type, syms.deprecatedType))
   14.91                  s.flags_field |= Flags.DEPRECATED;
   14.92 -            // Internally to java.dyn, a @PolymorphicSignature annotation
   14.93 +            // Internally to java.lang.invoke, a @PolymorphicSignature annotation
   14.94              // acts like a classfile attribute.
   14.95              if (!c.type.isErroneous() &&
   14.96 -                    types.isSameType(c.type, syms.polymorphicSignatureType)) {
   14.97 +                    (types.isSameType(c.type, syms.polymorphicSignatureType) ||
   14.98 +                     types.isSameType(c.type, syms.transientPolymorphicSignatureType))) {
   14.99                  if (!target.hasMethodHandles()) {
  14.100                      // Somebody is compiling JDK7 source code to a JDK6 target.
  14.101                      // Make it an error, since it is unlikely but important.
  14.102 @@ -1010,7 +1021,7 @@
  14.103      }
  14.104  
  14.105      private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
  14.106 -        Scope baseScope = new Scope.ClassScope(tree.sym, scopeCounter);
  14.107 +        Scope baseScope = new Scope(tree.sym);
  14.108          //import already entered local classes into base scope
  14.109          for (Scope.Entry e = env.outer.info.scope.elems ; e != null ; e = e.sibling) {
  14.110              if (e.sym.isLocal()) {
    15.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 10 16:24:51 2011 -0800
    15.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Feb 14 16:31:21 2011 -0800
    15.3 @@ -278,7 +278,7 @@
    15.4              return true;
    15.5          else {
    15.6              Symbol s2 = ((MethodSymbol)sym).implementation(site.tsym, types, true);
    15.7 -            return (s2 == null || s2 == sym ||
    15.8 +            return (s2 == null || s2 == sym || sym.owner == s2.owner ||
    15.9                      s2.isPolymorphicSignatureGeneric() ||
   15.10                      !types.isSubSignature(types.memberType(site, s2), types.memberType(site, sym)));
   15.11          }
   15.12 @@ -331,7 +331,7 @@
   15.13          throws Infer.InferenceException {
   15.14          boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles;
   15.15          if (useVarargs && (m.flags() & VARARGS) == 0)
   15.16 -            throw inapplicableMethodException.setMessage(null);
   15.17 +            throw inapplicableMethodException.setMessage();
   15.18          Type mt = types.memberType(site, m);
   15.19  
   15.20          // tvars is the list of formal type variables for which type arguments
   15.21 @@ -386,7 +386,7 @@
   15.22                                      useVarargs,
   15.23                                      warn);
   15.24  
   15.25 -        checkRawArgumentsAcceptable(argtypes, mt.getParameterTypes(),
   15.26 +        checkRawArgumentsAcceptable(env, argtypes, mt.getParameterTypes(),
   15.27                                  allowBoxing, useVarargs, warn);
   15.28          return mt;
   15.29      }
   15.30 @@ -411,19 +411,21 @@
   15.31  
   15.32      /** Check if a parameter list accepts a list of args.
   15.33       */
   15.34 -    boolean argumentsAcceptable(List<Type> argtypes,
   15.35 +    boolean argumentsAcceptable(Env<AttrContext> env,
   15.36 +                                List<Type> argtypes,
   15.37                                  List<Type> formals,
   15.38                                  boolean allowBoxing,
   15.39                                  boolean useVarargs,
   15.40                                  Warner warn) {
   15.41          try {
   15.42 -            checkRawArgumentsAcceptable(argtypes, formals, allowBoxing, useVarargs, warn);
   15.43 +            checkRawArgumentsAcceptable(env, argtypes, formals, allowBoxing, useVarargs, warn);
   15.44              return true;
   15.45          } catch (InapplicableMethodException ex) {
   15.46              return false;
   15.47          }
   15.48      }
   15.49 -    void checkRawArgumentsAcceptable(List<Type> argtypes,
   15.50 +    void checkRawArgumentsAcceptable(Env<AttrContext> env,
   15.51 +                                List<Type> argtypes,
   15.52                                  List<Type> formals,
   15.53                                  boolean allowBoxing,
   15.54                                  boolean useVarargs,
   15.55 @@ -460,6 +462,14 @@
   15.56                              elt);
   15.57                  argtypes = argtypes.tail;
   15.58              }
   15.59 +            //check varargs element type accessibility
   15.60 +            if (!isAccessible(env, elt)) {
   15.61 +                Symbol location = env.enclClass.sym;
   15.62 +                throw inapplicableMethodException.setMessage("inaccessible.varargs.type",
   15.63 +                            elt,
   15.64 +                            Kinds.kindName(location),
   15.65 +                            location);
   15.66 +            }
   15.67          }
   15.68          return;
   15.69      }
   15.70 @@ -474,6 +484,10 @@
   15.71                  this.diagnostic = null;
   15.72                  this.diags = diags;
   15.73              }
   15.74 +            InapplicableMethodException setMessage() {
   15.75 +                this.diagnostic = null;
   15.76 +                return this;
   15.77 +            }
   15.78              InapplicableMethodException setMessage(String key) {
   15.79                  this.diagnostic = key != null ? diags.fragment(key) : null;
   15.80                  return this;
   15.81 @@ -482,6 +496,10 @@
   15.82                  this.diagnostic = key != null ? diags.fragment(key, args) : null;
   15.83                  return this;
   15.84              }
   15.85 +            InapplicableMethodException setMessage(JCDiagnostic diag) {
   15.86 +                this.diagnostic = diag;
   15.87 +                return this;
   15.88 +            }
   15.89  
   15.90              public JCDiagnostic getDiagnostic() {
   15.91                  return diagnostic;
   15.92 @@ -712,13 +730,14 @@
   15.93                  Type mt1 = types.memberType(site, m1);
   15.94                  Type mt2 = types.memberType(site, m2);
   15.95                  if (!types.overrideEquivalent(mt1, mt2))
   15.96 -                    return new AmbiguityError(m1, m2);
   15.97 +                    return ambiguityError(m1, m2);
   15.98 +
   15.99                  // same signature; select (a) the non-bridge method, or
  15.100                  // (b) the one that overrides the other, or (c) the concrete
  15.101                  // one, or (d) merge both abstract signatures
  15.102 -                if ((m1.flags() & BRIDGE) != (m2.flags() & BRIDGE)) {
  15.103 +                if ((m1.flags() & BRIDGE) != (m2.flags() & BRIDGE))
  15.104                      return ((m1.flags() & BRIDGE) != 0) ? m2 : m1;
  15.105 -                }
  15.106 +
  15.107                  // if one overrides or hides the other, use it
  15.108                  TypeSymbol m1Owner = (TypeSymbol)m1.owner;
  15.109                  TypeSymbol m2Owner = (TypeSymbol)m2.owner;
  15.110 @@ -738,24 +757,24 @@
  15.111                  if (m2Abstract && !m1Abstract) return m1;
  15.112                  // both abstract or both concrete
  15.113                  if (!m1Abstract && !m2Abstract)
  15.114 -                    return new AmbiguityError(m1, m2);
  15.115 +                    return ambiguityError(m1, m2);
  15.116                  // check that both signatures have the same erasure
  15.117                  if (!types.isSameTypes(m1.erasure(types).getParameterTypes(),
  15.118                                         m2.erasure(types).getParameterTypes()))
  15.119 -                    return new AmbiguityError(m1, m2);
  15.120 +                    return ambiguityError(m1, m2);
  15.121                  // both abstract, neither overridden; merge throws clause and result type
  15.122                  Symbol mostSpecific;
  15.123                  Type result2 = mt2.getReturnType();
  15.124                  if (mt2.tag == FORALL)
  15.125                      result2 = types.subst(result2, ((ForAll)mt2).tvars, ((ForAll)mt1).tvars);
  15.126 -                if (types.isSubtype(mt1.getReturnType(), result2)) {
  15.127 +                if (types.isSubtype(mt1.getReturnType(), result2))
  15.128                      mostSpecific = m1;
  15.129 -                } else if (types.isSubtype(result2, mt1.getReturnType())) {
  15.130 +                else if (types.isSubtype(result2, mt1.getReturnType()))
  15.131                      mostSpecific = m2;
  15.132 -                } else {
  15.133 +                else {
  15.134                      // Theoretically, this can't happen, but it is possible
  15.135                      // due to error recovery or mixing incompatible class files
  15.136 -                    return new AmbiguityError(m1, m2);
  15.137 +                    return ambiguityError(m1, m2);
  15.138                  }
  15.139                  MethodSymbol result = new MethodSymbol(
  15.140                          mostSpecific.flags(),
  15.141 @@ -777,7 +796,7 @@
  15.142              }
  15.143              if (m1SignatureMoreSpecific) return m1;
  15.144              if (m2SignatureMoreSpecific) return m2;
  15.145 -            return new AmbiguityError(m1, m2);
  15.146 +            return ambiguityError(m1, m2);
  15.147          case AMBIGUOUS:
  15.148              AmbiguityError e = (AmbiguityError)m2;
  15.149              Symbol err1 = mostSpecific(m1, e.sym, env, site, allowBoxing, useVarargs);
  15.150 @@ -787,9 +806,9 @@
  15.151              if (err1 instanceof AmbiguityError &&
  15.152                  err2 instanceof AmbiguityError &&
  15.153                  ((AmbiguityError)err1).sym == ((AmbiguityError)err2).sym)
  15.154 -                return new AmbiguityError(m1, m2);
  15.155 +                return ambiguityError(m1, m2);
  15.156              else
  15.157 -                return new AmbiguityError(err1, err2);
  15.158 +                return ambiguityError(err1, err2);
  15.159          default:
  15.160              throw new AssertionError();
  15.161          }
  15.162 @@ -844,6 +863,14 @@
  15.163              return to;
  15.164          }
  15.165      }
  15.166 +    //where
  15.167 +    Symbol ambiguityError(Symbol m1, Symbol m2) {
  15.168 +        if (((m1.flags() | m2.flags()) & CLASH) != 0) {
  15.169 +            return (m1.flags() & CLASH) == 0 ? m1 : m2;
  15.170 +        } else {
  15.171 +            return new AmbiguityError(m1, m2);
  15.172 +        }
  15.173 +    }
  15.174  
  15.175      /** Find best qualified method matching given name, type and value
  15.176       *  arguments.
  15.177 @@ -1611,10 +1638,7 @@
  15.178                                  names.init, argtypes,
  15.179                                  typeargtypes, allowBoxing,
  15.180                                  useVarargs, false);
  15.181 -        if ((sym.flags() & DEPRECATED) != 0 &&
  15.182 -            (env.info.scope.owner.flags() & DEPRECATED) == 0 &&
  15.183 -            env.info.scope.owner.outermostClass() != sym.outermostClass())
  15.184 -            chk.warnDeprecated(pos, sym);
  15.185 +        chk.checkDeprecated(pos, env.info.scope.owner, sym);
  15.186          return sym;
  15.187      }
  15.188  
  15.189 @@ -1928,6 +1952,9 @@
  15.190                          key, name, first, second);
  15.191              }
  15.192              boolean hasLocation = false;
  15.193 +            if (location == null) {
  15.194 +                location = site.tsym;
  15.195 +            }
  15.196              if (!location.name.isEmpty()) {
  15.197                  if (location.kind == PCK && !site.tsym.exists()) {
  15.198                      return diags.create(dkind, log.currentSource(), pos,
  15.199 @@ -1945,7 +1972,7 @@
  15.200                  return diags.create(dkind, log.currentSource(), pos,
  15.201                          errKey, kindname, idname, //symbol kindname, name
  15.202                          typeargtypes, argtypes, //type parameters and arguments (if any)
  15.203 -                        getLocationDiag(location)); //location kindname, type
  15.204 +                        getLocationDiag(location, site)); //location kindname, type
  15.205              }
  15.206              else {
  15.207                  return diags.create(dkind, log.currentSource(), pos,
  15.208 @@ -1966,15 +1993,18 @@
  15.209              }
  15.210              return key + suffix;
  15.211          }
  15.212 -        private JCDiagnostic getLocationDiag(Symbol location) {
  15.213 -            boolean isVar = location.kind == VAR;
  15.214 -            String key = isVar ?
  15.215 -                "location.1" :
  15.216 -                "location";
  15.217 -            return diags.fragment(key,
  15.218 +        private JCDiagnostic getLocationDiag(Symbol location, Type site) {
  15.219 +            if (location.kind == VAR) {
  15.220 +                return diags.fragment("location.1",
  15.221                      kindName(location),
  15.222                      location,
  15.223 -                    isVar ? location.type : null);
  15.224 +                    location.type);
  15.225 +            } else {
  15.226 +                return diags.fragment("location",
  15.227 +                    typeKindName(site),
  15.228 +                    site,
  15.229 +                    null);
  15.230 +            }
  15.231          }
  15.232      }
  15.233  
  15.234 @@ -2025,8 +2055,14 @@
  15.235                  return null;
  15.236  
  15.237              if (isOperator(name)) {
  15.238 -                return diags.create(dkind, log.currentSource(),
  15.239 -                        pos, "operator.cant.be.applied", name, argtypes);
  15.240 +                boolean isUnaryOp = argtypes.size() == 1;
  15.241 +                String key = argtypes.size() == 1 ?
  15.242 +                    "operator.cant.be.applied" :
  15.243 +                    "operator.cant.be.applied.1";
  15.244 +                Type first = argtypes.head;
  15.245 +                Type second = !isUnaryOp ? argtypes.tail.head : null;
  15.246 +                return diags.create(dkind, log.currentSource(), pos,
  15.247 +                        key, name, first, second);
  15.248              }
  15.249              else {
  15.250                  Symbol ws = sym.asMemberOf(site, types);
    16.1 --- a/src/share/classes/com/sun/tools/javac/file/CacheFSInfo.java	Thu Feb 10 16:24:51 2011 -0800
    16.2 +++ b/src/share/classes/com/sun/tools/javac/file/CacheFSInfo.java	Mon Feb 14 16:31:21 2011 -0800
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -28,10 +28,10 @@
   16.11  import java.io.File;
   16.12  import java.io.IOException;
   16.13  import java.util.List;
   16.14 +import java.util.Map;
   16.15 +import java.util.concurrent.ConcurrentHashMap;
   16.16  
   16.17  import com.sun.tools.javac.util.Context;
   16.18 -import java.util.Map;
   16.19 -import java.util.concurrent.ConcurrentHashMap;
   16.20  
   16.21  /**
   16.22   * Caching implementation of FSInfo.
    17.1 --- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Feb 10 16:24:51 2011 -0800
    17.2 +++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Feb 14 16:31:21 2011 -0800
    17.3 @@ -76,8 +76,6 @@
    17.4   */
    17.5  public class JavacFileManager extends BaseFileManager implements StandardJavaFileManager {
    17.6  
    17.7 -    boolean useZipFileIndex;
    17.8 -
    17.9      public static char[] toArray(CharBuffer buffer) {
   17.10          if (buffer.hasArray())
   17.11              return ((CharBuffer)buffer.compact().flip()).array();
   17.12 @@ -91,6 +89,9 @@
   17.13  
   17.14      private FSInfo fsInfo;
   17.15  
   17.16 +    private boolean useZipFileIndex;
   17.17 +    private ZipFileIndexCache zipFileIndexCache;
   17.18 +
   17.19      private final File uninited = new File("U N I N I T E D");
   17.20  
   17.21      private final Set<JavaFileObject.Kind> sourceOrClass =
   17.22 @@ -163,7 +164,11 @@
   17.23  
   17.24          fsInfo = FSInfo.instance(context);
   17.25  
   17.26 -        useZipFileIndex = System.getProperty("useJavaUtilZip") == null;// TODO: options.get("useJavaUtilZip") == null;
   17.27 +        // retain check for system property for compatibility
   17.28 +        useZipFileIndex = options.isUnset("useJavaUtilZip")
   17.29 +                && System.getProperty("useJavaUtilZip") == null;
   17.30 +        if (useZipFileIndex)
   17.31 +            zipFileIndexCache = ZipFileIndexCache.getSharedInstance();
   17.32  
   17.33          mmappedIO = options.isSet("mmappedIO");
   17.34          ignoreSymbolFile = options.isSet("ignore.symbol.file");
   17.35 @@ -526,7 +531,7 @@
   17.36                      archive = new ZipArchive(this, zdir);
   17.37                  } else {
   17.38                      archive = new ZipFileIndexArchive(this,
   17.39 -                                ZipFileIndex.getZipFileIndex(zipFileName,
   17.40 +                                zipFileIndexCache.getZipFileIndex(zipFileName,
   17.41                                      null,
   17.42                                      usePreindexedCache,
   17.43                                      preindexCacheLocation,
   17.44 @@ -538,7 +543,7 @@
   17.45                  }
   17.46                  else {
   17.47                      archive = new ZipFileIndexArchive(this,
   17.48 -                                ZipFileIndex.getZipFileIndex(zipFileName,
   17.49 +                                zipFileIndexCache.getZipFileIndex(zipFileName,
   17.50                                      symbolFilePrefix,
   17.51                                      usePreindexedCache,
   17.52                                      preindexCacheLocation,
    18.1 --- a/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java	Thu Feb 10 16:24:51 2011 -0800
    18.2 +++ b/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java	Mon Feb 14 16:31:21 2011 -0800
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -38,11 +38,9 @@
   18.11  import java.util.Collections;
   18.12  import java.util.HashMap;
   18.13  import java.util.HashSet;
   18.14 -import java.util.Iterator;
   18.15  import java.util.List;
   18.16  import java.util.Map;
   18.17  import java.util.Set;
   18.18 -import java.util.concurrent.locks.ReentrantLock;
   18.19  import java.util.zip.DataFormatException;
   18.20  import java.util.zip.Inflater;
   18.21  import java.util.zip.ZipException;
   18.22 @@ -50,24 +48,28 @@
   18.23  import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
   18.24  import com.sun.tools.javac.file.RelativePath.RelativeFile;
   18.25  
   18.26 -/** This class implements building of index of a zip archive and access to it's context.
   18.27 - *  It also uses prebuild index if available. It supports invocations where it will
   18.28 - *  serialize an optimized zip index file to disk.
   18.29 +/**
   18.30 + * This class implements the building of index of a zip archive and access to
   18.31 + * its context. It also uses a prebuilt index if available.
   18.32 + * It supports invocations where it will serialize an optimized zip index file
   18.33 + * to disk.
   18.34   *
   18.35 - *  In oreder to use secondary index file make sure the option "usezipindex" is in the Options object,
   18.36 - *  when JavacFileManager is invoked. (You can pass "-XDusezipindex" on the command line.
   18.37 + * In order to use a secondary index file, set "usezipindex" in the Options
   18.38 + * object when JavacFileManager is invoked. (You can pass "-XDusezipindex" on
   18.39 + * the command line.)
   18.40   *
   18.41 - *  Location where to look for/generate optimized zip index files can be provided using
   18.42 - *  "-XDcachezipindexdir=<directory>". If this flag is not provided, the dfault location is
   18.43 - *  the value of the "java.io.tmpdir" system property.
   18.44 + * Location where to look for/generate optimized zip index files can be
   18.45 + * provided using "-XDcachezipindexdir=<directory>". If this flag is not
   18.46 + * provided, the default location is the value of the "java.io.tmpdir" system
   18.47 + * property.
   18.48   *
   18.49 - *  If key "-XDwritezipindexfiles" is specified, there will be new optimized index file
   18.50 - *  created for each archive, used by the compiler for compilation, at location,
   18.51 - *  specified by "cachezipindexdir" option.
   18.52 + * If "-XDwritezipindexfiles" is specified, there will be new optimized index
   18.53 + * file created for each archive, used by the compiler for compilation, at the
   18.54 + * location specified by the "cachezipindexdir" option.
   18.55   *
   18.56 - * If nonBatchMode option is specified (-XDnonBatchMode) the compiler will use timestamp
   18.57 - * checking to reindex the zip files if it is needed. In batch mode the timestamps are not checked
   18.58 - * and the compiler uses the cached indexes.
   18.59 + * If system property nonBatchMode option is specified the compiler will use
   18.60 + * timestamp checking to reindex the zip files if it is needed. In batch mode
   18.61 + * the timestamps are not checked and the compiler uses the cached indexes.
   18.62   *
   18.63   * <p><b>This is NOT part of any supported API.
   18.64   * If you write code that depends on this, you do so at your own risk.
   18.65 @@ -80,18 +82,18 @@
   18.66  
   18.67      public final static long NOT_MODIFIED = Long.MIN_VALUE;
   18.68  
   18.69 -    private static Map<File, ZipFileIndex> zipFileIndexCache = new HashMap<File, ZipFileIndex>();
   18.70 -    private static ReentrantLock lock = new ReentrantLock();
   18.71  
   18.72      private static boolean NON_BATCH_MODE = System.getProperty("nonBatchMode") != null;// TODO: Use -XD compiler switch for this.
   18.73  
   18.74 -    private Map<RelativeDirectory, DirectoryEntry> directories = Collections.<RelativeDirectory, DirectoryEntry>emptyMap();
   18.75 -    private Set<RelativeDirectory> allDirs = Collections.<RelativeDirectory>emptySet();
   18.76 +    private Map<RelativeDirectory, DirectoryEntry> directories =
   18.77 +            Collections.<RelativeDirectory, DirectoryEntry>emptyMap();
   18.78 +    private Set<RelativeDirectory> allDirs =
   18.79 +            Collections.<RelativeDirectory>emptySet();
   18.80  
   18.81      // ZipFileIndex data entries
   18.82 -    private File zipFile;
   18.83 +    final File zipFile;
   18.84      private Reference<File> absFileRef;
   18.85 -    private long zipFileLastModified = NOT_MODIFIED;
   18.86 +    long zipFileLastModified = NOT_MODIFIED;
   18.87      private RandomAccessFile zipRandomFile;
   18.88      private Entry[] entries;
   18.89  
   18.90 @@ -99,156 +101,24 @@
   18.91      private File zipIndexFile = null;
   18.92      private boolean triedToReadIndex = false;
   18.93      final RelativeDirectory symbolFilePrefix;
   18.94 -    private int symbolFilePrefixLength = 0;
   18.95 +    private final int symbolFilePrefixLength;
   18.96      private boolean hasPopulatedData = false;
   18.97 -    private long lastReferenceTimeStamp = NOT_MODIFIED;
   18.98 +    long lastReferenceTimeStamp = NOT_MODIFIED;
   18.99  
  18.100 -    private boolean usePreindexedCache = false;
  18.101 -    private String preindexedCacheLocation = null;
  18.102 +    private final boolean usePreindexedCache;
  18.103 +    private final String preindexedCacheLocation;
  18.104  
  18.105      private boolean writeIndex = false;
  18.106  
  18.107 -    private Map <String, SoftReference<RelativeDirectory>> relativeDirectoryCache =
  18.108 +    private Map<String, SoftReference<RelativeDirectory>> relativeDirectoryCache =
  18.109              new HashMap<String, SoftReference<RelativeDirectory>>();
  18.110  
  18.111 -    /**
  18.112 -     * Returns a list of all ZipFileIndex entries
  18.113 -     *
  18.114 -     * @return A list of ZipFileIndex entries, or an empty list
  18.115 -     */
  18.116 -    public static List<ZipFileIndex> getZipFileIndexes() {
  18.117 -        return getZipFileIndexes(false);
  18.118 +
  18.119 +    public synchronized boolean isOpen() {
  18.120 +        return (zipRandomFile != null);
  18.121      }
  18.122  
  18.123 -    /**
  18.124 -     * Returns a list of all ZipFileIndex entries
  18.125 -     *
  18.126 -     * @param openedOnly If true it returns a list of only opened ZipFileIndex entries, otherwise
  18.127 -     *                   all ZipFileEntry(s) are included into the list.
  18.128 -     * @return A list of ZipFileIndex entries, or an empty list
  18.129 -     */
  18.130 -    public static List<ZipFileIndex> getZipFileIndexes(boolean openedOnly) {
  18.131 -        List<ZipFileIndex> zipFileIndexes = new ArrayList<ZipFileIndex>();
  18.132 -        lock.lock();
  18.133 -        try {
  18.134 -            zipFileIndexes.addAll(zipFileIndexCache.values());
  18.135 -
  18.136 -            if (openedOnly) {
  18.137 -                for(ZipFileIndex elem : zipFileIndexes) {
  18.138 -                    if (!elem.isOpen()) {
  18.139 -                        zipFileIndexes.remove(elem);
  18.140 -                    }
  18.141 -                }
  18.142 -            }
  18.143 -        }
  18.144 -        finally {
  18.145 -            lock.unlock();
  18.146 -        }
  18.147 -        return zipFileIndexes;
  18.148 -    }
  18.149 -
  18.150 -    public boolean isOpen() {
  18.151 -        lock.lock();
  18.152 -        try {
  18.153 -            return zipRandomFile != null;
  18.154 -        }
  18.155 -        finally {
  18.156 -            lock.unlock();
  18.157 -        }
  18.158 -    }
  18.159 -
  18.160 -    public static ZipFileIndex getZipFileIndex(File zipFile,
  18.161 -            RelativeDirectory symbolFilePrefix,
  18.162 -            boolean useCache, String cacheLocation,
  18.163 -            boolean writeIndex) throws IOException {
  18.164 -        ZipFileIndex zi = null;
  18.165 -        lock.lock();
  18.166 -        try {
  18.167 -            zi = getExistingZipIndex(zipFile);
  18.168 -
  18.169 -            if (zi == null || (zi != null && zipFile.lastModified() != zi.zipFileLastModified)) {
  18.170 -                zi = new ZipFileIndex(zipFile, symbolFilePrefix, writeIndex,
  18.171 -                        useCache, cacheLocation);
  18.172 -                zipFileIndexCache.put(zipFile, zi);
  18.173 -            }
  18.174 -        }
  18.175 -        finally {
  18.176 -            lock.unlock();
  18.177 -        }
  18.178 -        return zi;
  18.179 -    }
  18.180 -
  18.181 -    public static ZipFileIndex getExistingZipIndex(File zipFile) {
  18.182 -        lock.lock();
  18.183 -        try {
  18.184 -            return zipFileIndexCache.get(zipFile);
  18.185 -        }
  18.186 -        finally {
  18.187 -            lock.unlock();
  18.188 -        }
  18.189 -    }
  18.190 -
  18.191 -    public static void clearCache() {
  18.192 -        lock.lock();
  18.193 -        try {
  18.194 -            zipFileIndexCache.clear();
  18.195 -        }
  18.196 -        finally {
  18.197 -            lock.unlock();
  18.198 -        }
  18.199 -    }
  18.200 -
  18.201 -    public static void clearCache(long timeNotUsed) {
  18.202 -        lock.lock();
  18.203 -        try {
  18.204 -            Iterator<File> cachedFileIterator = zipFileIndexCache.keySet().iterator();
  18.205 -            while (cachedFileIterator.hasNext()) {
  18.206 -                File cachedFile = cachedFileIterator.next();
  18.207 -                ZipFileIndex cachedZipIndex = zipFileIndexCache.get(cachedFile);
  18.208 -                if (cachedZipIndex != null) {
  18.209 -                    long timeToTest = cachedZipIndex.lastReferenceTimeStamp + timeNotUsed;
  18.210 -                    if (timeToTest < cachedZipIndex.lastReferenceTimeStamp || // Overflow...
  18.211 -                            System.currentTimeMillis() > timeToTest) {
  18.212 -                        zipFileIndexCache.remove(cachedFile);
  18.213 -                    }
  18.214 -                }
  18.215 -            }
  18.216 -        }
  18.217 -        finally {
  18.218 -            lock.unlock();
  18.219 -        }
  18.220 -    }
  18.221 -
  18.222 -    public static void removeFromCache(File file) {
  18.223 -        lock.lock();
  18.224 -        try {
  18.225 -            zipFileIndexCache.remove(file);
  18.226 -        }
  18.227 -        finally {
  18.228 -            lock.unlock();
  18.229 -        }
  18.230 -    }
  18.231 -
  18.232 -    /** Sets already opened list of ZipFileIndexes from an outside client
  18.233 -      * of the compiler. This functionality should be used in a non-batch clients of the compiler.
  18.234 -      */
  18.235 -    public static void setOpenedIndexes(List<ZipFileIndex>indexes) throws IllegalStateException {
  18.236 -        lock.lock();
  18.237 -        try {
  18.238 -            if (zipFileIndexCache.isEmpty()) {
  18.239 -                throw new IllegalStateException("Setting opened indexes should be called only when the ZipFileCache is empty. Call JavacFileManager.flush() before calling this method.");
  18.240 -            }
  18.241 -
  18.242 -            for (ZipFileIndex zfi : indexes) {
  18.243 -                zipFileIndexCache.put(zfi.zipFile, zfi);
  18.244 -            }
  18.245 -        }
  18.246 -        finally {
  18.247 -            lock.unlock();
  18.248 -        }
  18.249 -    }
  18.250 -
  18.251 -    private ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
  18.252 +    ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
  18.253              boolean useCache, String cacheLocation) throws IOException {
  18.254          this.zipFile = zipFile;
  18.255          this.symbolFilePrefix = symbolFilePrefix;
  18.256 @@ -266,19 +136,22 @@
  18.257          checkIndex();
  18.258      }
  18.259  
  18.260 +    @Override
  18.261      public String toString() {
  18.262          return "ZipFileIndex[" + zipFile + "]";
  18.263      }
  18.264  
  18.265      // Just in case...
  18.266 -    protected void finalize() {
  18.267 +    @Override
  18.268 +    protected void finalize() throws Throwable {
  18.269          closeFile();
  18.270 +        super.finalize();
  18.271      }
  18.272  
  18.273      private boolean isUpToDate() {
  18.274 -        if (zipFile != null &&
  18.275 -                ((!NON_BATCH_MODE) || zipFileLastModified == zipFile.lastModified()) &&
  18.276 -                hasPopulatedData) {
  18.277 +        if (zipFile != null
  18.278 +                && ((!NON_BATCH_MODE) || zipFileLastModified == zipFile.lastModified())
  18.279 +                && hasPopulatedData) {
  18.280              return true;
  18.281          }
  18.282  
  18.283 @@ -339,15 +212,9 @@
  18.284          allDirs = Collections.<RelativeDirectory>emptySet();
  18.285      }
  18.286  
  18.287 -    public void close() {
  18.288 -        lock.lock();
  18.289 -        try {
  18.290 -            writeIndex();
  18.291 -            closeFile();
  18.292 -        }
  18.293 -        finally {
  18.294 -            lock.unlock();
  18.295 -        }
  18.296 +    public synchronized void close() {
  18.297 +        writeIndex();
  18.298 +        closeFile();
  18.299      }
  18.300  
  18.301      private void closeFile() {
  18.302 @@ -361,29 +228,24 @@
  18.303      }
  18.304  
  18.305      /**
  18.306 -     * Returns the ZipFileIndexEntry for an absolute path, if there is one.
  18.307 +     * Returns the ZipFileIndexEntry for a path, if there is one.
  18.308       */
  18.309 -    Entry getZipIndexEntry(RelativePath path) {
  18.310 -        lock.lock();
  18.311 +    synchronized Entry getZipIndexEntry(RelativePath path) {
  18.312          try {
  18.313              checkIndex();
  18.314              DirectoryEntry de = directories.get(path.dirname());
  18.315              String lookFor = path.basename();
  18.316 -            return de == null ? null : de.getEntry(lookFor);
  18.317 +            return (de == null) ? null : de.getEntry(lookFor);
  18.318          }
  18.319          catch (IOException e) {
  18.320              return null;
  18.321          }
  18.322 -        finally {
  18.323 -            lock.unlock();
  18.324 -        }
  18.325      }
  18.326  
  18.327      /**
  18.328 -     * Returns a javac List of filenames within an absolute path in the ZipFileIndex.
  18.329 +     * Returns a javac List of filenames within a directory in the ZipFileIndex.
  18.330       */
  18.331 -    public com.sun.tools.javac.util.List<String> getFiles(RelativeDirectory path) {
  18.332 -        lock.lock();
  18.333 +    public synchronized com.sun.tools.javac.util.List<String> getFiles(RelativeDirectory path) {
  18.334          try {
  18.335              checkIndex();
  18.336  
  18.337 @@ -398,13 +260,9 @@
  18.338          catch (IOException e) {
  18.339              return com.sun.tools.javac.util.List.<String>nil();
  18.340          }
  18.341 -        finally {
  18.342 -            lock.unlock();
  18.343 -        }
  18.344      }
  18.345  
  18.346 -    public List<String> getDirectories(RelativeDirectory path) {
  18.347 -        lock.lock();
  18.348 +    public synchronized List<String> getDirectories(RelativeDirectory path) {
  18.349          try {
  18.350              checkIndex();
  18.351  
  18.352 @@ -420,13 +278,9 @@
  18.353          catch (IOException e) {
  18.354              return com.sun.tools.javac.util.List.<String>nil();
  18.355          }
  18.356 -        finally {
  18.357 -            lock.unlock();
  18.358 -        }
  18.359      }
  18.360  
  18.361 -    public Set<RelativeDirectory> getAllDirectories() {
  18.362 -        lock.lock();
  18.363 +    public synchronized Set<RelativeDirectory> getAllDirectories() {
  18.364          try {
  18.365              checkIndex();
  18.366              if (allDirs == Collections.EMPTY_SET) {
  18.367 @@ -438,9 +292,6 @@
  18.368          catch (IOException e) {
  18.369              return Collections.<RelativeDirectory>emptySet();
  18.370          }
  18.371 -        finally {
  18.372 -            lock.unlock();
  18.373 -        }
  18.374      }
  18.375  
  18.376      /**
  18.377 @@ -450,8 +301,7 @@
  18.378       * @param path A path within the zip.
  18.379       * @return True if the path is a file or dir, false otherwise.
  18.380       */
  18.381 -    public boolean contains(RelativePath path) {
  18.382 -        lock.lock();
  18.383 +    public synchronized boolean contains(RelativePath path) {
  18.384          try {
  18.385              checkIndex();
  18.386              return getZipIndexEntry(path) != null;
  18.387 @@ -459,114 +309,69 @@
  18.388          catch (IOException e) {
  18.389              return false;
  18.390          }
  18.391 -        finally {
  18.392 -            lock.unlock();
  18.393 +    }
  18.394 +
  18.395 +    public synchronized boolean isDirectory(RelativePath path) throws IOException {
  18.396 +        // The top level in a zip file is always a directory.
  18.397 +        if (path.getPath().length() == 0) {
  18.398 +            lastReferenceTimeStamp = System.currentTimeMillis();
  18.399 +            return true;
  18.400 +        }
  18.401 +
  18.402 +        checkIndex();
  18.403 +        return directories.get(path) != null;
  18.404 +    }
  18.405 +
  18.406 +    public synchronized long getLastModified(RelativeFile path) throws IOException {
  18.407 +        Entry entry = getZipIndexEntry(path);
  18.408 +        if (entry == null)
  18.409 +            throw new FileNotFoundException();
  18.410 +        return entry.getLastModified();
  18.411 +    }
  18.412 +
  18.413 +    public synchronized int length(RelativeFile path) throws IOException {
  18.414 +        Entry entry = getZipIndexEntry(path);
  18.415 +        if (entry == null)
  18.416 +            throw new FileNotFoundException();
  18.417 +
  18.418 +        if (entry.isDir) {
  18.419 +            return 0;
  18.420 +        }
  18.421 +
  18.422 +        byte[] header = getHeader(entry);
  18.423 +        // entry is not compressed?
  18.424 +        if (get2ByteLittleEndian(header, 8) == 0) {
  18.425 +            return entry.compressedSize;
  18.426 +        } else {
  18.427 +            return entry.size;
  18.428          }
  18.429      }
  18.430  
  18.431 -    public boolean isDirectory(RelativePath path) throws IOException {
  18.432 -        lock.lock();
  18.433 -        try {
  18.434 -            // The top level in a zip file is always a directory.
  18.435 -            if (path.getPath().length() == 0) {
  18.436 -                lastReferenceTimeStamp = System.currentTimeMillis();
  18.437 -                return true;
  18.438 -            }
  18.439 -
  18.440 -            checkIndex();
  18.441 -            return directories.get(path) != null;
  18.442 -        }
  18.443 -        finally {
  18.444 -            lock.unlock();
  18.445 -        }
  18.446 +    public synchronized byte[] read(RelativeFile path) throws IOException {
  18.447 +        Entry entry = getZipIndexEntry(path);
  18.448 +        if (entry == null)
  18.449 +            throw new FileNotFoundException("Path not found in ZIP: " + path.path);
  18.450 +        return read(entry);
  18.451      }
  18.452  
  18.453 -    public long getLastModified(RelativeFile path) throws IOException {
  18.454 -        lock.lock();
  18.455 -        try {
  18.456 -            Entry entry = getZipIndexEntry(path);
  18.457 -            if (entry == null)
  18.458 -                throw new FileNotFoundException();
  18.459 -            return entry.getLastModified();
  18.460 -        }
  18.461 -        finally {
  18.462 -            lock.unlock();
  18.463 -        }
  18.464 +    synchronized byte[] read(Entry entry) throws IOException {
  18.465 +        openFile();
  18.466 +        byte[] result = readBytes(entry);
  18.467 +        closeFile();
  18.468 +        return result;
  18.469      }
  18.470  
  18.471 -    public int length(RelativeFile path) throws IOException {
  18.472 -        lock.lock();
  18.473 -        try {
  18.474 -            Entry entry = getZipIndexEntry(path);
  18.475 -            if (entry == null)
  18.476 -                throw new FileNotFoundException();
  18.477 -
  18.478 -            if (entry.isDir) {
  18.479 -                return 0;
  18.480 -            }
  18.481 -
  18.482 -            byte[] header = getHeader(entry);
  18.483 -            // entry is not compressed?
  18.484 -            if (get2ByteLittleEndian(header, 8) == 0) {
  18.485 -                return entry.compressedSize;
  18.486 -            } else {
  18.487 -                return entry.size;
  18.488 -            }
  18.489 -        }
  18.490 -        finally {
  18.491 -            lock.unlock();
  18.492 -        }
  18.493 +    public synchronized int read(RelativeFile path, byte[] buffer) throws IOException {
  18.494 +        Entry entry = getZipIndexEntry(path);
  18.495 +        if (entry == null)
  18.496 +            throw new FileNotFoundException();
  18.497 +        return read(entry, buffer);
  18.498      }
  18.499  
  18.500 -    public byte[] read(RelativeFile path) throws IOException {
  18.501 -        lock.lock();
  18.502 -        try {
  18.503 -            Entry entry = getZipIndexEntry(path);
  18.504 -            if (entry == null)
  18.505 -                throw new FileNotFoundException("Path not found in ZIP: " + path.path);
  18.506 -            return read(entry);
  18.507 -        }
  18.508 -        finally {
  18.509 -            lock.unlock();
  18.510 -        }
  18.511 -    }
  18.512 -
  18.513 -    byte[] read(Entry entry) throws IOException {
  18.514 -        lock.lock();
  18.515 -        try {
  18.516 -            openFile();
  18.517 -            byte[] result = readBytes(entry);
  18.518 -            closeFile();
  18.519 -            return result;
  18.520 -        }
  18.521 -        finally {
  18.522 -            lock.unlock();
  18.523 -        }
  18.524 -    }
  18.525 -
  18.526 -    public int read(RelativeFile path, byte[] buffer) throws IOException {
  18.527 -        lock.lock();
  18.528 -        try {
  18.529 -            Entry entry = getZipIndexEntry(path);
  18.530 -            if (entry == null)
  18.531 -                throw new FileNotFoundException();
  18.532 -            return read(entry, buffer);
  18.533 -        }
  18.534 -        finally {
  18.535 -            lock.unlock();
  18.536 -        }
  18.537 -    }
  18.538 -
  18.539 -    int read(Entry entry, byte[] buffer)
  18.540 +    synchronized int read(Entry entry, byte[] buffer)
  18.541              throws IOException {
  18.542 -        lock.lock();
  18.543 -        try {
  18.544 -            int result = readBytes(entry, buffer);
  18.545 -            return result;
  18.546 -        }
  18.547 -        finally {
  18.548 -            lock.unlock();
  18.549 -        }
  18.550 +        int result = readBytes(entry, buffer);
  18.551 +        return  result;
  18.552      }
  18.553  
  18.554      private byte[] readBytes(Entry entry) throws IOException {
  18.555 @@ -638,21 +443,20 @@
  18.556    /*
  18.557     * Inflate using the java.util.zip.Inflater class
  18.558     */
  18.559 -    private static Inflater inflater;
  18.560 +    private SoftReference<Inflater> inflaterRef;
  18.561      private int inflate(byte[] src, byte[] dest) {
  18.562 +        Inflater inflater = (inflaterRef == null ? null : inflaterRef.get());
  18.563  
  18.564          // construct the inflater object or reuse an existing one
  18.565          if (inflater == null)
  18.566 -            inflater = new Inflater(true);
  18.567 +            inflaterRef = new SoftReference<Inflater>(inflater = new Inflater(true));
  18.568  
  18.569 -        synchronized (inflater) {
  18.570 -            inflater.reset();
  18.571 -            inflater.setInput(src);
  18.572 -            try {
  18.573 -                return inflater.inflate(dest);
  18.574 -            } catch (DataFormatException ex) {
  18.575 -                return -1;
  18.576 -            }
  18.577 +        inflater.reset();
  18.578 +        inflater.setInput(src);
  18.579 +        try {
  18.580 +            return inflater.inflate(dest);
  18.581 +        } catch (DataFormatException ex) {
  18.582 +            return -1;
  18.583          }
  18.584      }
  18.585  
  18.586 @@ -855,14 +659,10 @@
  18.587       * @return long
  18.588       */
  18.589      public long getZipFileLastModified() throws IOException {
  18.590 -        lock.lock();
  18.591 -        try {
  18.592 +        synchronized (this) {
  18.593              checkIndex();
  18.594              return zipFileLastModified;
  18.595          }
  18.596 -        finally {
  18.597 -            lock.unlock();
  18.598 -        }
  18.599      }
  18.600  
  18.601      /** ------------------------------------------------------------------------
  18.602 @@ -1028,8 +828,7 @@
  18.603          }
  18.604  
  18.605          boolean ret = false;
  18.606 -        lock.lock();
  18.607 -        try {
  18.608 +        synchronized (this) {
  18.609              triedToReadIndex = true;
  18.610              RandomAccessFile raf = null;
  18.611              try {
  18.612 @@ -1071,9 +870,6 @@
  18.613                  readFromIndex = true;
  18.614              }
  18.615          }
  18.616 -        finally {
  18.617 -            lock.unlock();
  18.618 -        }
  18.619  
  18.620          return ret;
  18.621      }
  18.622 @@ -1144,8 +940,8 @@
  18.623                  raf.seek(currFP);
  18.624  
  18.625                  // Now write each of the files in the DirectoryEntry
  18.626 -                List<Entry> entries = de.getEntriesAsCollection();
  18.627 -                for (Entry zfie : entries) {
  18.628 +                List<Entry> list = de.getEntriesAsCollection();
  18.629 +                for (Entry zfie : list) {
  18.630                      // Write the name bytes
  18.631                      byte [] zfieNameBytes = zfie.name.getBytes("UTF-8");
  18.632                      int zfieNameBytesLen = zfieNameBytes.length;
  18.633 @@ -1191,13 +987,9 @@
  18.634      }
  18.635  
  18.636      public boolean writeZipIndex() {
  18.637 -        lock.lock();
  18.638 -        try {
  18.639 +        synchronized (this) {
  18.640              return writeIndex();
  18.641          }
  18.642 -        finally {
  18.643 -            lock.unlock();
  18.644 -        }
  18.645      }
  18.646  
  18.647      private File getIndexFile() {
  18.648 @@ -1328,7 +1120,7 @@
  18.649              return hash;
  18.650          }
  18.651  
  18.652 -
  18.653 +        @Override
  18.654          public String toString() {
  18.655              return isDir ? ("Dir:" + dir + " : " + name) :
  18.656                  (dir + ":" + name);
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java	Mon Feb 14 16:31:21 2011 -0800
    19.3 @@ -0,0 +1,149 @@
    19.4 +/*
    19.5 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 + *
    19.8 + * This code is free software; you can redistribute it and/or modify it
    19.9 + * under the terms of the GNU General Public License version 2 only, as
   19.10 + * published by the Free Software Foundation.  Oracle designates this
   19.11 + * particular file as subject to the "Classpath" exception as provided
   19.12 + * by Oracle in the LICENSE file that accompanied this code.
   19.13 + *
   19.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   19.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.17 + * version 2 for more details (a copy is included in the LICENSE file that
   19.18 + * accompanied this code).
   19.19 + *
   19.20 + * You should have received a copy of the GNU General Public License version
   19.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   19.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.23 + *
   19.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.25 + * or visit www.oracle.com if you need additional information or have any
   19.26 + * questions.
   19.27 + */
   19.28 +
   19.29 +package com.sun.tools.javac.file;
   19.30 +
   19.31 +import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
   19.32 +import com.sun.tools.javac.util.Context;
   19.33 +import java.io.File;
   19.34 +import java.io.IOException;
   19.35 +import java.util.ArrayList;
   19.36 +import java.util.HashMap;
   19.37 +import java.util.Iterator;
   19.38 +import java.util.List;
   19.39 +import java.util.Map;
   19.40 +
   19.41 +
   19.42 +/** A cache for ZipFileIndex objects. */
   19.43 +public class ZipFileIndexCache {
   19.44 +
   19.45 +    private final Map<File, ZipFileIndex> map =
   19.46 +            new HashMap<File, ZipFileIndex>();
   19.47 +
   19.48 +    /** Get a shared instance of the cache. */
   19.49 +    private static ZipFileIndexCache sharedInstance;
   19.50 +    public synchronized static ZipFileIndexCache getSharedInstance() {
   19.51 +        if (sharedInstance == null)
   19.52 +            sharedInstance = new ZipFileIndexCache();
   19.53 +        return sharedInstance;
   19.54 +    }
   19.55 +
   19.56 +    /** Get a context-specific instance of a cache. */
   19.57 +    public static ZipFileIndexCache instance(Context context) {
   19.58 +        ZipFileIndexCache instance = context.get(ZipFileIndexCache.class);
   19.59 +        if (instance == null)
   19.60 +            context.put(ZipFileIndexCache.class, instance = new ZipFileIndexCache());
   19.61 +        return instance;
   19.62 +    }
   19.63 +
   19.64 +    /**
   19.65 +     * Returns a list of all ZipFileIndex entries
   19.66 +     *
   19.67 +     * @return A list of ZipFileIndex entries, or an empty list
   19.68 +     */
   19.69 +    public List<ZipFileIndex> getZipFileIndexes() {
   19.70 +        return getZipFileIndexes(false);
   19.71 +    }
   19.72 +
   19.73 +    /**
   19.74 +     * Returns a list of all ZipFileIndex entries
   19.75 +     *
   19.76 +     * @param openedOnly If true it returns a list of only opened ZipFileIndex entries, otherwise
   19.77 +     *                   all ZipFileEntry(s) are included into the list.
   19.78 +     * @return A list of ZipFileIndex entries, or an empty list
   19.79 +     */
   19.80 +    public synchronized List<ZipFileIndex> getZipFileIndexes(boolean openedOnly) {
   19.81 +        List<ZipFileIndex> zipFileIndexes = new ArrayList<ZipFileIndex>();
   19.82 +
   19.83 +        zipFileIndexes.addAll(map.values());
   19.84 +
   19.85 +        if (openedOnly) {
   19.86 +            for(ZipFileIndex elem : zipFileIndexes) {
   19.87 +                if (!elem.isOpen()) {
   19.88 +                    zipFileIndexes.remove(elem);
   19.89 +                }
   19.90 +            }
   19.91 +        }
   19.92 +
   19.93 +        return zipFileIndexes;
   19.94 +    }
   19.95 +
   19.96 +    public synchronized ZipFileIndex getZipFileIndex(File zipFile,
   19.97 +            RelativeDirectory symbolFilePrefix,
   19.98 +            boolean useCache, String cacheLocation,
   19.99 +            boolean writeIndex) throws IOException {
  19.100 +        ZipFileIndex zi = getExistingZipIndex(zipFile);
  19.101 +
  19.102 +        if (zi == null || (zi != null && zipFile.lastModified() != zi.zipFileLastModified)) {
  19.103 +            zi = new ZipFileIndex(zipFile, symbolFilePrefix, writeIndex,
  19.104 +                    useCache, cacheLocation);
  19.105 +            map.put(zipFile, zi);
  19.106 +        }
  19.107 +        return zi;
  19.108 +    }
  19.109 +
  19.110 +    public synchronized ZipFileIndex getExistingZipIndex(File zipFile) {
  19.111 +        return map.get(zipFile);
  19.112 +    }
  19.113 +
  19.114 +    public synchronized void clearCache() {
  19.115 +        map.clear();
  19.116 +    }
  19.117 +
  19.118 +    public synchronized void clearCache(long timeNotUsed) {
  19.119 +        Iterator<File> cachedFileIterator = map.keySet().iterator();
  19.120 +        while (cachedFileIterator.hasNext()) {
  19.121 +            File cachedFile = cachedFileIterator.next();
  19.122 +            ZipFileIndex cachedZipIndex = map.get(cachedFile);
  19.123 +            if (cachedZipIndex != null) {
  19.124 +                long timeToTest = cachedZipIndex.lastReferenceTimeStamp + timeNotUsed;
  19.125 +                if (timeToTest < cachedZipIndex.lastReferenceTimeStamp || // Overflow...
  19.126 +                        System.currentTimeMillis() > timeToTest) {
  19.127 +                    map.remove(cachedFile);
  19.128 +                }
  19.129 +            }
  19.130 +        }
  19.131 +    }
  19.132 +
  19.133 +    public synchronized void removeFromCache(File file) {
  19.134 +        map.remove(file);
  19.135 +    }
  19.136 +
  19.137 +    /** Sets already opened list of ZipFileIndexes from an outside client
  19.138 +      * of the compiler. This functionality should be used in a non-batch clients of the compiler.
  19.139 +      */
  19.140 +    public synchronized void setOpenedIndexes(List<ZipFileIndex>indexes) throws IllegalStateException {
  19.141 +        if (map.isEmpty()) {
  19.142 +            String msg =
  19.143 +                    "Setting opened indexes should be called only when the ZipFileCache is empty. "
  19.144 +                    + "Call JavacFileManager.flush() before calling this method.";
  19.145 +            throw new IllegalStateException(msg);
  19.146 +        }
  19.147 +
  19.148 +        for (ZipFileIndex zfi : indexes) {
  19.149 +            map.put(zfi.zipFile, zfi);
  19.150 +        }
  19.151 +    }
  19.152 +}
    20.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 10 16:24:51 2011 -0800
    20.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Feb 14 16:31:21 2011 -0800
    20.3 @@ -138,9 +138,6 @@
    20.4      /** The symbol table. */
    20.5      Symtab syms;
    20.6  
    20.7 -    /** The scope counter */
    20.8 -    Scope.ScopeCounter scopeCounter;
    20.9 -
   20.10      Types types;
   20.11  
   20.12      /** The name table. */
   20.13 @@ -264,7 +261,6 @@
   20.14  
   20.15          names = Names.instance(context);
   20.16          syms = Symtab.instance(context);
   20.17 -        scopeCounter = Scope.ScopeCounter.instance(context);
   20.18          types = Types.instance(context);
   20.19          fileManager = context.get(JavaFileManager.class);
   20.20          if (fileManager == null)
   20.21 @@ -1321,7 +1317,9 @@
   20.22                      sym.flags_field |= PROPRIETARY;
   20.23                  else
   20.24                      proxies.append(proxy);
   20.25 -                if (majorVersion >= V51.major && proxy.type.tsym == syms.polymorphicSignatureType.tsym) {
   20.26 +                if (majorVersion >= V51.major &&
   20.27 +                        (proxy.type.tsym == syms.polymorphicSignatureType.tsym ||
   20.28 +                         proxy.type.tsym == syms.transientPolymorphicSignatureType.tsym)) {
   20.29                      sym.flags_field |= POLYMORPHIC_SIGNATURE;
   20.30                  }
   20.31              }
   20.32 @@ -1879,7 +1877,7 @@
   20.33          ClassType ct = (ClassType)c.type;
   20.34  
   20.35          // allocate scope for members
   20.36 -        c.members_field = new Scope.ClassScope(c, scopeCounter);
   20.37 +        c.members_field = new Scope(c);
   20.38  
   20.39          // prepare type variable table
   20.40          typevars = typevars.dup(currentOwner);
    21.1 --- a/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Thu Feb 10 16:24:51 2011 -0800
    21.2 +++ b/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Mon Feb 14 16:31:21 2011 -0800
    21.3 @@ -39,7 +39,6 @@
    21.4  import java.nio.file.FileVisitResult;
    21.5  import java.nio.file.Path;
    21.6  import java.nio.file.SimpleFileVisitor;
    21.7 -import java.nio.file.attribute.Attributes;
    21.8  import java.nio.file.attribute.BasicFileAttributes;
    21.9  import java.util.ArrayList;
   21.10  import java.util.Arrays;
   21.11 @@ -223,9 +222,7 @@
   21.12          Path path = pathIter.next();
   21.13          if (pathIter.hasNext())
   21.14              throw new IllegalArgumentException("path too long for directory");
   21.15 -        if (!path.exists())
   21.16 -            throw new FileNotFoundException(path + ": does not exist");
   21.17 -        else if (!isDirectory(path))
   21.18 +        if (!isDirectory(path))
   21.19              throw new IOException(path + ": not a directory");
   21.20      }
   21.21  
   21.22 @@ -326,7 +323,7 @@
   21.23      private void list(Path path, String packageName, final Set<Kind> kinds,
   21.24              boolean recurse, final ListBuffer<JavaFileObject> results)
   21.25              throws IOException {
   21.26 -        if (!path.exists())
   21.27 +        if (!Files.exists(path))
   21.28              return;
   21.29  
   21.30          final Path pathDir;
   21.31 @@ -341,7 +338,7 @@
   21.32          String sep = path.getFileSystem().getSeparator();
   21.33          Path packageDir = packageName.isEmpty() ? pathDir
   21.34                  : pathDir.resolve(packageName.replace(".", sep));
   21.35 -        if (!packageDir.exists())
   21.36 +        if (!Files.exists(packageDir))
   21.37              return;
   21.38  
   21.39  /* Alternate impl of list, superceded by use of Files.walkFileTree */
   21.40 @@ -353,7 +350,7 @@
   21.41  //            DirectoryStream<Path> ds = dir.newDirectoryStream();
   21.42  //            try {
   21.43  //                for (Path p: ds) {
   21.44 -//                    String name = p.getName().toString();
   21.45 +//                    String name = p.getFileName().toString();
   21.46  //                    if (isDirectory(p)) {
   21.47  //                        if (recurse && SourceVersion.isIdentifier(name)) {
   21.48  //                            queue.add(p);
   21.49 @@ -376,7 +373,7 @@
   21.50                  new SimpleFileVisitor<Path>() {
   21.51              @Override
   21.52              public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
   21.53 -                Path name = dir.getName();
   21.54 +                Path name = dir.getFileName();
   21.55                  if (name == null || SourceVersion.isIdentifier(name.toString())) // JSR 292?
   21.56                      return FileVisitResult.CONTINUE;
   21.57                  else
   21.58 @@ -385,7 +382,7 @@
   21.59  
   21.60              @Override
   21.61              public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
   21.62 -                if (attrs.isRegularFile() && kinds.contains(getKind(file.getName().toString()))) {
   21.63 +                if (attrs.isRegularFile() && kinds.contains(getKind(file.getFileName().toString()))) {
   21.64                      JavaFileObject fe =
   21.65                          PathFileObject.createDirectoryPathFileObject(
   21.66                              JavacPathFileManager.this, file, pathDir);
   21.67 @@ -431,13 +428,13 @@
   21.68          for (Path p: getLocation(location)) {
   21.69              if (isDirectory(p)) {
   21.70                  Path f = resolve(p, relativePath);
   21.71 -                if (f.exists())
   21.72 +                if (Files.exists(f))
   21.73                      return PathFileObject.createDirectoryPathFileObject(this, f, p);
   21.74              } else {
   21.75                  FileSystem fs = getFileSystem(p);
   21.76                  if (fs != null) {
   21.77                      Path file = getPath(fs, relativePath);
   21.78 -                    if (file.exists())
   21.79 +                    if (Files.exists(file))
   21.80                          return PathFileObject.createJarPathFileObject(this, file);
   21.81                  }
   21.82              }
   21.83 @@ -504,7 +501,7 @@
   21.84      private FileSystem getFileSystem(Path p) throws IOException {
   21.85          FileSystem fs = fileSystems.get(p);
   21.86          if (fs == null) {
   21.87 -            fs = FileSystems.newFileSystem(p, Collections.<String,Void>emptyMap(), null);
   21.88 +            fs = FileSystems.newFileSystem(p, null);
   21.89              fileSystems.put(p, fs);
   21.90          }
   21.91          return fs;
   21.92 @@ -530,7 +527,7 @@
   21.93      }
   21.94  
   21.95      private static boolean isDirectory(Path path) throws IOException {
   21.96 -        BasicFileAttributes attrs = Attributes.readBasicFileAttributes(path);
   21.97 +        BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class);
   21.98          return attrs.isDirectory();
   21.99      }
  21.100  
    22.1 --- a/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Thu Feb 10 16:24:51 2011 -0800
    22.2 +++ b/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Mon Feb 14 16:31:21 2011 -0800
    22.3 @@ -38,7 +38,6 @@
    22.4  import java.nio.charset.CharsetDecoder;
    22.5  import java.nio.file.Files;
    22.6  import java.nio.file.Path;
    22.7 -import java.nio.file.attribute.Attributes;
    22.8  import java.nio.file.attribute.BasicFileAttributes;
    22.9  import javax.lang.model.element.Modifier;
   22.10  import javax.lang.model.element.NestingKind;
   22.11 @@ -153,7 +152,7 @@
   22.12  
   22.13      @Override
   22.14      public Kind getKind() {
   22.15 -        return BaseFileManager.getKind(path.getName().toString());
   22.16 +        return BaseFileManager.getKind(path.getFileName().toString());
   22.17      }
   22.18  
   22.19      @Override
   22.20 @@ -164,14 +163,14 @@
   22.21              return false;
   22.22          }
   22.23          String sn = simpleName + kind.extension;
   22.24 -        String pn = path.getName().toString();
   22.25 +        String pn = path.getFileName().toString();
   22.26          if (pn.equals(sn)) {
   22.27              return true;
   22.28          }
   22.29          if (pn.equalsIgnoreCase(sn)) {
   22.30              try {
   22.31                  // allow for Windows
   22.32 -                return path.toRealPath(false).getName().toString().equals(sn);
   22.33 +                return path.toRealPath(false).getFileName().toString().equals(sn);
   22.34              } catch (IOException e) {
   22.35              }
   22.36          }
   22.37 @@ -200,13 +199,13 @@
   22.38  
   22.39      @Override
   22.40      public InputStream openInputStream() throws IOException {
   22.41 -        return path.newInputStream();
   22.42 +        return Files.newInputStream(path);
   22.43      }
   22.44  
   22.45      @Override
   22.46      public OutputStream openOutputStream() throws IOException {
   22.47          ensureParentDirectoriesExist();
   22.48 -        return path.newOutputStream();
   22.49 +        return Files.newOutputStream(path);
   22.50      }
   22.51  
   22.52      @Override
   22.53 @@ -242,14 +241,13 @@
   22.54      @Override
   22.55      public Writer openWriter() throws IOException {
   22.56          ensureParentDirectoriesExist();
   22.57 -        return new OutputStreamWriter(path.newOutputStream(), fileManager.getEncodingName());
   22.58 +        return new OutputStreamWriter(Files.newOutputStream(path), fileManager.getEncodingName());
   22.59      }
   22.60  
   22.61      @Override
   22.62      public long getLastModified() {
   22.63          try {
   22.64 -            BasicFileAttributes attrs = Attributes.readBasicFileAttributes(path);
   22.65 -            return attrs.lastModifiedTime().toMillis();
   22.66 +            return Files.getLastModifiedTime(path).toMillis();
   22.67          } catch (IOException e) {
   22.68              return -1;
   22.69          }
   22.70 @@ -258,7 +256,7 @@
   22.71      @Override
   22.72      public boolean delete() {
   22.73          try {
   22.74 -            path.delete();
   22.75 +            Files.delete(path);
   22.76              return true;
   22.77          } catch (IOException e) {
   22.78              return false;
   22.79 @@ -267,7 +265,7 @@
   22.80  
   22.81      public boolean isSameFile(PathFileObject other) {
   22.82          try {
   22.83 -            return path.isSameFile(other.path);
   22.84 +            return Files.isSameFile(path, other.path);
   22.85          } catch (IOException e) {
   22.86              return false;
   22.87          }
   22.88 @@ -296,8 +294,7 @@
   22.89  
   22.90      private long size() {
   22.91          try {
   22.92 -            BasicFileAttributes attrs = Attributes.readBasicFileAttributes(path);
   22.93 -            return attrs.size();
   22.94 +            return Files.size(path);
   22.95          } catch (IOException e) {
   22.96              return -1;
   22.97          }
    23.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Feb 10 16:24:51 2011 -0800
    23.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Feb 14 16:31:21 2011 -0800
    23.3 @@ -142,7 +142,7 @@
    23.4       */
    23.5      boolean allowAnnotations;
    23.6  
    23.7 -    /** Switch: should we recognize automatic resource management?
    23.8 +    /** Switch: should we recognize try-with-resources?
    23.9       */
   23.10      boolean allowTWR;
   23.11  
   23.12 @@ -1639,7 +1639,7 @@
   23.13       *     | WHILE ParExpression Statement
   23.14       *     | DO Statement WHILE ParExpression ";"
   23.15       *     | TRY Block ( Catches | [Catches] FinallyPart )
   23.16 -     *     | TRY "(" ResourceSpecification ")" Block [Catches] [FinallyPart]
   23.17 +     *     | TRY "(" ResourceSpecification ";"opt ")" Block [Catches] [FinallyPart]
   23.18       *     | SWITCH ParExpression "{" SwitchBlockStatementGroups "}"
   23.19       *     | SYNCHRONIZED ParExpression Block
   23.20       *     | RETURN [Expression] ";"
   23.21 @@ -2182,31 +2182,24 @@
   23.22          ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
   23.23          defs.append(resource());
   23.24          while (S.token() == SEMI) {
   23.25 -            // All but last of multiple declarators subsume a semicolon
   23.26 +            // All but last of multiple declarators must subsume a semicolon
   23.27              storeEnd(defs.elems.last(), S.endPos());
   23.28 +            int semiColonPos = S.pos();
   23.29              S.nextToken();
   23.30 +            if (S.token() == RPAREN) { // Optional trailing semicolon
   23.31 +                                       // after last resource
   23.32 +                break;
   23.33 +            }
   23.34              defs.append(resource());
   23.35          }
   23.36          return defs.toList();
   23.37      }
   23.38  
   23.39 -    /** Resource =
   23.40 -     *    VariableModifiers Type VariableDeclaratorId = Expression
   23.41 -     *  | Expression
   23.42 +    /** Resource = VariableModifiersOpt Type VariableDeclaratorId = Expression
   23.43       */
   23.44      JCTree resource() {
   23.45 -        int pos = S.pos();
   23.46 -        if (S.token() == FINAL || S.token() == MONKEYS_AT) {
   23.47 -            return variableDeclaratorRest(pos, optFinal(0), parseType(),
   23.48 -                                          ident(), true, null);
   23.49 -        } else {
   23.50 -            JCExpression t = term(EXPR | TYPE);
   23.51 -            if ((lastmode & TYPE) != 0 && S.token() == IDENTIFIER)
   23.52 -                return variableDeclaratorRest(pos, toP(F.at(pos).Modifiers(Flags.FINAL)), t,
   23.53 -                                              ident(), true, null);
   23.54 -            else
   23.55 -                return t;
   23.56 -        }
   23.57 +        return variableDeclaratorRest(S.pos(), optFinal(Flags.FINAL),
   23.58 +                                      parseType(), ident(), true, null);
   23.59      }
   23.60  
   23.61      /** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
    24.1 --- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Feb 10 16:24:51 2011 -0800
    24.2 +++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Mon Feb 14 16:31:21 2011 -0800
    24.3 @@ -138,7 +138,7 @@
    24.4          source = fac.source;
    24.5          allowBinaryLiterals = source.allowBinaryLiterals();
    24.6          allowHexFloats = source.allowHexFloats();
    24.7 -        allowUnderscoresInLiterals = source.allowBinaryLiterals();
    24.8 +        allowUnderscoresInLiterals = source.allowUnderscoresInLiterals();
    24.9      }
   24.10  
   24.11      private static final boolean hexFloatsWork = hexFloatsWork();
    25.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 10 16:24:51 2011 -0800
    25.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Feb 14 16:31:21 2011 -0800
    25.3 @@ -23,258 +23,437 @@
    25.4  # questions.
    25.5  #
    25.6  
    25.7 +# Messages in this file which use "placeholders" for values (e.g. {0}, {1})
    25.8 +# are preceded by a stylized comment describing the type of the corresponding
    25.9 +# values.
   25.10 +# The types currently in use are
   25.11 +#
   25.12 +# boolean           true or false
   25.13 +# file name         the name of an input file; e.g.   MyFile.java
   25.14 +# message segment   a sub-message; see compiler.misc.*
   25.15 +# modifier          a Java modifier; e.g. public, private, protected
   25.16 +# name              a name, typically a Java identifier
   25.17 +# number            an integer
   25.18 +# option name       the name of a command line option
   25.19 +# source version    a source version number, such as 1.5, 1.6, 1.7
   25.20 +# string            a general string
   25.21 +# symbol            the name of a declared type
   25.22 +# symbol kind       a description of the kind of a declaration; see compiler.misc.kindname.*
   25.23 +# token             the name of a non-terminal in source code; see compiler.misc.token.*
   25.24 +# type              a Java type; e.g. int, X, X<T>
   25.25 +# unused            the value is not used in this message
   25.26 +#
   25.27 +# list of X         a comma-separated list of items; e.g. list of type
   25.28 +# X or Y            alternation; e.g. message segment or type
   25.29 +# set of X          a comma-separated collection of items; e.g. set of modifier
   25.30 +#
   25.31 +# These may be composed: e.g.   list of type or message segment
   25.32 +#
   25.33 +# These comments are verified by the jtreg test test/tools/javac/diags/MessageInfo,
   25.34 +# using info derived from the collected set of examples in test/tools/javac/diags/examples.
   25.35 +# MessageInfo can also be run as a standalone utility providing more facilities
   25.36 +# for manipulating this file. For more details, see MessageInfo.java.
   25.37 +
   25.38  ##
   25.39  ## errors
   25.40  ##
   25.41  
   25.42 +# 0: symbol
   25.43  compiler.err.abstract.cant.be.instantiated=\
   25.44      {0} is abstract; cannot be instantiated
   25.45 +
   25.46  compiler.err.abstract.meth.cant.have.body=\
   25.47      abstract methods cannot have a body
   25.48 +
   25.49  compiler.err.already.annotated=\
   25.50      {0} {1} has already been annotated
   25.51 +
   25.52 +# 0: symbol, 1: symbol
   25.53  compiler.err.already.defined=\
   25.54      {0} is already defined in {1}
   25.55 +
   25.56 +# 0: string
   25.57  compiler.err.already.defined.single.import=\
   25.58      {0} is already defined in a single-type import
   25.59 +
   25.60 +# 0: string
   25.61  compiler.err.already.defined.static.single.import=\
   25.62      {0} is already defined in a static single-type import
   25.63 +
   25.64  compiler.err.already.defined.this.unit=\
   25.65      {0} is already defined in this compilation unit
   25.66 +
   25.67 +# 0: type, 1: list of name
   25.68  compiler.err.annotation.missing.default.value=\
   25.69      annotation {0} is missing value for the attribute {1}
   25.70 +
   25.71 +# 0: type, 1: list of name
   25.72  compiler.err.annotation.missing.default.value.1=\
   25.73      annotation {0} is missing values for attributes {1}
   25.74 +
   25.75 +# 0: type
   25.76  compiler.err.annotation.not.valid.for.type=\
   25.77      annotation not valid for a value of type {0}
   25.78 +
   25.79  compiler.err.annotation.type.not.applicable=\
   25.80      annotation type not applicable to this kind of declaration
   25.81 +
   25.82  compiler.err.annotation.value.must.be.annotation=\
   25.83      annotation value must be an annotation
   25.84 +
   25.85  compiler.err.annotation.value.must.be.class.literal=\
   25.86      annotation value must be a class literal
   25.87 +
   25.88  compiler.err.annotation.value.must.be.name.value=\
   25.89      annotation values must be of the form ''name=value''
   25.90 +
   25.91  compiler.err.annotation.value.not.allowable.type=\
   25.92      annotation value not of an allowable type
   25.93 +
   25.94  compiler.err.anon.class.impl.intf.no.args=\
   25.95      anonymous class implements interface; cannot have arguments
   25.96 +
   25.97  compiler.err.anon.class.impl.intf.no.typeargs=\
   25.98      anonymous class implements interface; cannot have type arguments
   25.99 +
  25.100  compiler.err.anon.class.impl.intf.no.qual.for.new=\
  25.101      anonymous class implements interface; cannot have qualifier for new
  25.102 +
  25.103 +# 0: symbol, 1: symbol, 2: symbol
  25.104  compiler.err.array.and.varargs=\
  25.105      cannot declare both {0} and {1} in {2}
  25.106 +
  25.107  compiler.err.array.dimension.missing=\
  25.108      array dimension missing
  25.109 +
  25.110 +# 0: type
  25.111  compiler.err.array.req.but.found=\
  25.112      array required, but {0} found
  25.113  
  25.114  compiler.err.assignment.from.super-bound=\
  25.115      assigning from wildcard {0}
  25.116 +
  25.117  compiler.err.assignment.to.extends-bound=\
  25.118      assigning to wildcard {0}
  25.119 +
  25.120  compiler.err.attribute.value.must.be.constant=\
  25.121      attribute value must be constant
  25.122  
  25.123  compiler.err.break.outside.switch.loop=\
  25.124      break outside switch or loop
  25.125  
  25.126 +# 0: name
  25.127  compiler.err.call.must.be.first.stmt.in.ctor=\
  25.128      call to {0} must be first statement in constructor
  25.129 +
  25.130  compiler.err.cant.apply.symbol=\
  25.131      {0} {1} in {4} {5} cannot be applied to given types\n\
  25.132      required: {2}\n\
  25.133      found: {3}
  25.134 +
  25.135 +# 0: symbol kind, 1: name, 2: list of type or message segment, 3: list of type or message segment, 4: symbol kind, 5: type, 6: message segment
  25.136  compiler.err.cant.apply.symbol.1=\
  25.137      {0} {1} in {4} {5} cannot be applied to given types;\n\
  25.138      required: {2}\n\
  25.139      found: {3}\n\
  25.140      reason: {6}
  25.141 +
  25.142 +# 0: symbol kind, 1: name, 2: list of type
  25.143  compiler.err.cant.apply.symbols=\
  25.144      no suitable {0} found for {1}({2})
  25.145 +
  25.146 +# 0: symbol
  25.147  compiler.err.cant.assign.val.to.final.var=\
  25.148      cannot assign a value to final variable {0}
  25.149 +
  25.150 +# 0: type
  25.151  compiler.err.cant.deref=\
  25.152      {0} cannot be dereferenced
  25.153 +
  25.154  compiler.err.cant.extend.intf.annotation=\
  25.155      ''extends'' not allowed for @interfaces
  25.156 +
  25.157 +# 0: symbol
  25.158  compiler.err.cant.inherit.from.final=\
  25.159      cannot inherit from final {0}
  25.160 +
  25.161 +# 0: symbol
  25.162  compiler.err.cant.ref.before.ctor.called=\
  25.163      cannot reference {0} before supertype constructor has been called
  25.164 +
  25.165  compiler.err.cant.ret.val.from.meth.decl.void=\
  25.166      cannot return a value from method whose result type is void
  25.167 +
  25.168  compiler.err.cant.select.static.class.from.param.type=\
  25.169      cannot select a static class from a parameterized type
  25.170 +
  25.171 +# 0: symbol, 1: string, 2: string
  25.172  compiler.err.cant.inherit.diff.arg=\
  25.173      {0} cannot be inherited with different arguments: <{1}> and <{2}>
  25.174 +
  25.175  compiler.err.catch.without.try=\
  25.176      ''catch'' without ''try''
  25.177 +
  25.178 +# 0: symbol kind, 1: symbol
  25.179  compiler.err.clash.with.pkg.of.same.name=\
  25.180      {0} {1} clashes with package of same name
  25.181 +
  25.182  compiler.err.const.expr.req=\
  25.183      constant expression required
  25.184 +
  25.185  compiler.err.cont.outside.loop=\
  25.186      continue outside of loop
  25.187 +
  25.188 +# 0: symbol
  25.189  compiler.err.cyclic.inheritance=\
  25.190      cyclic inheritance involving {0}
  25.191 +
  25.192  compiler.err.cyclic.annotation.element=\
  25.193      cyclic annotation element type
  25.194 +
  25.195 +# 0: unused
  25.196  compiler.err.call.to.super.not.allowed.in.enum.ctor=\
  25.197      call to super not allowed in enum constructor
  25.198 +
  25.199 +# 0: type
  25.200  compiler.err.no.superclass=\
  25.201      {0} has no superclass
  25.202  
  25.203  compiler.err.wrong.target.for.polymorphic.signature.definition=\
  25.204      MethodHandle API building requires -target 7 runtimes or better; current is -target {0}
  25.205  
  25.206 +# 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
  25.207  compiler.err.concrete.inheritance.conflict=\
  25.208      methods {0} from {1} and {2} from {3} are inherited with the same signature
  25.209  
  25.210  compiler.err.default.allowed.in.intf.annotation.member=\
  25.211      default value only allowed in an @interface member
  25.212 +
  25.213 +# 0: symbol
  25.214  compiler.err.doesnt.exist=\
  25.215      package {0} does not exist
  25.216 +
  25.217  compiler.err.duplicate.annotation=\
  25.218      duplicate annotation
  25.219 +
  25.220 +# 0: name, 1: type
  25.221  compiler.err.duplicate.annotation.member.value=\
  25.222      duplicate annotation member value {0} in {1}
  25.223 +
  25.224 +# 0: name
  25.225  compiler.err.duplicate.class=\
  25.226      duplicate class: {0}
  25.227 +
  25.228  compiler.err.duplicate.case.label=\
  25.229      duplicate case label
  25.230 +
  25.231  compiler.err.duplicate.default.label=\
  25.232      duplicate default label
  25.233  
  25.234  compiler.err.else.without.if=\
  25.235      ''else'' without ''if''
  25.236 +
  25.237  compiler.err.empty.char.lit=\
  25.238      empty character literal
  25.239 +
  25.240 +# 0: symbol
  25.241  compiler.err.encl.class.required=\
  25.242      an enclosing instance that contains {0} is required
  25.243 +
  25.244  compiler.err.enum.annotation.must.be.enum.constant=\
  25.245      an enum annotation value must be an enum constant
  25.246  
  25.247  compiler.err.enum.cant.be.instantiated=\
  25.248      enum types may not be instantiated
  25.249 +
  25.250  compiler.err.enum.label.must.be.unqualified.enum=\
  25.251      an enum switch case label must be the unqualified name of an enumeration constant
  25.252 +
  25.253  compiler.err.enum.no.subclassing=\
  25.254      classes cannot directly extend java.lang.Enum
  25.255 +
  25.256  compiler.err.enum.types.not.extensible=\
  25.257      enum types are not extensible
  25.258 +
  25.259  compiler.err.enum.no.finalize=\
  25.260      enums cannot have finalize methods
  25.261 +
  25.262 +# 0: file name, 1: string
  25.263  compiler.err.error.reading.file=\
  25.264      error reading {0}; {1}
  25.265 +
  25.266 +# 0: type
  25.267  compiler.err.except.already.caught=\
  25.268      exception {0} has already been caught
  25.269 +
  25.270 +# 0: type
  25.271  compiler.err.except.never.thrown.in.try=\
  25.272      exception {0} is never thrown in body of corresponding try statement
  25.273  
  25.274 +# 0: symbol
  25.275  compiler.err.final.parameter.may.not.be.assigned=\
  25.276      final parameter {0} may not be assigned
  25.277 +
  25.278 +# 0: symbol
  25.279  compiler.err.try.resource.may.not.be.assigned=\
  25.280      auto-closeable resource {0} may not be assigned
  25.281 +
  25.282 +# 0: symbol
  25.283  compiler.err.multicatch.parameter.may.not.be.assigned=\
  25.284      multi-catch parameter {0} may not be assigned
  25.285 +
  25.286  compiler.err.finally.without.try=\
  25.287      ''finally'' without ''try''
  25.288 +
  25.289 +# 0: type, 1: message segment
  25.290  compiler.err.foreach.not.applicable.to.type=\
  25.291      for-each not applicable to expression type\n\
  25.292      required: {1}\n\
  25.293      found:    {0}
  25.294 +
  25.295  compiler.err.fp.number.too.large=\
  25.296      floating point number too large
  25.297 +
  25.298  compiler.err.fp.number.too.small=\
  25.299      floating point number too small
  25.300  
  25.301  compiler.err.generic.array.creation=\
  25.302      generic array creation
  25.303 +
  25.304  compiler.err.generic.throwable=\
  25.305      a generic class may not extend java.lang.Throwable
  25.306  
  25.307 +# 0: symbol
  25.308  compiler.err.icls.cant.have.static.decl=\
  25.309      Illegal static declaration in inner class {0}\n\
  25.310      modifier \''static\'' is only allowed in constant variable declarations
  25.311 +
  25.312 +# 0: string
  25.313  compiler.err.illegal.char=\
  25.314      illegal character: \\{0}
  25.315 +
  25.316  compiler.err.illegal.char.for.encoding=\
  25.317      unmappable character for encoding {0}
  25.318 +
  25.319 +# 0: set of modifier, 1: set of modifier
  25.320  compiler.err.illegal.combination.of.modifiers=\
  25.321      illegal combination of modifiers: {0} and {1}
  25.322 +
  25.323  compiler.err.illegal.enum.static.ref=\
  25.324      illegal reference to static field from initializer
  25.325 +
  25.326  compiler.err.illegal.esc.char=\
  25.327      illegal escape character
  25.328 +
  25.329  compiler.err.illegal.forward.ref=\
  25.330      illegal forward reference
  25.331 +
  25.332 +# 0: symbol
  25.333  compiler.warn.forward.ref=\
  25.334      reference to variable ''{0}'' before it has been initialized
  25.335 +
  25.336  compiler.err.illegal.self.ref=\
  25.337      self-reference in initializer
  25.338 +
  25.339 +# 0: symbol
  25.340  compiler.warn.self.ref=\
  25.341      self-reference in initializer of variable ''{0}''
  25.342 +
  25.343  compiler.err.illegal.generic.type.for.instof=\
  25.344      illegal generic type for instanceof
  25.345 +
  25.346 +# 0: type
  25.347  compiler.err.illegal.initializer.for.type=\
  25.348      illegal initializer for {0}
  25.349 +
  25.350  compiler.err.illegal.line.end.in.char.lit=\
  25.351      illegal line end in character literal
  25.352 +
  25.353  compiler.err.illegal.nonascii.digit=\
  25.354      illegal non-ASCII digit
  25.355 +
  25.356  compiler.err.illegal.underscore=\
  25.357      illegal underscore
  25.358 +
  25.359 +# 0: symbol
  25.360  compiler.err.illegal.qual.not.icls=\
  25.361      illegal qualifier; {0} is not an inner class
  25.362 +
  25.363  compiler.err.illegal.start.of.expr=\
  25.364      illegal start of expression
  25.365 +
  25.366  compiler.err.illegal.start.of.type=\
  25.367      illegal start of type
  25.368 +
  25.369  compiler.err.illegal.unicode.esc=\
  25.370      illegal unicode escape
  25.371 +
  25.372 +# 0: symbol
  25.373  compiler.err.import.requires.canonical=\
  25.374      import requires canonical name for {0}
  25.375 +
  25.376  compiler.err.improperly.formed.type.param.missing=\
  25.377      improperly formed type, some parameters are missing
  25.378 +
  25.379  compiler.err.improperly.formed.type.inner.raw.param=\
  25.380      improperly formed type, type arguments given on a raw type
  25.381 +
  25.382 +# 0: type, 1: type
  25.383  compiler.err.incomparable.types=\
  25.384      incomparable types: {0} and {1}
  25.385 +
  25.386 +# 0: number
  25.387  compiler.err.int.number.too.large=\
  25.388      integer number too large: {0}
  25.389 +
  25.390  compiler.err.internal.error.cant.instantiate=\
  25.391      internal error; cannot instantiate {0} at {1} to ({2})
  25.392 +
  25.393  compiler.err.intf.annotation.members.cant.have.params=\
  25.394      @interface members may not have parameters
  25.395 +
  25.396  compiler.err.intf.annotation.cant.have.type.params=\
  25.397      @interface may not have type parameters
  25.398 +
  25.399  compiler.err.intf.annotation.members.cant.have.type.params=\
  25.400      @interface members may not have type parameters
  25.401 +
  25.402 +# 0: symbol, 1: type
  25.403  compiler.err.intf.annotation.member.clash=\
  25.404      @interface member clashes with method ''{0}'' in {1}
  25.405 +
  25.406  compiler.err.intf.expected.here=\
  25.407      interface expected here
  25.408 +
  25.409  compiler.err.intf.meth.cant.have.body=\
  25.410      interface methods cannot have body
  25.411 +
  25.412  compiler.err.invalid.annotation.member.type=\
  25.413      invalid type for annotation member
  25.414 +
  25.415  compiler.err.invalid.binary.number=\
  25.416      binary numbers must contain at least one binary digit
  25.417 +
  25.418  compiler.err.invalid.hex.number=\
  25.419      hexadecimal numbers must contain at least one hexadecimal digit
  25.420 +
  25.421  compiler.err.invalid.meth.decl.ret.type.req=\
  25.422      invalid method declaration; return type required
  25.423 +
  25.424  compiler.err.varargs.and.old.array.syntax=\
  25.425      legacy array notation not allowed on variable-arity parameter
  25.426  
  25.427 +# 0: name
  25.428  compiler.err.label.already.in.use=\
  25.429      label {0} already in use
  25.430 +
  25.431 +# 0: symbol
  25.432  compiler.err.local.var.accessed.from.icls.needs.final=\
  25.433      local variable {0} is accessed from within inner class; needs to be declared final
  25.434 +
  25.435  compiler.err.local.enum=\
  25.436      enum types must not be local
  25.437 +
  25.438  compiler.err.cannot.create.array.with.type.arguments=\
  25.439      cannot create array with type arguments
  25.440  
  25.441 @@ -285,79 +464,131 @@
  25.442  #
  25.443  compiler.err.limit.code=\
  25.444      code too large
  25.445 +
  25.446  compiler.err.limit.code.too.large.for.try.stmt=\
  25.447      code too large for try statement
  25.448 +
  25.449  compiler.err.limit.dimensions=\
  25.450      array type has too many dimensions
  25.451 +
  25.452  compiler.err.limit.locals=\
  25.453      too many local variables
  25.454 +
  25.455  compiler.err.limit.parameters=\
  25.456      too many parameters
  25.457 +
  25.458  compiler.err.limit.pool=\
  25.459      too many constants
  25.460 +
  25.461  compiler.err.limit.pool.in.class=\
  25.462      too many constants in class {0}
  25.463 +
  25.464  compiler.err.limit.stack=\
  25.465      code requires too much stack
  25.466 +
  25.467  compiler.err.limit.string=\
  25.468      constant string too long
  25.469 +
  25.470  compiler.err.limit.string.overflow=\
  25.471      UTF8 representation for string \"{0}...\" is too long for the constant pool
  25.472  
  25.473  compiler.err.malformed.fp.lit=\
  25.474      malformed floating point literal
  25.475 +
  25.476  compiler.err.method.does.not.override.superclass=\
  25.477      method does not override or implement a method from a supertype
  25.478 +
  25.479  compiler.err.missing.meth.body.or.decl.abstract=\
  25.480      missing method body, or declare abstract
  25.481 +
  25.482  compiler.err.missing.ret.stmt=\
  25.483      missing return statement
  25.484 +
  25.485  compiler.err.missing.ret.val=\
  25.486      missing return value
  25.487 +
  25.488 +# 0: set of modifier
  25.489  compiler.err.mod.not.allowed.here=\
  25.490      modifier {0} not allowed here
  25.491 +
  25.492  compiler.err.intf.not.allowed.here=\
  25.493      interface not allowed here
  25.494 +
  25.495  compiler.err.enums.must.be.static=\
  25.496      enum declarations allowed only in static contexts
  25.497  
  25.498 +# 0: symbol, 1: symbol
  25.499  compiler.err.name.clash.same.erasure=\
  25.500      name clash: {0} and {1} have the same erasure
  25.501 +
  25.502 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol, 4: unused, 5: unused
  25.503  compiler.err.name.clash.same.erasure.no.override=\
  25.504      name clash: {0} in {1} and {2} in {3} have the same erasure, yet neither overrides the other
  25.505 +
  25.506 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol, 4: symbol, 5: symbol
  25.507 +compiler.err.name.clash.same.erasure.no.override.1=\
  25.508 +    name clash: {0} in {1} overrides a method whose erasure is the same as another method, yet neither overrides the other\n\
  25.509 +    first method:  {2} in {3}\n\
  25.510 +    second method: {4} in {5}
  25.511 +
  25.512 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  25.513 +compiler.err.name.clash.same.erasure.no.hide=\
  25.514 +    name clash: {0} in {1} and {2} in {3} have the same erasure, yet neither hides the other
  25.515 +
  25.516  compiler.err.name.reserved.for.internal.use=\
  25.517      {0} is reserved for internal use
  25.518 +
  25.519  compiler.err.native.meth.cant.have.body=\
  25.520      native methods cannot have a body
  25.521 +
  25.522 +# 0: type, 1: type
  25.523  compiler.err.neither.conditional.subtype=\
  25.524 -incompatible types for ?: neither is a subtype of the other\n\
  25.525 -second operand: {0}\n\
  25.526 -third operand : {1}
  25.527 +    incompatible types for ?: neither is a subtype of the other\n\
  25.528 +    second operand: {0}\n\
  25.529 +    third operand : {1}
  25.530 +
  25.531  compiler.err.new.not.allowed.in.annotation=\
  25.532      ''new'' not allowed in an annotation
  25.533 +
  25.534  compiler.err.no.annotation.member=\
  25.535      no annotation member {0} in {1}
  25.536 +
  25.537  compiler.err.no.encl.instance.of.type.in.scope=\
  25.538      no enclosing instance of type {0} is in scope
  25.539 +
  25.540  compiler.err.no.intf.expected.here=\
  25.541      no interface expected here
  25.542 +
  25.543  compiler.err.no.match.entry=\
  25.544      {0} has no match in entry in {1}; required {2}
  25.545 +
  25.546  compiler.err.not.annotation.type=\
  25.547      {0} is not an annotation type
  25.548 +
  25.549 +# 0: symbol, 1: symbol
  25.550  compiler.err.not.def.access.class.intf.cant.access=\
  25.551      {0} in {1} is defined in an inaccessible class or interface
  25.552 +
  25.553 +# 0: symbol, 1: symbol
  25.554  compiler.err.not.def.public.cant.access=\
  25.555      {0} is not public in {1}; cannot be accessed from outside package
  25.556 +
  25.557 +# 0: name
  25.558  compiler.err.not.loop.label=\
  25.559      not a loop label: {0}
  25.560 +
  25.561  compiler.err.not.stmt=\
  25.562      not a statement
  25.563 +
  25.564 +# 0: symbol
  25.565  compiler.err.not.encl.class=\
  25.566      not an enclosing class: {0}
  25.567  
  25.568 +# 0: name, 1: type, 2: unused
  25.569  compiler.err.operator.cant.be.applied=\
  25.570      bad operand type {1} for unary operator ''{0}''
  25.571 +
  25.572 +# 0: name, 1: type, 2: type
  25.573  compiler.err.operator.cant.be.applied.1=\
  25.574      bad operand types for binary operator ''{0}''\n\
  25.575      first type:  {1}\n\
  25.576 @@ -365,6 +596,8 @@
  25.577  
  25.578  compiler.err.pkg.annotations.sb.in.package-info.java=\
  25.579      package annotations should be in file package-info.java
  25.580 +
  25.581 +# 0: symbol
  25.582  compiler.err.pkg.clashes.with.class.of.same.name=\
  25.583      package {0} clashes with class of same name
  25.584  
  25.585 @@ -374,18 +607,21 @@
  25.586  # Errors related to annotation processing
  25.587  
  25.588  compiler.err.proc.cant.access=\
  25.589 -cannot access {0}\n\
  25.590 -{1}\n\
  25.591 -Consult the following stack trace for details.\n\
  25.592 -{2}
  25.593 -
  25.594 +    cannot access {0}\n\
  25.595 +    {1}\n\
  25.596 +    Consult the following stack trace for details.\n\
  25.597 +    {2}
  25.598 +
  25.599 +# 0: string
  25.600  compiler.err.proc.cant.find.class=\
  25.601      Could not find class file for ''{0}''.
  25.602  
  25.603  # Print a client-generated error message; assumed to be localized, no translation required
  25.604 +# 0: string
  25.605  compiler.err.proc.messager=\
  25.606      {0}
  25.607  
  25.608 +# 0: list of string
  25.609  compiler.err.proc.no.explicit.annotation.processing.requested=\
  25.610      Class names, ''{0}'', are only accepted if annotation processing is explicitly requested
  25.611  
  25.612 @@ -396,15 +632,18 @@
  25.613  compiler.err.proc.processor.bad.option.name=\
  25.614      Bad option name ''{0}'' provided by processor ''{1}''
  25.615  
  25.616 +# 0: string
  25.617  compiler.err.proc.processor.cant.instantiate=\
  25.618      Could not instantiate an instance of processor ''{0}''
  25.619  
  25.620  compiler.err.proc.processor.constructor.error=\
  25.621      Exception thrown while constructing Processor object: {0}
  25.622  
  25.623 +# 0: string
  25.624  compiler.err.proc.processor.not.found=\
  25.625      Annotation processor ''{0}'' not found
  25.626  
  25.627 +# 0: string
  25.628  compiler.err.proc.processor.wrong.type=\
  25.629      Annotation processor ''{0}'' does not implement javax.annotation.processing.Processor
  25.630  
  25.631 @@ -417,127 +656,201 @@
  25.632  compiler.err.proc.cant.create.loader=\
  25.633      Could not create class loader for annotation processors: {0}
  25.634  
  25.635 +# 0: unused
  25.636  compiler.err.qualified.new.of.static.class=\
  25.637      qualified new of static class
  25.638  
  25.639  compiler.err.recursive.ctor.invocation=\
  25.640      recursive constructor invocation
  25.641 +
  25.642 +# 0: name, 1: symbol kind, 2: symbol, 3: symbol, 4: symbol kind, 5: symbol, 6: symbol
  25.643  compiler.err.ref.ambiguous=\
  25.644      reference to {0} is ambiguous, both {1} {2} in {3} and {4} {5} in {6} match
  25.645 +
  25.646  compiler.err.repeated.annotation.target=\
  25.647      repeated annotation target
  25.648 +
  25.649  compiler.err.repeated.interface=\
  25.650      repeated interface
  25.651 +
  25.652  compiler.err.repeated.modifier=\
  25.653      repeated modifier
  25.654 +
  25.655 +# 0: symbol, 1: set of modifier, 2: symbol
  25.656  compiler.err.report.access=\
  25.657      {0} has {1} access in {2}
  25.658 +
  25.659  compiler.err.ret.outside.meth=\
  25.660      return outside method
  25.661  
  25.662  compiler.err.signature.doesnt.match.supertype=\
  25.663      signature does not match {0}; incompatible supertype
  25.664 +
  25.665  compiler.err.signature.doesnt.match.intf=\
  25.666      signature does not match {0}; incompatible interfaces
  25.667 +
  25.668 +# 0: symbol, 1: symbol, 2: symbol
  25.669  compiler.err.does.not.override.abstract=\
  25.670      {0} is not abstract and does not override abstract method {1} in {2}
  25.671 +
  25.672  compiler.err.source.cant.overwrite.input.file=\
  25.673      error writing source; cannot overwrite input file {0}
  25.674 +
  25.675  compiler.err.stack.sim.error=\
  25.676      Internal error: stack sim error on {0}
  25.677 +
  25.678  compiler.err.static.imp.only.classes.and.interfaces=\
  25.679      static import only from classes and interfaces
  25.680 +
  25.681  compiler.err.string.const.req=\
  25.682      constant string expression required
  25.683 +
  25.684 +# 0: symbol, 1: symbol
  25.685  compiler.err.synthetic.name.conflict=\
  25.686      the symbol {0} conflicts with a compiler-synthesized symbol in {1}
  25.687 +
  25.688 +# 0: symbol, 1: symbol
  25.689  compiler.warn.synthetic.name.conflict=\
  25.690      the symbol {0} conflicts with a compiler-synthesized symbol in {1}
  25.691  
  25.692  compiler.err.throws.not.allowed.in.intf.annotation=\
  25.693      throws clause not allowed in @interface members
  25.694 +
  25.695  compiler.err.try.without.catch.or.finally=\
  25.696      ''try'' without ''catch'' or ''finally''
  25.697 +
  25.698  compiler.err.try.without.catch.finally.or.resource.decls=\
  25.699      ''try'' without ''catch'', ''finally'' or resource declarations
  25.700 +
  25.701 +# 0: symbol
  25.702  compiler.err.type.doesnt.take.params=\
  25.703      type {0} does not take parameters
  25.704 +
  25.705  compiler.err.type.var.cant.be.deref=\
  25.706      cannot select from a type variable
  25.707 +
  25.708  compiler.err.type.var.may.not.be.followed.by.other.bounds=\
  25.709      a type variable may not be followed by other bounds
  25.710 +
  25.711  compiler.err.type.var.more.than.once=\
  25.712      type variable {0} occurs more than once in result type of {1}; cannot be left uninstantiated
  25.713 +
  25.714  compiler.err.type.var.more.than.once.in.result=\
  25.715      type variable {0} occurs more than once in type of {1}; cannot be left uninstantiated
  25.716 +
  25.717 +# 0: type, 1: type, 2: string
  25.718  compiler.err.types.incompatible.diff.ret=\
  25.719      types {0} and {1} are incompatible; both define {2}, but with unrelated return types
  25.720  
  25.721  compiler.err.unclosed.char.lit=\
  25.722      unclosed character literal
  25.723 +
  25.724  compiler.err.unclosed.comment=\
  25.725      unclosed comment
  25.726 +
  25.727  compiler.err.unclosed.str.lit=\
  25.728      unclosed string literal
  25.729 +
  25.730  compiler.err.unknown.enum.constant=\
  25.731      in class file {0}: unknown enum constant {1}.{2}
  25.732 +
  25.733 +# 0: name
  25.734  compiler.err.unsupported.encoding=\
  25.735      unsupported encoding: {0}
  25.736 +
  25.737  compiler.err.io.exception=\
  25.738      error reading source file: {0}
  25.739 +
  25.740 +# 0: name
  25.741  compiler.err.undef.label=\
  25.742      undefined label: {0}
  25.743 +
  25.744  compiler.err.undetermined.type=\
  25.745      cannot infer type arguments for {0}
  25.746 +
  25.747 +# 0: type, 1: message segment
  25.748  compiler.err.undetermined.type.1=\
  25.749      cannot infer type arguments for {0};\n\
  25.750      reason: {1}
  25.751 +
  25.752 +# 0: list of type, 1: message segment
  25.753  compiler.err.invalid.inferred.types=\
  25.754      invalid inferred types for {0}; {1}
  25.755 +
  25.756 +# 0: message segment, 1: unused
  25.757  compiler.err.cant.apply.diamond=\
  25.758      cannot infer type arguments for {0}
  25.759 +
  25.760 +# 0: message segment, 1: message segment
  25.761  compiler.err.cant.apply.diamond.1=\
  25.762      cannot infer type arguments for {0};\n\
  25.763      reason: {1}
  25.764 +
  25.765  compiler.err.unreachable.stmt=\
  25.766      unreachable statement
  25.767 +
  25.768  compiler.err.initializer.must.be.able.to.complete.normally=\
  25.769      initializer must be able to complete normally
  25.770 +
  25.771 +# 0: type
  25.772  compiler.err.unreported.exception.need.to.catch.or.throw=\
  25.773      unreported exception {0}; must be caught or declared to be thrown
  25.774 +
  25.775 +# 0: type
  25.776  compiler.err.unreported.exception.default.constructor=\
  25.777      unreported exception {0} in default constructor
  25.778 +
  25.779  compiler.err.unsupported.cross.fp.lit=\
  25.780      hexadecimal floating-point literals are not supported on this VM
  25.781 +
  25.782  compiler.err.void.not.allowed.here=\
  25.783      ''void'' type not allowed here
  25.784  
  25.785 +# 0: string
  25.786  compiler.err.wrong.number.type.args=\
  25.787      wrong number of type arguments; required {0}
  25.788  
  25.789 +# 0: symbol
  25.790  compiler.err.var.might.already.be.assigned=\
  25.791      variable {0} might already have been assigned
  25.792 +
  25.793 +# 0: symbol
  25.794  compiler.err.var.might.not.have.been.initialized=\
  25.795      variable {0} might not have been initialized
  25.796 +
  25.797 +# 0: symbol
  25.798  compiler.err.var.might.be.assigned.in.loop=\
  25.799      variable {0} might be assigned in loop
  25.800  
  25.801 +# 0: symbol, 1: message segment
  25.802  compiler.err.varargs.invalid.trustme.anno=\
  25.803      Invalid {0} annotation. {1}
  25.804 +
  25.805 +# 0: type
  25.806  compiler.misc.varargs.trustme.on.reifiable.varargs=\
  25.807      Varargs element type {0} is reifiable.
  25.808 +
  25.809 +# 0: symbol
  25.810  compiler.misc.varargs.trustme.on.non.varargs.meth=\
  25.811      Method {0} is not a varargs method.
  25.812 +
  25.813 +# 0: symbol
  25.814  compiler.misc.varargs.trustme.on.virtual.varargs=\
  25.815      Instance method {0} is not final.
  25.816  
  25.817 +# 0: type, 1: kind, 2: symbol
  25.818 +compiler.misc.inaccessible.varargs.type=\
  25.819 +    formal varargs element type {0} is not accessible from {1} {2}
  25.820 +
  25.821  # In the following string, {1} will always be the detail message from
  25.822  # java.io.IOException.
  25.823 +# 0: symbol, 1: string
  25.824  compiler.err.class.cant.write=\
  25.825      error while writing {0}: {1}
  25.826  
  25.827  # In the following string, {0} is the name of the class in the Java source.
  25.828  # It really should be used two times..
  25.829 +# 0: name
  25.830  compiler.err.class.public.should.be.in.file=\
  25.831      class {0} is public, should be declared in a file named {0}.java
  25.832  
  25.833 @@ -556,12 +869,16 @@
  25.834  
  25.835  compiler.misc.fatal.err.no.java.lang=\
  25.836      Fatal Error: Unable to find package java.lang in classpath or bootclasspath
  25.837 +
  25.838  compiler.misc.fatal.err.cant.locate.meth=\
  25.839      Fatal Error: Unable to find method {0}
  25.840 +
  25.841  compiler.misc.fatal.err.cant.locate.field=\
  25.842      Fatal Error: Unable to find field {0}
  25.843 +
  25.844  compiler.misc.fatal.err.cant.locate.ctor=\
  25.845      Fatal Error: Unable to find constructor for {0}
  25.846 +
  25.847  compiler.misc.fatal.err.cant.close.loader=\
  25.848      Fatal Error: Cannot close class loader for annotation processors
  25.849  
  25.850 @@ -573,10 +890,15 @@
  25.851  
  25.852  compiler.misc.source.unavailable=\
  25.853      (source unavailable)
  25.854 +
  25.855  compiler.misc.base.membership=\
  25.856      all your base class are belong to us
  25.857 +
  25.858 +# 0: string, 1: string, 2: boolean
  25.859  compiler.misc.x.print.processor.info=\
  25.860      Processor {0} matches {1} and returns {2}.
  25.861 +
  25.862 +# 0: number, 1: string, 2: set of symbol, 3: boolean
  25.863  compiler.misc.x.print.rounds=\
  25.864      Round {0}:\n\tinput files: {1}\n\tannotations: {2}\n\tlast round: {3}
  25.865  
  25.866 @@ -587,61 +909,84 @@
  25.867  compiler.note.note=\
  25.868      Note:\u0020
  25.869  
  25.870 +# 0: file name
  25.871  compiler.note.deprecated.filename=\
  25.872      {0} uses or overrides a deprecated API.
  25.873 +
  25.874  compiler.note.deprecated.plural=\
  25.875      Some input files use or override a deprecated API.
  25.876 +
  25.877  # The following string may appear after one of the above deprecation
  25.878  # messages.
  25.879  compiler.note.deprecated.recompile=\
  25.880      Recompile with -Xlint:deprecation for details.
  25.881  
  25.882 +# 0: file name
  25.883  compiler.note.deprecated.filename.additional=\
  25.884      {0} has additional uses or overrides of a deprecated API.
  25.885 +
  25.886  compiler.note.deprecated.plural.additional=\
  25.887      Some input files additionally use or override a deprecated API.
  25.888  
  25.889 +# 0: file name
  25.890  compiler.note.unchecked.filename=\
  25.891      {0} uses unchecked or unsafe operations.
  25.892 +
  25.893  compiler.note.unchecked.plural=\
  25.894      Some input files use unchecked or unsafe operations.
  25.895 +
  25.896  # The following string may appear after one of the above deprecation
  25.897  # messages.
  25.898  compiler.note.unchecked.recompile=\
  25.899      Recompile with -Xlint:unchecked for details.
  25.900  
  25.901 +# 0: file name
  25.902  compiler.note.unchecked.filename.additional=\
  25.903      {0} has additional unchecked or unsafe operations.
  25.904 +
  25.905  compiler.note.unchecked.plural.additional=\
  25.906      Some input files additionally use unchecked or unsafe operations.
  25.907  
  25.908 +# 0: file name
  25.909  compiler.note.sunapi.filename=\
  25.910      {0} uses internal proprietary API that may be removed in a future release.
  25.911 +
  25.912  compiler.note.sunapi.plural=\
  25.913      Some input files use internal proprietary API that may be removed in a future release.
  25.914 +
  25.915  # The following string may appear after one of the above sunapi messages.
  25.916  compiler.note.sunapi.recompile=\
  25.917      Recompile with -Xlint:sunapi for details.
  25.918  
  25.919 +# 0: file name
  25.920  compiler.note.sunapi.filename.additional=\
  25.921      {0} uses additional internal proprietary API that may be removed in a future release.
  25.922 +
  25.923  compiler.note.sunapi.plural.additional=\
  25.924      Some input files additionally use internal proprietary API that may be removed in a future release.
  25.925  
  25.926  # Notes related to annotation processing
  25.927  
  25.928  # Print a client-generated note; assumed to be localized, no translation required
  25.929 +# 0: string
  25.930  compiler.note.proc.messager=\
  25.931      {0}
  25.932  
  25.933  #####
  25.934  
  25.935 +# 0: number
  25.936  compiler.misc.count.error=\
  25.937      {0} error
  25.938 +
  25.939 +# 0: number
  25.940  compiler.misc.count.error.plural=\
  25.941      {0} errors
  25.942 +
  25.943 +# 0: number
  25.944  compiler.misc.count.warn=\
  25.945      {0} warning
  25.946 +
  25.947 +# 0: number
  25.948  compiler.misc.count.warn.plural=\
  25.949      {0} warnings
  25.950  
  25.951 @@ -650,38 +995,53 @@
  25.952  
  25.953  ## extra output when using -verbose (JavaCompiler)
  25.954  
  25.955 +# 0: symbol
  25.956  compiler.misc.verbose.checking.attribution=\
  25.957      [checking {0}]
  25.958 +
  25.959 +# 0: string
  25.960  compiler.misc.verbose.parsing.done=\
  25.961      [parsing completed {0}ms]
  25.962 +
  25.963 +# 0: file name
  25.964  compiler.misc.verbose.parsing.started=\
  25.965      [parsing started {0}]
  25.966 +
  25.967 +# 0: string
  25.968  compiler.misc.verbose.total=\
  25.969      [total {0}ms]
  25.970 +
  25.971 +# 0: file name
  25.972  compiler.misc.verbose.wrote.file=\
  25.973      [wrote {0}]
  25.974  
  25.975  ## extra output when using -verbose (Retro)
  25.976  compiler.misc.verbose.retro=\
  25.977      [retrofitting {0}]
  25.978 +
  25.979  compiler.misc.verbose.retro.with=\
  25.980      \tretrofitting {0} with {1}
  25.981 +
  25.982  compiler.misc.verbose.retro.with.list=\
  25.983      \tretrofitting {0} with type parameters {1}, supertype {2}, interfaces {3}
  25.984  
  25.985  ## extra output when using -verbose (code/ClassReader)
  25.986 +# 0: string
  25.987  compiler.misc.verbose.loading=\
  25.988      [loading {0}]
  25.989  
  25.990 +# 0: string
  25.991  compiler.misc.verbose.sourcepath=\
  25.992      [search path for source files: {0}]
  25.993  
  25.994 +# 0: string
  25.995  compiler.misc.verbose.classpath=\
  25.996      [search path for class files: {0}]
  25.997  
  25.998  ## extra output when using -checkclassfile (code/ClassReader)
  25.999  compiler.misc.ccf.found.later.version=\
 25.1000      class file has later version than expected: {0}
 25.1001 +
 25.1002  compiler.misc.ccf.unrecognized.attribute=\
 25.1003      unrecognized attribute: {0}
 25.1004  
 25.1005 @@ -701,103 +1061,135 @@
 25.1006  
 25.1007  ## Warning messages may also include the following prefix to identify a
 25.1008  ## lint option
 25.1009 +# 0: option name
 25.1010  compiler.warn.lintOption=\
 25.1011      [{0}]\u0020
 25.1012  
 25.1013 +# 0: symbol
 25.1014  compiler.warn.constant.SVUID=\
 25.1015      serialVersionUID must be constant in class {0}
 25.1016  
 25.1017 +# 0: file name
 25.1018  compiler.warn.dir.path.element.not.found=\
 25.1019      bad path element "{0}": no such directory
 25.1020  
 25.1021  compiler.warn.finally.cannot.complete=\
 25.1022      finally clause cannot complete normally
 25.1023  
 25.1024 +# 0: symbol, 1: symbol
 25.1025  compiler.warn.has.been.deprecated=\
 25.1026      {0} in {1} has been deprecated
 25.1027  
 25.1028 +# 0: symbol
 25.1029  compiler.warn.sun.proprietary=\
 25.1030      {0} is internal proprietary API and may be removed in a future release
 25.1031  
 25.1032  compiler.warn.illegal.char.for.encoding=\
 25.1033      unmappable character for encoding {0}
 25.1034  
 25.1035 +# 0: symbol
 25.1036  compiler.warn.improper.SVUID=\
 25.1037      serialVersionUID must be declared static final in class {0}
 25.1038  
 25.1039 +# 0: type, 1: type
 25.1040  compiler.warn.inexact.non-varargs.call=\
 25.1041 -non-varargs call of varargs method with inexact argument type for last parameter;\n\
 25.1042 -cast to {0} for a varargs call\n\
 25.1043 -cast to {1} for a non-varargs call and to suppress this warning
 25.1044 -
 25.1045 +    non-varargs call of varargs method with inexact argument type for last parameter;\n\
 25.1046 +    cast to {0} for a varargs call\n\
 25.1047 +    cast to {1} for a non-varargs call and to suppress this warning
 25.1048 +
 25.1049 +# 0: symbol
 25.1050  compiler.warn.long.SVUID=\
 25.1051      serialVersionUID must be of type long in class {0}
 25.1052  
 25.1053 +# 0: symbol
 25.1054  compiler.warn.missing.SVUID=\
 25.1055      serializable class {0} has no definition of serialVersionUID
 25.1056  
 25.1057 +# 0: message segment
 25.1058  compiler.warn.override.varargs.missing=\
 25.1059      {0}; overridden method has no ''...''
 25.1060 +
 25.1061 +# 0: message segment
 25.1062  compiler.warn.override.varargs.extra=\
 25.1063      {0}; overriding method is missing ''...''
 25.1064 +
 25.1065  compiler.warn.override.bridge=\
 25.1066      {0}; overridden method is a bridge method
 25.1067  
 25.1068 +# 0: symbol
 25.1069  compiler.warn.pkg-info.already.seen=\
 25.1070      a package-info.java file has already been seen for package {0}
 25.1071  
 25.1072 +# 0: file name
 25.1073  compiler.warn.path.element.not.found=\
 25.1074      bad path element "{0}": no such file or directory
 25.1075  
 25.1076  compiler.warn.possible.fall-through.into.case=\
 25.1077      possible fall-through into case
 25.1078  
 25.1079 +# 0: type
 25.1080  compiler.warn.redundant.cast=\
 25.1081      redundant cast to {0}
 25.1082  
 25.1083 +# 0: number
 25.1084  compiler.warn.position.overflow=\
 25.1085      Position encoding overflows at line {0}
 25.1086  
 25.1087 +# 0: file name, 1: number, 2: number
 25.1088  compiler.warn.big.major.version=\
 25.1089      {0}: major version {1} is newer than {2}, the highest major version supported by this compiler.\n\
 25.1090      It is recommended that the compiler be upgraded.
 25.1091  
 25.1092 +# 0: symbol kind, 1: symbol
 25.1093  compiler.warn.static.not.qualified.by.type=\
 25.1094      static {0} should be qualified by type name, {1}, instead of by an expression
 25.1095  
 25.1096 +# 0: string
 25.1097  compiler.warn.source.no.bootclasspath=\
 25.1098      bootstrap class path not set in conjunction with -source {0}
 25.1099  
 25.1100 +# 0: name, 1: number, 2: number, 3: number, 4: number
 25.1101  compiler.warn.future.attr=\
 25.1102      {0} attribute introduced in version {1}.{2} class files is ignored in version {3}.{4} class files
 25.1103  
 25.1104  # Warnings related to annotation processing
 25.1105 +# 0: name
 25.1106  compiler.warn.proc.package.does.not.exist=\
 25.1107      package {0} does not exist
 25.1108 +
 25.1109 +# 0: name
 25.1110  compiler.warn.proc.file.reopening=\
 25.1111      Attempt to create a file for ''{0}'' multiple times
 25.1112  
 25.1113 +# 0: name
 25.1114  compiler.warn.proc.type.already.exists=\
 25.1115      A file for type ''{0}'' already exists on the sourcepath or classpath
 25.1116  
 25.1117 +# 0: name
 25.1118  compiler.warn.proc.type.recreate=\
 25.1119      Attempt to create a file for type ''{0}'' multiple times
 25.1120  
 25.1121 +# 0: string
 25.1122  compiler.warn.proc.illegal.file.name=\
 25.1123      Cannot create file for illegal name ''{0}''.
 25.1124  
 25.1125 +# 0: string, 1: string
 25.1126  compiler.warn.proc.suspicious.class.name=\
 25.1127      Creating file for a type whose name ends in {1}: ''{0}''
 25.1128  
 25.1129 +# 0: name
 25.1130  compiler.warn.proc.file.create.last.round=\
 25.1131      File for type ''{0}'' created in the last round will not be subject to annotation processing.
 25.1132  
 25.1133 +# 0: string, 1: string
 25.1134  compiler.warn.proc.malformed.supported.string=\
 25.1135      Malformed string ''{0}'' for a supported annotation type returned by processor ''{1}''
 25.1136  
 25.1137 +# 0: set of string
 25.1138  compiler.warn.proc.annotations.without.processors=\
 25.1139      No processor claimed any of these annotations: {0}
 25.1140  
 25.1141 +# 0: source version, 1: string, 2: string
 25.1142  compiler.warn.proc.processor.incompatible.source.version=\
 25.1143      Supported source version ''{0}'' from annotation processor ''{1}'' less than -source ''{2}''
 25.1144  
 25.1145 @@ -805,46 +1197,62 @@
 25.1146      Annotation processing without compilation requested but no processors were found.
 25.1147  
 25.1148  compiler.warn.proc.use.implicit=\
 25.1149 -Implicitly compiled files were not subject to annotation processing.\n\
 25.1150 -Use -implicit to specify a policy for implicit compilation.
 25.1151 +    Implicitly compiled files were not subject to annotation processing.\n\
 25.1152 +    Use -implicit to specify a policy for implicit compilation.
 25.1153  
 25.1154  compiler.warn.proc.use.proc.or.implicit=\
 25.1155 -Implicitly compiled files were not subject to annotation processing.\n\
 25.1156 -Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.
 25.1157 +    Implicitly compiled files were not subject to annotation processing.\n\
 25.1158 +    Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.
 25.1159  
 25.1160  # Print a client-generated warning; assumed to be localized, no translation required
 25.1161 +# 0: string
 25.1162  compiler.warn.proc.messager=\
 25.1163      {0}
 25.1164  
 25.1165 +# 0: set of name
 25.1166  compiler.warn.proc.unclosed.type.files=\
 25.1167      Unclosed files for the types ''{0}''; these types will not undergo annotation processing
 25.1168  
 25.1169 +# 0: string
 25.1170  compiler.warn.proc.unmatched.processor.options=\
 25.1171      The following options were not recognized by any processor: ''{0}''
 25.1172  
 25.1173  compiler.warn.try.explicit.close.call=\
 25.1174      explicit call to close() on an auto-closeable resource
 25.1175 +
 25.1176 +# 0: symbol
 25.1177  compiler.warn.try.resource.not.referenced=\
 25.1178      auto-closeable resource {0} is never referenced in body of corresponding try statement
 25.1179 +
 25.1180  compiler.warn.unchecked.assign=\
 25.1181      unchecked assignment: {0} to {1}
 25.1182 +
 25.1183 +# 0: symbol, 1: type
 25.1184  compiler.warn.unchecked.assign.to.var=\
 25.1185      unchecked assignment to variable {0} as member of raw type {1}
 25.1186 +
 25.1187 +# 0: symbol, 1: type
 25.1188  compiler.warn.unchecked.call.mbr.of.raw.type=\
 25.1189      unchecked call to {0} as a member of the raw type {1}
 25.1190 +
 25.1191  compiler.warn.unchecked.cast.to.type=\
 25.1192      unchecked cast to type {0}
 25.1193 +
 25.1194 +# 0: symbol kind, 1: name, 2: list of type, 3: list of type, 4: symbol kind, 5: symbol
 25.1195  compiler.warn.unchecked.meth.invocation.applied=\
 25.1196      unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
 25.1197      required: {2}\n\
 25.1198      found: {3}
 25.1199  
 25.1200 +# 0: type
 25.1201  compiler.warn.unchecked.generic.array.creation=\
 25.1202      unchecked generic array creation for varargs parameter of type {0}
 25.1203  
 25.1204 +# 0: type
 25.1205  compiler.warn.unchecked.varargs.non.reifiable.type=\
 25.1206      Possible heap pollution from parameterized vararg type {0}
 25.1207  
 25.1208 +# 0: symbol
 25.1209  compiler.warn.varargs.unsafe.use.varargs.param=\
 25.1210      Varargs method could cause heap pollution from non-reifiable varargs parameter {0}
 25.1211  
 25.1212 @@ -869,17 +1277,22 @@
 25.1213  compiler.warn.annotation.method.not.found.reason=\
 25.1214      Cannot find annotation method ''{1}()'' in type ''{0}'': {2}
 25.1215  
 25.1216 +# 0: type, 1: type
 25.1217  compiler.warn.raw.class.use=\
 25.1218      found raw type: {0}\n\
 25.1219      missing type arguments for generic class {1}
 25.1220  
 25.1221 +# 0: unused, 1: unused
 25.1222  compiler.warn.diamond.redundant.args=\
 25.1223      redundant type arguments in new expression (use diamond operator instead).
 25.1224 +
 25.1225 +# 0: type, 1: type
 25.1226  compiler.warn.diamond.redundant.args.1=\
 25.1227      redundant type arguments in new expression (use diamond operator instead).\n\
 25.1228      explicit: {0}\n\
 25.1229      inferred: {1}
 25.1230  
 25.1231 +# 0: symbol, 1: message segment
 25.1232  compiler.warn.varargs.redundant.trustme.anno=\
 25.1233      Redundant {0} annotation. {1}
 25.1234  
 25.1235 @@ -889,20 +1302,28 @@
 25.1236  ## be named as JLS3 calls them when translated to the appropriate language.
 25.1237  compiler.misc.token.identifier=\
 25.1238      <identifier>
 25.1239 +
 25.1240  compiler.misc.token.character=\
 25.1241      <character>
 25.1242 +
 25.1243  compiler.misc.token.string=\
 25.1244      <string>
 25.1245 +
 25.1246  compiler.misc.token.integer=\
 25.1247      <integer>
 25.1248 +
 25.1249  compiler.misc.token.long-integer=\
 25.1250      <long integer>
 25.1251 +
 25.1252  compiler.misc.token.float=\
 25.1253      <float>
 25.1254 +
 25.1255  compiler.misc.token.double=\
 25.1256      <double>
 25.1257 +
 25.1258  compiler.misc.token.bad-symbol=\
 25.1259      <bad symbol>
 25.1260 +
 25.1261  compiler.misc.token.end-of-input=\
 25.1262      <end of input>
 25.1263  
 25.1264 @@ -915,10 +1336,15 @@
 25.1265  ## 6. an operator (JLS3.12)
 25.1266  ##
 25.1267  ## This is the only place these tokens will be used.
 25.1268 +# 0: token
 25.1269  compiler.err.expected=\
 25.1270      {0} expected
 25.1271 +
 25.1272 +# 0: token, 1: token
 25.1273  compiler.err.expected2=\
 25.1274      {0} or {1} expected
 25.1275 +
 25.1276 +# 0: token, 1: token, 2: token
 25.1277  compiler.err.expected3=\
 25.1278      {0}, {1}, or {2} expected
 25.1279  
 25.1280 @@ -930,12 +1356,15 @@
 25.1281      ''.class'' expected
 25.1282  
 25.1283  ## The argument to this string will always be either 'case' or 'default'.
 25.1284 +# 0: token
 25.1285  compiler.err.orphaned=\
 25.1286      orphaned {0}
 25.1287  
 25.1288 +# 0: name
 25.1289  compiler.misc.anonymous.class=\
 25.1290      <anonymous {0}>
 25.1291  
 25.1292 +# 0: name, 1: type
 25.1293  compiler.misc.type.captureof=\
 25.1294      capture#{0} of {1}
 25.1295  
 25.1296 @@ -950,54 +1379,73 @@
 25.1297  
 25.1298  #####
 25.1299  
 25.1300 +# 0: symbol, 1: message segment
 25.1301  compiler.err.cant.access=\
 25.1302 -cannot access {0}\n\
 25.1303 -{1}
 25.1304 +    cannot access {0}\n\
 25.1305 +    {1}
 25.1306  
 25.1307  compiler.misc.bad.class.file.header=\
 25.1308 -bad class file: {0}\n\
 25.1309 -{1}\n\
 25.1310 -Please remove or make sure it appears in the correct subdirectory of the classpath.
 25.1311 +    bad class file: {0}\n\
 25.1312 +    {1}\n\
 25.1313 +    Please remove or make sure it appears in the correct subdirectory of the classpath.
 25.1314 +
 25.1315 +# 0: file name, 1: message segment
 25.1316  compiler.misc.bad.source.file.header=\
 25.1317 -bad source file: {0}\n\
 25.1318 -{1}\n\
 25.1319 -Please remove or make sure it appears in the correct subdirectory of the sourcepath.
 25.1320 +    bad source file: {0}\n\
 25.1321 +    {1}\n\
 25.1322 +    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
 25.1323  
 25.1324  ## The following are all possible strings for the second argument ({1}) of the
 25.1325  ## above strings.
 25.1326  compiler.misc.bad.class.signature=\
 25.1327      bad class signature: {0}
 25.1328 +
 25.1329  compiler.misc.bad.enclosing.method=\
 25.1330      bad enclosing method attribute: {0}
 25.1331 +
 25.1332  compiler.misc.bad.runtime.invisible.param.annotations=\
 25.1333      bad RuntimeInvisibleParameterAnnotations attribute: {0}
 25.1334 +
 25.1335  compiler.misc.bad.const.pool.tag=\
 25.1336      bad constant pool tag: {0}
 25.1337 +
 25.1338  compiler.misc.bad.const.pool.tag.at=\
 25.1339      bad constant pool tag: {0} at {1}
 25.1340 +
 25.1341  compiler.misc.bad.signature=\
 25.1342      bad signature: {0}
 25.1343 +
 25.1344  compiler.misc.class.file.wrong.class=\
 25.1345      class file contains wrong class: {0}
 25.1346 +
 25.1347  compiler.misc.class.file.not.found=\
 25.1348      class file for {0} not found
 25.1349 +
 25.1350 +# 0: name
 25.1351  compiler.misc.file.doesnt.contain.class=\
 25.1352      file does not contain class {0}
 25.1353 +
 25.1354  compiler.misc.file.does.not.contain.package=\
 25.1355      file does not contain package {0}
 25.1356 +
 25.1357  compiler.misc.illegal.start.of.class.file=\
 25.1358      illegal start of class file
 25.1359 +
 25.1360  compiler.misc.unable.to.access.file=\
 25.1361      unable to access file: {0}
 25.1362 +
 25.1363  compiler.misc.unicode.str.not.supported=\
 25.1364      unicode string in class file not supported
 25.1365 +
 25.1366  compiler.misc.undecl.type.var=\
 25.1367      undeclared type variable: {0}
 25.1368 +
 25.1369  compiler.misc.wrong.version=\
 25.1370      class file has wrong version {0}.{1}, should be {2}.{3}
 25.1371  
 25.1372  #####
 25.1373  
 25.1374 +# 0: type, 1: type or symbol
 25.1375  compiler.err.not.within.bounds=\
 25.1376      type argument {0} is not within bounds of type-variable {1}
 25.1377  
 25.1378 @@ -1008,32 +1456,41 @@
 25.1379  
 25.1380  #####
 25.1381  
 25.1382 +# 0: message segment, 1: type, 2: type
 25.1383  compiler.err.prob.found.req=\
 25.1384 -{0}\n\
 25.1385 -required: {2}\n\
 25.1386 -found:    {1}
 25.1387 +    {0}\n\
 25.1388 +    required: {2}\n\
 25.1389 +    found:    {1}
 25.1390 +
 25.1391 +# 0: message segment, 1: type, 2: type
 25.1392  compiler.warn.prob.found.req=\
 25.1393 -{0}\n\
 25.1394 -required: {2}\n\
 25.1395 -found:    {1}
 25.1396 +    {0}\n\
 25.1397 +    required: {2}\n\
 25.1398 +    found:    {1}
 25.1399 +
 25.1400  compiler.err.prob.found.req.1=\
 25.1401 -{0} {3}\n\
 25.1402 -required: {2}\n\
 25.1403 -found:    {1}
 25.1404 +    {0} {3}\n\
 25.1405 +    required: {2}\n\
 25.1406 +    found:    {1}
 25.1407  
 25.1408  ## The following are all possible strings for the first argument ({0}) of the
 25.1409  ## above strings.
 25.1410  compiler.misc.incompatible.types=\
 25.1411      incompatible types
 25.1412 +
 25.1413 +# 0: message segment
 25.1414  compiler.misc.incompatible.types.1=\
 25.1415      incompatible types; {0}
 25.1416 +
 25.1417  compiler.misc.inconvertible.types=\
 25.1418      inconvertible types
 25.1419 +
 25.1420  compiler.misc.possible.loss.of.precision=\
 25.1421      possible loss of precision
 25.1422  
 25.1423  compiler.misc.unchecked.assign=\
 25.1424      unchecked conversion
 25.1425 +
 25.1426  # compiler.misc.storecheck=\
 25.1427  #     assignment might cause later store checks to fail
 25.1428  # compiler.misc.unchecked=\
 25.1429 @@ -1043,8 +1500,10 @@
 25.1430  
 25.1431  compiler.misc.assignment.from.super-bound=\
 25.1432      assignment from super-bound type {0}
 25.1433 +
 25.1434  compiler.misc.assignment.to.extends-bound=\
 25.1435      assignment to extends-bound type {0}
 25.1436 +
 25.1437  # compiler.err.star.expected=\
 25.1438  #     ''*'' expected
 25.1439  # compiler.err.no.elem.type=\
 25.1440 @@ -1055,23 +1514,30 @@
 25.1441  
 25.1442  #####
 25.1443  
 25.1444 +# 0: message segment or type, 1: message segment
 25.1445  compiler.err.type.found.req=\
 25.1446 -unexpected type\n\
 25.1447 -required: {1}\n\
 25.1448 -found:    {0}
 25.1449 +    unexpected type\n\
 25.1450 +    required: {1}\n\
 25.1451 +    found:    {0}
 25.1452  
 25.1453  ## The following are all possible strings for the first argument ({0}) of the
 25.1454  ## above string.
 25.1455  compiler.misc.type.req.class=\
 25.1456      class
 25.1457 +
 25.1458  compiler.misc.type.req.class.array=\
 25.1459      class or array
 25.1460 +
 25.1461  compiler.misc.type.req.array.or.iterable=\
 25.1462      array or java.lang.Iterable
 25.1463 +
 25.1464  compiler.misc.type.req.ref=\
 25.1465      reference
 25.1466 +
 25.1467  compiler.misc.type.req.exact=\
 25.1468      class or interface without bounds
 25.1469 +
 25.1470 +# 0: type
 25.1471  compiler.misc.type.parameter=\
 25.1472      type parameter {0}
 25.1473  
 25.1474 @@ -1081,87 +1547,114 @@
 25.1475  ## diagnostics whose key ends in ".1"
 25.1476  compiler.misc.undetermined.type=\
 25.1477      undetermined type
 25.1478 +
 25.1479  compiler.misc.type.variable.has.undetermined.type=\
 25.1480      type variable {0} has undetermined type
 25.1481 +
 25.1482 +# 0: type, 1: list of type
 25.1483  compiler.misc.no.unique.maximal.instance.exists=\
 25.1484      no unique maximal instance exists for type variable {0} with upper bounds {1}
 25.1485 +
 25.1486  compiler.misc.no.unique.minimal.instance.exists=\
 25.1487      no unique minimal instance exists for type variable {0} with lower bounds {1}
 25.1488 +
 25.1489 +# 0: list of type, 1: type, 2: type
 25.1490  compiler.misc.infer.no.conforming.instance.exists=\
 25.1491      no instance(s) of type variable(s) {0} exist so that {1} conforms to {2}
 25.1492 +
 25.1493 +# 0: list of type, 1: type, 2: type
 25.1494  compiler.misc.infer.no.conforming.assignment.exists=\
 25.1495      no instance(s) of type variable(s) {0} exist so that argument type {1} conforms to formal parameter type {2}
 25.1496 +
 25.1497  compiler.misc.infer.arg.length.mismatch=\
 25.1498      cannot instantiate from arguments because actual and formal argument lists differ in length
 25.1499 +
 25.1500 +# 0: type, 1: list of type
 25.1501  compiler.misc.inferred.do.not.conform.to.bounds=\
 25.1502      inferred type does not conform to declared bound(s)\n\
 25.1503      inferred: {0}\n\
 25.1504      bound(s): {1}
 25.1505 -compiler.misc.inferred.do.not.conform.to.params=\
 25.1506 -    actual arguments do not conform to inferred formal arguments\n\
 25.1507 -    required: {0}\n\
 25.1508 -    found: {1}
 25.1509 +
 25.1510 +# 0: symbol
 25.1511  compiler.misc.diamond=\
 25.1512      {0}<>
 25.1513 +
 25.1514 +# 0: list of type, 1: message segment
 25.1515  compiler.misc.diamond.invalid.arg=\
 25.1516      type argument {0} inferred for {1} is not allowed in this context
 25.1517 +
 25.1518 +# 0: list of type, 1: message segment
 25.1519  compiler.misc.diamond.invalid.args=\
 25.1520      type arguments {0} inferred for {1} are not allowed in this context
 25.1521  
 25.1522 +# 0: type, 1: list of type
 25.1523  compiler.misc.explicit.param.do.not.conform.to.bounds=\
 25.1524      explicit type argument {0} does not conform to declared bound(s) {1}
 25.1525  
 25.1526  compiler.misc.arg.length.mismatch=\
 25.1527      actual and formal argument lists differ in length
 25.1528 +
 25.1529 +# 0: type, 1: type
 25.1530  compiler.misc.no.conforming.assignment.exists=\
 25.1531      actual argument {0} cannot be converted to {1} by method invocation conversion
 25.1532 +
 25.1533 +# 0: type, 1: type
 25.1534  compiler.misc.varargs.argument.mismatch=\
 25.1535      argument type {0} does not conform to vararg element type {1}
 25.1536 +
 25.1537  #####
 25.1538  
 25.1539  ## The first argument ({0}) is a "kindname".
 25.1540 +# 0: symbol kind, 1: symbol, 2: symbol
 25.1541  compiler.err.abstract.cant.be.accessed.directly=\
 25.1542      abstract {0} {1} in {2} cannot be accessed directly
 25.1543  
 25.1544  ## The first argument ({0}) is a "kindname".
 25.1545 +# 0: symbol kind, 1: symbol
 25.1546  compiler.err.non-static.cant.be.ref=\
 25.1547      non-static {0} {1} cannot be referenced from a static context
 25.1548  
 25.1549  ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
 25.1550  ## of kindnames (the list should be identical to that provided in source.
 25.1551  compiler.err.unexpected.type=\
 25.1552 -unexpected type\n\
 25.1553 -required: {0}\n\
 25.1554 -found:    {1}
 25.1555 +    unexpected type\n\
 25.1556 +    required: {0}\n\
 25.1557 +    found:    {1}
 25.1558  
 25.1559  ## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.)
 25.1560  ## The second argument {1} is the non-resolved symbol
 25.1561  ## The third argument {2} is a list of type parameters (non-empty if {1} is a method)
 25.1562  ## The fourth argument {3} is a list of argument types (non-empty if {1} is a method)
 25.1563 +# 0: symbol kind, 1: name, 2: unused, 3: unused
 25.1564  compiler.err.cant.resolve=\
 25.1565      cannot find symbol\n\
 25.1566      symbol: {0} {1}
 25.1567  
 25.1568 +# 0: symbol kind, 1: name, 2: unused, 3: list of type
 25.1569  compiler.err.cant.resolve.args=\
 25.1570      cannot find symbol\n\
 25.1571      symbol: {0} {1}({3})
 25.1572  
 25.1573 +# 0: symbol kind, 1: name, 2: list of type, 3: list of type
 25.1574  compiler.err.cant.resolve.args.params=\
 25.1575      cannot find symbol\n\
 25.1576      symbol: {0} <{2}>{1}({3})
 25.1577  
 25.1578  ## arguments from {0} to {3} have the same meaning as above
 25.1579  ## The fifth argument {4} is a location subdiagnostic (see below)
 25.1580 +# 0: symbol kind, 1: name, 2: unused, 3: unused, 4: message segment
 25.1581  compiler.err.cant.resolve.location=\
 25.1582      cannot find symbol\n\
 25.1583      symbol:   {0} {1}\n\
 25.1584      location: {4}
 25.1585  
 25.1586 +# 0: symbol kind, 1: name, 2: unused, 3: list of type, 4: message segment
 25.1587  compiler.err.cant.resolve.location.args=\
 25.1588      cannot find symbol\n\
 25.1589      symbol:   {0} {1}({3})\n\
 25.1590      location: {4}
 25.1591  
 25.1592 +# 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
 25.1593  compiler.err.cant.resolve.location.args.params=\
 25.1594      cannot find symbol\n\
 25.1595      symbol:   {0} <{2}>{1}({3})\n\
 25.1596 @@ -1172,8 +1665,11 @@
 25.1597  ## The second argument {1} is the location name
 25.1598  ## The third argument {2} is the location type (only when {1} is a variable name)
 25.1599  
 25.1600 +# 0: symbol kind, 1: symbol, 2: unused
 25.1601  compiler.misc.location=\
 25.1602      {0} {1}
 25.1603 +
 25.1604 +# 0: symbol kind, 1: symbol, 2: type
 25.1605  compiler.misc.location.1=\
 25.1606      {0} {1} of type {2}
 25.1607  
 25.1608 @@ -1184,85 +1680,124 @@
 25.1609  #     static member
 25.1610  compiler.misc.kindname.annotation=\
 25.1611      @interface
 25.1612 +
 25.1613  compiler.misc.kindname.constructor=\
 25.1614      constructor
 25.1615 +
 25.1616  compiler.misc.kindname.enum=\
 25.1617      enum
 25.1618 +
 25.1619  compiler.misc.kindname.interface=\
 25.1620      interface
 25.1621 +
 25.1622  compiler.misc.kindname.static=\
 25.1623      static
 25.1624 +
 25.1625  compiler.misc.kindname.type.variable=\
 25.1626      type variable
 25.1627 +
 25.1628  compiler.misc.kindname.type.variable.bound=\
 25.1629      bound of type variable
 25.1630 +
 25.1631  compiler.misc.kindname.variable=\
 25.1632      variable
 25.1633 +
 25.1634  compiler.misc.kindname.value=\
 25.1635      value
 25.1636 +
 25.1637  compiler.misc.kindname.method=\
 25.1638      method
 25.1639 +
 25.1640  compiler.misc.kindname.class=\
 25.1641      class
 25.1642 +
 25.1643  compiler.misc.kindname.package=\
 25.1644      package
 25.1645 +
 25.1646  #####
 25.1647  
 25.1648  compiler.misc.no.args=\
 25.1649      no arguments
 25.1650  
 25.1651 +# 0: message segment
 25.1652  compiler.err.override.static=\
 25.1653      {0}\n\
 25.1654      overriding method is static
 25.1655 +
 25.1656 +# 0: message segment, 1: set of modifier
 25.1657  compiler.err.override.meth=\
 25.1658      {0}\n\
 25.1659      overridden method is {1}
 25.1660  
 25.1661 +# 0: message segment, 1: type
 25.1662  compiler.err.override.meth.doesnt.throw=\
 25.1663      {0}\n\
 25.1664      overridden method does not throw {1}
 25.1665  
 25.1666  # In the following string {1} is a space separated list of Java Keywords, as
 25.1667  # they would have been declared in the source code
 25.1668 +# 0: message segment, 1: set of modifier
 25.1669  compiler.err.override.weaker.access=\
 25.1670      {0}\n\
 25.1671      attempting to assign weaker access privileges; was {1}
 25.1672  
 25.1673 +# 0: message segment, 1: type, 2: type
 25.1674  compiler.err.override.incompatible.ret=\
 25.1675      {0}\n\
 25.1676      return type {1} is not compatible with {2}
 25.1677  
 25.1678 +# 0: message segment, 1: type, 2: type
 25.1679  compiler.warn.override.unchecked.ret=\
 25.1680      {0}\n\
 25.1681      return type requires unchecked conversion from {1} to {2}
 25.1682  
 25.1683 +# 0: message segment, 1: type
 25.1684  compiler.warn.override.unchecked.thrown=\
 25.1685      {0}\n\
 25.1686      overridden method does not throw {1}
 25.1687  
 25.1688  ## The following are all possible strings for the first argument ({0}) of the
 25.1689  ## above strings.
 25.1690 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1691  compiler.misc.cant.override=\
 25.1692      {0} in {1} cannot override {2} in {3}
 25.1693 +
 25.1694 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1695  compiler.misc.cant.implement=\
 25.1696      {0} in {1} cannot implement {2} in {3}
 25.1697 +
 25.1698 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1699  compiler.misc.clashes.with=\
 25.1700      {0} in {1} clashes with {2} in {3}
 25.1701 +
 25.1702 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1703  compiler.misc.unchecked.override=\
 25.1704      {0} in {1} overrides {2} in {3}
 25.1705 +
 25.1706 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1707  compiler.misc.unchecked.implement=\
 25.1708      {0} in {1} implements {2} in {3}
 25.1709 +
 25.1710 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1711  compiler.misc.unchecked.clash.with=\
 25.1712      {0} in {1} overrides {2} in {3}
 25.1713 +
 25.1714 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1715  compiler.misc.varargs.override=\
 25.1716      {0} in {1} overrides {2} in {3}
 25.1717 +
 25.1718 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1719  compiler.misc.varargs.implement=\
 25.1720      {0} in {1} implements {2} in {3}
 25.1721 +
 25.1722 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
 25.1723  compiler.misc.varargs.clash.with=\
 25.1724      {0} in {1} overrides {2} in {3}
 25.1725 +
 25.1726  compiler.misc.non.denotable.type=\
 25.1727      Non-denotable type {0} not allowed here
 25.1728  
 25.1729 +# 0: symbol kind, 1: symbol, 2: symbol, 3: message segment
 25.1730  compiler.misc.inapplicable.method=\
 25.1731      {0} {1}.{2} is not applicable\n\
 25.1732      ({3})
 25.1733 @@ -1270,77 +1805,90 @@
 25.1734  ########################################
 25.1735  # Diagnostics for language feature changes
 25.1736  ########################################
 25.1737 +# 0: string
 25.1738  compiler.err.unsupported.fp.lit=\
 25.1739      hexadecimal floating point literals are not supported in -source {0}\n\
 25.1740 -(use -source 5 or higher to enable hexadecimal floating point literals)
 25.1741 -
 25.1742 +    (use -source 5 or higher to enable hexadecimal floating point literals)
 25.1743 +
 25.1744 +# 0: string
 25.1745  compiler.err.unsupported.binary.lit=\
 25.1746      binary literals are not supported in -source {0}\n\
 25.1747 -(use -source 7 or higher to enable binary literals)
 25.1748 -
 25.1749 +    (use -source 7 or higher to enable binary literals)
 25.1750 +
 25.1751 +# 0: string
 25.1752  compiler.err.unsupported.underscore.lit=\
 25.1753      underscores in literals are not supported in -source {0}\n\
 25.1754 -(use -source 7 or higher to enable underscores in literals)
 25.1755 -
 25.1756 +    (use -source 7 or higher to enable underscores in literals)
 25.1757 +
 25.1758 +# 0: string
 25.1759  compiler.err.try.with.resources.not.supported.in.source=\
 25.1760      try-with-resources is not supported in -source {0}\n\
 25.1761 -(use -source 7 or higher to enable try-with-resources)
 25.1762 +    (use -source 7 or higher to enable try-with-resources)
 25.1763  
 25.1764  compiler.warn.enum.as.identifier=\
 25.1765      as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
 25.1766 -(use -source 5 or higher to use ''enum'' as a keyword)
 25.1767 +    (use -source 5 or higher to use ''enum'' as a keyword)
 25.1768  
 25.1769  compiler.warn.assert.as.identifier=\
 25.1770      as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
 25.1771 -(use -source 1.4 or higher to use ''assert'' as a keyword)
 25.1772 +    (use -source 1.4 or higher to use ''assert'' as a keyword)
 25.1773  
 25.1774  compiler.err.enum.as.identifier=\
 25.1775      as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
 25.1776 -(use -source 1.4 or lower to use ''enum'' as an identifier)
 25.1777 +    (use -source 1.4 or lower to use ''enum'' as an identifier)
 25.1778  
 25.1779  compiler.err.assert.as.identifier=\
 25.1780      as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
 25.1781 -(use -source 1.3 or lower to use ''assert'' as an identifier)
 25.1782 -
 25.1783 +    (use -source 1.3 or lower to use ''assert'' as an identifier)
 25.1784 +
 25.1785 +# 0: string
 25.1786  compiler.err.generics.not.supported.in.source=\
 25.1787      generics are not supported in -source {0}\n\
 25.1788 -(use -source 5 or higher to enable generics)
 25.1789 -
 25.1790 +    (use -source 5 or higher to enable generics)
 25.1791 +
 25.1792 +# 0: string
 25.1793  compiler.err.varargs.not.supported.in.source=\
 25.1794      variable-arity methods are not supported in -source {0}\n\
 25.1795 -(use -source 5 or higher to enable variable-arity methods)
 25.1796 -
 25.1797 +    (use -source 5 or higher to enable variable-arity methods)
 25.1798 +
 25.1799 +# 0: string
 25.1800  compiler.err.annotations.not.supported.in.source=\
 25.1801      annotations are not supported in -source {0}\n\
 25.1802 -(use -source 5 or higher to enable annotations)
 25.1803 +    (use -source 5 or higher to enable annotations)
 25.1804  
 25.1805  #308 compiler.err.type.annotations.not.supported.in.source=\
 25.1806  #308     type annotations are not supported in -source {0}\n\
 25.1807  #308 (use -source 7 or higher to enable type annotations)
 25.1808  
 25.1809 +# 0: string
 25.1810  compiler.err.foreach.not.supported.in.source=\
 25.1811      for-each loops are not supported in -source {0}\n\
 25.1812 -(use -source 5 or higher to enable for-each loops)
 25.1813 -
 25.1814 +    (use -source 5 or higher to enable for-each loops)
 25.1815 +
 25.1816 +# 0: string
 25.1817  compiler.err.static.import.not.supported.in.source=\
 25.1818      static import declarations are not supported in -source {0}\n\
 25.1819 -(use -source 5 or higher to enable static import declarations)
 25.1820 -
 25.1821 +    (use -source 5 or higher to enable static import declarations)
 25.1822 +
 25.1823 +# 0: string
 25.1824  compiler.err.enums.not.supported.in.source=\
 25.1825      enums are not supported in -source {0}\n\
 25.1826 -(use -source 5 or higher to enable enums)
 25.1827 -
 25.1828 +    (use -source 5 or higher to enable enums)
 25.1829 +
 25.1830 +# 0: string
 25.1831  compiler.err.diamond.not.supported.in.source=\
 25.1832      diamond operator is not supported in -source {0}\n\
 25.1833 -(use -source 7 or higher to enable diamond operator)
 25.1834 -
 25.1835 +    (use -source 7 or higher to enable diamond operator)
 25.1836 +
 25.1837 +# 0: string
 25.1838  compiler.err.multicatch.not.supported.in.source=\
 25.1839      multi-catch statement is not supported in -source {0}\n\
 25.1840 -(use -source 7 or higher to enable multi-catch statement)
 25.1841 -
 25.1842 +    (use -source 7 or higher to enable multi-catch statement)
 25.1843 +
 25.1844 +# 0: string
 25.1845  compiler.err.string.switch.not.supported.in.source=\
 25.1846      strings in switch are not supported in -source {0}\n\
 25.1847 -(use -source 7 or higher to enable strings in switch)
 25.1848 +    (use -source 7 or higher to enable strings in switch)
 25.1849  
 25.1850  ########################################
 25.1851  # Diagnostics for where clause implementation
 25.1852 @@ -1351,29 +1899,35 @@
 25.1853      <null>
 25.1854  
 25.1855  # X#n (where n is an int id) is disambiguated tvar name
 25.1856 +# 0: name, 1: number
 25.1857  compiler.misc.type.var=\
 25.1858      {0}#{1}
 25.1859  
 25.1860  # CAP#n (where n is an int id) is an abbreviation for 'captured type'
 25.1861 +# 0: number
 25.1862  compiler.misc.captured.type=\
 25.1863      CAP#{0}
 25.1864  
 25.1865  # <INT#n> (where n is an int id) is an abbreviation for 'intersection type'
 25.1866 +# 0: number
 25.1867  compiler.misc.intersection.type=\
 25.1868      INT#{0}
 25.1869  
 25.1870  # where clause for captured type: contains upper ('extends {1}') and lower
 25.1871  # ('super {2}') bound along with the wildcard that generated this captured type ({3})
 25.1872 +# 0: type, 1: type, 2: type, 3: type
 25.1873  compiler.misc.where.captured=\
 25.1874      {0} extends {1} super: {2} from capture of {3}
 25.1875  
 25.1876  # compact where clause for captured type: contains upper ('extends {1}') along
 25.1877  # with the wildcard that generated this captured type ({3})
 25.1878 +# 0: type, 1: type, 2: unused, 3: type
 25.1879  compiler.misc.where.captured.1=\
 25.1880      {0} extends {1} from capture of {3}
 25.1881  
 25.1882  # where clause for type variable: contains upper bound(s) ('extends {1}') along with
 25.1883  # the kindname ({2}) and location ({3}) in which the typevar has been declared
 25.1884 +# 0: type, 1: list of type, 2: symbol kind, 3: symbol
 25.1885  compiler.misc.where.typevar=\
 25.1886      {0} extends {1} declared in {2} {3}
 25.1887  
 25.1888 @@ -1384,20 +1938,30 @@
 25.1889  
 25.1890  # where clause for type variable: contains all the upper bound(s) ('extends {1}')
 25.1891  # of this intersection type
 25.1892 +# 0: type, 1: list of type
 25.1893  compiler.misc.where.intersection=\
 25.1894      {0} extends {1}
 25.1895  
 25.1896  ### Where clause headers ###
 25.1897  compiler.misc.where.description.captured=\
 25.1898      where {0} is a fresh type-variable:
 25.1899 +
 25.1900 +# 0: set of type
 25.1901  compiler.misc.where.description.typevar=\
 25.1902      where {0} is a type-variable:
 25.1903 +
 25.1904 +# 0: set of type
 25.1905  compiler.misc.where.description.intersection=\
 25.1906      where {0} is an intersection type:
 25.1907 +
 25.1908 +# 0: set of type
 25.1909  compiler.misc.where.description.captured.1=\
 25.1910      where {0} are fresh type-variables:
 25.1911 +
 25.1912 +# 0: set of type
 25.1913  compiler.misc.where.description.typevar.1=\
 25.1914      where {0} are type-variables:
 25.1915 +
 25.1916  compiler.misc.where.description.intersection.1=\
 25.1917      where {0} are intersection types:
 25.1918  
    26.1 --- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Feb 10 16:24:51 2011 -0800
    26.2 +++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Mon Feb 14 16:31:21 2011 -0800
    26.3 @@ -465,9 +465,10 @@
    26.4          public List<JCImport> getImports() {
    26.5              ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
    26.6              for (JCTree tree : defs) {
    26.7 -                if (tree.getTag() == IMPORT)
    26.8 +                int tag = tree.getTag();
    26.9 +                if (tag == IMPORT)
   26.10                      imports.append((JCImport)tree);
   26.11 -                else
   26.12 +                else if (tag != SKIP)
   26.13                      break;
   26.14              }
   26.15              return imports.toList();
    27.1 --- a/src/share/classes/com/sun/tools/javac/util/Names.java	Thu Feb 10 16:24:51 2011 -0800
    27.2 +++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Mon Feb 14 16:31:21 2011 -0800
    27.3 @@ -73,7 +73,8 @@
    27.4      public final Name java_io_Serializable;
    27.5      public final Name serialVersionUID;
    27.6      public final Name java_lang_Enum;
    27.7 -    public final Name java_dyn_MethodHandle;
    27.8 +    public final Name transient_java_dyn_MethodHandle; // transient - 292
    27.9 +    public final Name java_lang_invoke_MethodHandle;
   27.10      public final Name package_info;
   27.11      public final Name ConstantValue;
   27.12      public final Name LineNumberTable;
   27.13 @@ -183,7 +184,8 @@
   27.14          java_lang_Cloneable = fromString("java.lang.Cloneable");
   27.15          java_io_Serializable = fromString("java.io.Serializable");
   27.16          java_lang_Enum = fromString("java.lang.Enum");
   27.17 -        java_dyn_MethodHandle = fromString("java.dyn.MethodHandle");
   27.18 +        transient_java_dyn_MethodHandle = fromString("java.dyn.MethodHandle"); //transient - 292
   27.19 +        java_lang_invoke_MethodHandle = fromString("java.lang.invoke.MethodHandle");
   27.20          package_info = fromString("package-info");
   27.21          serialVersionUID = fromString("serialVersionUID");
   27.22          ConstantValue = fromString("ConstantValue");
    28.1 --- a/src/share/classes/javax/lang/model/element/Element.java	Thu Feb 10 16:24:51 2011 -0800
    28.2 +++ b/src/share/classes/javax/lang/model/element/Element.java	Mon Feb 14 16:31:21 2011 -0800
    28.3 @@ -1,5 +1,5 @@
    28.4  /*
    28.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    28.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    28.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.8   *
    28.9   * This code is free software; you can redistribute it and/or modify it
   28.10 @@ -159,18 +159,26 @@
   28.11      Set<Modifier> getModifiers();
   28.12  
   28.13      /**
   28.14 -     * Returns the simple (unqualified) name of this element.
   28.15 -     * The name of a generic type does not include any reference
   28.16 -     * to its formal type parameters.
   28.17 -     * For example, the simple name of the type element
   28.18 -     * {@code java.util.Set<E>} is {@code "Set"}.
   28.19 -     * If this element represents an unnamed package, an empty name is
   28.20 -     * returned.  If it represents a constructor, the name "{@code
   28.21 -     * <init>}" is returned.  If it represents a static initializer,
   28.22 -     * the name "{@code <clinit>}" is returned.  If it represents an
   28.23 -     * anonymous class or instance initializer, an empty name is
   28.24 +     * Returns the simple (unqualified) name of this element.  The
   28.25 +     * name of a generic type does not include any reference to its
   28.26 +     * formal type parameters.
   28.27 +     *
   28.28 +     * For example, the simple name of the type element {@code
   28.29 +     * java.util.Set<E>} is {@code "Set"}.
   28.30 +     *
   28.31 +     * If this element represents an unnamed {@linkplain
   28.32 +     * PackageElement#getSimpleName package}, an empty name is
   28.33       * returned.
   28.34       *
   28.35 +     * If it represents a {@linkplain ExecutableElement#getSimpleName
   28.36 +     * constructor}, the name "{@code <init>}" is returned.  If it
   28.37 +     * represents a {@linkplain ExecutableElement#getSimpleName static
   28.38 +     * initializer}, the name "{@code <clinit>}" is returned.
   28.39 +     *
   28.40 +     * If it represents an {@linkplain TypeElement#getSimpleName
   28.41 +     * anonymous class} or {@linkplain ExecutableElement#getSimpleName
   28.42 +     * instance initializer}, an empty name is returned.
   28.43 +     *
   28.44       * @return the simple name of this element
   28.45       */
   28.46      Name getSimpleName();
   28.47 @@ -182,9 +190,18 @@
   28.48       * <li> If this element is one whose declaration is lexically enclosed
   28.49       * immediately within the declaration of another element, that other
   28.50       * element is returned.
   28.51 -     * <li> If this is a top-level type, its package is returned.
   28.52 -     * <li> If this is a package, {@code null} is returned.
   28.53 -     * <li> If this is a type parameter, {@code null} is returned.
   28.54 +     *
   28.55 +     * <li> If this is a {@linkplain TypeElement#getEnclosingElement
   28.56 +     * top-level type}, its package is returned.
   28.57 +     *
   28.58 +     * <li> If this is a {@linkplain
   28.59 +     * PackageElement#getEnclosingElement package}, {@code null} is
   28.60 +     * returned.
   28.61 +
   28.62 +     * <li> If this is a {@linkplain
   28.63 +     * TypeParameterElement#getEnclosingElement type parameter},
   28.64 +     * {@code null} is returned.
   28.65 +
   28.66       * </ul>
   28.67       *
   28.68       * @return the enclosing element, or {@code null} if there is none
    29.1 --- a/src/share/classes/javax/lang/model/element/ExecutableElement.java	Thu Feb 10 16:24:51 2011 -0800
    29.2 +++ b/src/share/classes/javax/lang/model/element/ExecutableElement.java	Mon Feb 14 16:31:21 2011 -0800
    29.3 @@ -1,5 +1,5 @@
    29.4  /*
    29.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
    29.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    29.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.8   *
    29.9   * This code is free software; you can redistribute it and/or modify it
   29.10 @@ -97,4 +97,17 @@
   29.11       * @return the default value, or {@code null} if none
   29.12       */
   29.13      AnnotationValue getDefaultValue();
   29.14 +
   29.15 +    /**
   29.16 +     * Returns the simple name of a constructor, method, or
   29.17 +     * initializer.  For a constructor, the name {@code "<init>"} is
   29.18 +     * returned, for a static initializer, the name {@code "<clinit>"}
   29.19 +     * is returned, and for an anonymous class or instance
   29.20 +     * initializer, an empty name is returned.
   29.21 +     *
   29.22 +     * @return the simple name of a constructor, method, or
   29.23 +     * initializer
   29.24 +     */
   29.25 +    @Override
   29.26 +    Name getSimpleName();
   29.27  }
    30.1 --- a/src/share/classes/javax/lang/model/element/PackageElement.java	Thu Feb 10 16:24:51 2011 -0800
    30.2 +++ b/src/share/classes/javax/lang/model/element/PackageElement.java	Mon Feb 14 16:31:21 2011 -0800
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 2005, 2011, 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 @@ -48,6 +48,16 @@
   30.11      Name getQualifiedName();
   30.12  
   30.13      /**
   30.14 +     * Returns the simple name of this package.  For an unnamed
   30.15 +     * package, an empty name is returned
   30.16 +     *
   30.17 +     * @return the simple name of this package or an empty name if
   30.18 +     * this is an unnamed package
   30.19 +     */
   30.20 +    @Override
   30.21 +    Name getSimpleName();
   30.22 +
   30.23 +    /**
   30.24       * Returns {@code true} is this is an unnamed package and {@code
   30.25       * false} otherwise.
   30.26       *
   30.27 @@ -56,4 +66,13 @@
   30.28       * @jls3 7.4.2 Unnamed Packages
   30.29       */
   30.30      boolean isUnnamed();
   30.31 +
   30.32 +    /**
   30.33 +     * Returns {@code null} since a package is not enclosed by another
   30.34 +     * element.
   30.35 +     *
   30.36 +     * @return {@code null}
   30.37 +     */
   30.38 +    @Override
   30.39 +    Element getEnclosingElement();
   30.40  }
    31.1 --- a/src/share/classes/javax/lang/model/element/TypeElement.java	Thu Feb 10 16:24:51 2011 -0800
    31.2 +++ b/src/share/classes/javax/lang/model/element/TypeElement.java	Mon Feb 14 16:31:21 2011 -0800
    31.3 @@ -1,5 +1,5 @@
    31.4  /*
    31.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
    31.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    31.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.8   *
    31.9   * This code is free software; you can redistribute it and/or modify it
   31.10 @@ -105,6 +105,19 @@
   31.11       */
   31.12      Name getQualifiedName();
   31.13  
   31.14 +
   31.15 +    /**
   31.16 +     * Returns the simple name of this type element.
   31.17 +     *
   31.18 +     * For an anonymous class, an empty name is returned.
   31.19 +     *
   31.20 +     * @return the simple name of this class or interface,
   31.21 +     * an empty name for an anonymous class
   31.22 +     *
   31.23 +     */
   31.24 +    @Override
   31.25 +    Name getSimpleName();
   31.26 +
   31.27      /**
   31.28       * Returns the direct superclass of this type element.
   31.29       * If this type element represents an interface or the class
   31.30 @@ -132,4 +145,16 @@
   31.31       * if there are none
   31.32       */
   31.33      List<? extends TypeParameterElement> getTypeParameters();
   31.34 +
   31.35 +
   31.36 +    /**
   31.37 +     * Returns the package of a top-level type and returns the
   31.38 +     * immediately lexically enclosing element for a {@linkplain
   31.39 +     * NestingKind#isNested nested} type.
   31.40 +     *
   31.41 +     * @return the package of a top-level type, the immediately
   31.42 +     * lexically enclosing element for a nested type
   31.43 +     */
   31.44 +    @Override
   31.45 +    Element getEnclosingElement();
   31.46  }
    32.1 --- a/src/share/classes/javax/lang/model/element/TypeParameterElement.java	Thu Feb 10 16:24:51 2011 -0800
    32.2 +++ b/src/share/classes/javax/lang/model/element/TypeParameterElement.java	Mon Feb 14 16:31:21 2011 -0800
    32.3 @@ -1,5 +1,5 @@
    32.4  /*
    32.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    32.6 + * Copyright (c) 2005, 2011, 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 @@ -62,4 +62,12 @@
   32.11       * there are none
   32.12       */
   32.13      List<? extends TypeMirror> getBounds();
   32.14 +
   32.15 +    /**
   32.16 +     * Returns {@code null}.
   32.17 +     *
   32.18 +     * @return {@code null}
   32.19 +     */
   32.20 +    @Override
   32.21 +    Element getEnclosingElement();
   32.22  }
    33.1 --- a/src/share/classes/javax/lang/model/element/VariableElement.java	Thu Feb 10 16:24:51 2011 -0800
    33.2 +++ b/src/share/classes/javax/lang/model/element/VariableElement.java	Mon Feb 14 16:31:21 2011 -0800
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 2005, 2011, 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 @@ -28,17 +28,16 @@
   33.11  import javax.lang.model.type.TypeMirror;
   33.12  import javax.lang.model.util.Elements;
   33.13  
   33.14 -
   33.15  /**
   33.16   * Represents a field, {@code enum} constant, method or constructor
   33.17 - * parameter, local variable, or exception parameter.
   33.18 + * parameter, local variable, resource variable, or exception
   33.19 + * parameter.
   33.20   *
   33.21   * @author Joseph D. Darcy
   33.22   * @author Scott Seligman
   33.23   * @author Peter von der Ah&eacute;
   33.24   * @since 1.6
   33.25   */
   33.26 -
   33.27  public interface VariableElement extends Element {
   33.28  
   33.29      /**
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/src/share/classes/javax/lang/model/type/DisjunctiveType.java	Mon Feb 14 16:31:21 2011 -0800
    34.3 @@ -0,0 +1,49 @@
    34.4 +/*
    34.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.7 + *
    34.8 + * This code is free software; you can redistribute it and/or modify it
    34.9 + * under the terms of the GNU General Public License version 2 only, as
   34.10 + * published by the Free Software Foundation.  Oracle designates this
   34.11 + * particular file as subject to the "Classpath" exception as provided
   34.12 + * by Oracle in the LICENSE file that accompanied this code.
   34.13 + *
   34.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   34.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   34.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   34.17 + * version 2 for more details (a copy is included in the LICENSE file that
   34.18 + * accompanied this code).
   34.19 + *
   34.20 + * You should have received a copy of the GNU General Public License version
   34.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   34.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   34.23 + *
   34.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   34.25 + * or visit www.oracle.com if you need additional information or have any
   34.26 + * questions.
   34.27 + */
   34.28 +
   34.29 +package javax.lang.model.type;
   34.30 +
   34.31 +import java.util.List;
   34.32 +
   34.33 +/**
   34.34 + * Represents a disjunctive type.
   34.35 + *
   34.36 + * As of the {@link javax.lang.model.SourceVersion#RELEASE_7
   34.37 + * RELEASE_7} source version, disjunctive types can appear as the type
   34.38 + * of a multi-catch exception parameter.
   34.39 + *
   34.40 + * @since 1.7
   34.41 + */
   34.42 +public interface DisjunctiveType extends TypeMirror {
   34.43 +
   34.44 +    /**
   34.45 +     * Return the alternatives comprising this disjunctive type.
   34.46 +     *
   34.47 +     * The alternatives are formally referred to as <i>disjuncts</i>.
   34.48 +     *
   34.49 +     * @return the alternatives comprising this disjunctive type.
   34.50 +     */
   34.51 +    List<? extends TypeMirror> getAlternatives();
   34.52 +}
    35.1 --- a/src/share/classes/javax/lang/model/type/TypeKind.java	Thu Feb 10 16:24:51 2011 -0800
    35.2 +++ b/src/share/classes/javax/lang/model/type/TypeKind.java	Mon Feb 14 16:31:21 2011 -0800
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    35.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.8   *
    35.9   * This code is free software; you can redistribute it and/or modify it
   35.10 @@ -137,7 +137,14 @@
   35.11       * An implementation-reserved type.
   35.12       * This is not the type you are looking for.
   35.13       */
   35.14 -    OTHER;
   35.15 +    OTHER,
   35.16 +
   35.17 +    /**
   35.18 +      * A disjunctive type.
   35.19 +      *
   35.20 +      * @since 1.7
   35.21 +      */
   35.22 +    DISJUNCTIVE;
   35.23  
   35.24      /**
   35.25       * Returns {@code true} if this kind corresponds to a primitive
    36.1 --- a/src/share/classes/javax/lang/model/type/TypeVisitor.java	Thu Feb 10 16:24:51 2011 -0800
    36.2 +++ b/src/share/classes/javax/lang/model/type/TypeVisitor.java	Mon Feb 14 16:31:21 2011 -0800
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    36.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
   36.10 @@ -162,4 +162,14 @@
   36.11       *  a visitor implementation may optionally throw this exception
   36.12       */
   36.13      R visitUnknown(TypeMirror t, P p);
   36.14 +
   36.15 +    /**
   36.16 +     * Visits a disjunctive type.
   36.17 +     *
   36.18 +     * @param t the type to visit
   36.19 +     * @param p a visitor-specified parameter
   36.20 +     * @return  a visitor-specified result
   36.21 +     * @since 1.7
   36.22 +     */
   36.23 +    R visitDisjunctive(DisjunctiveType t, P p);
   36.24  }
    37.1 --- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Thu Feb 10 16:24:51 2011 -0800
    37.2 +++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Mon Feb 14 16:31:21 2011 -0800
    37.3 @@ -1,5 +1,5 @@
    37.4  /*
    37.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    37.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    37.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.8   *
    37.9   * This code is free software; you can redistribute it and/or modify it
   37.10 @@ -29,7 +29,8 @@
   37.11  
   37.12  /**
   37.13   * A skeletal visitor of types with default behavior appropriate for
   37.14 - * the version 6 language level.
   37.15 + * the {@link javax.lang.model.SourceVersion#RELEASE_6 RELEASE_6}
   37.16 + * source version.
   37.17   *
   37.18   * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
   37.19   * by this class may have methods added to it in the future to
   37.20 @@ -95,6 +96,20 @@
   37.21      }
   37.22  
   37.23      /**
   37.24 +     * Visits a {@code DisjunctiveType} element by calling {@code
   37.25 +     * visitUnknown}.
   37.26 +
   37.27 +     * @param t  {@inheritDoc}
   37.28 +     * @param p  {@inheritDoc}
   37.29 +     * @return the result of {@code visitUnknown}
   37.30 +     *
   37.31 +     * @since 1.7
   37.32 +     */
   37.33 +    public R visitDisjunctive(DisjunctiveType t, P p) {
   37.34 +        return visitUnknown(t, p);
   37.35 +    }
   37.36 +
   37.37 +    /**
   37.38       * {@inheritDoc}
   37.39       *
   37.40       * <p> The default implementation of this method in {@code
    38.1 --- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	Thu Feb 10 16:24:51 2011 -0800
    38.2 +++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	Mon Feb 14 16:31:21 2011 -0800
    38.3 @@ -1,5 +1,5 @@
    38.4  /*
    38.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    38.6 + * Copyright (c) 2010, 2011 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 @@ -29,7 +29,8 @@
   38.11  
   38.12  /**
   38.13   * A skeletal visitor of types with default behavior appropriate for
   38.14 - * the version 7 language level.
   38.15 + * the {@link javax.lang.model.SourceVersion#RELEASE_7 RELEASE_7}
   38.16 + * source version.
   38.17   *
   38.18   * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
   38.19   * by this class may have methods added to it in the future to
   38.20 @@ -64,4 +65,13 @@
   38.21      protected AbstractTypeVisitor7() {
   38.22          super();
   38.23      }
   38.24 +
   38.25 +    /**
   38.26 +     * Visits a {@code DisjunctiveType} in a manner defined by a subclass.
   38.27 +     *
   38.28 +     * @param t  {@inheritDoc}
   38.29 +     * @param p  {@inheritDoc}
   38.30 +     * @return the result of the visit as defined by a subclass
   38.31 +     */
   38.32 +    public abstract R visitDisjunctive(DisjunctiveType t, P p);
   38.33  }
    39.1 --- a/src/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Thu Feb 10 16:24:51 2011 -0800
    39.2 +++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Mon Feb 14 16:31:21 2011 -0800
    39.3 @@ -1,5 +1,5 @@
    39.4  /*
    39.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    39.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    39.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.8   *
    39.9   * This code is free software; you can redistribute it and/or modify it
   39.10 @@ -199,7 +199,8 @@
   39.11       * Visits a variable element, dispatching to the visit method for
   39.12       * the specific {@linkplain ElementKind kind} of variable, {@code
   39.13       * ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD},
   39.14 -     * {@code LOCAL_VARIABLE}, or {@code PARAMETER}.
   39.15 +     * {@code LOCAL_VARIABLE}, {@code PARAMETER}, or {@code RESOURCE_VARIABLE}.
   39.16 +     *
   39.17       * @param e {@inheritDoc}
   39.18       * @param p {@inheritDoc}
   39.19       * @return  the result of the kind-specific visit method
   39.20 @@ -223,10 +224,12 @@
   39.21          case PARAMETER:
   39.22              return visitVariableAsParameter(e, p);
   39.23  
   39.24 +        case RESOURCE_VARIABLE:
   39.25 +            return visitVariableAsResourceVariable(e, p);
   39.26 +
   39.27          default:
   39.28              throw new AssertionError("Bad kind " + k + " for VariableElement" + e);
   39.29          }
   39.30 -
   39.31      }
   39.32  
   39.33      /**
   39.34 @@ -290,6 +293,20 @@
   39.35      }
   39.36  
   39.37      /**
   39.38 +     * Visits a {@code RESOURCE_VARIABLE} variable element by calling
   39.39 +     * {@code visitUnknown}.
   39.40 +     *
   39.41 +     * @param e the element to visit
   39.42 +     * @param p a visitor-specified parameter
   39.43 +     * @return  the result of {@code visitUnknown}
   39.44 +     *
   39.45 +     * @since 1.7
   39.46 +     */
   39.47 +    public R visitVariableAsResourceVariable(VariableElement e, P p) {
   39.48 +        return visitUnknown(e, p);
   39.49 +    }
   39.50 +
   39.51 +    /**
   39.52       * Visits an executable element, dispatching to the visit method
   39.53       * for the specific {@linkplain ElementKind kind} of executable,
   39.54       * {@code CONSTRUCTOR}, {@code INSTANCE_INIT}, {@code METHOD}, or
    40.1 --- a/src/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Thu Feb 10 16:24:51 2011 -0800
    40.2 +++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Mon Feb 14 16:31:21 2011 -0800
    40.3 @@ -1,5 +1,5 @@
    40.4  /*
    40.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    40.6 + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
    40.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.8   *
    40.9   * This code is free software; you can redistribute it and/or modify it
   40.10 @@ -34,7 +34,7 @@
   40.11  /**
   40.12   * A visitor of program elements based on their {@linkplain
   40.13   * ElementKind kind} with default behavior appropriate for the {@link
   40.14 - * SourceVersion#RELEASE_6 RELEASE_6} source version.  For {@linkplain
   40.15 + * SourceVersion#RELEASE_7 RELEASE_7} source version.  For {@linkplain
   40.16   * Element elements} <tt><i>XYZ</i></tt> that may have more than one
   40.17   * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
   40.18   * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
   40.19 @@ -94,4 +94,17 @@
   40.20      protected ElementKindVisitor7(R defaultValue) {
   40.21          super(defaultValue);
   40.22      }
   40.23 +
   40.24 +    /**
   40.25 +     * Visits a {@code RESOURCE_VARIABLE} variable element by calling
   40.26 +     * {@code defaultAction}.
   40.27 +     *
   40.28 +     * @param e {@inheritDoc}
   40.29 +     * @param p {@inheritDoc}
   40.30 +     * @return  the result of {@code defaultAction}
   40.31 +     */
   40.32 +    @Override
   40.33 +    public R visitVariableAsResourceVariable(VariableElement e, P p) {
   40.34 +        return defaultAction(e, p);
   40.35 +    }
   40.36  }
    41.1 --- a/src/share/classes/javax/lang/model/util/ElementScanner6.java	Thu Feb 10 16:24:51 2011 -0800
    41.2 +++ b/src/share/classes/javax/lang/model/util/ElementScanner6.java	Mon Feb 14 16:31:21 2011 -0800
    41.3 @@ -1,5 +1,5 @@
    41.4  /*
    41.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    41.6 + * Copyright (c) 2005, 2011, 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 @@ -152,8 +152,8 @@
   41.11      /**
   41.12       * {@inheritDoc} This implementation scans the enclosed elements.
   41.13       *
   41.14 -     * @param e  the element to visit
   41.15 -     * @param p  a visitor-specified parameter
   41.16 +     * @param e  {@inheritDoc}
   41.17 +     * @param p  {@inheritDoc}
   41.18       * @return the result of scanning
   41.19       */
   41.20      public R visitPackage(PackageElement e, P p) {
   41.21 @@ -163,8 +163,8 @@
   41.22      /**
   41.23       * {@inheritDoc} This implementation scans the enclosed elements.
   41.24       *
   41.25 -     * @param e  the element to visit
   41.26 -     * @param p  a visitor-specified parameter
   41.27 +     * @param e  {@inheritDoc}
   41.28 +     * @param p  {@inheritDoc}
   41.29       * @return the result of scanning
   41.30       */
   41.31      public R visitType(TypeElement e, P p) {
   41.32 @@ -172,21 +172,28 @@
   41.33      }
   41.34  
   41.35      /**
   41.36 -     * {@inheritDoc} This implementation scans the enclosed elements.
   41.37 +     * {@inheritDoc}
   41.38       *
   41.39 -     * @param e  the element to visit
   41.40 -     * @param p  a visitor-specified parameter
   41.41 +     * This implementation scans the enclosed elements, unless the
   41.42 +     * element is a {@code RESOURCE_VARIABLE} in which case {@code
   41.43 +     * visitUnknown} is called.
   41.44 +     *
   41.45 +     * @param e  {@inheritDoc}
   41.46 +     * @param p  {@inheritDoc}
   41.47       * @return the result of scanning
   41.48       */
   41.49      public R visitVariable(VariableElement e, P p) {
   41.50 -        return scan(e.getEnclosedElements(), p);
   41.51 +        if (e.getKind() != ElementKind.RESOURCE_VARIABLE)
   41.52 +            return scan(e.getEnclosedElements(), p);
   41.53 +        else
   41.54 +            return visitUnknown(e, p);
   41.55      }
   41.56  
   41.57      /**
   41.58       * {@inheritDoc} This implementation scans the parameters.
   41.59       *
   41.60 -     * @param e  the element to visit
   41.61 -     * @param p  a visitor-specified parameter
   41.62 +     * @param e  {@inheritDoc}
   41.63 +     * @param p  {@inheritDoc}
   41.64       * @return the result of scanning
   41.65       */
   41.66      public R visitExecutable(ExecutableElement e, P p) {
   41.67 @@ -196,8 +203,8 @@
   41.68      /**
   41.69       * {@inheritDoc} This implementation scans the enclosed elements.
   41.70       *
   41.71 -     * @param e  the element to visit
   41.72 -     * @param p  a visitor-specified parameter
   41.73 +     * @param e  {@inheritDoc}
   41.74 +     * @param p  {@inheritDoc}
   41.75       * @return the result of scanning
   41.76       */
   41.77      public R visitTypeParameter(TypeParameterElement e, P p) {
    42.1 --- a/src/share/classes/javax/lang/model/util/ElementScanner7.java	Thu Feb 10 16:24:51 2011 -0800
    42.2 +++ b/src/share/classes/javax/lang/model/util/ElementScanner7.java	Mon Feb 14 16:31:21 2011 -0800
    42.3 @@ -1,5 +1,5 @@
    42.4  /*
    42.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    42.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    42.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.8   *
    42.9   * This code is free software; you can redistribute it and/or modify it
   42.10 @@ -105,4 +105,16 @@
   42.11      protected ElementScanner7(R defaultValue){
   42.12          super(defaultValue);
   42.13      }
   42.14 +
   42.15 +    /**
   42.16 +     * This implementation scans the enclosed elements.
   42.17 +     *
   42.18 +     * @param e  {@inheritDoc}
   42.19 +     * @param p  {@inheritDoc}
   42.20 +     * @return the result of scanning
   42.21 +     */
   42.22 +    @Override
   42.23 +    public R visitVariable(VariableElement e, P p) {
   42.24 +        return scan(e.getEnclosedElements(), p);
   42.25 +    }
   42.26  }
    43.1 --- a/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	Thu Feb 10 16:24:51 2011 -0800
    43.2 +++ b/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	Mon Feb 14 16:31:21 2011 -0800
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
   43.10 @@ -36,8 +36,8 @@
   43.11  /**
   43.12   * A simple visitor for annotation values with default behavior
   43.13   * appropriate for the {@link SourceVersion#RELEASE_7 RELEASE_7}
   43.14 - * source version.  Visit methods call {@link
   43.15 - * #defaultAction} passing their arguments to {@code defaultAction}'s
   43.16 + * source version.  Visit methods call {@link #defaultAction
   43.17 + * defaultAction} passing their arguments to {@code defaultAction}'s
   43.18   * corresponding parameters.
   43.19   *
   43.20   * <p> Methods in this class may be overridden subject to their
    44.1 --- a/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Thu Feb 10 16:24:51 2011 -0800
    44.2 +++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Mon Feb 14 16:31:21 2011 -0800
    44.3 @@ -1,5 +1,5 @@
    44.4  /*
    44.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    44.6 + * Copyright (c) 2005, 2011, 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 @@ -38,8 +38,11 @@
   44.11   * source version.
   44.12   *
   44.13   * Visit methods corresponding to {@code RELEASE_6} language
   44.14 - * constructs call {@link #defaultAction}, passing their arguments to
   44.15 - * {@code defaultAction}'s corresponding parameters.
   44.16 + * constructs call {@link #defaultAction defaultAction}, passing their
   44.17 + * arguments to {@code defaultAction}'s corresponding parameters.
   44.18 + *
   44.19 + * For constructs introduced in {@code RELEASE_7} and later, {@code
   44.20 + * visitUnknown} is called instead.
   44.21   *
   44.22   * <p> Methods in this class may be overridden subject to their
   44.23   * general contract.  Note that annotating methods in concrete
   44.24 @@ -137,14 +140,21 @@
   44.25      }
   44.26  
   44.27      /**
   44.28 -     * {@inheritDoc} This implementation calls {@code defaultAction}.
   44.29 +     * {@inheritDoc}
   44.30 +     *
   44.31 +     * This implementation calls {@code defaultAction}, unless the
   44.32 +     * element is a {@code RESOURCE_VARIABLE} in which case {@code
   44.33 +     * visitUnknown} is called.
   44.34       *
   44.35       * @param e {@inheritDoc}
   44.36       * @param p {@inheritDoc}
   44.37 -     * @return  the result of {@code defaultAction}
   44.38 +     * @return  the result of {@code defaultAction} or {@code visitUnknown}
   44.39       */
   44.40      public R visitVariable(VariableElement e, P p) {
   44.41 -        return defaultAction(e, p);
   44.42 +        if (e.getKind() != ElementKind.RESOURCE_VARIABLE)
   44.43 +            return defaultAction(e, p);
   44.44 +        else
   44.45 +            return visitUnknown(e, p);
   44.46      }
   44.47  
   44.48      /**
    45.1 --- a/src/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	Thu Feb 10 16:24:51 2011 -0800
    45.2 +++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	Mon Feb 14 16:31:21 2011 -0800
    45.3 @@ -1,5 +1,5 @@
    45.4  /*
    45.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    45.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    45.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.8   *
    45.9   * This code is free software; you can redistribute it and/or modify it
   45.10 @@ -36,9 +36,10 @@
   45.11   * appropriate for the {@link SourceVersion#RELEASE_7 RELEASE_7}
   45.12   * source version.
   45.13   *
   45.14 - * Visit methods corresponding to {@code RELEASE_7} language
   45.15 - * constructs call {@link #defaultAction}, passing their arguments to
   45.16 - * {@code defaultAction}'s corresponding parameters.
   45.17 + * Visit methods corresponding to {@code RELEASE_7} and earlier
   45.18 + * language constructs call {@link #defaultAction defaultAction},
   45.19 + * passing their arguments to {@code defaultAction}'s corresponding
   45.20 + * parameters.
   45.21   *
   45.22   * <p> Methods in this class may be overridden subject to their
   45.23   * general contract.  Note that annotating methods in concrete
   45.24 @@ -89,4 +90,16 @@
   45.25      protected SimpleElementVisitor7(R defaultValue){
   45.26          super(defaultValue);
   45.27      }
   45.28 +
   45.29 +    /**
   45.30 +     * This implementation calls {@code defaultAction}.
   45.31 +     *
   45.32 +     * @param e {@inheritDoc}
   45.33 +     * @param p {@inheritDoc}
   45.34 +     * @return  the result of {@code defaultAction}
   45.35 +     */
   45.36 +    @Override
   45.37 +    public R visitVariable(VariableElement e, P p) {
   45.38 +        return defaultAction(e, p);
   45.39 +    }
   45.40  }
    46.1 --- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Thu Feb 10 16:24:51 2011 -0800
    46.2 +++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Mon Feb 14 16:31:21 2011 -0800
    46.3 @@ -1,5 +1,5 @@
    46.4  /*
    46.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    46.6 + * Copyright (c) 2005, 2011, 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 @@ -36,8 +36,11 @@
   46.11   * {@link SourceVersion#RELEASE_6 RELEASE_6} source version.
   46.12   *
   46.13   * Visit methods corresponding to {@code RELEASE_6} language
   46.14 - * constructs call {@link #defaultAction}, passing their arguments to
   46.15 - * {@code defaultAction}'s corresponding parameters.
   46.16 + * constructs call {@link #defaultAction defaultAction}, passing their
   46.17 + * arguments to {@code defaultAction}'s corresponding parameters.
   46.18 + *
   46.19 + * For constructs introduced in {@code RELEASE_7} and later, {@code
   46.20 + * visitUnknown} is called instead.
   46.21   *
   46.22   * <p> Methods in this class may be overridden subject to their
   46.23   * general contract.  Note that annotating methods in concrete
    47.1 --- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	Thu Feb 10 16:24:51 2011 -0800
    47.2 +++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	Mon Feb 14 16:31:21 2011 -0800
    47.3 @@ -1,5 +1,5 @@
    47.4  /*
    47.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    47.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    47.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.8   *
    47.9   * This code is free software; you can redistribute it and/or modify it
   47.10 @@ -34,9 +34,10 @@
   47.11   * A simple visitor of types with default behavior appropriate for the
   47.12   * {@link SourceVersion#RELEASE_7 RELEASE_7} source version.
   47.13   *
   47.14 - * Visit methods corresponding to {@code RELEASE_7} language
   47.15 - * constructs call {@link #defaultAction}, passing their arguments to
   47.16 - * {@code defaultAction}'s corresponding parameters.
   47.17 + * Visit methods corresponding to {@code RELEASE_7} and earlier
   47.18 + * language constructs call {@link #defaultAction defaultAction},
   47.19 + * passing their arguments to {@code defaultAction}'s corresponding
   47.20 + * parameters.
   47.21   *
   47.22   * <p> Methods in this class may be overridden subject to their
   47.23   * general contract.  Note that annotating methods in concrete
   47.24 @@ -88,4 +89,17 @@
   47.25      protected SimpleTypeVisitor7(R defaultValue){
   47.26          super(defaultValue);
   47.27      }
   47.28 +
   47.29 +    /**
   47.30 +     * This implementation visits a {@code DisjunctiveType} by calling
   47.31 +     * {@code defaultAction}.
   47.32 +     *
   47.33 +     * @param t  {@inheritDoc}
   47.34 +     * @param p  {@inheritDoc}
   47.35 +     * @return the result of {@code defaultAction}
   47.36 +     */
   47.37 +    @Override
   47.38 +    public R visitDisjunctive(DisjunctiveType t, P p) {
   47.39 +        return defaultAction(t, p);
   47.40 +    }
   47.41  }
    48.1 --- a/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Thu Feb 10 16:24:51 2011 -0800
    48.2 +++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Mon Feb 14 16:31:21 2011 -0800
    48.3 @@ -1,5 +1,5 @@
    48.4  /*
    48.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    48.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    48.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.8   *
    48.9   * This code is free software; you can redistribute it and/or modify it
   48.10 @@ -92,4 +92,17 @@
   48.11      protected TypeKindVisitor7(R defaultValue) {
   48.12          super(defaultValue);
   48.13      }
   48.14 +
   48.15 +    /**
   48.16 +     * This implementation visits a {@code DisjunctiveType} by calling
   48.17 +     * {@code defaultAction}.
   48.18 +     *
   48.19 +     * @param t  {@inheritDoc}
   48.20 +     * @param p  {@inheritDoc}
   48.21 +     * @return the result of {@code defaultAction}
   48.22 +     */
   48.23 +    @Override
   48.24 +    public R visitDisjunctive(DisjunctiveType t, P p) {
   48.25 +        return defaultAction(t, p);
   48.26 +    }
   48.27  }
    49.1 --- a/src/share/classes/javax/lang/model/util/Types.java	Thu Feb 10 16:24:51 2011 -0800
    49.2 +++ b/src/share/classes/javax/lang/model/util/Types.java	Mon Feb 14 16:31:21 2011 -0800
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    49.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.8   *
    49.9   * This code is free software; you can redistribute it and/or modify it
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/tools/javac/5017953/T5017953.java	Mon Feb 14 16:31:21 2011 -0800
    50.3 @@ -0,0 +1,20 @@
    50.4 +/*
    50.5 + * @test  /nodynamiccopyright/
    50.6 + * @bug 5017953
    50.7 + * @summary spurious cascaded diagnostics when name not found
    50.8 + * @compile/fail/ref=T5017953.out -XDrawDiagnostics T5017953.java
    50.9 + */
   50.10 +
   50.11 +class T5017953 {
   50.12 +
   50.13 +    int f = 0;
   50.14 +    void test(int i) {}
   50.15 +
   50.16 +    {   test(NonExistentClass.f ++);
   50.17 +        test(1 + NonExistentClass.f);
   50.18 +        test(NonExistentClass.f + 1);
   50.19 +        test(NonExistentClass.f + NonExistentClass.f);
   50.20 +        test(NonExistentClass.f += 1);
   50.21 +        test(f += NonExistentClass.f);
   50.22 +    }
   50.23 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/tools/javac/5017953/T5017953.out	Mon Feb 14 16:31:21 2011 -0800
    51.3 @@ -0,0 +1,8 @@
    51.4 +T5017953.java:13:14: compiler.err.cant.resolve.location: kindname.variable, NonExistentClass, , , (compiler.misc.location: kindname.class, T5017953, null)
    51.5 +T5017953.java:14:18: compiler.err.cant.resolve.location: kindname.variable, NonExistentClass, , , (compiler.misc.location: kindname.class, T5017953, null)
    51.6 +T5017953.java:15:14: compiler.err.cant.resolve.location: kindname.variable, NonExistentClass, , , (compiler.misc.location: kindname.class, T5017953, null)
    51.7 +T5017953.java:16:14: compiler.err.cant.resolve.location: kindname.variable, NonExistentClass, , , (compiler.misc.location: kindname.class, T5017953, null)
    51.8 +T5017953.java:16:35: compiler.err.cant.resolve.location: kindname.variable, NonExistentClass, , , (compiler.misc.location: kindname.class, T5017953, null)
    51.9 +T5017953.java:17:14: compiler.err.cant.resolve.location: kindname.variable, NonExistentClass, , , (compiler.misc.location: kindname.class, T5017953, null)
   51.10 +T5017953.java:18:19: compiler.err.cant.resolve.location: kindname.variable, NonExistentClass, , , (compiler.misc.location: kindname.class, T5017953, null)
   51.11 +7 errors
    52.1 --- a/test/tools/javac/6491592/T6491592.out	Thu Feb 10 16:24:51 2011 -0800
    52.2 +++ b/test/tools/javac/6491592/T6491592.out	Mon Feb 14 16:31:21 2011 -0800
    52.3 @@ -1,2 +1,2 @@
    52.4 -T6491592.java:12:11: compiler.err.operator.cant.be.applied: +, java.lang.Object,compiler.misc.type.null
    52.5 +T6491592.java:12:11: compiler.err.operator.cant.be.applied.1: +, java.lang.Object, compiler.misc.type.null
    52.6  1 error
    53.1 --- a/test/tools/javac/AnonStaticMember_2.java	Thu Feb 10 16:24:51 2011 -0800
    53.2 +++ b/test/tools/javac/AnonStaticMember_2.java	Mon Feb 14 16:31:21 2011 -0800
    53.3 @@ -1,33 +1,10 @@
    53.4  /*
    53.5 - * Copyright (c) 1999, 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.
   53.11 - *
   53.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   53.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.15 - * version 2 for more details (a copy is included in the LICENSE file that
   53.16 - * accompanied this code).
   53.17 - *
   53.18 - * You should have received a copy of the GNU General Public License version
   53.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   53.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.21 - *
   53.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   53.23 - * or visit www.oracle.com if you need additional information or have any
   53.24 - * questions.
   53.25 - */
   53.26 -
   53.27 -/*
   53.28 - * @test
   53.29 + * @test  /nodynamiccopyright/
   53.30   * @bug 4279339
   53.31   * @summary Verify that an anonymous class cannot contain a static method.
   53.32   * @author maddox
   53.33   *
   53.34 - * @run compile/fail AnonStaticMember_2.java
   53.35 + * @run compile/fail/ref=AnonStaticMember_2.out -XDrawDiagnostics AnonStaticMember_2.java
   53.36   */
   53.37  
   53.38  class AnonStaticMember_2 {
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/tools/javac/AnonStaticMember_2.out	Mon Feb 14 16:31:21 2011 -0800
    54.3 @@ -0,0 +1,2 @@
    54.4 +AnonStaticMember_2.java:12:21: compiler.err.icls.cant.have.static.decl: compiler.misc.anonymous.class: AnonStaticMember_2$1
    54.5 +1 error
    55.1 --- a/test/tools/javac/ClassPathTest/ClassPathTest.sh	Thu Feb 10 16:24:51 2011 -0800
    55.2 +++ b/test/tools/javac/ClassPathTest/ClassPathTest.sh	Mon Feb 14 16:31:21 2011 -0800
    55.3 @@ -100,7 +100,7 @@
    55.4  	expectedResult="$1"; shift
    55.5  	cleanup
    55.6  	echo $javac ${TESTTOOLVMOPTS} "$@"
    55.7 -	$javac ${TESTTOOLVMOPTS} "$@"
    55.8 +	"$javac" ${TESTTOOLVMOPTS} "$@"
    55.9  	report $expectedResult $?
   55.10  }
   55.11  
    56.1 --- a/test/tools/javac/ExtDirs/ExtDirs.sh	Thu Feb 10 16:24:51 2011 -0800
    56.2 +++ b/test/tools/javac/ExtDirs/ExtDirs.sh	Mon Feb 14 16:31:21 2011 -0800
    56.3 @@ -85,15 +85,15 @@
    56.4  done
    56.5  
    56.6  echo "Test 1"
    56.7 -$javac ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java"
    56.8 +"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java"
    56.9  if [ $? -ne 0 ] ; then fail ; fi
   56.10  
   56.11  echo "Test 2"
   56.12 -$javac ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java"
   56.13 +"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java"
   56.14  if [ $? -ne 0 ] ; then fail ; fi
   56.15  
   56.16  echo "Test 3"
   56.17 -$javac ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java"
   56.18 +"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java"
   56.19  if [ $? -ne 0 ] ; then fail ; fi
   56.20  
   56.21  echo PASS: all tests gave expected results
    57.1 --- a/test/tools/javac/InterfaceInInner.java	Thu Feb 10 16:24:51 2011 -0800
    57.2 +++ b/test/tools/javac/InterfaceInInner.java	Mon Feb 14 16:31:21 2011 -0800
    57.3 @@ -1,33 +1,10 @@
    57.4  /*
    57.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
    57.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.7 - *
    57.8 - * This code is free software; you can redistribute it and/or modify it
    57.9 - * under the terms of the GNU General Public License version 2 only, as
   57.10 - * published by the Free Software Foundation.
   57.11 - *
   57.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   57.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   57.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   57.15 - * version 2 for more details (a copy is included in the LICENSE file that
   57.16 - * accompanied this code).
   57.17 - *
   57.18 - * You should have received a copy of the GNU General Public License version
   57.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   57.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   57.21 - *
   57.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   57.23 - * or visit www.oracle.com if you need additional information or have any
   57.24 - * questions.
   57.25 - */
   57.26 -
   57.27 -/*
   57.28 - * @test
   57.29 + * @test  /nodynamiccopyright/
   57.30   * @bug 4063740
   57.31   * @summary Interfaces may only be declared in top level classes.
   57.32   * @author turnidge
   57.33   *
   57.34 - * @compile/fail InterfaceInInner.java
   57.35 + * @compile/fail/ref=InterfaceInInner.out -XDrawDiagnostics InterfaceInInner.java
   57.36   */
   57.37  class InterfaceInInner {
   57.38      InterfaceInInner() {
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/tools/javac/InterfaceInInner.out	Mon Feb 14 16:31:21 2011 -0800
    58.3 @@ -0,0 +1,2 @@
    58.4 +InterfaceInInner.java:12:13: compiler.err.intf.not.allowed.here
    58.5 +1 error
    59.1 --- a/test/tools/javac/Paths/Help.sh	Thu Feb 10 16:24:51 2011 -0800
    59.2 +++ b/test/tools/javac/Paths/Help.sh	Mon Feb 14 16:31:21 2011 -0800
    59.3 @@ -40,8 +40,8 @@
    59.4  
    59.5  DiagnosticsInEnglishPlease
    59.6  
    59.7 -HELP="`$javac ${TESTTOOLVMOPTS} -help 2>&1`"
    59.8 -XHELP="`$javac ${TESTTOOLVMOPTS} -X 2>&1`"
    59.9 +HELP="`\"$javac\" ${TESTTOOLVMOPTS} -help 2>&1`"
   59.10 +XHELP="`\"$javac\" ${TESTTOOLVMOPTS} -X 2>&1`"
   59.11  
   59.12  #----------------------------------------------------------------
   59.13  # Standard options
    60.1 --- a/test/tools/javac/QualifiedNew.java	Thu Feb 10 16:24:51 2011 -0800
    60.2 +++ b/test/tools/javac/QualifiedNew.java	Mon Feb 14 16:31:21 2011 -0800
    60.3 @@ -1,33 +1,10 @@
    60.4  /*
    60.5 - * Copyright (c) 2002, 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 -/*
   60.28 - * @test
   60.29 + * @test  /nodynamiccopyright/
   60.30   * @bug 4406966
   60.31   * @summary null qualifying inner instance creation should be error.
   60.32   * @author gafter
   60.33   *
   60.34 - * @compile/fail QualifiedNew.java
   60.35 + * @compile/fail/ref=QualifiedNew.out -XDrawDiagnostics QualifiedNew.java
   60.36   */
   60.37  
   60.38  class QualifiedNew {
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/test/tools/javac/QualifiedNew.out	Mon Feb 14 16:31:21 2011 -0800
    61.3 @@ -0,0 +1,3 @@
    61.4 +QualifiedNew.java:14:23: compiler.err.type.found.req: compiler.misc.type.null, (compiler.misc.type.req.ref)
    61.5 +QualifiedNew.java:15:29: compiler.err.cant.resolve.location: kindname.class, Y, , , (compiler.misc.location: kindname.class, QualifiedNew.Y[], null)
    61.6 +2 errors
    62.1 --- a/test/tools/javac/T6247324.out	Thu Feb 10 16:24:51 2011 -0800
    62.2 +++ b/test/tools/javac/T6247324.out	Mon Feb 14 16:31:21 2011 -0800
    62.3 @@ -1,2 +1,2 @@
    62.4 -T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , (compiler.misc.location: kindname.class, Pair, null)
    62.5 +T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , (compiler.misc.location: kindname.class, Pair<X,Y>, null)
    62.6  1 error
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/test/tools/javac/T6554097.java	Mon Feb 14 16:31:21 2011 -0800
    63.3 @@ -0,0 +1,26 @@
    63.4 +/*
    63.5 + * @test /nodynamiccopyright/
    63.6 + * @bug     6554097
    63.7 + * @summary "final" confuses at-SuppressWarnings
    63.8 + * @compile T6554097.java
    63.9 + * @compile/fail/ref=T6554097.out -XDrawDiagnostics -Werror -Xlint:serial T6554097.java
   63.10 + */
   63.11 +
   63.12 +class T6554097 {
   63.13 +    @SuppressWarnings("serial") final Throwable[] v1 = { new Throwable() {} };
   63.14 +    @SuppressWarnings("serial")       Throwable[] v2 = { new Throwable() {} };
   63.15 +
   63.16 +    public static void m1() throws Throwable {
   63.17 +            @SuppressWarnings("serial") final Throwable[] v3 = { new Throwable() {} };
   63.18 +            @SuppressWarnings("serial")       Throwable[] v4 = { new Throwable() {} };
   63.19 +    }
   63.20 +
   63.21 +    final Throwable[] v5 = { new Throwable() {} };
   63.22 +          Throwable[] v6 = { new Throwable() {} };
   63.23 +
   63.24 +    public static void m2() throws Throwable {
   63.25 +        final Throwable[] v7 = { new Throwable() {} };
   63.26 +                  Throwable[] v8 = { new Throwable() {} };
   63.27 +    }
   63.28 +}
   63.29 +
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/test/tools/javac/T6554097.out	Mon Feb 14 16:31:21 2011 -0800
    64.3 @@ -0,0 +1,7 @@
    64.4 +T6554097.java:18:46: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$5
    64.5 +T6554097.java:19:46: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$6
    64.6 +T6554097.java:22:50: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$7
    64.7 +T6554097.java:23:54: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$8
    64.8 +- compiler.err.warnings.and.werror
    64.9 +1 error
   64.10 +4 warnings
    65.1 --- a/test/tools/javac/T6725036.java	Thu Feb 10 16:24:51 2011 -0800
    65.2 +++ b/test/tools/javac/T6725036.java	Mon Feb 14 16:31:21 2011 -0800
    65.3 @@ -1,5 +1,5 @@
    65.4  /*
    65.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    65.6 + * Copyright (c) 2008, 2011, 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
   65.10 @@ -38,6 +38,7 @@
   65.11  import com.sun.tools.javac.file.RelativePath.RelativeFile;
   65.12  import com.sun.tools.javac.file.ZipFileIndex;
   65.13  import com.sun.tools.javac.file.ZipFileIndexArchive;
   65.14 +import com.sun.tools.javac.file.ZipFileIndexCache;
   65.15  import com.sun.tools.javac.util.Context;
   65.16  
   65.17  public class T6725036 {
   65.18 @@ -57,8 +58,8 @@
   65.19          JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
   65.20          long jarEntryTime = je.getTime();
   65.21  
   65.22 -        ZipFileIndex zfi =
   65.23 -                ZipFileIndex.getZipFileIndex(rt_jar, null, false, null, false);
   65.24 +        ZipFileIndexCache zfic = ZipFileIndexCache.getSharedInstance();
   65.25 +        ZipFileIndex zfi = zfic.getZipFileIndex(rt_jar, null, false, null, false);
   65.26          long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);
   65.27  
   65.28          check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);
    66.1 --- a/test/tools/javac/TryWithResources/BadTwrSyntax.java	Thu Feb 10 16:24:51 2011 -0800
    66.2 +++ b/test/tools/javac/TryWithResources/BadTwrSyntax.java	Mon Feb 14 16:31:21 2011 -0800
    66.3 @@ -4,13 +4,18 @@
    66.4   * @author Joseph D. Darcy
    66.5   * @summary Verify bad TWRs don't compile
    66.6   * @compile/fail -source 6 BadTwrSyntax.java
    66.7 - * @compile/fail/ref=BadTwrSyntax.out  -XDrawDiagnostics BadTwrSyntax.java
    66.8 + * @compile/fail/ref=BadTwrSyntax.out -XDrawDiagnostics BadTwrSyntax.java
    66.9   */
   66.10  
   66.11  import java.io.IOException;
   66.12  public class BadTwrSyntax implements AutoCloseable {
   66.13      public static void main(String... args) throws Exception {
   66.14 -        // illegal semicolon ending resources
   66.15 +        // illegal double semicolon ending resources
   66.16 +        try(BadTwr twrflow = new BadTwr();;) {
   66.17 +            System.out.println(twrflow.toString());
   66.18 +        }
   66.19 +
   66.20 +        // but one semicolon is fine
   66.21          try(BadTwr twrflow = new BadTwr();) {
   66.22              System.out.println(twrflow.toString());
   66.23          }
    67.1 --- a/test/tools/javac/TryWithResources/BadTwrSyntax.out	Thu Feb 10 16:24:51 2011 -0800
    67.2 +++ b/test/tools/javac/TryWithResources/BadTwrSyntax.out	Mon Feb 14 16:31:21 2011 -0800
    67.3 @@ -1,2 +1,7 @@
    67.4 -BadTwrSyntax.java:14:43: compiler.err.illegal.start.of.expr
    67.5 -1 error
    67.6 +BadTwrSyntax.java:14:43: compiler.err.illegal.start.of.type
    67.7 +BadTwrSyntax.java:14:44: compiler.err.expected: =
    67.8 +BadTwrSyntax.java:14:45: compiler.err.expected: ')'
    67.9 +BadTwrSyntax.java:14:47: compiler.err.expected: '{'
   67.10 +BadTwrSyntax.java:15:19: compiler.err.illegal.start.of.expr
   67.11 +BadTwrSyntax.java:15:23: compiler.err.expected: ';'
   67.12 +6 errors
    68.1 --- a/test/tools/javac/TryWithResources/DuplicateResource.java	Thu Feb 10 16:24:51 2011 -0800
    68.2 +++ b/test/tools/javac/TryWithResources/DuplicateResource.java	Mon Feb 14 16:31:21 2011 -0800
    68.3 @@ -1,5 +1,5 @@
    68.4  /*
    68.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    68.6 + * Copyright (c) 2010, 2011 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 @@ -23,9 +23,9 @@
   68.11  
   68.12  /*
   68.13   * @test
   68.14 - * @bug 6911256 6964740 6965277
   68.15 + * @bug 6911256 6964740 6965277 7013420
   68.16   * @author Maurizio Cimadamore
   68.17 - * @summary Check that lowered arm block does not end up creating resource twice
   68.18 + * @summary Check that lowered try-with-resources block does not end up creating resource twice
   68.19   */
   68.20  
   68.21  import java.util.ArrayList;
   68.22 @@ -45,7 +45,7 @@
   68.23      static ArrayList<TestResource> resources = new ArrayList<TestResource>();
   68.24  
   68.25      public static void main(String[] args) {
   68.26 -        try(new TestResource()) {
   68.27 +        try(TestResource tr = new TestResource()) {
   68.28             //do something
   68.29          } catch (Exception e) {
   68.30              throw new AssertionError("Shouldn't reach here", e);
   68.31 @@ -59,7 +59,7 @@
   68.32         }
   68.33         TestResource resource = resources.get(0);
   68.34         if (!resource.isClosed) {
   68.35 -           throw new AssertionError("Resource used in ARM block has not been automatically closed");
   68.36 +           throw new AssertionError("Resource used in try-with-resources block has not been automatically closed");
   68.37         }
   68.38      }
   68.39  }
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/test/tools/javac/TryWithResources/ExplicitFinal.java	Mon Feb 14 16:31:21 2011 -0800
    69.3 @@ -0,0 +1,56 @@
    69.4 +/*
    69.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    69.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.7 + *
    69.8 + * This code is free software; you can redistribute it and/or modify it
    69.9 + * under the terms of the GNU General Public License version 2 only, as
   69.10 + * published by the Free Software Foundation.
   69.11 + *
   69.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   69.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   69.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   69.15 + * version 2 for more details (a copy is included in the LICENSE file that
   69.16 + * accompanied this code).
   69.17 + *
   69.18 + * You should have received a copy of the GNU General Public License version
   69.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   69.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   69.21 + *
   69.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   69.23 + * or visit www.oracle.com if you need additional information or have any
   69.24 + * questions.
   69.25 + */
   69.26 +
   69.27 +/*
   69.28 + * @test
   69.29 + * @bug 7013420
   69.30 + * @author Joseph D. Darcy
   69.31 + * @summary Test that resource variables are accepted as explicitly final.
   69.32 + */
   69.33 +
   69.34 +import java.io.IOException;
   69.35 +
   69.36 +public class ExplicitFinal implements AutoCloseable {
   69.37 +    public static void main(String... args) {
   69.38 +        try(final ExplicitFinal r2 = new ExplicitFinal()) {
   69.39 +            r2.toString();
   69.40 +        } catch (IOException ioe) {
   69.41 +            throw new AssertionError("Shouldn't reach here", ioe);
   69.42 +        }
   69.43 +
   69.44 +        try(final @SuppressWarnings("unchecked") ExplicitFinal r3 = new ExplicitFinal()) {
   69.45 +            r3.toString();
   69.46 +        } catch (IOException ioe) {
   69.47 +            throw new AssertionError("Shouldn't reach here", ioe);
   69.48 +        }
   69.49 +
   69.50 +        try(@SuppressWarnings("unchecked") ExplicitFinal r4 = new ExplicitFinal()) {
   69.51 +            r4.toString();
   69.52 +        } catch (IOException ioe) {
   69.53 +            throw new AssertionError("Shouldn't reach here", ioe);
   69.54 +        }
   69.55 +    }
   69.56 +    public void close() throws IOException {
   69.57 +        System.out.println("Calling close on " + this);
   69.58 +    }
   69.59 +}
    70.1 --- a/test/tools/javac/TryWithResources/ImplicitFinal.java	Thu Feb 10 16:24:51 2011 -0800
    70.2 +++ b/test/tools/javac/TryWithResources/ImplicitFinal.java	Mon Feb 14 16:31:21 2011 -0800
    70.3 @@ -1,6 +1,6 @@
    70.4  /*
    70.5   * @test  /nodynamiccopyright/
    70.6 - * @bug 6911256 6964740 6965277
    70.7 + * @bug 6911256 6964740 6965277 7013420
    70.8   * @author Maurizio Cimadamore
    70.9   * @summary Test that resource variables are implicitly final
   70.10   * @compile/fail/ref=ImplicitFinal.out -XDrawDiagnostics ImplicitFinal.java
   70.11 @@ -15,12 +15,25 @@
   70.12          } catch (IOException ioe) { // Not reachable
   70.13              throw new AssertionError("Shouldn't reach here", ioe);
   70.14          }
   70.15 +
   70.16 +        try(@SuppressWarnings("unchecked") ImplicitFinal r1 = new ImplicitFinal()) {
   70.17 +            r1 = null; //disallowed
   70.18 +        } catch (IOException ioe) { // Not reachable
   70.19 +            throw new AssertionError("Shouldn't reach here", ioe);
   70.20 +        }
   70.21 +
   70.22 +        try(final ImplicitFinal r2 = new ImplicitFinal()) {
   70.23 +            r2 = null; //disallowed
   70.24 +        } catch (IOException ioe) { // Not reachable
   70.25 +            throw new AssertionError("Shouldn't reach here", ioe);
   70.26 +        }
   70.27 +
   70.28 +        try(final @SuppressWarnings("unchecked") ImplicitFinal r3 = new ImplicitFinal()) {
   70.29 +            r3 = null; //disallowed
   70.30 +        } catch (IOException ioe) { // Not reachable
   70.31 +            throw new AssertionError("Shouldn't reach here", ioe);
   70.32 +        }
   70.33      }
   70.34 -
   70.35 -
   70.36 -     // A close method, but the class is <em>not</em> Closeable or
   70.37 -     // AutoCloseable.
   70.38 -
   70.39      public void close() throws IOException {
   70.40          throw new IOException();
   70.41      }
    71.1 --- a/test/tools/javac/TryWithResources/ImplicitFinal.out	Thu Feb 10 16:24:51 2011 -0800
    71.2 +++ b/test/tools/javac/TryWithResources/ImplicitFinal.out	Mon Feb 14 16:31:21 2011 -0800
    71.3 @@ -1,2 +1,5 @@
    71.4  ImplicitFinal.java:14:13: compiler.err.try.resource.may.not.be.assigned: r
    71.5 -1 error
    71.6 +ImplicitFinal.java:20:13: compiler.err.try.resource.may.not.be.assigned: r1
    71.7 +ImplicitFinal.java:26:13: compiler.err.try.resource.may.not.be.assigned: r2
    71.8 +ImplicitFinal.java:32:13: compiler.err.try.resource.may.not.be.assigned: r3
    71.9 +4 errors
    72.1 --- a/test/tools/javac/TryWithResources/TwrFlow.java	Thu Feb 10 16:24:51 2011 -0800
    72.2 +++ b/test/tools/javac/TryWithResources/TwrFlow.java	Mon Feb 14 16:31:21 2011 -0800
    72.3 @@ -1,26 +1,16 @@
    72.4  /*
    72.5   * @test  /nodynamiccopyright/
    72.6 - * @bug 6911256 6964740
    72.7 + * @bug 6911256 6964740 7013420
    72.8   * @author Joseph D. Darcy
    72.9 - * @summary Test exception analysis of ARM blocks
   72.10 + * @summary Test exception analysis of try-with-resources blocks
   72.11   * @compile/fail/ref=TwrFlow.out -XDrawDiagnostics TwrFlow.java
   72.12   */
   72.13  
   72.14  import java.io.IOException;
   72.15  public class TwrFlow implements AutoCloseable {
   72.16      public static void main(String... args) {
   72.17 -        try(TwrFlow armflow = new TwrFlow()) {
   72.18 -            System.out.println(armflow.toString());
   72.19 -        } catch (IOException ioe) { // Not reachable
   72.20 -            throw new AssertionError("Shouldn't reach here", ioe);
   72.21 -        }
   72.22 -        // CustomCloseException should be caught or added to throws clause
   72.23 -
   72.24 -        // Also check behavior on a resource expression rather than a
   72.25 -        // declaration.
   72.26 -        TwrFlow armflowexpr = new TwrFlow();
   72.27 -        try(armflowexpr) {
   72.28 -            System.out.println(armflowexpr.toString());
   72.29 +        try(TwrFlow twrFlow = new TwrFlow()) {
   72.30 +            System.out.println(twrFlow.toString());
   72.31          } catch (IOException ioe) { // Not reachable
   72.32              throw new AssertionError("Shouldn't reach here", ioe);
   72.33          }
    73.1 --- a/test/tools/javac/TryWithResources/TwrFlow.out	Thu Feb 10 16:24:51 2011 -0800
    73.2 +++ b/test/tools/javac/TryWithResources/TwrFlow.out	Mon Feb 14 16:31:21 2011 -0800
    73.3 @@ -1,5 +1,3 @@
    73.4  TwrFlow.java:14:11: compiler.err.except.never.thrown.in.try: java.io.IOException
    73.5 -TwrFlow.java:24:11: compiler.err.except.never.thrown.in.try: java.io.IOException
    73.6  TwrFlow.java:12:46: compiler.err.unreported.exception.need.to.catch.or.throw: CustomCloseException
    73.7 -TwrFlow.java:22:26: compiler.err.unreported.exception.need.to.catch.or.throw: CustomCloseException
    73.8 -4 errors
    73.9 +2 errors
    74.1 --- a/test/tools/javac/TryWithResources/TwrInference.java	Thu Feb 10 16:24:51 2011 -0800
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,43 +0,0 @@
    74.4 -/*
    74.5 - * Copyright (c) 2010, 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 6911256 6964740 6965277
   74.30 - * @author Maurizio Cimadamore
   74.31 - * @summary Verify that method type-inference works as expected in TWR context
   74.32 - * @compile TwrInference.java
   74.33 - */
   74.34 -
   74.35 -class TwrInference {
   74.36 -
   74.37 -    public void test() {
   74.38 -        try(getX()) {
   74.39 -            //do something
   74.40 -        } catch (Exception e) { // Not reachable
   74.41 -            throw new AssertionError("Shouldn't reach here", e);
   74.42 -        }
   74.43 -    }
   74.44 -
   74.45 -    <X> X getX() { return null; }
   74.46 -}
    75.1 --- a/test/tools/javac/TryWithResources/TwrIntersection.java	Thu Feb 10 16:24:51 2011 -0800
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,47 +0,0 @@
    75.4 -/*
    75.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    75.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.7 - *
    75.8 - * This code is free software; you can redistribute it and/or modify it
    75.9 - * under the terms of the GNU General Public License version 2 only, as
   75.10 - * published by the Free Software Foundation.
   75.11 - *
   75.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   75.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   75.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   75.15 - * version 2 for more details (a copy is included in the LICENSE file that
   75.16 - * accompanied this code).
   75.17 - *
   75.18 - * You should have received a copy of the GNU General Public License version
   75.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   75.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   75.21 - *
   75.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   75.23 - * or visit www.oracle.com if you need additional information or have any
   75.24 - * questions.
   75.25 - */
   75.26 -
   75.27 -/*
   75.28 - * @test
   75.29 - * @bug 6911256 6964740 6965277
   75.30 - * @author Maurizio Cimadamore
   75.31 - * @summary Resource of an intersection type crashes Flow
   75.32 - * @compile TwrIntersection.java
   75.33 - */
   75.34 -
   75.35 -interface MyCloseable extends AutoCloseable {
   75.36 -   void close() throws java.io.IOException;
   75.37 -}
   75.38 -
   75.39 -class ResourceTypeVar {
   75.40 -
   75.41 -    public void test() {
   75.42 -        try(getX()) {
   75.43 -            //do something
   75.44 -        } catch (java.io.IOException e) { // Not reachable
   75.45 -            throw new AssertionError("Shouldn't reach here", e);
   75.46 -        }
   75.47 -    }
   75.48 -
   75.49 -    <X extends Number & MyCloseable> X getX() { return null; }
   75.50 -}
    76.1 --- a/test/tools/javac/TryWithResources/TwrIntersection02.java	Thu Feb 10 16:24:51 2011 -0800
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,37 +0,0 @@
    76.4 -/*
    76.5 - * @test  /nodynamiccopyright/
    76.6 - * @bug 6911256 6964740 6965277
    76.7 - * @author Maurizio Cimadamore
    76.8 - * @summary Check that resources of an intersection type forces union of exception types
    76.9 - *          to be caught outside twr block
   76.10 - * @compile/fail/ref=TwrIntersection02.out -XDrawDiagnostics TwrIntersection02.java
   76.11 - */
   76.12 -
   76.13 -class TwrIntersection02 {
   76.14 -
   76.15 -    static class Exception1 extends Exception {}
   76.16 -    static class Exception2 extends Exception {}
   76.17 -
   76.18 -
   76.19 -    interface MyResource1 extends AutoCloseable {
   76.20 -       void close() throws Exception1;
   76.21 -    }
   76.22 -
   76.23 -    interface MyResource2 extends AutoCloseable {
   76.24 -       void close() throws Exception2;
   76.25 -    }
   76.26 -
   76.27 -    public void test1() throws Exception1 {
   76.28 -        try(getX()) {
   76.29 -            //do something
   76.30 -        }
   76.31 -    }
   76.32 -
   76.33 -    public void test2() throws Exception2 {
   76.34 -        try(getX()) {
   76.35 -            //do something
   76.36 -        }
   76.37 -    }
   76.38 -
   76.39 -    <X extends MyResource1 & MyResource2> X getX() { return null; }
   76.40 -}
    77.1 --- a/test/tools/javac/TryWithResources/TwrIntersection02.out	Thu Feb 10 16:24:51 2011 -0800
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,3 +0,0 @@
    77.4 -TwrIntersection02.java:25:21: compiler.err.unreported.exception.need.to.catch.or.throw: TwrIntersection02.Exception2
    77.5 -TwrIntersection02.java:31:21: compiler.err.unreported.exception.need.to.catch.or.throw: TwrIntersection02.Exception1
    77.6 -2 errors
    78.1 --- a/test/tools/javac/TryWithResources/TwrMultiCatch.java	Thu Feb 10 16:24:51 2011 -0800
    78.2 +++ b/test/tools/javac/TryWithResources/TwrMultiCatch.java	Mon Feb 14 16:31:21 2011 -0800
    78.3 @@ -1,5 +1,5 @@
    78.4  /*
    78.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    78.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    78.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    78.8   *
    78.9   * This code is free software; you can redistribute it and/or modify it
   78.10 @@ -23,7 +23,7 @@
   78.11  
   78.12  /*
   78.13   * @test
   78.14 - * @bug 6911256 6964740
   78.15 + * @bug 6911256 6964740 7013420
   78.16   * @author Joseph D. Darcy
   78.17   * @summary Test that TWR and multi-catch play well together
   78.18   * @compile TwrMultiCatch.java
   78.19 @@ -48,9 +48,9 @@
   78.20  
   78.21      private static void test(TwrMultiCatch twrMultiCatch,
   78.22                       Class<? extends Exception> expected) {
   78.23 -        try(twrMultiCatch) {
   78.24 -            System.out.println(twrMultiCatch.toString());
   78.25 -        } catch (final CustomCloseException1 |
   78.26 +        try(TwrMultiCatch tmc = twrMultiCatch) {
   78.27 +            System.out.println(tmc.toString());
   78.28 +        } catch (CustomCloseException1 |
   78.29                   CustomCloseException2 exception) {
   78.30              if (!exception.getClass().equals(expected) ) {
   78.31                  throw new RuntimeException("Unexpected catch!");
   78.32 @@ -68,7 +68,7 @@
   78.33  
   78.34          try {
   78.35              throw t;
   78.36 -        } catch (final CustomCloseException1 |
   78.37 +        } catch (CustomCloseException1 |
   78.38                   CustomCloseException2 exception) {
   78.39              throw exception;
   78.40          } catch (Throwable throwable) {
    79.1 --- a/test/tools/javac/TryWithResources/TwrOnNonResource.java	Thu Feb 10 16:24:51 2011 -0800
    79.2 +++ b/test/tools/javac/TryWithResources/TwrOnNonResource.java	Mon Feb 14 16:31:21 2011 -0800
    79.3 @@ -1,6 +1,6 @@
    79.4  /*
    79.5   * @test  /nodynamiccopyright/
    79.6 - * @bug 6911256 6964740
    79.7 + * @bug 6911256 6964740 7013420
    79.8   * @author Joseph D. Darcy
    79.9   * @summary Verify invalid TWR block is not accepted.
   79.10   * @compile/fail -source 6 TwrOnNonResource.java
   79.11 @@ -18,18 +18,6 @@
   79.12          try(TwrOnNonResource aonr = new TwrOnNonResource()) {
   79.13              System.out.println(aonr.toString());
   79.14          } catch (Exception e) {;}
   79.15 -
   79.16 -        // Also check expression form
   79.17 -        TwrOnNonResource aonr = new TwrOnNonResource();
   79.18 -        try(aonr) {
   79.19 -            System.out.println(aonr.toString());
   79.20 -        }
   79.21 -        try(aonr) {
   79.22 -            System.out.println(aonr.toString());
   79.23 -        } finally {;}
   79.24 -        try(aonr) {
   79.25 -            System.out.println(aonr.toString());
   79.26 -        } catch (Exception e) {;}
   79.27      }
   79.28  
   79.29      /*
    80.1 --- a/test/tools/javac/TryWithResources/TwrOnNonResource.out	Thu Feb 10 16:24:51 2011 -0800
    80.2 +++ b/test/tools/javac/TryWithResources/TwrOnNonResource.out	Mon Feb 14 16:31:21 2011 -0800
    80.3 @@ -1,7 +1,4 @@
    80.4  TwrOnNonResource.java:12:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
    80.5  TwrOnNonResource.java:15:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
    80.6  TwrOnNonResource.java:18:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
    80.7 -TwrOnNonResource.java:24:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
    80.8 -TwrOnNonResource.java:27:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
    80.9 -TwrOnNonResource.java:30:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
   80.10 -6 errors
   80.11 +3 errors
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/test/tools/javac/diags/ArgTypeCompilerFactory.java	Mon Feb 14 16:31:21 2011 -0800
    81.3 @@ -0,0 +1,346 @@
    81.4 +/*
    81.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    81.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    81.7 + *
    81.8 + * This code is free software; you can redistribute it and/or modify it
    81.9 + * under the terms of the GNU General Public License version 2 only, as
   81.10 + * published by the Free Software Foundation.
   81.11 + *
   81.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   81.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   81.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   81.15 + * version 2 for more details (a copy is included in the LICENSE file that
   81.16 + * accompanied this code).
   81.17 + *
   81.18 + * You should have received a copy of the GNU General Public License version
   81.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   81.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   81.21 + *
   81.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   81.23 + * or visit www.oracle.com if you need additional information or have any
   81.24 + * questions.
   81.25 + */
   81.26 +
   81.27 +import java.io.*;
   81.28 +import java.util.*;
   81.29 +import java.util.List;
   81.30 +import javax.tools.*;
   81.31 +
   81.32 +import com.sun.tools.javac.api.*;
   81.33 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.DiagnosticPart;
   81.34 +import com.sun.tools.javac.api.Formattable.LocalizedString;
   81.35 +import com.sun.tools.javac.code.Flags.Flag;
   81.36 +import com.sun.tools.javac.code.Kinds.KindName;
   81.37 +import com.sun.tools.javac.code.*;
   81.38 +import com.sun.tools.javac.file.*;
   81.39 +import com.sun.tools.javac.main.Main;
   81.40 +import com.sun.tools.javac.parser.Token;
   81.41 +import com.sun.tools.javac.util.*;
   81.42 +import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
   81.43 +import javax.lang.model.SourceVersion;
   81.44 +
   81.45 +/**
   81.46 + * Compiler factory for instances of Example.Compiler that use custom
   81.47 + * DiagnosticFormatter and Messages objects to track the types of args
   81.48 + * when when localizing diagnostics.
   81.49 + * The compiler objects only support "output" mode, not "check" mode.
   81.50 + */
   81.51 +class ArgTypeCompilerFactory implements Example.Compiler.Factory {
   81.52 +    // Same code as Example.Compiler.DefaultFactory, but the names resolve differently
   81.53 +    public Example.Compiler getCompiler(List<String> opts, boolean verbose) {
   81.54 +        String first;
   81.55 +        String[] rest;
   81.56 +        if (opts == null || opts.isEmpty()) {
   81.57 +            first = null;
   81.58 +            rest = new String[0];
   81.59 +        } else {
   81.60 +            first = opts.get(0);
   81.61 +            rest = opts.subList(1, opts.size()).toArray(new String[opts.size() - 1]);
   81.62 +        }
   81.63 +        if (first == null || first.equals("jsr199"))
   81.64 +            return new Jsr199Compiler(verbose, rest);
   81.65 +        else if (first.equals("simple"))
   81.66 +            return new SimpleCompiler(verbose);
   81.67 +        else if (first.equals("backdoor"))
   81.68 +            return new BackdoorCompiler(verbose);
   81.69 +        else
   81.70 +            throw new IllegalArgumentException(first);
   81.71 +    }
   81.72 +
   81.73 +    /**
   81.74 +     * Compile using the JSR 199 API.  The diagnostics generated are
   81.75 +     * scanned for resource keys.   Not all diagnostic keys are generated
   81.76 +     * via the JSR 199 API -- for example, rich diagnostics are not directly
   81.77 +     * accessible, and some diagnostics generated by the file manager may
   81.78 +     * not be generated (for example, the JSR 199 file manager does not see
   81.79 +     * -Xlint:path).
   81.80 +     */
   81.81 +    static class Jsr199Compiler extends Example.Compiler {
   81.82 +        List<String> fmOpts;
   81.83 +
   81.84 +        Jsr199Compiler(boolean verbose, String... args) {
   81.85 +            super(verbose);
   81.86 +            for (int i = 0; i < args.length; i++) {
   81.87 +                String arg = args[i];
   81.88 +                if (arg.equals("-filemanager") && (i + 1 < args.length)) {
   81.89 +                    fmOpts = Arrays.asList(args[++i].split(","));
   81.90 +                } else
   81.91 +                    throw new IllegalArgumentException(arg);
   81.92 +            }
   81.93 +        }
   81.94 +
   81.95 +        @Override
   81.96 +        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
   81.97 +            assert out != null && keys == null;
   81.98 +
   81.99 +            if (verbose)
  81.100 +                System.err.println("run_jsr199: " + opts + " " + files);
  81.101 +
  81.102 +            JavacTool tool = JavacTool.create();
  81.103 +
  81.104 +            StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
  81.105 +            if (fmOpts != null)
  81.106 +                fm = new FileManager(fm, fmOpts);
  81.107 +
  81.108 +            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
  81.109 +
  81.110 +            JavacTaskImpl t = (JavacTaskImpl) tool.getTask(out, fm, null, opts, null, fos);
  81.111 +            Context c = t.getContext();
  81.112 +            ArgTypeMessages.preRegister(c);
  81.113 +            Options options = Options.instance(c);
  81.114 +            Log.instance(c).setDiagnosticFormatter(new ArgTypeDiagnosticFormatter(options));
  81.115 +            Boolean ok = t.call();
  81.116 +
  81.117 +            return ok;
  81.118 +        }
  81.119 +    }
  81.120 +
  81.121 +    /**
  81.122 +     * Run the test using the standard simple entry point.
  81.123 +     */
  81.124 +    static class SimpleCompiler extends Example.Compiler {
  81.125 +        SimpleCompiler(boolean verbose) {
  81.126 +            super(verbose);
  81.127 +        }
  81.128 +
  81.129 +        @Override
  81.130 +        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
  81.131 +            assert out != null && keys == null;
  81.132 +
  81.133 +            if (verbose)
  81.134 +                System.err.println("run_simple: " + opts + " " + files);
  81.135 +
  81.136 +            List<String> args = new ArrayList<String>();
  81.137 +
  81.138 +            args.addAll(opts);
  81.139 +            for (File f: files)
  81.140 +                args.add(f.getPath());
  81.141 +
  81.142 +            Main main = new Main("javac", out);
  81.143 +            Context c = new Context() {
  81.144 +                @Override public void clear() {
  81.145 +                    ((JavacFileManager) get(JavaFileManager.class)).close();
  81.146 +                    super.clear();
  81.147 +                }
  81.148 +            };
  81.149 +            JavacFileManager.preRegister(c); // can't create it until Log has been set up
  81.150 +            ArgTypeDiagnosticFormatter.preRegister(c);
  81.151 +            ArgTypeMessages.preRegister(c);
  81.152 +            int result = main.compile(args.toArray(new String[args.size()]), c);
  81.153 +
  81.154 +            return (result == 0);
  81.155 +        }
  81.156 +    }
  81.157 +
  81.158 +    static class BackdoorCompiler extends Example.Compiler {
  81.159 +        BackdoorCompiler(boolean verbose) {
  81.160 +            super(verbose);
  81.161 +        }
  81.162 +
  81.163 +        @Override
  81.164 +        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
  81.165 +            assert out != null && keys == null;
  81.166 +
  81.167 +            if (verbose)
  81.168 +                System.err.println("run_simple: " + opts + " " + files);
  81.169 +
  81.170 +            List<String> args = new ArrayList<String>(opts);
  81.171 +            for (File f: files)
  81.172 +                args.add(f.getPath());
  81.173 +
  81.174 +            Context c = new Context();
  81.175 +            JavacFileManager.preRegister(c); // can't create it until Log has been set up
  81.176 +            ArgTypeDiagnosticFormatter.preRegister(c);
  81.177 +            ArgTypeMessages.preRegister(c);
  81.178 +            com.sun.tools.javac.main.Main m = new com.sun.tools.javac.main.Main("javac", out);
  81.179 +            int rc = m.compile(args.toArray(new String[args.size()]), c);
  81.180 +
  81.181 +            return (rc == 0);
  81.182 +        }
  81.183 +
  81.184 +    }
  81.185 +
  81.186 +
  81.187 +    // <editor-fold defaultstate="collapsed" desc="Custom Javac components">
  81.188 +
  81.189 +    /**
  81.190 +     * Diagnostic formatter which reports formats a diag as a series of lines
  81.191 +     * containing a key, and a possibly empty set of descriptive strings for the
  81.192 +     * arg types.
  81.193 +     */
  81.194 +    static class ArgTypeDiagnosticFormatter extends AbstractDiagnosticFormatter {
  81.195 +        static void preRegister(final Context context) {
  81.196 +            context.put(Log.logKey, new Context.Factory<Log>() {
  81.197 +                public Log make() {
  81.198 +                    Log log = new Log(context) { };
  81.199 +                    Options options = Options.instance(context);
  81.200 +                    log.setDiagnosticFormatter(new ArgTypeDiagnosticFormatter(options));
  81.201 +                    return log;
  81.202 +                }
  81.203 +            });
  81.204 +
  81.205 +        }
  81.206 +
  81.207 +        ArgTypeDiagnosticFormatter(Options options) {
  81.208 +            super(null, new SimpleConfiguration(options,
  81.209 +                    EnumSet.of(DiagnosticPart.SUMMARY,
  81.210 +                    DiagnosticPart.DETAILS,
  81.211 +                    DiagnosticPart.SUBDIAGNOSTICS)));
  81.212 +        }
  81.213 +
  81.214 +        @Override
  81.215 +        protected String formatDiagnostic(JCDiagnostic d, Locale locale) {
  81.216 +            return formatMessage(d, locale);
  81.217 +        }
  81.218 +
  81.219 +        @Override
  81.220 +        public String formatMessage(JCDiagnostic d, Locale l) {
  81.221 +            StringBuilder buf = new StringBuilder();
  81.222 +            formatMessage(d, buf);
  81.223 +            return buf.toString();
  81.224 +        }
  81.225 +
  81.226 +        private void formatMessage(JCDiagnostic d, StringBuilder buf) {
  81.227 +            String key = d.getCode();
  81.228 +            Object[] args = d.getArgs();
  81.229 +            // report the primary arg types, without recursing into diag fragments
  81.230 +            buf.append(getKeyArgsString(key, args));
  81.231 +            // report details for any diagnostic fragments
  81.232 +            for (Object arg: args) {
  81.233 +                if (arg instanceof JCDiagnostic) {
  81.234 +                    buf.append("\n");
  81.235 +                    formatMessage((JCDiagnostic) arg, buf);
  81.236 +                }
  81.237 +            }
  81.238 +            // report details for any subdiagnostics
  81.239 +            for (String s: formatSubdiagnostics(d, null)) {
  81.240 +                buf.append("\n");
  81.241 +                buf.append(s);
  81.242 +            }
  81.243 +        }
  81.244 +
  81.245 +        @Override
  81.246 +        public boolean isRaw() {
  81.247 +            return true;
  81.248 +        }
  81.249 +    }
  81.250 +
  81.251 +    /**
  81.252 +     * Diagnostic formatter which "localizes" a message as a line
  81.253 +     * containing a key, and a possibly empty set of descriptive strings for the
  81.254 +     * arg types.
  81.255 +     */
  81.256 +    static class ArgTypeMessages extends JavacMessages {
  81.257 +        static void preRegister(final Context c) {
  81.258 +            c.put(JavacMessages.messagesKey, new Context.Factory<JavacMessages>() {
  81.259 +                public JavacMessages make() {
  81.260 +                    return new ArgTypeMessages(c) {
  81.261 +                        @Override
  81.262 +                        public String getLocalizedString(Locale l, String key, Object... args) {
  81.263 +                            return getKeyArgsString(key, args);
  81.264 +                        }
  81.265 +                    };
  81.266 +                }
  81.267 +            });
  81.268 +        }
  81.269 +
  81.270 +        ArgTypeMessages(Context context) {
  81.271 +            super(context);
  81.272 +        }
  81.273 +    }
  81.274 +
  81.275 +    /**
  81.276 +     * Utility method to generate a string for key and args
  81.277 +     */
  81.278 +    static String getKeyArgsString(String key, Object... args) {
  81.279 +        StringBuilder buf = new StringBuilder();
  81.280 +        buf.append(key);
  81.281 +        String sep = ": ";
  81.282 +        for (Object o : args) {
  81.283 +            buf.append(sep);
  81.284 +            buf.append(getArgTypeOrStringValue(o));
  81.285 +            sep = ", ";
  81.286 +        }
  81.287 +        return buf.toString();
  81.288 +    }
  81.289 +
  81.290 +    static boolean showStringValues = false;
  81.291 +
  81.292 +    static String getArgTypeOrStringValue(Object o) {
  81.293 +        if (showStringValues && o instanceof String)
  81.294 +            return "\"" + o + "\"";
  81.295 +        return getArgType(o);
  81.296 +    }
  81.297 +
  81.298 +    static String getArgType(Object o) {
  81.299 +        if (o == null)
  81.300 +            return "null";
  81.301 +        if (o instanceof Name)
  81.302 +            return "name";
  81.303 +        if (o instanceof Boolean)
  81.304 +            return "boolean";
  81.305 +        if (o instanceof Integer)
  81.306 +            return "number";
  81.307 +        if (o instanceof String)
  81.308 +            return "string";
  81.309 +        if (o instanceof Flag)
  81.310 +            return "modifier";
  81.311 +        if (o instanceof KindName)
  81.312 +            return "symbol kind";
  81.313 +        if (o instanceof Token)
  81.314 +            return "token";
  81.315 +        if (o instanceof Symbol)
  81.316 +            return "symbol";
  81.317 +        if (o instanceof Type)
  81.318 +            return "type";
  81.319 +        if (o instanceof List) {
  81.320 +            List<?> l = (List<?>) o;
  81.321 +            if (l.isEmpty())
  81.322 +                return "list";
  81.323 +            else
  81.324 +                return "list of " + getArgType(l.get(0));
  81.325 +        }
  81.326 +        if (o instanceof ListBuffer)
  81.327 +            return getArgType(((ListBuffer) o).toList());
  81.328 +        if (o instanceof Set) {
  81.329 +            Set<?> s = (Set<?>) o;
  81.330 +            if (s.isEmpty())
  81.331 +                return "set";
  81.332 +            else
  81.333 +                return "set of " + getArgType(s.iterator().next());
  81.334 +        }
  81.335 +        if (o instanceof SourceVersion)
  81.336 +            return "source version";
  81.337 +        if (o instanceof FileObject || o instanceof File)
  81.338 +            return "file name";
  81.339 +        if (o instanceof JCDiagnostic)
  81.340 +            return "message segment";
  81.341 +        if (o instanceof LocalizedString)
  81.342 +            return "message segment";  // only instance is "no arguments"
  81.343 +        String s = o.getClass().getSimpleName();
  81.344 +        return (s.isEmpty() ? o.getClass().getName() : s);
  81.345 +    }
  81.346 +
  81.347 +    // </editor-fold>
  81.348 +
  81.349 +}
    82.1 --- a/test/tools/javac/diags/Example.java	Thu Feb 10 16:24:51 2011 -0800
    82.2 +++ b/test/tools/javac/diags/Example.java	Mon Feb 14 16:31:21 2011 -0800
    82.3 @@ -1,5 +1,5 @@
    82.4  /*
    82.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    82.6 + * Copyright (c) 2010, 2011, 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
   82.10 @@ -168,7 +168,7 @@
   82.11          try {
   82.12              run(null, keys, true, verbose);
   82.13          } catch (IOException e) {
   82.14 -            e.printStackTrace();
   82.15 +            e.printStackTrace(System.err);
   82.16          }
   82.17          return keys;
   82.18      }
   82.19 @@ -293,10 +293,15 @@
   82.20      }
   82.21  
   82.22      abstract static class Compiler {
   82.23 -        static Compiler getCompiler(List<String> opts, boolean verbose) {
   82.24 +        interface Factory {
   82.25 +            Compiler getCompiler(List<String> opts, boolean verbose);
   82.26 +        }
   82.27 +
   82.28 +        static class DefaultFactory implements Factory {
   82.29 +            public Compiler getCompiler(List<String> opts, boolean verbose) {
   82.30              String first;
   82.31              String[] rest;
   82.32 -            if (opts == null || opts.size() == 0) {
   82.33 +                if (opts == null || opts.isEmpty()) {
   82.34                  first = null;
   82.35                  rest = new String[0];
   82.36              } else {
   82.37 @@ -311,6 +316,16 @@
   82.38                  return new BackdoorCompiler(verbose);
   82.39              else
   82.40                  throw new IllegalArgumentException(first);
   82.41 +                }
   82.42 +        }
   82.43 +
   82.44 +        static Factory factory;
   82.45 +
   82.46 +        static Compiler getCompiler(List<String> opts, boolean verbose) {
   82.47 +            if (factory == null)
   82.48 +                factory = new DefaultFactory();
   82.49 +
   82.50 +            return factory.getCompiler(opts, verbose);
   82.51          }
   82.52  
   82.53          protected Compiler(boolean verbose) {
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/test/tools/javac/diags/MessageFile.java	Mon Feb 14 16:31:21 2011 -0800
    83.3 @@ -0,0 +1,463 @@
    83.4 +/*
    83.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    83.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.7 + *
    83.8 + * This code is free software; you can redistribute it and/or modify it
    83.9 + * under the terms of the GNU General Public License version 2 only, as
   83.10 + * published by the Free Software Foundation.
   83.11 + *
   83.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   83.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   83.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   83.15 + * version 2 for more details (a copy is included in the LICENSE file that
   83.16 + * accompanied this code).
   83.17 + *
   83.18 + * You should have received a copy of the GNU General Public License version
   83.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   83.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   83.21 + *
   83.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   83.23 + * or visit www.oracle.com if you need additional information or have any
   83.24 + * questions.
   83.25 + */
   83.26 +
   83.27 +import java.io.*;
   83.28 +import java.util.*;
   83.29 +import java.util.regex.Matcher;
   83.30 +import java.util.regex.Pattern;
   83.31 +
   83.32 +/**
   83.33 + * Class to facilitate manipulating compiler.properties.
   83.34 + */
   83.35 +class MessageFile {
   83.36 +    static final Pattern emptyOrCommentPattern = Pattern.compile("( *#.*)?");
   83.37 +    static final Pattern infoPattern = Pattern.compile("# ([0-9]+: [-A-Za-z ]+, )*[0-9]+: [-A-Za-z ]+");
   83.38 +
   83.39 +    /**
   83.40 +     * A line of text within the message file.
   83.41 +     * The lines form a doubly linked list for simple navigation.
   83.42 +     */
   83.43 +    class Line {
   83.44 +        String text;
   83.45 +        Line prev;
   83.46 +        Line next;
   83.47 +
   83.48 +        Line(String text) {
   83.49 +            this.text = text;
   83.50 +        }
   83.51 +
   83.52 +        boolean isEmptyOrComment() {
   83.53 +            return emptyOrCommentPattern.matcher(text).matches();
   83.54 +        }
   83.55 +
   83.56 +        boolean isInfo() {
   83.57 +            return infoPattern.matcher(text).matches();
   83.58 +        }
   83.59 +
   83.60 +        boolean hasContinuation() {
   83.61 +            return (next != null) && text.endsWith("\\");
   83.62 +        }
   83.63 +
   83.64 +        Line insertAfter(String text) {
   83.65 +            Line l = new Line(text);
   83.66 +            insertAfter(l);
   83.67 +            return l;
   83.68 +        }
   83.69 +
   83.70 +        void insertAfter(Line l) {
   83.71 +            assert prev == null && next == null;
   83.72 +            l.prev = this;
   83.73 +            l.next = next;
   83.74 +            if (next == null)
   83.75 +                lastLine = l;
   83.76 +            else
   83.77 +                next.prev = l;
   83.78 +            next = l;
   83.79 +        }
   83.80 +
   83.81 +        Line insertBefore(String text) {
   83.82 +            Line l = new Line(text);
   83.83 +            insertBefore(l);
   83.84 +            return l;
   83.85 +        }
   83.86 +
   83.87 +        void insertBefore(Line l) {
   83.88 +            assert prev == null && next == null;
   83.89 +            l.prev = prev;
   83.90 +            l.next = this;
   83.91 +            if (prev == null)
   83.92 +                firstLine = l;
   83.93 +            else
   83.94 +                prev.next = l;
   83.95 +            prev = l;
   83.96 +        }
   83.97 +
   83.98 +        void remove() {
   83.99 +            if (prev == null)
  83.100 +                firstLine = next;
  83.101 +            else
  83.102 +                prev.next = next;
  83.103 +            if (next == null)
  83.104 +                lastLine = prev;
  83.105 +            else
  83.106 +                next.prev = prev;
  83.107 +            prev = null;
  83.108 +            next = null;
  83.109 +        }
  83.110 +    }
  83.111 +
  83.112 +    /**
  83.113 +     * A message within the message file.
  83.114 +     * A message is a series of lines containing a "name=value" property,
  83.115 +     * optionally preceded by a comment describing the use of placeholders
  83.116 +     * such as {0}, {1}, etc within the property value.
  83.117 +     */
  83.118 +    static final class Message {
  83.119 +        final Line firstLine;
  83.120 +        private Info info;
  83.121 +
  83.122 +        Message(Line l) {
  83.123 +            firstLine = l;
  83.124 +        }
  83.125 +
  83.126 +        boolean needInfo() {
  83.127 +            Line l = firstLine;
  83.128 +            while (true) {
  83.129 +                if (l.text.matches(".*\\{[0-9]+\\}.*"))
  83.130 +                    return true;
  83.131 +                if (!l.hasContinuation())
  83.132 +                    return false;
  83.133 +                l = l.next;
  83.134 +            }
  83.135 +        }
  83.136 +
  83.137 +        Set<Integer> getPlaceholders() {
  83.138 +            Pattern p = Pattern.compile("\\{([0-9]+)\\}");
  83.139 +            Set<Integer> results = new TreeSet<Integer>();
  83.140 +            Line l = firstLine;
  83.141 +            while (true) {
  83.142 +                Matcher m = p.matcher(l.text);
  83.143 +                while (m.find())
  83.144 +                    results.add(Integer.parseInt(m.group(1)));
  83.145 +                if (!l.hasContinuation())
  83.146 +                    return results;
  83.147 +                l = l.next;
  83.148 +            }
  83.149 +        }
  83.150 +
  83.151 +        /**
  83.152 +         * Get the Info object for this message. It may be empty if there
  83.153 +         * if no comment preceding the property specification.
  83.154 +         */
  83.155 +        Info getInfo() {
  83.156 +            if (info == null) {
  83.157 +                Line l = firstLine.prev;
  83.158 +                if (l != null && l.isInfo())
  83.159 +                    info = new Info(l.text);
  83.160 +                else
  83.161 +                    info = new Info();
  83.162 +            }
  83.163 +            return info;
  83.164 +        }
  83.165 +
  83.166 +        /**
  83.167 +         * Set the Info for this message.
  83.168 +         * If there was an info comment preceding the property specification,
  83.169 +         * it will be updated; otherwise, one will be inserted.
  83.170 +         */
  83.171 +        void setInfo(Info info) {
  83.172 +            this.info = info;
  83.173 +            Line l = firstLine.prev;
  83.174 +            if (l != null && l.isInfo())
  83.175 +                l.text = info.toComment();
  83.176 +            else
  83.177 +                firstLine.insertBefore(info.toComment());
  83.178 +        }
  83.179 +
  83.180 +        /**
  83.181 +         * Get all the lines pertaining to this message.
  83.182 +         */
  83.183 +        List<Line> getLines(boolean includeAllPrecedingComments) {
  83.184 +            List<Line> lines = new ArrayList<Line>();
  83.185 +            Line l = firstLine;
  83.186 +            if (includeAllPrecedingComments) {
  83.187 +                // scan back to find end of prev message
  83.188 +                while (l.prev != null && l.prev.isEmptyOrComment())
  83.189 +                    l = l.prev;
  83.190 +                // skip leading blank lines
  83.191 +                while (l.text.isEmpty())
  83.192 +                    l = l.next;
  83.193 +            } else {
  83.194 +                if (l.prev != null && l.prev.isInfo())
  83.195 +                    l = l.prev;
  83.196 +            }
  83.197 +
  83.198 +            // include any preceding lines
  83.199 +            for ( ; l != firstLine; l = l.next)
  83.200 +                lines.add(l);
  83.201 +
  83.202 +            // include message lines
  83.203 +            for (l = firstLine; l != null && l.hasContinuation(); l = l.next)
  83.204 +                lines.add(l);
  83.205 +            lines.add(l);
  83.206 +
  83.207 +            // include trailing blank line if present
  83.208 +            l = l.next;
  83.209 +            if (l != null && l.text.isEmpty())
  83.210 +                lines.add(l);
  83.211 +
  83.212 +            return lines;
  83.213 +        }
  83.214 +    }
  83.215 +
  83.216 +    /**
  83.217 +     * An object to represent the comment that may precede the property
  83.218 +     * specification in a Message.
  83.219 +     * The comment is modelled as a list of fields, where the fields correspond
  83.220 +     * to the placeholder values (e.g. {0}, {1}, etc) within the message value.
  83.221 +     */
  83.222 +    static final class Info {
  83.223 +        /**
  83.224 +         * An ordered set of descriptions for a placeholder value in a
  83.225 +         * message.
  83.226 +         */
  83.227 +        static class Field {
  83.228 +            boolean unused;
  83.229 +            Set<String> values;
  83.230 +            boolean listOfAny = false;
  83.231 +            boolean setOfAny = false;
  83.232 +            Field(String s) {
  83.233 +                s = s.substring(s.indexOf(": ") + 2);
  83.234 +                values = new LinkedHashSet<String>(Arrays.asList(s.split(" or ")));
  83.235 +                for (String v: values) {
  83.236 +                    if (v.startsWith("list of"))
  83.237 +                        listOfAny = true;
  83.238 +                    if (v.startsWith("set of"))
  83.239 +                        setOfAny = true;
  83.240 +                }
  83.241 +            }
  83.242 +
  83.243 +            /**
  83.244 +             * Return true if this field logically contains all the values of
  83.245 +             * another field.
  83.246 +             */
  83.247 +            boolean contains(Field other) {
  83.248 +                if (unused != other.unused)
  83.249 +                    return false;
  83.250 +
  83.251 +                for (String v: other.values) {
  83.252 +                    if (values.contains(v))
  83.253 +                        continue;
  83.254 +                    if (v.equals("null") || v.equals("string"))
  83.255 +                        continue;
  83.256 +                    if (v.equals("list") && listOfAny)
  83.257 +                        continue;
  83.258 +                    if (v.equals("set") && setOfAny)
  83.259 +                        continue;
  83.260 +                    return false;
  83.261 +                }
  83.262 +                return true;
  83.263 +            }
  83.264 +
  83.265 +            /**
  83.266 +             * Merge the values of another field into this field.
  83.267 +             */
  83.268 +            void merge(Field other) {
  83.269 +                unused |= other.unused;
  83.270 +                values.addAll(other.values);
  83.271 +
  83.272 +                // cleanup unnecessary entries
  83.273 +
  83.274 +                if (values.contains("null") && values.size() > 1) {
  83.275 +                    // "null" is superceded by anything else
  83.276 +                    values.remove("null");
  83.277 +                }
  83.278 +
  83.279 +                if (values.contains("string") && values.size() > 1) {
  83.280 +                    // "string" is superceded by anything else
  83.281 +                    values.remove("string");
  83.282 +                }
  83.283 +
  83.284 +                if (values.contains("list")) {
  83.285 +                    // list is superceded by "list of ..."
  83.286 +                    for (String s: values) {
  83.287 +                        if (s.startsWith("list of ")) {
  83.288 +                            values.remove("list");
  83.289 +                            break;
  83.290 +                        }
  83.291 +                    }
  83.292 +                }
  83.293 +
  83.294 +                if (values.contains("set")) {
  83.295 +                    // set is superceded by "set of ..."
  83.296 +                    for (String s: values) {
  83.297 +                        if (s.startsWith("set of ")) {
  83.298 +                            values.remove("set");
  83.299 +                            break;
  83.300 +                        }
  83.301 +                    }
  83.302 +                }
  83.303 +
  83.304 +                if (other.values.contains("unused")) {
  83.305 +                    values.clear();
  83.306 +                    values.add("unused");
  83.307 +                }
  83.308 +            }
  83.309 +
  83.310 +            void markUnused() {
  83.311 +                values = new LinkedHashSet<String>();
  83.312 +                values.add("unused");
  83.313 +                listOfAny = false;
  83.314 +                setOfAny = false;
  83.315 +            }
  83.316 +
  83.317 +            @Override
  83.318 +            public String toString() {
  83.319 +                return values.toString();
  83.320 +            }
  83.321 +        }
  83.322 +
  83.323 +        /** The fields of the Info object. */
  83.324 +        List<Field> fields = new ArrayList<Field>();
  83.325 +
  83.326 +        Info() { }
  83.327 +
  83.328 +        Info(String text) throws IllegalArgumentException {
  83.329 +            if (!text.startsWith("# "))
  83.330 +                throw new IllegalArgumentException();
  83.331 +            String[] segs = text.substring(2).split(", ");
  83.332 +            fields = new ArrayList<Field>();
  83.333 +            for (String seg: segs) {
  83.334 +                fields.add(new Field(seg));
  83.335 +            }
  83.336 +        }
  83.337 +
  83.338 +        Info(Set<String> infos) throws IllegalArgumentException {
  83.339 +            for (String s: infos)
  83.340 +                merge(new Info(s));
  83.341 +        }
  83.342 +
  83.343 +        boolean isEmpty() {
  83.344 +            return fields.isEmpty();
  83.345 +        }
  83.346 +
  83.347 +        boolean contains(Info other) {
  83.348 +            if (other.isEmpty())
  83.349 +                return true;
  83.350 +
  83.351 +            if (fields.size() != other.fields.size())
  83.352 +                return false;
  83.353 +
  83.354 +            Iterator<Field> oIter = other.fields.iterator();
  83.355 +            for (Field values: fields) {
  83.356 +                if (!values.contains(oIter.next()))
  83.357 +                    return false;
  83.358 +            }
  83.359 +
  83.360 +            return true;
  83.361 +        }
  83.362 +
  83.363 +        void merge(Info other) {
  83.364 +            if (fields.isEmpty()) {
  83.365 +                fields.addAll(other.fields);
  83.366 +                return;
  83.367 +            }
  83.368 +
  83.369 +            if (other.fields.size() != fields.size())
  83.370 +                throw new IllegalArgumentException();
  83.371 +
  83.372 +            Iterator<Field> oIter = other.fields.iterator();
  83.373 +            for (Field d: fields) {
  83.374 +                d.merge(oIter.next());
  83.375 +            }
  83.376 +        }
  83.377 +
  83.378 +        void markUnused(Set<Integer> used) {
  83.379 +            for (int i = 0; i < fields.size(); i++) {
  83.380 +                if (!used.contains(i))
  83.381 +                    fields.get(i).markUnused();
  83.382 +            }
  83.383 +        }
  83.384 +
  83.385 +        @Override
  83.386 +        public String toString() {
  83.387 +            return fields.toString();
  83.388 +        }
  83.389 +
  83.390 +        String toComment() {
  83.391 +            StringBuilder sb = new StringBuilder();
  83.392 +            sb.append("# ");
  83.393 +            String sep = "";
  83.394 +            int i = 0;
  83.395 +            for (Field f: fields) {
  83.396 +                sb.append(sep);
  83.397 +                sb.append(i++);
  83.398 +                sb.append(": ");
  83.399 +                sep = "";
  83.400 +                for (String s: f.values) {
  83.401 +                    sb.append(sep);
  83.402 +                    sb.append(s);
  83.403 +                    sep = " or ";
  83.404 +                }
  83.405 +                sep = ", ";
  83.406 +            }
  83.407 +            return sb.toString();
  83.408 +        }
  83.409 +    }
  83.410 +
  83.411 +    Line firstLine;
  83.412 +    Line lastLine;
  83.413 +    Map<String, Message> messages = new TreeMap<String, Message>();
  83.414 +
  83.415 +    MessageFile(File file) throws IOException {
  83.416 +        Reader in = new FileReader(file);
  83.417 +        try {
  83.418 +            read(in);
  83.419 +        } finally {
  83.420 +            in.close();
  83.421 +        }
  83.422 +    }
  83.423 +
  83.424 +    MessageFile(Reader in) throws IOException {
  83.425 +        read(in);
  83.426 +    }
  83.427 +
  83.428 +    final void read(Reader in) throws IOException {
  83.429 +        BufferedReader br = (in instanceof BufferedReader)
  83.430 +                ? (BufferedReader) in
  83.431 +                : new BufferedReader(in);
  83.432 +        String line;
  83.433 +        while ((line = br.readLine()) != null) {
  83.434 +            Line l;
  83.435 +            if (firstLine == null)
  83.436 +                l = firstLine = lastLine = new Line(line);
  83.437 +            else
  83.438 +                l = lastLine.insertAfter(line);
  83.439 +            if (line.startsWith("compiler.")) {
  83.440 +                int eq = line.indexOf("=");
  83.441 +                if (eq > 0)
  83.442 +                    messages.put(line.substring(0, eq), new Message(l));
  83.443 +            }
  83.444 +        }
  83.445 +    }
  83.446 +
  83.447 +    void write(File file) throws IOException {
  83.448 +        Writer out = new FileWriter(file);
  83.449 +        try {
  83.450 +            write(out);
  83.451 +        } finally {
  83.452 +            out.close();
  83.453 +        }
  83.454 +    }
  83.455 +
  83.456 +    void write(Writer out) throws IOException {
  83.457 +        BufferedWriter bw = (out instanceof BufferedWriter)
  83.458 +                ? (BufferedWriter) out
  83.459 +                : new BufferedWriter(out);
  83.460 +        for (Line l = firstLine; l != null; l = l.next) {
  83.461 +            bw.write(l.text);
  83.462 +            bw.write("\n"); // always use Unix line endings
  83.463 +        }
  83.464 +        bw.flush();
  83.465 +    }
  83.466 +}
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/test/tools/javac/diags/MessageInfo.java	Mon Feb 14 16:31:21 2011 -0800
    84.3 @@ -0,0 +1,410 @@
    84.4 +/*
    84.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.7 + *
    84.8 + * This code is free software; you can redistribute it and/or modify it
    84.9 + * under the terms of the GNU General Public License version 2 only, as
   84.10 + * published by the Free Software Foundation.
   84.11 + *
   84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   84.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   84.15 + * version 2 for more details (a copy is included in the LICENSE file that
   84.16 + * accompanied this code).
   84.17 + *
   84.18 + * You should have received a copy of the GNU General Public License version
   84.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   84.21 + *
   84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   84.23 + * or visit www.oracle.com if you need additional information or have any
   84.24 + * questions.
   84.25 + */
   84.26 +
   84.27 +/**
   84.28 + * @test
   84.29 + * @bug 7013272
   84.30 + * @summary Automatically generate info about how compiler resource keys are used
   84.31 + * @build Example ArgTypeCompilerFactory MessageFile MessageInfo
   84.32 + * @run main MessageInfo
   84.33 + */
   84.34 +
   84.35 +import java.io.*;
   84.36 +import java.text.SimpleDateFormat;
   84.37 +import java.util.*;
   84.38 +
   84.39 +/**
   84.40 + * Utility to manipulate compiler.properties, and suggest info comments based
   84.41 + * on information derived from running examples.
   84.42 + *
   84.43 + * Options:
   84.44 + *   -examples dir   location of examples directory
   84.45 + *   -o file         output file
   84.46 + *   -check          just check message file
   84.47 + *   -ensureNewlines ensure newline after each entry
   84.48 + *   -fixIndent      fix indentation of continuation lines
   84.49 + *   -sort           sort messages
   84.50 + *   -verbose        verbose output
   84.51 + *   -replace        replace comments instead of merging comments
   84.52 + *   file            javac compiler.properties file
   84.53 + *
   84.54 + */
   84.55 +public class MessageInfo {
   84.56 +    public static void main(String... args) throws Exception {
   84.57 +        jtreg = (System.getProperty("test.src") != null);
   84.58 +        File tmpDir;
   84.59 +        if (jtreg) {
   84.60 +            // use standard jtreg scratch directory: the current directory
   84.61 +            tmpDir = new File(System.getProperty("user.dir"));
   84.62 +        } else {
   84.63 +            tmpDir = new File(System.getProperty("java.io.tmpdir"),
   84.64 +                    MessageInfo.class.getName()
   84.65 +                    + (new SimpleDateFormat("yyMMddHHmmss")).format(new Date()));
   84.66 +        }
   84.67 +        Example.setTempDir(tmpDir);
   84.68 +        Example.Compiler.factory = new ArgTypeCompilerFactory();
   84.69 +
   84.70 +        MessageInfo mi = new MessageInfo();
   84.71 +
   84.72 +        try {
   84.73 +            if (mi.run(args))
   84.74 +                return;
   84.75 +        } finally {
   84.76 +            /* VERY IMPORTANT NOTE. In jtreg mode, tmpDir is set to the
   84.77 +             * jtreg scratch directory, which is the current directory.
   84.78 +             * In case someone is faking jtreg mode, make sure to only
   84.79 +             * clean tmpDir when it is reasonable to do so.
   84.80 +             */
   84.81 +            if (tmpDir.isDirectory() &&
   84.82 +                    tmpDir.getName().startsWith(MessageInfo.class.getName())) {
   84.83 +                if (clean(tmpDir))
   84.84 +                    tmpDir.delete();
   84.85 +            }
   84.86 +        }
   84.87 +
   84.88 +        if (jtreg)
   84.89 +            throw new Exception(mi.errors + " errors occurred");
   84.90 +        else
   84.91 +            System.exit(1);
   84.92 +    }
   84.93 +
   84.94 +    void usage() {
   84.95 +        System.out.println("Usage:");
   84.96 +        System.out.println("    java MessageInfo [options] [file]");
   84.97 +        System.out.println("where options include");
   84.98 +        System.out.println("    -examples dir   location of examples directory");
   84.99 +        System.out.println("    -o file         output file");
  84.100 +        System.out.println("    -check          just check message file");
  84.101 +        System.out.println("    -ensureNewlines ensure newline after each entry");
  84.102 +        System.out.println("    -fixIndent      fix indentation of continuation lines");
  84.103 +        System.out.println("    -sort           sort messages");
  84.104 +        System.out.println("    -verbose        verbose output");
  84.105 +        System.out.println("    -replace        replace comments instead of merging comments");
  84.106 +        System.out.println("    file            javac compiler.properties file");
  84.107 +    }
  84.108 +
  84.109 +    boolean run(String... args) {
  84.110 +        File testSrc = new File(System.getProperty("test.src", "."));
  84.111 +        File examplesDir = new File(testSrc, "examples");
  84.112 +        File notYetFile = null;
  84.113 +        File msgFile = null;
  84.114 +        File outFile = null;
  84.115 +        boolean verbose = false;
  84.116 +        boolean ensureNewlines = false;
  84.117 +        boolean fixIndent = false;
  84.118 +        boolean sort = false;
  84.119 +        boolean replace = false;
  84.120 +        boolean check = jtreg; // default true in jtreg mode
  84.121 +
  84.122 +        for (int i = 0; i < args.length; i++) {
  84.123 +            String arg = args[i];
  84.124 +            if (arg.equals("-examples") && (i + 1) < args.length)
  84.125 +                examplesDir = new File(args[++i]);
  84.126 +            else if(arg.equals("-notyet") && (i + 1) < args.length)
  84.127 +                notYetFile = new File(args[++i]);
  84.128 +            else if (arg.equals("-ensureNewlines"))
  84.129 +                ensureNewlines = true;
  84.130 +            else if (arg.equals("-fixIndent"))
  84.131 +                fixIndent = true;
  84.132 +            else if (arg.equals("-sort"))
  84.133 +                sort = true;
  84.134 +            else if (arg.equals("-verbose"))
  84.135 +                verbose = true;
  84.136 +            else if (arg.equals("-replace"))
  84.137 +                replace = true;
  84.138 +            else if (arg.equals("-check"))
  84.139 +                check = true;
  84.140 +            else if (arg.equals("-o") && (i + 1) < args.length)
  84.141 +                outFile = new File(args[++i]);
  84.142 +            else if (arg.startsWith("-")) {
  84.143 +                error("unknown option: " + arg);
  84.144 +                return false;
  84.145 +            } else if (i == args.length - 1) {
  84.146 +                msgFile = new File(arg);
  84.147 +            } else {
  84.148 +                error("unknown arg: " + arg);
  84.149 +                return false;
  84.150 +            }
  84.151 +        }
  84.152 +
  84.153 +        if (!check && outFile == null) {
  84.154 +            usage();
  84.155 +            return true;
  84.156 +        }
  84.157 +
  84.158 +        if ((ensureNewlines || fixIndent || sort) && outFile == null) {
  84.159 +            error("must set output file for these options");
  84.160 +            return false;
  84.161 +        }
  84.162 +
  84.163 +        if (notYetFile == null) {
  84.164 +            notYetFile = new File(examplesDir.getParentFile(), "examples.not-yet.txt");
  84.165 +        }
  84.166 +
  84.167 +        if (msgFile == null) {
  84.168 +            for (File d = testSrc; d != null; d = d.getParentFile()) {
  84.169 +                if (new File(d, "TEST.ROOT").exists()) {
  84.170 +                    d = d.getParentFile();
  84.171 +                    File f = new File(d, "src/share/classes/com/sun/tools/javac/resources/compiler.properties");
  84.172 +                    if (f.exists()) {
  84.173 +                        msgFile = f;
  84.174 +                        break;
  84.175 +                    }
  84.176 +                }
  84.177 +            }
  84.178 +            if (msgFile == null) {
  84.179 +                if (jtreg) {
  84.180 +                    System.err.println("Warning: no message file available, test skipped");
  84.181 +                    return true;
  84.182 +                }
  84.183 +                error("no message file available");
  84.184 +                return false;
  84.185 +            }
  84.186 +        }
  84.187 +
  84.188 +        MessageFile mf;
  84.189 +        try {
  84.190 +            mf = new MessageFile(msgFile);
  84.191 +        } catch (IOException e) {
  84.192 +            error("problem reading message file: " + e);
  84.193 +            return false;
  84.194 +        }
  84.195 +
  84.196 +        Map<String, Set<String>> msgInfo = runExamples(examplesDir, verbose);
  84.197 +
  84.198 +        if (ensureNewlines)
  84.199 +            ensureNewlines(mf);
  84.200 +
  84.201 +        if (fixIndent)
  84.202 +            fixIndent(mf);
  84.203 +
  84.204 +        if (sort)
  84.205 +            sort(mf, true);
  84.206 +
  84.207 +        for (Map.Entry<String, Set<String>> e: msgInfo.entrySet()) {
  84.208 +            String k = e.getKey();
  84.209 +            Set<String> suggestions = e.getValue();
  84.210 +            MessageFile.Message m = mf.messages.get(k);
  84.211 +            if (m == null) {
  84.212 +                error("Can't find message for " + k + " in message file");
  84.213 +                continue;
  84.214 +            }
  84.215 +
  84.216 +            MessageFile.Info info = m.getInfo();
  84.217 +            Set<Integer> placeholders = m.getPlaceholders();
  84.218 +            MessageFile.Info suggestedInfo = new MessageFile.Info(suggestions);
  84.219 +            suggestedInfo.markUnused(placeholders);
  84.220 +
  84.221 +            if (!info.isEmpty()) {
  84.222 +                if (info.contains(suggestedInfo))
  84.223 +                    continue;
  84.224 +                if (!replace) {
  84.225 +                    if (info.fields.size() != suggestedInfo.fields.size())
  84.226 +                        error("Cannot merge info for " + k);
  84.227 +                    else
  84.228 +                        suggestedInfo.merge(info);
  84.229 +                }
  84.230 +            }
  84.231 +
  84.232 +            if (outFile == null) {
  84.233 +                System.err.println("suggest for " + k);
  84.234 +                System.err.println(suggestedInfo.toComment());
  84.235 +            }  else
  84.236 +                m.setInfo(suggestedInfo);
  84.237 +        }
  84.238 +
  84.239 +        if (check)
  84.240 +            check(mf, notYetFile);
  84.241 +
  84.242 +        try {
  84.243 +            if (outFile != null)
  84.244 +                mf.write(outFile);
  84.245 +        } catch (IOException e) {
  84.246 +            error("problem writing file: " + e);
  84.247 +            return false;
  84.248 +        }
  84.249 +
  84.250 +        return (errors == 0);
  84.251 +    }
  84.252 +
  84.253 +    void check(MessageFile mf, File notYetFile) {
  84.254 +        Set<String> notYetList = null;
  84.255 +        for (Map.Entry<String, MessageFile.Message> e: mf.messages.entrySet()) {
  84.256 +            String key = e.getKey();
  84.257 +            MessageFile.Message m = e.getValue();
  84.258 +            if (m.needInfo() && m.getInfo().isEmpty()) {
  84.259 +                if (notYetList == null)
  84.260 +                    notYetList = getNotYetList(notYetFile);
  84.261 +                if (notYetList.contains(key))
  84.262 +                    System.err.println("Warning: no info for " + key);
  84.263 +                else
  84.264 +                    error("no info for " + key);
  84.265 +            }
  84.266 +        }
  84.267 +
  84.268 +    }
  84.269 +
  84.270 +    void ensureNewlines(MessageFile mf) {
  84.271 +        for (MessageFile.Message m: mf.messages.values()) {
  84.272 +            MessageFile.Line l = m.firstLine;
  84.273 +            while (l.text.endsWith("\\"))
  84.274 +                l = l.next;
  84.275 +            if (l.next != null && !l.next.text.isEmpty())
  84.276 +                l.insertAfter("");
  84.277 +        }
  84.278 +    }
  84.279 +
  84.280 +    void fixIndent(MessageFile mf) {
  84.281 +        for (MessageFile.Message m: mf.messages.values()) {
  84.282 +            MessageFile.Line l = m.firstLine;
  84.283 +            while (l.text.endsWith("\\") && l.next != null) {
  84.284 +                if (!l.next.text.matches("^    \\S.*"))
  84.285 +                    l.next.text = "    " + l.next.text.trim();
  84.286 +                l = l.next;
  84.287 +            }
  84.288 +        }
  84.289 +    }
  84.290 +
  84.291 +    void sort(MessageFile mf, boolean includePrecedingNewlines) {
  84.292 +        for (MessageFile.Message m: mf.messages.values()) {
  84.293 +            for (MessageFile.Line l: m.getLines(includePrecedingNewlines)) {
  84.294 +                l.remove();
  84.295 +                mf.lastLine.insertAfter(l);
  84.296 +            }
  84.297 +        }
  84.298 +    }
  84.299 +
  84.300 +    Map<String, Set<String>> runExamples(File examplesDir, boolean verbose) {
  84.301 +        Map<String, Set<String>> map = new TreeMap<String, Set<String>>();
  84.302 +        for (Example e: getExamples(examplesDir)) {
  84.303 +            StringWriter sw = new StringWriter();
  84.304 +            PrintWriter pw = new PrintWriter(sw);
  84.305 +            e.run(pw, true, verbose);
  84.306 +            pw.close();
  84.307 +            String[] lines = sw.toString().split("\n");
  84.308 +            for (String line: lines) {
  84.309 +                if (!line.startsWith("compiler."))
  84.310 +                    continue;
  84.311 +                int colon = line.indexOf(":");
  84.312 +                if (colon == -1)
  84.313 +                    continue;
  84.314 +                String key = line.substring(0, colon);
  84.315 +                StringBuilder sb = new StringBuilder();
  84.316 +                sb.append("# ");
  84.317 +                int i = 0;
  84.318 +                String[] descs = line.substring(colon + 1).split(", *");
  84.319 +                for (String desc: descs) {
  84.320 +                    if (i > 0) sb.append(", ");
  84.321 +                    sb.append(i++);
  84.322 +                    sb.append(": ");
  84.323 +                    sb.append(desc.trim());
  84.324 +                }
  84.325 +                Set<String> set = map.get(key);
  84.326 +                if (set == null)
  84.327 +                    map.put(key, set = new TreeSet<String>());
  84.328 +                set.add(sb.toString());
  84.329 +            }
  84.330 +        }
  84.331 +
  84.332 +        return map;
  84.333 +    }
  84.334 +
  84.335 +    /**
  84.336 +     * Get the complete set of examples to be checked.
  84.337 +     */
  84.338 +    Set<Example> getExamples(File examplesDir) {
  84.339 +        Set<Example> results = new TreeSet<Example>();
  84.340 +        for (File f: examplesDir.listFiles()) {
  84.341 +            if (isValidExample(f))
  84.342 +                results.add(new Example(f));
  84.343 +        }
  84.344 +        return results;
  84.345 +    }
  84.346 +
  84.347 +    boolean isValidExample(File f) {
  84.348 +        return (f.isDirectory() && (!jtreg || f.list().length > 0)) ||
  84.349 +                (f.isFile() && f.getName().endsWith(".java"));
  84.350 +    }
  84.351 +
  84.352 +    /**
  84.353 +     * Get the contents of the "not-yet" list.
  84.354 +     */
  84.355 +    Set<String> getNotYetList(File file) {
  84.356 +        Set<String> results = new TreeSet<String>();
  84.357 +        try {
  84.358 +            String[] lines = read(file).split("[\r\n]");
  84.359 +            for (String line: lines) {
  84.360 +                int hash = line.indexOf("#");
  84.361 +                if (hash != -1)
  84.362 +                    line = line.substring(0, hash).trim();
  84.363 +                if (line.matches("[A-Za-z0-9-_.]+"))
  84.364 +                    results.add(line);
  84.365 +            }
  84.366 +        } catch (IOException e) {
  84.367 +            throw new Error(e);
  84.368 +        }
  84.369 +        return results;
  84.370 +    }
  84.371 +
  84.372 +    /**
  84.373 +     * Read the contents of a file.
  84.374 +     */
  84.375 +    String read(File f) throws IOException {
  84.376 +        byte[] bytes = new byte[(int) f.length()];
  84.377 +        DataInputStream in = new DataInputStream(new FileInputStream(f));
  84.378 +        try {
  84.379 +            in.readFully(bytes);
  84.380 +        } finally {
  84.381 +            in.close();
  84.382 +        }
  84.383 +        return new String(bytes);
  84.384 +    }
  84.385 +
  84.386 +    /**
  84.387 +     * Report an error.
  84.388 +     */
  84.389 +    void error(String msg) {
  84.390 +        System.err.println("Error: " + msg);
  84.391 +        errors++;
  84.392 +    }
  84.393 +
  84.394 +    static boolean jtreg;
  84.395 +
  84.396 +    int errors;
  84.397 +
  84.398 +    /**
  84.399 +     * Clean the contents of a directory.
  84.400 +     */
  84.401 +    static boolean clean(File dir) {
  84.402 +        boolean ok = true;
  84.403 +        for (File f: dir.listFiles()) {
  84.404 +            if (f.isDirectory())
  84.405 +                ok &= clean(f);
  84.406 +            ok &= f.delete();
  84.407 +        }
  84.408 +        return ok;
  84.409 +    }
  84.410 +
  84.411 +}
  84.412 +
  84.413 +
    85.1 --- a/test/tools/javac/diags/RunExamples.java	Thu Feb 10 16:24:51 2011 -0800
    85.2 +++ b/test/tools/javac/diags/RunExamples.java	Mon Feb 14 16:31:21 2011 -0800
    85.3 @@ -1,5 +1,5 @@
    85.4  /*
    85.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    85.6 + * Copyright (c) 2010, 2011, 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
   85.10 @@ -25,7 +25,7 @@
   85.11   * @test
   85.12   * @bug 6968063
   85.13   * @summary provide examples of code that generate diagnostics
   85.14 - * @build Example HTMLWriter RunExamples
   85.15 + * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples
   85.16   * @run main RunExamples
   85.17   */
   85.18  
   85.19 @@ -97,6 +97,7 @@
   85.20          boolean raw = false;
   85.21          boolean showFiles = false;
   85.22          boolean verbose = false;
   85.23 +        boolean argTypes = false;
   85.24          String title = null;
   85.25  
   85.26          for (int i = 0; i < args.length; i++) {
   85.27 @@ -115,6 +116,8 @@
   85.28                  outFile = new File(args[++i]);
   85.29              else if (arg.equals("-title") && (i + 1) < args.length)
   85.30                  title = args[++i];
   85.31 +            else if (arg.equals("-argtypes"))
   85.32 +                argTypes = true;
   85.33              else if (arg.startsWith("-")) {
   85.34                  error("unknown option: " + arg);
   85.35                  return false;
   85.36 @@ -127,6 +130,11 @@
   85.37              }
   85.38          }
   85.39  
   85.40 +        // special mode to show message keys and the types of the args that
   85.41 +        // are used.
   85.42 +        if (argTypes)
   85.43 +            Example.Compiler.factory = new ArgTypeCompilerFactory();
   85.44 +
   85.45          if (selectedKeys.size() > 0) {
   85.46              Set<Example> examples = getExamples(examplesDir);
   85.47          nextKey:
   85.48 @@ -138,7 +146,7 @@
   85.49                  error("Key " + k + ": no examples found");
   85.50              }
   85.51          } else {
   85.52 -            if (selectedExamples.size() == 0)
   85.53 +            if (selectedExamples.isEmpty())
   85.54                  selectedExamples = getExamples(examplesDir);
   85.55          }
   85.56  
    86.1 --- a/test/tools/javac/diags/examples.not-yet.txt	Thu Feb 10 16:24:51 2011 -0800
    86.2 +++ b/test/tools/javac/diags/examples.not-yet.txt	Mon Feb 14 16:31:21 2011 -0800
    86.3 @@ -63,7 +63,6 @@
    86.4  compiler.misc.fatal.err.cant.close.loader               # JavacProcessingEnvironment
    86.5  compiler.misc.file.does.not.contain.package
    86.6  compiler.misc.illegal.start.of.class.file
    86.7 -compiler.misc.inferred.do.not.conform.to.params         # UNUSED (hard to see if very complex inference scenario might require this though, so leaving it in, as per JLS3)
    86.8  compiler.misc.kindname.annotation
    86.9  compiler.misc.kindname.enum
   86.10  compiler.misc.kindname.package
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/test/tools/javac/diags/examples/InaccessibleVarargsType/InaccessibleVarargsType.java	Mon Feb 14 16:31:21 2011 -0800
    87.3 @@ -0,0 +1,31 @@
    87.4 +/*
    87.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    87.7 + *
    87.8 + * This code is free software; you can redistribute it and/or modify it
    87.9 + * under the terms of the GNU General Public License version 2 only, as
   87.10 + * published by the Free Software Foundation.
   87.11 + *
   87.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   87.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   87.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   87.15 + * version 2 for more details (a copy is included in the LICENSE file that
   87.16 + * accompanied this code).
   87.17 + *
   87.18 + * You should have received a copy of the GNU General Public License version
   87.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   87.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   87.21 + *
   87.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   87.23 + * or visit www.oracle.com if you need additional information or have any
   87.24 + * questions.
   87.25 + */
   87.26 +
   87.27 +// key: compiler.misc.inaccessible.varargs.type
   87.28 +// key: compiler.err.cant.apply.symbol.1
   87.29 +
   87.30 +import p1.B;
   87.31 +
   87.32 +class InaccessibleVarargsType {
   87.33 +    { new B().foo(new B(), new B()); }
   87.34 +}
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/test/tools/javac/diags/examples/InaccessibleVarargsType/p1/A.java	Mon Feb 14 16:31:21 2011 -0800
    88.3 @@ -0,0 +1,28 @@
    88.4 +/*
    88.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    88.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    88.7 + *
    88.8 + * This code is free software; you can redistribute it and/or modify it
    88.9 + * under the terms of the GNU General Public License version 2 only, as
   88.10 + * published by the Free Software Foundation.
   88.11 + *
   88.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   88.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   88.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   88.15 + * version 2 for more details (a copy is included in the LICENSE file that
   88.16 + * accompanied this code).
   88.17 + *
   88.18 + * You should have received a copy of the GNU General Public License version
   88.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   88.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   88.21 + *
   88.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   88.23 + * or visit www.oracle.com if you need additional information or have any
   88.24 + * questions.
   88.25 + */
   88.26 +
   88.27 +package p1;
   88.28 +
   88.29 +class A {
   88.30 +    A() { }
   88.31 +}
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/test/tools/javac/diags/examples/InaccessibleVarargsType/p1/B.java	Mon Feb 14 16:31:21 2011 -0800
    89.3 @@ -0,0 +1,29 @@
    89.4 +/*
    89.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    89.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.7 + *
    89.8 + * This code is free software; you can redistribute it and/or modify it
    89.9 + * under the terms of the GNU General Public License version 2 only, as
   89.10 + * published by the Free Software Foundation.
   89.11 + *
   89.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   89.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   89.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   89.15 + * version 2 for more details (a copy is included in the LICENSE file that
   89.16 + * accompanied this code).
   89.17 + *
   89.18 + * You should have received a copy of the GNU General Public License version
   89.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   89.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   89.21 + *
   89.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   89.23 + * or visit www.oracle.com if you need additional information or have any
   89.24 + * questions.
   89.25 + */
   89.26 +
   89.27 +package p1;
   89.28 +
   89.29 +public class B extends A {
   89.30 +    public B() {}
   89.31 +    public void foo(A... args) { }
   89.32 +}
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/test/tools/javac/diags/examples/NameClashSameErasureNoHide.java	Mon Feb 14 16:31:21 2011 -0800
    90.3 @@ -0,0 +1,34 @@
    90.4 +/*
    90.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    90.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    90.7 + *
    90.8 + * This code is free software; you can redistribute it and/or modify it
    90.9 + * under the terms of the GNU General Public License version 2 only, as
   90.10 + * published by the Free Software Foundation.
   90.11 + *
   90.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   90.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   90.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   90.15 + * version 2 for more details (a copy is included in the LICENSE file that
   90.16 + * accompanied this code).
   90.17 + *
   90.18 + * You should have received a copy of the GNU General Public License version
   90.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   90.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   90.21 + *
   90.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   90.23 + * or visit www.oracle.com if you need additional information or have any
   90.24 + * questions.
   90.25 + */
   90.26 +
   90.27 +// key: compiler.err.name.clash.same.erasure.no.hide
   90.28 +
   90.29 +public class NameClashSameErasureNoHide<X> {
   90.30 +    static class A {
   90.31 +        static void m(NameClashSameErasureNoHide<String> l) {}
   90.32 +    }
   90.33 +
   90.34 +    static class B extends A {
   90.35 +        static void m(NameClashSameErasureNoHide<Integer> l) {}
   90.36 +    }
   90.37 +}
    91.1 --- a/test/tools/javac/diags/examples/NameClashSameErasureNoOverride.java	Thu Feb 10 16:24:51 2011 -0800
    91.2 +++ b/test/tools/javac/diags/examples/NameClashSameErasureNoOverride.java	Mon Feb 14 16:31:21 2011 -0800
    91.3 @@ -1,5 +1,5 @@
    91.4  /*
    91.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    91.6 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    91.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    91.8   *
    91.9   * This code is free software; you can redistribute it and/or modify it
   91.10 @@ -25,10 +25,10 @@
   91.11  
   91.12  public class NameClashSameErasureNoOverride<X> {
   91.13      static class A {
   91.14 -        static void m(NameClashSameErasureNoOverride<String> l) {}
   91.15 +        void m(NameClashSameErasureNoOverride<String> l) {}
   91.16      }
   91.17  
   91.18      static class B extends A {
   91.19 -        static void m(NameClashSameErasureNoOverride<Integer> l) {}
   91.20 +        void m(NameClashSameErasureNoOverride<Integer> l) {}
   91.21      }
   91.22  }
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/test/tools/javac/diags/examples/NameClashSameErasureNoOverride1.java	Mon Feb 14 16:31:21 2011 -0800
    92.3 @@ -0,0 +1,39 @@
    92.4 +/*
    92.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    92.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    92.7 + *
    92.8 + * This code is free software; you can redistribute it and/or modify it
    92.9 + * under the terms of the GNU General Public License version 2 only, as
   92.10 + * published by the Free Software Foundation.
   92.11 + *
   92.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   92.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   92.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   92.15 + * version 2 for more details (a copy is included in the LICENSE file that
   92.16 + * accompanied this code).
   92.17 + *
   92.18 + * You should have received a copy of the GNU General Public License version
   92.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   92.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   92.21 + *
   92.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   92.23 + * or visit www.oracle.com if you need additional information or have any
   92.24 + * questions.
   92.25 + */
   92.26 +
   92.27 +// key: compiler.err.name.clash.same.erasure.no.override.1
   92.28 +
   92.29 +public class NameClashSameErasureNoOverride1 {
   92.30 +
   92.31 +    interface I<X> {
   92.32 +        void m(X l);
   92.33 +    }
   92.34 +
   92.35 +    class A {
   92.36 +        void m(Object l) {}
   92.37 +    }
   92.38 +
   92.39 +    class B extends A implements I<Integer> {
   92.40 +        public void m(Integer l) {}
   92.41 +    }
   92.42 +}
    93.1 --- a/test/tools/javac/generics/5009937/T5009937.out	Thu Feb 10 16:24:51 2011 -0800
    93.2 +++ b/test/tools/javac/generics/5009937/T5009937.out	Mon Feb 14 16:31:21 2011 -0800
    93.3 @@ -1,2 +1,2 @@
    93.4 -T5009937.java:16:21: compiler.err.name.clash.same.erasure.no.override: m(T5009937<java.lang.Integer>), T5009937.B, m(T5009937<java.lang.String>), T5009937.A
    93.5 +T5009937.java:16:21: compiler.err.name.clash.same.erasure.no.hide: m(T5009937<java.lang.Integer>), T5009937.B, m(T5009937<java.lang.String>), T5009937.A
    93.6  1 error
    94.1 --- a/test/tools/javac/generics/6182950/T6182950b.out	Thu Feb 10 16:24:51 2011 -0800
    94.2 +++ b/test/tools/javac/generics/6182950/T6182950b.out	Mon Feb 14 16:31:21 2011 -0800
    94.3 @@ -1,2 +1,2 @@
    94.4 -T6182950b.java:15:16: compiler.err.name.clash.same.erasure.no.override: m(java.util.List<java.lang.Integer>), T6182950b.B, m(java.util.List<java.lang.String>), T6182950b.A
    94.5 +T6182950b.java:15:16: compiler.err.name.clash.same.erasure.no.override: m(java.util.List<java.lang.Integer>), T6182950b.B, m(java.util.List<java.lang.String>), T6182950b.A, m(java.util.List<java.lang.Integer>), T6182950b.B
    94.6  1 error
    95.1 --- a/test/tools/javac/generics/6476118/T6476118a.out	Thu Feb 10 16:24:51 2011 -0800
    95.2 +++ b/test/tools/javac/generics/6476118/T6476118a.out	Mon Feb 14 16:31:21 2011 -0800
    95.3 @@ -1,2 +1,2 @@
    95.4 -T6476118a.java:14:20: compiler.err.name.clash.same.erasure.no.override: compareTo(T), java.lang.Comparable, compareTo(java.lang.Object), T6476118a.A
    95.5 +T6476118a.java:14:20: compiler.err.name.clash.same.erasure.no.override.1: compareTo(T6476118a.B), T6476118a.B, compareTo(java.lang.Object), T6476118a.A, compareTo(T), java.lang.Comparable
    95.6  1 error
    96.1 --- a/test/tools/javac/generics/6476118/T6476118b.out	Thu Feb 10 16:24:51 2011 -0800
    96.2 +++ b/test/tools/javac/generics/6476118/T6476118b.out	Mon Feb 14 16:31:21 2011 -0800
    96.3 @@ -1,2 +1,2 @@
    96.4 -T6476118b.java:12:20: compiler.err.name.clash.same.erasure.no.override: compareTo(T), java.lang.Comparable, compareTo(java.lang.Object), T6476118b
    96.5 +T6476118b.java:12:20: compiler.err.name.clash.same.erasure.no.override.1: compareTo(T6476118b.B), T6476118b.B, compareTo(java.lang.Object), T6476118b, compareTo(T), java.lang.Comparable
    96.6  1 error
    97.1 --- a/test/tools/javac/generics/6476118/T6476118c.java	Thu Feb 10 16:24:51 2011 -0800
    97.2 +++ b/test/tools/javac/generics/6476118/T6476118c.java	Mon Feb 14 16:31:21 2011 -0800
    97.3 @@ -5,7 +5,7 @@
    97.4   * @compile/fail/ref=T6476118c.out -XDrawDiagnostics T6476118c.java
    97.5   */
    97.6  
    97.7 -class T6476118b {
    97.8 +class T6476118c {
    97.9      static class A<T> {
   97.10          public void foo(T t) { }
   97.11      }
    98.1 --- a/test/tools/javac/generics/6476118/T6476118c.out	Thu Feb 10 16:24:51 2011 -0800
    98.2 +++ b/test/tools/javac/generics/6476118/T6476118c.out	Mon Feb 14 16:31:21 2011 -0800
    98.3 @@ -1,3 +1,3 @@
    98.4 -T6476118c.java:18:21: compiler.err.name.clash.same.erasure.no.override: foo(java.lang.Object), T6476118b.C, foo(T), T6476118b.A
    98.5 -T6476118c.java:19:21: compiler.err.name.clash.same.erasure.no.override: foo(java.lang.Number), T6476118b.C, foo(T), T6476118b.B
    98.6 +T6476118c.java:18:21: compiler.err.name.clash.same.erasure.no.override: foo(java.lang.Object), T6476118c.C, foo(T), T6476118c.A, foo(java.lang.Object), T6476118c.C
    98.7 +T6476118c.java:19:21: compiler.err.name.clash.same.erasure.no.override: foo(java.lang.Number), T6476118c.C, foo(T), T6476118c.B, foo(java.lang.Number), T6476118c.C
    98.8  2 errors
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/test/tools/javac/generics/6910550/T6910550a.java	Mon Feb 14 16:31:21 2011 -0800
    99.3 @@ -0,0 +1,16 @@
    99.4 +/*
    99.5 + * @test /nodynamiccopyright/
    99.6 + * @bug 6910550
    99.7 + *
    99.8 + * @summary javac 1.5.0_17 fails with incorrect error message
    99.9 + * @compile/fail/ref=T6910550a.out -XDrawDiagnostics T6910550a.java
   99.10 + *
   99.11 + */
   99.12 +import java.util.*;
   99.13 +
   99.14 +class T6910550a {
   99.15 +    void m(List<String> ls) {}
   99.16 +    void m(List<Integer> li) {}
   99.17 +
   99.18 +    { m(Arrays.asList(12)); }
   99.19 +}
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/test/tools/javac/generics/6910550/T6910550a.out	Mon Feb 14 16:31:21 2011 -0800
   100.3 @@ -0,0 +1,2 @@
   100.4 +T6910550a.java:13:10: compiler.err.name.clash.same.erasure: m(java.util.List<java.lang.Integer>), m(java.util.List<java.lang.String>)
   100.5 +1 error
   101.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.2 +++ b/test/tools/javac/generics/6910550/T6910550b.java	Mon Feb 14 16:31:21 2011 -0800
   101.3 @@ -0,0 +1,16 @@
   101.4 +/*
   101.5 + * @test /nodynamiccopyright/
   101.6 + * @bug 6910550
   101.7 + *
   101.8 + * @summary javac 1.5.0_17 fails with incorrect error message
   101.9 + * @compile/fail/ref=T6910550b.out -XDrawDiagnostics T6910550b.java
  101.10 + *
  101.11 + */
  101.12 +
  101.13 +class T6910550b<X, Y, Z> {
  101.14 +    void m(X x) {}
  101.15 +    void m(Y y) {}
  101.16 +    void m(Z y) {}
  101.17 +
  101.18 +    { m(null); }
  101.19 +}
   102.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.2 +++ b/test/tools/javac/generics/6910550/T6910550b.out	Mon Feb 14 16:31:21 2011 -0800
   102.3 @@ -0,0 +1,3 @@
   102.4 +T6910550b.java:12:10: compiler.err.name.clash.same.erasure: m(Y), m(X)
   102.5 +T6910550b.java:13:10: compiler.err.name.clash.same.erasure: m(Z), m(X)
   102.6 +2 errors
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/test/tools/javac/generics/6910550/T6910550c.java	Mon Feb 14 16:31:21 2011 -0800
   103.3 @@ -0,0 +1,18 @@
   103.4 +/*
   103.5 + * @test /nodynamiccopyright/
   103.6 + * @bug 6910550
   103.7 + *
   103.8 + * @summary javac 1.5.0_17 fails with incorrect error message
   103.9 + * @compile/fail/ref=T6910550c.out -XDrawDiagnostics T6910550c.java
  103.10 + *
  103.11 + */
  103.12 +
  103.13 +class T6910550c {
  103.14 +    void m(Object[] x) {}
  103.15 +    void m(Object... x) {}
  103.16 +
  103.17 +    { m(); }
  103.18 +    { m(null); }
  103.19 +    { m(null, null); }
  103.20 +    { m(null, null, null); }
  103.21 +}
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/test/tools/javac/generics/6910550/T6910550c.out	Mon Feb 14 16:31:21 2011 -0800
   104.3 @@ -0,0 +1,2 @@
   104.4 +T6910550c.java:12:10: compiler.err.array.and.varargs: m(java.lang.Object...), m(java.lang.Object[]), T6910550c
   104.5 +1 error
   105.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.2 +++ b/test/tools/javac/generics/6910550/T6910550d.java	Mon Feb 14 16:31:21 2011 -0800
   105.3 @@ -0,0 +1,15 @@
   105.4 +/*
   105.5 + * @test /nodynamiccopyright/
   105.6 + * @bug 6910550
   105.7 + *
   105.8 + * @summary javac 1.5.0_17 fails with incorrect error message
   105.9 + * @compile/fail/ref=T6910550d.out -XDrawDiagnostics T6910550d.java
  105.10 + *
  105.11 + */
  105.12 +
  105.13 +class T6910550d {
  105.14 +    <X> void m(X x) {}
  105.15 +    <Y> void m(Y y) {}
  105.16 +
  105.17 +    { m(null); }
  105.18 +}
   106.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.2 +++ b/test/tools/javac/generics/6910550/T6910550d.out	Mon Feb 14 16:31:21 2011 -0800
   106.3 @@ -0,0 +1,2 @@
   106.4 +T6910550d.java:12:14: compiler.err.already.defined: <X>m(X), T6910550d
   106.5 +1 error
   107.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.2 +++ b/test/tools/javac/generics/6910550/T6910550e.java	Mon Feb 14 16:31:21 2011 -0800
   107.3 @@ -0,0 +1,18 @@
   107.4 +/*
   107.5 + * @test /nodynamiccopyright/
   107.6 + * @bug 6910550
   107.7 + *
   107.8 + * @summary javac 1.5.0_17 fails with incorrect error message
   107.9 + * @compile/fail/ref=T6910550e.out -XDrawDiagnostics T6910550e.java
  107.10 + *
  107.11 + */
  107.12 +
  107.13 +class T6910550e {
  107.14 +    static class Pair<X,Y> {}
  107.15 +
  107.16 +    <X> void m(Pair<X,X> x) {}
  107.17 +    <X,Y> void m(Pair<X,Y> y) {}
  107.18 +
  107.19 +   { m(new Pair<String,String>());
  107.20 +     m(new Pair<String,Integer>()); }
  107.21 +}
   108.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   108.2 +++ b/test/tools/javac/generics/6910550/T6910550e.out	Mon Feb 14 16:31:21 2011 -0800
   108.3 @@ -0,0 +1,2 @@
   108.4 +T6910550e.java:14:16: compiler.err.name.clash.same.erasure: <X,Y>m(T6910550e.Pair<X,Y>), <X>m(T6910550e.Pair<X,X>)
   108.5 +1 error
   109.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   109.2 +++ b/test/tools/javac/generics/6969184/T6969184.java	Mon Feb 14 16:31:21 2011 -0800
   109.3 @@ -0,0 +1,29 @@
   109.4 +/*
   109.5 + * @test /nodynamiccopyright/
   109.6 + * @bug 6956758
   109.7 + *
   109.8 + * @summary  poor error recovery after symbol not found
   109.9 + * @author Maurizio Cimadamore
  109.10 + * @compile/fail/ref=T6969184.out -XDrawDiagnostics T6969184.java
  109.11 + *
  109.12 + */
  109.13 +
  109.14 +class T6969184 {
  109.15 +    static class C1<X> {
  109.16 +        void m1(C1<? extends NonExistentClass> n) {}
  109.17 +        void m2(C1<? super NonExistentClass> n) {}
  109.18 +        void m3(C1<?> n) {}
  109.19 +    }
  109.20 +
  109.21 +    static class C2<X extends NonExistentBound> {
  109.22 +        void m1(C2<? extends NonExistentClass> n) {}
  109.23 +        void m2(C2<? super NonExistentClass> n) {}
  109.24 +        void m3(C2<?> n) {}
  109.25 +    }
  109.26 +
  109.27 +    static class C3<X extends NonExistentBound1 & NonExistentBound2> {
  109.28 +        void m1(C3<? extends NonExistentClass> n) {}
  109.29 +        void m2(C3<? super NonExistentClass> n) {}
  109.30 +        void m3(C3<?> n) {}
  109.31 +    }
  109.32 +}
   110.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   110.2 +++ b/test/tools/javac/generics/6969184/T6969184.out	Mon Feb 14 16:31:21 2011 -0800
   110.3 @@ -0,0 +1,10 @@
   110.4 +T6969184.java:13:30: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T6969184.C1<X>, null)
   110.5 +T6969184.java:14:28: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T6969184.C1<X>, null)
   110.6 +T6969184.java:18:31: compiler.err.cant.resolve.location: kindname.class, NonExistentBound, , , (compiler.misc.location: kindname.class, T6969184, null)
   110.7 +T6969184.java:19:30: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T6969184.C2<X>, null)
   110.8 +T6969184.java:20:28: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T6969184.C2<X>, null)
   110.9 +T6969184.java:24:31: compiler.err.cant.resolve.location: kindname.class, NonExistentBound1, , , (compiler.misc.location: kindname.class, T6969184, null)
  110.10 +T6969184.java:24:51: compiler.err.cant.resolve.location: kindname.class, NonExistentBound2, , , (compiler.misc.location: kindname.class, T6969184, null)
  110.11 +T6969184.java:25:30: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T6969184.C3<X>, null)
  110.12 +T6969184.java:26:28: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T6969184.C3<X>, null)
  110.13 +9 errors
   111.1 --- a/test/tools/javac/generics/6985719/T6985719e.out	Thu Feb 10 16:24:51 2011 -0800
   111.2 +++ b/test/tools/javac/generics/6985719/T6985719e.out	Mon Feb 14 16:31:21 2011 -0800
   111.3 @@ -1,2 +1,2 @@
   111.4 -T6985719e.java:13:34: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719e.B, f(java.util.List<java.lang.String>), T6985719e.A
   111.5 +T6985719e.java:13:34: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719e.B, f(java.util.List<java.lang.String>), T6985719e.A, f(java.util.List<java.lang.Integer>), T6985719e.B
   111.6  1 error
   112.1 --- a/test/tools/javac/generics/6985719/T6985719f.out	Thu Feb 10 16:24:51 2011 -0800
   112.2 +++ b/test/tools/javac/generics/6985719/T6985719f.out	Mon Feb 14 16:31:21 2011 -0800
   112.3 @@ -1,2 +1,2 @@
   112.4 -T6985719f.java:13:39: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719f.B, f(java.util.List<java.lang.String>), T6985719f.A
   112.5 +T6985719f.java:13:39: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719f.B, f(java.util.List<java.lang.String>), T6985719f.A, f(java.util.List<java.lang.Integer>), T6985719f.B
   112.6  1 error
   113.1 --- a/test/tools/javac/generics/6985719/T6985719g.out	Thu Feb 10 16:24:51 2011 -0800
   113.2 +++ b/test/tools/javac/generics/6985719/T6985719g.out	Mon Feb 14 16:31:21 2011 -0800
   113.3 @@ -1,2 +1,2 @@
   113.4 -T6985719g.java:13:42: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719g.B, f(java.util.List<X>), T6985719g.A
   113.5 +T6985719g.java:13:42: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719g.B, f(java.util.List<X>), T6985719g.A, f(java.util.List<java.lang.Integer>), T6985719g.B
   113.6  1 error
   114.1 --- a/test/tools/javac/generics/6985719/T6985719h.out	Thu Feb 10 16:24:51 2011 -0800
   114.2 +++ b/test/tools/javac/generics/6985719/T6985719h.out	Mon Feb 14 16:31:21 2011 -0800
   114.3 @@ -1,2 +1,2 @@
   114.4 -T6985719h.java:13:56: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719h.B, f(java.util.List<X>), T6985719h.A
   114.5 +T6985719h.java:13:56: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719h.B, f(java.util.List<X>), T6985719h.A, f(java.util.List<java.lang.Integer>), T6985719h.B
   114.6  1 error
   115.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   115.2 +++ b/test/tools/javac/generics/7007615/T7007615.java	Mon Feb 14 16:31:21 2011 -0800
   115.3 @@ -0,0 +1,27 @@
   115.4 +/*
   115.5 + * @test /nodynamiccopyright/
   115.6 + * @bug     7007615
   115.7 + * @summary java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
   115.8 + * @author  mcimadamore
   115.9 + * @compile/fail/ref=T7007615.out -XDrawDiagnostics T7007615.java
  115.10 + */
  115.11 +
  115.12 +class T6985719a {
  115.13 +    class AX<T extends Number> {
  115.14 +        void foo(T t) { }
  115.15 +    }
  115.16 +
  115.17 +    class BX<S extends Integer> extends AX<S> {
  115.18 +        @Override
  115.19 +        void foo(S t) { }
  115.20 +        void bar(BX bx){}
  115.21 +    }
  115.22 +
  115.23 +    class DX extends BX<Integer> {
  115.24 +        void foo(Number t) { }
  115.25 +        void bar(BX<?> bx) { }
  115.26 +
  115.27 +        @Override
  115.28 +        void foo(Integer t) { }
  115.29 +    }
  115.30 +}
   116.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   116.2 +++ b/test/tools/javac/generics/7007615/T7007615.out	Mon Feb 14 16:31:21 2011 -0800
   116.3 @@ -0,0 +1,3 @@
   116.4 +T7007615.java:21:14: compiler.err.name.clash.same.erasure.no.override: foo(java.lang.Number), T6985719a.DX, foo(T), T6985719a.AX, foo(java.lang.Number), T6985719a.DX
   116.5 +T7007615.java:22:14: compiler.err.name.clash.same.erasure.no.override: bar(T6985719a.BX<?>), T6985719a.DX, bar(T6985719a.BX), T6985719a.BX, bar(T6985719a.BX<?>), T6985719a.DX
   116.6 +2 errors
   117.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   117.2 +++ b/test/tools/javac/generics/7007615/acc1/AccessibilityCheck01.java	Mon Feb 14 16:31:21 2011 -0800
   117.3 @@ -0,0 +1,12 @@
   117.4 +/*
   117.5 + * @test /nodynamiccopyright/
   117.6 + * @bug     7007615
   117.7 + * @summary java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
   117.8 + * @author  dlsmith
   117.9 + * @compile AccessibilityCheck01.java
  117.10 + */
  117.11 +
  117.12 +public class AccessibilityCheck01 extends p2.E {
  117.13 +  String m(Object o) { return "hi"; } // this is okay
  117.14 +  int m(String s) { return 3; } // this overrides m(String) illegally
  117.15 +}
   118.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   118.2 +++ b/test/tools/javac/generics/7007615/acc1/p1/C.java	Mon Feb 14 16:31:21 2011 -0800
   118.3 @@ -0,0 +1,25 @@
   118.4 +/*
   118.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   118.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   118.7 + *
   118.8 + * This code is free software; you can redistribute it and/or modify it
   118.9 + * under the terms of the GNU General Public License version 2 only, as
  118.10 + * published by the Free Software Foundation.
  118.11 + *
  118.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  118.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  118.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  118.15 + * version 2 for more details (a copy is included in the LICENSE file that
  118.16 + * accompanied this code).
  118.17 + *
  118.18 + * You should have received a copy of the GNU General Public License version
  118.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  118.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  118.21 + *
  118.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  118.23 + * or visit www.oracle.com if you need additional information or have any
  118.24 + * questions.
  118.25 + */
  118.26 +
  118.27 +package p1;
  118.28 +public class C<T> { void m(T arg) { } /* implicit: m(Object) */ }
   119.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   119.2 +++ b/test/tools/javac/generics/7007615/acc1/p1/D.java	Mon Feb 14 16:31:21 2011 -0800
   119.3 @@ -0,0 +1,25 @@
   119.4 +/*
   119.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   119.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   119.7 + *
   119.8 + * This code is free software; you can redistribute it and/or modify it
   119.9 + * under the terms of the GNU General Public License version 2 only, as
  119.10 + * published by the Free Software Foundation.
  119.11 + *
  119.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  119.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  119.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  119.15 + * version 2 for more details (a copy is included in the LICENSE file that
  119.16 + * accompanied this code).
  119.17 + *
  119.18 + * You should have received a copy of the GNU General Public License version
  119.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  119.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  119.21 + *
  119.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  119.23 + * or visit www.oracle.com if you need additional information or have any
  119.24 + * questions.
  119.25 + */
  119.26 +
  119.27 +package p1;
  119.28 +public class D<T> extends C<T> { /* inherits m(T), implicit m(Object) */ }
   120.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   120.2 +++ b/test/tools/javac/generics/7007615/acc1/p2/E.java	Mon Feb 14 16:31:21 2011 -0800
   120.3 @@ -0,0 +1,25 @@
   120.4 +/*
   120.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   120.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   120.7 + *
   120.8 + * This code is free software; you can redistribute it and/or modify it
   120.9 + * under the terms of the GNU General Public License version 2 only, as
  120.10 + * published by the Free Software Foundation.
  120.11 + *
  120.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  120.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  120.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  120.15 + * version 2 for more details (a copy is included in the LICENSE file that
  120.16 + * accompanied this code).
  120.17 + *
  120.18 + * You should have received a copy of the GNU General Public License version
  120.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  120.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  120.21 + *
  120.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  120.23 + * or visit www.oracle.com if you need additional information or have any
  120.24 + * questions.
  120.25 + */
  120.26 +
  120.27 +package p2;
  120.28 +public class E<T> extends p1.D<T> { /* inherits nothing */ }
   121.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   121.2 +++ b/test/tools/javac/generics/7007615/acc2/AccessibilityCheck02.java	Mon Feb 14 16:31:21 2011 -0800
   121.3 @@ -0,0 +1,13 @@
   121.4 +/*
   121.5 + * @test /nodynamiccopyright/
   121.6 + * @bug     7007615
   121.7 + * @summary java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
   121.8 + * @author  dlsmith
   121.9 + * @compile/fail/ref=AccessibilityCheck02.out -XDrawDiagnostics AccessibilityCheck02.java
  121.10 + */
  121.11 +
  121.12 +public class AccessibilityCheck02 extends p2.E {
  121.13 +  String m(Object o) { return "hi"; } // this is okay
  121.14 +  public int m(String s) { return 3; } // this overrides m(String) illegally
  121.15 +}
  121.16 +
   122.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   122.2 +++ b/test/tools/javac/generics/7007615/acc2/AccessibilityCheck02.out	Mon Feb 14 16:31:21 2011 -0800
   122.3 @@ -0,0 +1,2 @@
   122.4 +AccessibilityCheck02.java:11:14: compiler.err.override.incompatible.ret: (compiler.misc.cant.override: m(java.lang.String), AccessibilityCheck02, m(java.lang.String), p1.D), int, void
   122.5 +1 error
   123.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   123.2 +++ b/test/tools/javac/generics/7007615/acc2/p1/C.java	Mon Feb 14 16:31:21 2011 -0800
   123.3 @@ -0,0 +1,25 @@
   123.4 +/*
   123.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   123.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   123.7 + *
   123.8 + * This code is free software; you can redistribute it and/or modify it
   123.9 + * under the terms of the GNU General Public License version 2 only, as
  123.10 + * published by the Free Software Foundation.
  123.11 + *
  123.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  123.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  123.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  123.15 + * version 2 for more details (a copy is included in the LICENSE file that
  123.16 + * accompanied this code).
  123.17 + *
  123.18 + * You should have received a copy of the GNU General Public License version
  123.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  123.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  123.21 + *
  123.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  123.23 + * or visit www.oracle.com if you need additional information or have any
  123.24 + * questions.
  123.25 + */
  123.26 +
  123.27 +package p1;
  123.28 +public class C<T> { void m(T arg) { } /* implicit: m(Object) */ }
   124.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   124.2 +++ b/test/tools/javac/generics/7007615/acc2/p1/D.java	Mon Feb 14 16:31:21 2011 -0800
   124.3 @@ -0,0 +1,25 @@
   124.4 +/*
   124.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   124.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   124.7 + *
   124.8 + * This code is free software; you can redistribute it and/or modify it
   124.9 + * under the terms of the GNU General Public License version 2 only, as
  124.10 + * published by the Free Software Foundation.
  124.11 + *
  124.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  124.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  124.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  124.15 + * version 2 for more details (a copy is included in the LICENSE file that
  124.16 + * accompanied this code).
  124.17 + *
  124.18 + * You should have received a copy of the GNU General Public License version
  124.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  124.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  124.21 + *
  124.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  124.23 + * or visit www.oracle.com if you need additional information or have any
  124.24 + * questions.
  124.25 + */
  124.26 +
  124.27 +package p1;
  124.28 +public class D extends C<String> { public void m(String arg) {} /* implicit bridge: m(Object) */ }
   125.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   125.2 +++ b/test/tools/javac/generics/7007615/acc2/p2/E.java	Mon Feb 14 16:31:21 2011 -0800
   125.3 @@ -0,0 +1,25 @@
   125.4 +/*
   125.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   125.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   125.7 + *
   125.8 + * This code is free software; you can redistribute it and/or modify it
   125.9 + * under the terms of the GNU General Public License version 2 only, as
  125.10 + * published by the Free Software Foundation.
  125.11 + *
  125.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  125.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  125.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  125.15 + * version 2 for more details (a copy is included in the LICENSE file that
  125.16 + * accompanied this code).
  125.17 + *
  125.18 + * You should have received a copy of the GNU General Public License version
  125.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  125.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  125.21 + *
  125.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  125.23 + * or visit www.oracle.com if you need additional information or have any
  125.24 + * questions.
  125.25 + */
  125.26 +
  125.27 +package p2;
  125.28 +public class E extends p1.D { /* inherits m(String) but not m(Object) */ }
   126.1 --- a/test/tools/javac/generics/diamond/neg/Neg01.out	Thu Feb 10 16:24:51 2011 -0800
   126.2 +++ b/test/tools/javac/generics/diamond/neg/Neg01.out	Mon Feb 14 16:31:21 2011 -0800
   126.3 @@ -17,7 +17,7 @@
   126.4  Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
   126.5  Neg01.java:29:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   126.6  Neg01.java:30:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   126.7 -Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01, null)
   126.8 +Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01<X>, null)
   126.9  Neg01.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  126.10  Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String, X
  126.11  Neg01.java:33:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   127.1 --- a/test/tools/javac/generics/inference/6638712/T6638712c.out	Thu Feb 10 16:24:51 2011 -0800
   127.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712c.out	Mon Feb 14 16:31:21 2011 -0800
   127.3 @@ -1,2 +1,2 @@
   127.4 -T6638712c.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, sort, T[],java.util.Comparator<? super T>, java.lang.Enum[],java.util.Comparator<java.lang.Enum<?>>, kindname.class, T6638712c, (compiler.misc.inferred.do.not.conform.to.params: java.lang.Enum[],java.util.Comparator<? super java.lang.Enum>, java.lang.Enum[],java.util.Comparator<java.lang.Enum<?>>)
   127.5 +T6638712c.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, sort, T[],java.util.Comparator<? super T>, java.lang.Enum[],java.util.Comparator<java.lang.Enum<?>>, kindname.class, T6638712c, (compiler.misc.no.conforming.assignment.exists: java.util.Comparator<java.lang.Enum<?>>, java.util.Comparator<? super java.lang.Enum>)
   127.6  1 error
   128.1 --- a/test/tools/javac/generics/inference/6638712/T6638712d.out	Thu Feb 10 16:24:51 2011 -0800
   128.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712d.out	Mon Feb 14 16:31:21 2011 -0800
   128.3 @@ -1,2 +1,2 @@
   128.4 -T6638712d.java:16:9: compiler.err.cant.apply.symbol.1: 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.params: java.lang.String,java.util.List<java.util.List<java.lang.String>>, int,java.util.List<java.util.List<java.lang.String>>)
   128.5 +T6638712d.java:16:9: compiler.err.cant.apply.symbol.1: 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.no.conforming.assignment.exists: int, java.lang.String)
   128.6  1 error
   129.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   129.2 +++ b/test/tools/javac/generics/inference/6838943/T6838943.java	Mon Feb 14 16:31:21 2011 -0800
   129.3 @@ -0,0 +1,16 @@
   129.4 +/**
   129.5 + * @test /nodynamiccopyright/
   129.6 + * @bug 6838943
   129.7 + * @summary inference: javac is not handling type-variable substitution properly
   129.8 + * @compile/fail/ref=T6838943.out -XDrawDiagnostics T6838943.java
   129.9 + */
  129.10 +class T6838943 {
  129.11 +    static class A<X> {}
  129.12 +    static class B {}
  129.13 +    static class C<X> {
  129.14 +        <Z> void m(X x, Z z) {
  129.15 +            C<A<Z>> c = new C<A<Z>>();
  129.16 +            c.m(new A<B>(), new B()); //should fail
  129.17 +        }
  129.18 +    }
  129.19 +}
   130.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   130.2 +++ b/test/tools/javac/generics/inference/6838943/T6838943.out	Mon Feb 14 16:31:21 2011 -0800
   130.3 @@ -0,0 +1,2 @@
   130.4 +T6838943.java:13:14: compiler.err.cant.apply.symbol.1: kindname.method, m, T6838943.A<Z>,Z, T6838943.A<T6838943.B>,T6838943.B, kindname.class, T6838943.C<X>, (compiler.misc.infer.no.conforming.assignment.exists: Z, T6838943.A<T6838943.B>, T6838943.A<Z>)
   130.5 +1 error
   131.1 --- a/test/tools/javac/generics/inference/6943278/T6943278.out	Thu Feb 10 16:24:51 2011 -0800
   131.2 +++ b/test/tools/javac/generics/inference/6943278/T6943278.out	Mon Feb 14 16:31:21 2011 -0800
   131.3 @@ -1,3 +1,3 @@
   131.4  T6943278.java:7:35: compiler.err.cant.resolve: kindname.class, NonExistentInterface, , 
   131.5 -T6943278.java:9:25: compiler.err.cant.resolve.location: kindname.class, NonExistentInterface, , , (compiler.misc.location: kindname.class, T6943278, null)
   131.6 +T6943278.java:9:25: compiler.err.cant.resolve.location: kindname.class, NonExistentInterface, , , (compiler.misc.location: kindname.class, T6943278<X>, null)
   131.7  2 errors
   132.1 --- a/test/tools/javac/javazip/Test.sh	Thu Feb 10 16:24:51 2011 -0800
   132.2 +++ b/test/tools/javac/javazip/Test.sh	Mon Feb 14 16:31:21 2011 -0800
   132.3 @@ -66,8 +66,8 @@
   132.4      # clean old classes
   132.5      rm -f ${TC}${FS}*.class 
   132.6  
   132.7 -    echo "$*"
   132.8 -    if $* 2>&1 ; then
   132.9 +    echo "$@"
  132.10 +    if "$@" 2>&1 ; then
  132.11        actual=ok
  132.12      else
  132.13        actual=err
   133.1 --- a/test/tools/javac/nio/compileTest/CompileTest.java	Thu Feb 10 16:24:51 2011 -0800
   133.2 +++ b/test/tools/javac/nio/compileTest/CompileTest.java	Mon Feb 14 16:31:21 2011 -0800
   133.3 @@ -84,8 +84,7 @@
   133.4          System.err.println("Test " + count + " " + Arrays.asList(opts) + " " + className);
   133.5          Path testSrcDir = Paths.get(System.getProperty("test.src"));
   133.6          Path testClassesDir = Paths.get(System.getProperty("test.classes"));
   133.7 -        Path classes = Paths.get("classes." + count);
   133.8 -        classes.createDirectory();
   133.9 +        Path classes = Files.createDirectory(Paths.get("classes." + count));
  133.10  
  133.11          Context ctx = new Context();
  133.12          PathFileManager fm = new JavacPathFileManager(ctx, true, null);
   134.1 --- a/test/tools/javac/processing/model/element/TestResourceVariable.java	Thu Feb 10 16:24:51 2011 -0800
   134.2 +++ b/test/tools/javac/processing/model/element/TestResourceVariable.java	Mon Feb 14 16:31:21 2011 -0800
   134.3 @@ -1,5 +1,5 @@
   134.4  /*
   134.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   134.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   134.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   134.8   *
   134.9   * This code is free software; you can redistribute it and/or modify it
  134.10 @@ -23,7 +23,7 @@
  134.11  
  134.12  /*
  134.13   * @test
  134.14 - * @bug  6911256 6964740 6967842
  134.15 + * @bug  6911256 6964740 6967842 6961571
  134.16   * @summary Test that the resource variable kind is appropriately set
  134.17   * @author  Joseph D. Darcy
  134.18   * @library ../../../lib
  134.19 @@ -31,8 +31,6 @@
  134.20   * @compile -processor TestResourceVariable -proc:only TestResourceVariable.java
  134.21   */
  134.22  
  134.23 -// Bug should be filed for this misbehavior
  134.24 -
  134.25  import java.io.*;
  134.26  import javax.annotation.processing.*;
  134.27  import javax.lang.model.*;
  134.28 @@ -82,6 +80,33 @@
  134.29          try(TestResourceVariable trv1 = this; TestResourceVariable trv2 = trv1) {}
  134.30      }
  134.31  
  134.32 +    /**
  134.33 +     * Verify that a resource variable modeled as an element behaves
  134.34 +     * as expected under 6 and 7 specific visitors.
  134.35 +     */
  134.36 +    private static void testResourceVariable(Element element) {
  134.37 +        ElementVisitor visitor6 = new ElementKindVisitor6<Void, Void>() {};
  134.38 +
  134.39 +        try {
  134.40 +            visitor6.visit(element);
  134.41 +            throw new RuntimeException("Expected UnknownElementException not thrown.");
  134.42 +        } catch (UnknownElementException uee) {
  134.43 +            ; // Expected.
  134.44 +        }
  134.45 +
  134.46 +        ElementKindVisitor7 visitor7 = new ElementKindVisitor7<Object, Void>() {
  134.47 +            @Override
  134.48 +            public Object visitVariableAsResourceVariable(VariableElement e,
  134.49 +                                                          Void p) {
  134.50 +                return e; // a non-null value
  134.51 +            }
  134.52 +        };
  134.53 +
  134.54 +        if (visitor7.visit(element) == null) {
  134.55 +            throw new RuntimeException("Null result of resource variable visitation.");
  134.56 +        }
  134.57 +    }
  134.58 +
  134.59      class ResourceVariableScanner extends TreeScanner<Void, CompilationUnitTree> {
  134.60         private Trees trees;
  134.61  
  134.62 @@ -92,17 +117,14 @@
  134.63         @Override
  134.64         public Void visitVariable(VariableTree node, CompilationUnitTree cu) {
  134.65             Element element = trees.getElement(trees.getPath(cu, node));
  134.66 -           if (element == null) {
  134.67 -               System.out.println("Null variable element: " + node);
  134.68 -           } else {
  134.69 -               System.out.println("Name: " + element.getSimpleName() +
  134.70 -                                  "\tKind: " + element.getKind());
  134.71 -           }
  134.72 -           if (element != null &&
  134.73 -               element.getKind() == ElementKind.RESOURCE_VARIABLE) {
  134.74 +
  134.75 +           System.out.println("Name: " + element.getSimpleName() +
  134.76 +                              "\tKind: " + element.getKind());
  134.77 +           if (element.getKind() == ElementKind.RESOURCE_VARIABLE) {
  134.78 +               testResourceVariable(element);
  134.79                 resourceVariableCount++;
  134.80             }
  134.81             return super.visitVariable(node, cu);
  134.82         }
  134.83 -   }
  134.84 +    }
  134.85  }
   135.1 --- a/test/tools/javac/scope/HashCollisionTest.java	Thu Feb 10 16:24:51 2011 -0800
   135.2 +++ b/test/tools/javac/scope/HashCollisionTest.java	Mon Feb 14 16:31:21 2011 -0800
   135.3 @@ -47,7 +47,6 @@
   135.4          JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab
   135.5          names = Names.instance(context);       // Name.Table impls tied to an instance of Names
   135.6          symtab = Symtab.instance(context);
   135.7 -        scopeCounter = ScopeCounter.instance(context);
   135.8  
   135.9          // determine hashMask for an empty scope
  135.10          Scope emptyScope = new Scope(symtab.unnamedPackage); // any owner will do
  135.11 @@ -171,7 +170,7 @@
  135.12       */
  135.13      ClassSymbol createClass(Name name, Symbol owner) {
  135.14          ClassSymbol sym = new ClassSymbol(0, name, owner);
  135.15 -        sym.members_field = new ClassScope(sym, scopeCounter);
  135.16 +        sym.members_field = new Scope(sym);
  135.17          if (owner != symtab.unnamedPackage)
  135.18              owner.members().enter(sym);
  135.19          return sym;
  135.20 @@ -247,5 +246,4 @@
  135.21  
  135.22      Names names;
  135.23      Symtab symtab;
  135.24 -    ScopeCounter scopeCounter;
  135.25  }
   136.1 --- a/test/tools/javac/scope/StarImportTest.java	Thu Feb 10 16:24:51 2011 -0800
   136.2 +++ b/test/tools/javac/scope/StarImportTest.java	Mon Feb 14 16:31:21 2011 -0800
   136.3 @@ -136,7 +136,6 @@
   136.4              JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab
   136.5              names = Names.instance(context);       // Name.Table impls tied to an instance of Names
   136.6              symtab = Symtab.instance(context);
   136.7 -            scopeCounter = ScopeCounter.instance(context);
   136.8              int setupCount = rgen.nextInt(MAX_SETUP_COUNT);
   136.9              for (int i = 0; i < setupCount; i++) {
  136.10                  switch (random(SetupKind.values())) {
  136.11 @@ -303,7 +302,7 @@
  136.12  
  136.13          ClassSymbol createClass(Name name, Symbol owner) {
  136.14              ClassSymbol sym = new ClassSymbol(0, name, owner);
  136.15 -            sym.members_field = new ClassScope(sym, scopeCounter);
  136.16 +            sym.members_field = new Scope(sym);
  136.17              if (owner != symtab.unnamedPackage)
  136.18                  owner.members().enter(sym);
  136.19              return sym;
  136.20 @@ -311,7 +310,6 @@
  136.21  
  136.22          Context context;
  136.23          Symtab symtab;
  136.24 -        ScopeCounter scopeCounter;
  136.25          Names names;
  136.26          int nextNameSerial;
  136.27          List<PackageSymbol> packages = new ArrayList<PackageSymbol>();
   137.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   137.2 +++ b/test/tools/javac/tree/T6963934.java	Mon Feb 14 16:31:21 2011 -0800
   137.3 @@ -0,0 +1,58 @@
   137.4 +/*
   137.5 + * Copyright (c) 2011 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     6963934
  137.30 + * @summary JCCompilationUnit.getImports does not report all imports
  137.31 + */
  137.32 +
  137.33 +import java.io.File;
  137.34 +import javax.tools.JavaCompiler;
  137.35 +import javax.tools.StandardJavaFileManager;
  137.36 +import javax.tools.ToolProvider;; // NOTE: extra semicolon for test
  137.37 +
  137.38 +import com.sun.source.tree.CompilationUnitTree;
  137.39 +import com.sun.source.tree.ImportTree;
  137.40 +import com.sun.source.util.JavacTask;
  137.41 +; // NOTE: extra semicolon for test
  137.42 +
  137.43 +public class T6963934 {
  137.44 +    public static void main(String[] args) throws Exception {
  137.45 +        File testSrc = new File(System.getProperty("test.src"));
  137.46 +        File thisSrc = new File(testSrc, T6963934.class.getSimpleName() + ".java");
  137.47 +        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
  137.48 +        StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
  137.49 +        JavacTask task = (JavacTask) compiler.getTask(null, fileManager, null, null, null,
  137.50 +                fileManager.getJavaFileObjects(thisSrc));
  137.51 +        CompilationUnitTree tree = task.parse().iterator().next();
  137.52 +        int count = 0;
  137.53 +        for (ImportTree importTree : tree.getImports()) {
  137.54 +            System.out.println(importTree);
  137.55 +            count++;
  137.56 +        }
  137.57 +        int expected = 7;
  137.58 +        if (count != expected)
  137.59 +            throw new Exception("unexpected number of imports found: " + count + ", expected: " + expected);
  137.60 +    }
  137.61 +}
   138.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   138.2 +++ b/test/tools/javac/varargs/6313164/T6313164.java	Mon Feb 14 16:31:21 2011 -0800
   138.3 @@ -0,0 +1,18 @@
   138.4 +/*
   138.5 + * @test /nodynamiccopyright/
   138.6 + * @bug     6313164
   138.7 + * @author mcimadamore
   138.8 + * @summary  javac generates code that fails byte code verification for the varargs feature
   138.9 + * @compile/fail/ref=T6313164.out -XDrawDiagnostics T6313164.java
  138.10 + */
  138.11 +import p1.*;
  138.12 +
  138.13 +class T6313164 {
  138.14 +    { B b = new B();
  138.15 +      b.foo1(new B(), new B()); //error - A not accesible
  138.16 +      b.foo2(new B(), new B()); //ok - A not accessible, but foo2(Object...) applicable
  138.17 +      b.foo3(null, null); //error - A (inferred) not accesible
  138.18 +      b.foo4(null, null); //error - A (inferred in 15.12.2.8 - no resolution backtrack) not accesible
  138.19 +      b.foo4(new B(), new C()); //ok - A (inferred in 15.12.2.7) not accessible, but foo4(Object...) applicable
  138.20 +    }
  138.21 +}
   139.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   139.2 +++ b/test/tools/javac/varargs/6313164/T6313164.out	Mon Feb 14 16:31:21 2011 -0800
   139.3 @@ -0,0 +1,6 @@
   139.4 +T6313164.java:12:8: compiler.err.cant.apply.symbol.1: kindname.method, foo1, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
   139.5 +T6313164.java:14:13: compiler.err.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
   139.6 +T6313164.java:15:13: compiler.err.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
   139.7 +- compiler.note.unchecked.filename: B.java
   139.8 +- compiler.note.unchecked.recompile
   139.9 +3 errors
   140.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   140.2 +++ b/test/tools/javac/varargs/6313164/p1/A.java	Mon Feb 14 16:31:21 2011 -0800
   140.3 @@ -0,0 +1,28 @@
   140.4 +/*
   140.5 + * Copyright (c) 2011, 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 +package p1;
  140.28 +
  140.29 +class A {
  140.30 +    A() { }
  140.31 +}
   141.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   141.2 +++ b/test/tools/javac/varargs/6313164/p1/B.java	Mon Feb 14 16:31:21 2011 -0800
   141.3 @@ -0,0 +1,35 @@
   141.4 +/*
   141.5 + * Copyright (c) 2011, 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 +package p1;
  141.28 +
  141.29 +public class B extends A {
  141.30 +    public B() {}
  141.31 +    public void foo1(A... args) { }
  141.32 +    public void foo2(A... args) { }
  141.33 +    public void foo2(Object... args) { }
  141.34 +    public <X extends A> void foo3(X... args) { }
  141.35 +    public <X extends A> void foo4(X... args) { }
  141.36 +    public void foo4(Object... args) { }
  141.37 +
  141.38 +}
   142.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   142.2 +++ b/test/tools/javac/varargs/6313164/p1/C.java	Mon Feb 14 16:31:21 2011 -0800
   142.3 @@ -0,0 +1,26 @@
   142.4 +/*
   142.5 + * Copyright (c) 2011, 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 +package p1;
  142.28 +
  142.29 +public class C extends A { }
   143.1 --- a/test/tools/javac/versions/check.sh	Thu Feb 10 16:24:51 2011 -0800
   143.2 +++ b/test/tools/javac/versions/check.sh	Mon Feb 14 16:31:21 2011 -0800
   143.3 @@ -32,7 +32,7 @@
   143.4  
   143.5  J="$TESTJAVA/bin/java" 
   143.6  JC="$TESTJAVA/bin/javac" 
   143.7 -CFV="$J ${TESTVMOPTS} -cp $TC CheckClassFileVersion"
   143.8 +CFV="${TESTVMOPTS} -cp $TC CheckClassFileVersion"
   143.9  
  143.10  rm -f $TC/X.java $TC/X.java
  143.11  echo 'public class X { }' > $TC/X.java
  143.12 @@ -44,7 +44,7 @@
  143.13  check() {
  143.14    V=$1; shift
  143.15    echo "+ javac $* [$V]"
  143.16 -  $JC ${TESTTOOLVMOPTS} -d $TC $* $TC/X.java && $CFV $TC/X.class $V || exit 2
  143.17 +  "$JC" ${TESTTOOLVMOPTS} -d $TC $* $TC/X.java && "$J" $CFV $TC/X.class $V || exit 2
  143.18  }
  143.19  
  143.20  check 48.0 -source 1.4
  143.21 @@ -73,7 +73,7 @@
  143.22  
  143.23  fail() {
  143.24    echo "+ javac $*"
  143.25 -  if $JC ${TESTTOOLVMOPTS} -d $TC $*; then
  143.26 +  if "$JC" ${TESTTOOLVMOPTS} -d $TC $*; then
  143.27      echo "-- did not fail as expected"
  143.28      exit 3
  143.29    else
  143.30 @@ -83,7 +83,7 @@
  143.31  
  143.32  pass() {
  143.33    echo "+ javac $*"
  143.34 -  if $JC ${TESTTOOLVMOPTS} -d $TC $*; then
  143.35 +  if "$JC" ${TESTTOOLVMOPTS} -d $TC $*; then
  143.36      echo "-- passed"
  143.37    else
  143.38      echo "-- failed"
   144.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   144.2 +++ b/test/tools/javac/warnings/6594914/DeprecatedClass.java	Mon Feb 14 16:31:21 2011 -0800
   144.3 @@ -0,0 +1,25 @@
   144.4 +/*
   144.5 + * Copyright (c) 2011, 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 +@Deprecated
  144.28 +class DeprecatedClass extends Exception {}
   145.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   145.2 +++ b/test/tools/javac/warnings/6594914/T6594914a.java	Mon Feb 14 16:31:21 2011 -0800
   145.3 @@ -0,0 +1,29 @@
   145.4 +/**
   145.5 + * @test /nodynamiccopyright/
   145.6 + * @bug 6594914
   145.7 + * @summary \\@SuppressWarnings("deprecation") does not not work for the type of a variable
   145.8 + * @compile/ref=T6594914a.out -XDrawDiagnostics -Xlint:deprecation T6594914a.java
   145.9 + */
  145.10 +
  145.11 +
  145.12 +class T6747671a {
  145.13 +
  145.14 +    DeprecatedClass a1; //warn
  145.15 +
  145.16 +    @SuppressWarnings("deprecation")
  145.17 +    DeprecatedClass a2;
  145.18 +
  145.19 +    <X extends DeprecatedClass> DeprecatedClass m1(DeprecatedClass a)
  145.20 +            throws DeprecatedClass { return null; } //warn
  145.21 +
  145.22 +    @SuppressWarnings("deprecation")
  145.23 +    <X extends DeprecatedClass> DeprecatedClass m2(DeprecatedClass a)
  145.24 +            throws DeprecatedClass { return null; }
  145.25 +
  145.26 +    void test() {
  145.27 +        DeprecatedClass a1; //warn
  145.28 +
  145.29 +        @SuppressWarnings("deprecation")
  145.30 +        DeprecatedClass a2;
  145.31 +    }
  145.32 +}
   146.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   146.2 +++ b/test/tools/javac/warnings/6594914/T6594914a.out	Mon Feb 14 16:31:21 2011 -0800
   146.3 @@ -0,0 +1,7 @@
   146.4 +T6594914a.java:11:5: compiler.warn.has.been.deprecated: DeprecatedClass, compiler.misc.unnamed.package
   146.5 +T6594914a.java:16:16: compiler.warn.has.been.deprecated: DeprecatedClass, compiler.misc.unnamed.package
   146.6 +T6594914a.java:16:52: compiler.warn.has.been.deprecated: DeprecatedClass, compiler.misc.unnamed.package
   146.7 +T6594914a.java:16:33: compiler.warn.has.been.deprecated: DeprecatedClass, compiler.misc.unnamed.package
   146.8 +T6594914a.java:17:20: compiler.warn.has.been.deprecated: DeprecatedClass, compiler.misc.unnamed.package
   146.9 +T6594914a.java:24:9: compiler.warn.has.been.deprecated: DeprecatedClass, compiler.misc.unnamed.package
  146.10 +6 warnings
   147.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   147.2 +++ b/test/tools/javac/warnings/6594914/T6594914b.java	Mon Feb 14 16:31:21 2011 -0800
   147.3 @@ -0,0 +1,29 @@
   147.4 +/**
   147.5 + * @test /nodynamiccopyright/
   147.6 + * @bug 6594914
   147.7 + * @summary \\@SuppressWarnings("deprecation") does not not work for the type of a variable
   147.8 + * @compile/ref=T6594914b.out -XDenableSunApiLintControl -XDrawDiagnostics -Xlint:sunapi T6594914b.java
   147.9 + */
  147.10 +
  147.11 +
  147.12 +class T6747671b {
  147.13 +
  147.14 +    sun.misc.Lock a1; //warn
  147.15 +
  147.16 +    @SuppressWarnings("sunapi")
  147.17 +    sun.misc.Lock a2;
  147.18 +
  147.19 +    <X extends sun.misc.Lock> sun.misc.Lock m1(sun.misc.Lock a)
  147.20 +            throws sun.misc.CEFormatException { return null; } //warn
  147.21 +
  147.22 +    @SuppressWarnings("sunapi")
  147.23 +    <X extends sun.misc.Lock> sun.misc.Lock m2(sun.misc.Lock a)
  147.24 +            throws sun.misc.CEFormatException { return null; }
  147.25 +
  147.26 +    void test() {
  147.27 +        sun.misc.Lock a1; //warn
  147.28 +
  147.29 +        @SuppressWarnings("sunapi")
  147.30 +        sun.misc.Lock a2;
  147.31 +    }
  147.32 +}
   148.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   148.2 +++ b/test/tools/javac/warnings/6594914/T6594914b.out	Mon Feb 14 16:31:21 2011 -0800
   148.3 @@ -0,0 +1,7 @@
   148.4 +T6594914b.java:11:13: compiler.warn.sun.proprietary: sun.misc.Lock
   148.5 +T6594914b.java:16:24: compiler.warn.sun.proprietary: sun.misc.Lock
   148.6 +T6594914b.java:16:56: compiler.warn.sun.proprietary: sun.misc.Lock
   148.7 +T6594914b.java:16:39: compiler.warn.sun.proprietary: sun.misc.Lock
   148.8 +T6594914b.java:17:28: compiler.warn.sun.proprietary: sun.misc.CEFormatException
   148.9 +T6594914b.java:24:17: compiler.warn.sun.proprietary: sun.misc.Lock
  148.10 +6 warnings

mercurial