@@ -260,7 +260,7 @@ object RefChecks {
260
260
def overrideAccessError () = {
261
261
ctx.log(i " member: ${member.showLocated} ${member.flagsString}" ) // DEBUG
262
262
ctx.log(i " other: ${other.showLocated} ${other.flagsString}" ) // DEBUG
263
- val otherAccess = (other.flags & AccessFlags ).toString
263
+ val otherAccess = (other.flags & AccessFlags ).flagsString
264
264
overrideError(" has weaker access privileges; it should be " +
265
265
(if (otherAccess == " " ) " public" else " at least " + otherAccess))
266
266
}
@@ -325,13 +325,14 @@ object RefChecks {
325
325
// todo: align accessibility implication checking with isAccessible in Contexts
326
326
val ob = other.accessBoundary(member.owner)
327
327
val mb = member.accessBoundary(member.owner)
328
- def isOverrideAccessOK = (
329
- (member.flags & AccessFlags ).isEmpty // member is public
330
- || // - or -
331
- (! other.is(Protected ) || member.is(Protected )) && // if o is protected, so is m, and
332
- (ob.isContainedIn(mb) || other.isAllOf(JavaProtected )) // m relaxes o's access boundary,
333
- // or o is Java defined and protected (see #3946)
334
- )
328
+ def isOverrideAccessOK =
329
+ (member.flags & AccessFlags ).isEmpty
330
+ && ! member.privateWithin.exists // member is public, or
331
+ || (! other.is(Protected ) || member.is(Protected ))
332
+ // if o is protected, so is m, and
333
+ && (ob.isContainedIn(mb) || other.isAllOf(JavaProtected ))
334
+ // m relaxes o's access boundary,
335
+ // or o is Java defined and protected (see #3946)
335
336
if (! isOverrideAccessOK)
336
337
overrideAccessError()
337
338
else if (other.isClass)
0 commit comments