src/share/classes/com/sun/tools/javac/code/Scope.java

changeset 1945
f7f271bd74a2
parent 1886
79c3146e417b
child 2525
2eb010b6cb22
child 2812
9ec429ab0e7e
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Scope.java	Sat Aug 10 16:29:26 2013 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Scope.java	Mon Aug 12 17:25:07 2013 +0100
     1.3 @@ -199,7 +199,7 @@
     1.4      }
     1.5  
     1.6      public void enter(Symbol sym, Scope s) {
     1.7 -        enter(sym, s, s);
     1.8 +        enter(sym, s, s, false);
     1.9      }
    1.10  
    1.11      /**
    1.12 @@ -207,7 +207,7 @@
    1.13       * given scope `s' accessed through `origin'.  The last two
    1.14       * arguments are only used in import scopes.
    1.15       */
    1.16 -    public void enter(Symbol sym, Scope s, Scope origin) {
    1.17 +    public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) {
    1.18          Assert.check(shared == 0);
    1.19          if (nelems * 3 >= hashMask * 2)
    1.20              dble();
    1.21 @@ -217,7 +217,7 @@
    1.22              old = sentinel;
    1.23              nelems++;
    1.24          }
    1.25 -        Entry e = makeEntry(sym, old, elems, s, origin);
    1.26 +        Entry e = makeEntry(sym, old, elems, s, origin, staticallyImported);
    1.27          table[hash] = e;
    1.28          elems = e;
    1.29  
    1.30 @@ -227,7 +227,7 @@
    1.31          }
    1.32      }
    1.33  
    1.34 -    Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) {
    1.35 +    Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin, boolean staticallyImported) {
    1.36          return new Entry(sym, shadowed, sibling, scope);
    1.37      }
    1.38  
    1.39 @@ -499,6 +499,10 @@
    1.40              else return shadowed.next(sf);
    1.41          }
    1.42  
    1.43 +        public boolean isStaticallyImported() {
    1.44 +            return false;
    1.45 +        }
    1.46 +
    1.47          public Scope getOrigin() {
    1.48              // The origin is only recorded for import scopes.  For all
    1.49              // other scope entries, the "enclosing" type is available
    1.50 @@ -517,20 +521,19 @@
    1.51          }
    1.52  
    1.53          @Override
    1.54 -        Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) {
    1.55 -            return new ImportEntry(sym, shadowed, sibling, scope, origin);
    1.56 -        }
    1.57 +        Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope,
    1.58 +                final Scope origin, final boolean staticallyImported) {
    1.59 +            return new Entry(sym, shadowed, sibling, scope) {
    1.60 +                @Override
    1.61 +                public Scope getOrigin() {
    1.62 +                    return origin;
    1.63 +                }
    1.64  
    1.65 -        static class ImportEntry extends Entry {
    1.66 -            private Scope origin;
    1.67 -
    1.68 -            ImportEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) {
    1.69 -                super(sym, shadowed, sibling, scope);
    1.70 -                this.origin = origin;
    1.71 -            }
    1.72 -
    1.73 -            @Override
    1.74 -            public Scope getOrigin() { return origin; }
    1.75 +                @Override
    1.76 +                public boolean isStaticallyImported() {
    1.77 +                    return staticallyImported;
    1.78 +                }
    1.79 +            };
    1.80          }
    1.81      }
    1.82  
    1.83 @@ -724,7 +727,7 @@
    1.84          }
    1.85  
    1.86          @Override
    1.87 -        public void enter(Symbol sym, Scope s, Scope origin) {
    1.88 +        public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) {
    1.89              throw new UnsupportedOperationException();
    1.90          }
    1.91  

mercurial