From 358136a97feff6fd0586fe04a39adbc7ced381c1 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Fri, 12 Nov 2021 14:19:18 +0100 Subject: Consider location of expression when determining field accessibility A protected field is not accessible unless we are referencing it from within a class which extends its owner. Therefore, we may use a synthetic property with the same name as long as we do not have access to the field. --- src/testB/java/b/pkg/B.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/testB/java/b') diff --git a/src/testB/java/b/pkg/B.java b/src/testB/java/b/pkg/B.java index 150ab0b..67d2ea8 100644 --- a/src/testB/java/b/pkg/B.java +++ b/src/testB/java/b/pkg/B.java @@ -67,6 +67,11 @@ public class B extends BParent implements BInterface { return conflictingField; } + protected int protectedField; + public int getProtectedFieldWithoutConflict() { + return protectedField; + } + public void bOverloaded() { } -- cgit