< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
Print this page
rev 50604 : imported patch jep181-rev1
@@ -92,10 +92,11 @@
private final Name dollarAssertionsDisabled;
private final Name classDollar;
private final Name dollarCloseResource;
private final Types types;
private final boolean debugLower;
+ private final boolean disableProtectedAccessors; // experimental
private final PkgInfo pkginfoOpt;
protected Lower(Context context) {
context.put(lowerKey, this);
names = Names.instance(context);
@@ -120,10 +121,11 @@
types = Types.instance(context);
Options options = Options.instance(context);
debugLower = options.isSet("debuglower");
pkginfoOpt = PkgInfo.get(options);
+ disableProtectedAccessors = options.isSet("disableProtectedAccessors");
}
/** The currently enclosing class.
*/
ClassSymbol currentClass;
@@ -1029,10 +1031,13 @@
}
/** Do we need an access method to reference private symbol?
*/
boolean needsPrivateAccess(Symbol sym) {
+ if (target.hasNestmateAccess()) {
+ return false;
+ }
if ((sym.flags() & PRIVATE) == 0 || sym.owner == currentClass) {
return false;
} else if (sym.name == names.init && sym.owner.isLocal()) {
// private constructor in local class: relax protection
sym.flags_field &= ~PRIVATE;
@@ -1043,10 +1048,11 @@
}
/** Do we need an access method to reference symbol in other package?
*/
boolean needsProtectedAccess(Symbol sym, JCTree tree) {
+ if (disableProtectedAccessors) return false;
if ((sym.flags() & PROTECTED) == 0 ||
sym.owner.owner == currentClass.owner || // fast special case
sym.packge() == currentClass.packge())
return false;
if (!currentClass.isSubClass(sym.owner, types))
< prev index next >