diff -r 90c4a1a64217 -r ade773eb432d langtools/src/share/classes/com/sun/tools/javac/code/Types.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Thu Sep 16 09:57:37 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Sat Sep 18 09:54:51 2010 -0700 @@ -69,6 +69,7 @@ new Context.Key(); final Symtab syms; + final Scope.ScopeCounter scopeCounter; final JavacMessages messages; final Names names; final boolean allowBoxing; @@ -89,6 +90,7 @@ protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); + scopeCounter = Scope.ScopeCounter.instance(context); names = Names.instance(context); allowBoxing = Source.instance(context).allowBoxing(); reader = ClassReader.instance(context); @@ -1984,22 +1986,26 @@ final MethodSymbol cachedImpl; final Filter implFilter; final boolean checkResult; + final Scope.ScopeCounter scopeCounter; public Entry(MethodSymbol cachedImpl, Filter scopeFilter, - boolean checkResult) { + boolean checkResult, + Scope.ScopeCounter scopeCounter) { this.cachedImpl = cachedImpl; this.implFilter = scopeFilter; this.checkResult = checkResult; + this.scopeCounter = scopeCounter; } - boolean matches(Filter scopeFilter, boolean checkResult) { + boolean matches(Filter scopeFilter, boolean checkResult, Scope.ScopeCounter scopeCounter) { return this.implFilter == scopeFilter && - this.checkResult == checkResult; + this.checkResult == checkResult && + this.scopeCounter.val() >= scopeCounter.val(); } } - MethodSymbol get(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter implFilter) { + MethodSymbol get(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter implFilter, Scope.ScopeCounter scopeCounter) { SoftReference> ref_cache = _map.get(ms); Map cache = ref_cache != null ? ref_cache.get() : null; if (cache == null) { @@ -2008,9 +2014,9 @@ } Entry e = cache.get(origin); if (e == null || - !e.matches(implFilter, checkResult)) { + !e.matches(implFilter, checkResult, scopeCounter)) { MethodSymbol impl = implementationInternal(ms, origin, Types.this, checkResult, implFilter); - cache.put(origin, new Entry(impl, implFilter, checkResult)); + cache.put(origin, new Entry(impl, implFilter, checkResult, scopeCounter)); return impl; } else { @@ -2038,7 +2044,7 @@ private ImplementationCache implCache = new ImplementationCache(); public MethodSymbol implementation(MethodSymbol ms, TypeSymbol origin, Types types, boolean checkResult, Filter implFilter) { - return implCache.get(ms, origin, checkResult, implFilter); + return implCache.get(ms, origin, checkResult, implFilter, scopeCounter); } //