changeset 1573:d27b39c92849

Merge
author asaha
date Wed, 03 Jul 2013 17:45:42 -0700
parents b8ef7bb9c7b2 (current diff) 7a45e1dd8665 (diff)
children 61d5b73ae0ac
files .hgtags
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Jul 02 15:17:32 2013 -0700
+++ b/.hgtags	Wed Jul 03 17:45:42 2013 -0700
@@ -341,4 +341,5 @@
 bfe3575143fddbf71c2e570b580afef007d171e4 jdk7u40-b29
 0586afeb2caa0b4595bf5b306657a5dd1f0d121c jdk7u40-b30
 9c343668b0a95e5510f715014884e5d45df9dfb0 jdk7u40-b31
+056f998e75f87a299808671ecc0d96e270f62dca jdk7u40-b32
 9bbfba4981e1db5016bbfbc23025763966021c26 jdk7u45-b01
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Jul 02 15:17:32 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jul 03 17:45:42 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,7 @@
 import java.util.Set;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 
 /** Helper class for name resolution, used mostly by the attribution phase.
  *
@@ -306,11 +307,11 @@
         }
 
     /** Try to instantiate the type of a method so that it fits
-     *  given type arguments and argument types. If succesful, return
+     *  given type arguments and argument types. If successful, return
      *  the method's instantiated type, else return null.
      *  The instantiation will take into account an additional leading
      *  formal parameter if the method is an instance method seen as a member
-     *  of un underdetermined site In this case, we treat site as an additional
+     *  of an undetermined site In this case, we treat site as an additional
      *  parameter and the parameters of the class containing the method as
      *  additional type variables that get instantiated.
      *
@@ -2121,7 +2122,7 @@
      */
     class InapplicableSymbolsError extends ResolveError {
 
-        private List<Candidate> candidates = List.nil();
+        private Set<Candidate> candidates = new LinkedHashSet<Candidate>();
 
         InapplicableSymbolsError(Symbol sym) {
             super(WRONG_MTHS, "inapplicable symbols");
@@ -2135,7 +2136,7 @@
                 Name name,
                 List<Type> argtypes,
                 List<Type> typeargtypes) {
-            if (candidates.nonEmpty()) {
+            if (!candidates.isEmpty()) {
                 JCDiagnostic err = diags.create(dkind,
                         log.currentSource(),
                         pos,
@@ -2153,24 +2154,26 @@
         //where
         List<JCDiagnostic> candidateDetails(Type site) {
             List<JCDiagnostic> details = List.nil();
-            for (Candidate c : candidates)
+            for (Candidate c : candidates) {
                 details = details.prepend(c.getDiagnostic(site));
+            }
             return details.reverse();
         }
 
         Symbol addCandidate(MethodResolutionPhase currentStep, Symbol sym, JCDiagnostic details) {
             Candidate c = new Candidate(currentStep, sym, details);
-            if (c.isValid() && !candidates.contains(c))
-                candidates = candidates.append(c);
+            if (c.isValid() && !candidates.contains(c)) {
+                candidates.add(c);
+            }
             return this;
         }
 
         void clear() {
-            candidates = List.nil();
+            candidates.clear();
         }
 
         private Name getName() {
-            Symbol sym = candidates.head.sym;
+            Symbol sym = candidates.iterator().next().sym;
             return sym.name == names.init ?
                 sym.owner.name :
                 sym.name;