langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
changeset 29149 3fa94aad0264
parent 29051 7244db2ab176
child 29293 1583c6dd6df7
equal deleted inserted replaced
29148:57ca99b88ddb 29149:3fa94aad0264
  3526             if (checkTypeContainsImportableElement(t.tsym, origin, packge, name, processed))
  3526             if (checkTypeContainsImportableElement(t.tsym, origin, packge, name, processed))
  3527                 return true;
  3527                 return true;
  3528 
  3528 
  3529         for (Symbol sym : tsym.members().getSymbolsByName(name)) {
  3529         for (Symbol sym : tsym.members().getSymbolsByName(name)) {
  3530             if (sym.isStatic() &&
  3530             if (sym.isStatic() &&
  3531                 staticImportAccessible(sym, packge) &&
  3531                 importAccessible(sym, packge) &&
  3532                 sym.isMemberOf(origin, types)) {
  3532                 sym.isMemberOf(origin, types)) {
  3533                 return true;
  3533                 return true;
  3534             }
  3534             }
  3535         }
  3535         }
  3536 
  3536 
  3537         return false;
  3537         return false;
  3538     }
  3538     }
  3539 
  3539 
  3540     // is the sym accessible everywhere in packge?
  3540     // is the sym accessible everywhere in packge?
  3541     public boolean staticImportAccessible(Symbol sym, PackageSymbol packge) {
  3541     public boolean importAccessible(Symbol sym, PackageSymbol packge) {
  3542         int flags = (int)(sym.flags() & AccessFlags);
  3542         try {
  3543         switch (flags) {
  3543             int flags = (int)(sym.flags() & AccessFlags);
  3544         default:
  3544             switch (flags) {
  3545         case PUBLIC:
  3545             default:
  3546             return true;
  3546             case PUBLIC:
  3547         case PRIVATE:
  3547                 return true;
       
  3548             case PRIVATE:
       
  3549                 return false;
       
  3550             case 0:
       
  3551             case PROTECTED:
       
  3552                 return sym.packge() == packge;
       
  3553             }
       
  3554         } catch (ClassFinder.BadClassFile err) {
       
  3555             throw err;
       
  3556         } catch (CompletionFailure ex) {
  3548             return false;
  3557             return false;
  3549         case 0:
       
  3550         case PROTECTED:
       
  3551             return sym.packge() == packge;
       
  3552         }
  3558         }
  3553     }
  3559     }
  3554 
  3560 
  3555 }
  3561 }