993 enterSynthetic(tree.pos(), accessor, accOwner.members());
994 accessors[acode] = accessor;
995 }
996 return accessor;
997 }
998
999 /** The qualifier to be used for accessing a symbol in an outer class.
1000 * This is either C.sym or C.this.sym, depending on whether or not
1001 * sym is static.
1002 * @param sym The accessed symbol.
1003 */
1004 JCExpression accessBase(DiagnosticPosition pos, Symbol sym) {
1005 return (sym.flags() & STATIC) != 0
1006 ? access(make.at(pos.getStartPosition()).QualIdent(sym.owner))
1007 : makeOwnerThis(pos, sym, true);
1008 }
1009
1010 /** Do we need an access method to reference private symbol?
1011 */
1012 boolean needsPrivateAccess(Symbol sym) {
1013 if (disableAccessors || disablePrivateAccessors) return false;
1014 if ((sym.flags() & PRIVATE) == 0 || sym.owner == currentClass) {
1015 return false;
1016 } else if (sym.name == names.init && sym.owner.isLocal()) {
1017 // private constructor in local class: relax protection
1018 sym.flags_field &= ~PRIVATE;
1019 return false;
1020 } else {
1021 return true;
1022 }
1023 }
1024
1025 /** Do we need an access method to reference symbol in other package?
1026 */
1027 boolean needsProtectedAccess(Symbol sym, JCTree tree) {
1028 if (disableAccessors) return false;
1029 if ((sym.flags() & PROTECTED) == 0 ||
1030 sym.owner.owner == currentClass.owner || // fast special case
1031 sym.packge() == currentClass.packge())
1032 return false;
1033 if (!currentClass.isSubClass(sym.owner, types))
|
993 enterSynthetic(tree.pos(), accessor, accOwner.members());
994 accessors[acode] = accessor;
995 }
996 return accessor;
997 }
998
999 /** The qualifier to be used for accessing a symbol in an outer class.
1000 * This is either C.sym or C.this.sym, depending on whether or not
1001 * sym is static.
1002 * @param sym The accessed symbol.
1003 */
1004 JCExpression accessBase(DiagnosticPosition pos, Symbol sym) {
1005 return (sym.flags() & STATIC) != 0
1006 ? access(make.at(pos.getStartPosition()).QualIdent(sym.owner))
1007 : makeOwnerThis(pos, sym, true);
1008 }
1009
1010 /** Do we need an access method to reference private symbol?
1011 */
1012 boolean needsPrivateAccess(Symbol sym) {
1013 if (disableAccessors || disablePrivateAccessors ||
1014 target.hasNestmateAccess()) {
1015 return false;
1016 }
1017 if ((sym.flags() & PRIVATE) == 0 || sym.owner == currentClass) {
1018 return false;
1019 } else if (sym.name == names.init && sym.owner.isLocal()) {
1020 // private constructor in local class: relax protection
1021 sym.flags_field &= ~PRIVATE;
1022 return false;
1023 } else {
1024 return true;
1025 }
1026 }
1027
1028 /** Do we need an access method to reference symbol in other package?
1029 */
1030 boolean needsProtectedAccess(Symbol sym, JCTree tree) {
1031 if (disableAccessors) return false;
1032 if ((sym.flags() & PROTECTED) == 0 ||
1033 sym.owner.owner == currentClass.owner || // fast special case
1034 sym.packge() == currentClass.packge())
1035 return false;
1036 if (!currentClass.isSubClass(sym.owner, types))
|