langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
changeset 30999 f1bb0191a5a7
parent 29149 3fa94aad0264
child 31506 4e07f827a794
equal deleted inserted replaced
30998:9e8f3b991f97 30999:f1bb0191a5a7
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   405             for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) {
   405             for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) {
   406                 l.head.symbolAdded(sym, this);
   406                 l.head.symbolAdded(sym, this);
   407             }
   407             }
   408         }
   408         }
   409 
   409 
   410         /** Remove symbol from this scope.  Used when an inner class
   410         /** Remove symbol from this scope.
   411          *  attribute tells us that the class isn't a package member.
       
   412          */
   411          */
   413         public void remove(Symbol sym) {
   412         public void remove(Symbol sym) {
   414             Assert.check(shared == 0);
   413             Assert.check(shared == 0);
   415             Entry e = lookup(sym.name);
   414             Entry e = lookup(sym.name, candidate -> candidate == sym);
   416             if (e.scope == null) return;
   415             if (e.scope == null) return;
   417 
   416 
   418             // remove e from table and shadowed list;
   417             // remove e from table and shadowed list;
   419             int i = getIndex(sym.name);
   418             int i = getIndex(sym.name);
   420             Entry te = table[i];
   419             Entry te = table[i];