From bdc014d1a10803b61b0d859a479404dad25a2b6c Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 10 Mar 2015 13:26:34 +0100 Subject: [PATCH] Calls to @VisibleForTesting annotated methods from an inner class were reported as forbidden accesses. This access type should always be allowed. --- .../worksap/oss/findbugs/guava/UnexpectedAccessDetector.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetector.java b/src/main/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetector.java index bfbf3f0..4d60c09 100644 --- a/src/main/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetector.java +++ b/src/main/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetector.java @@ -71,8 +71,8 @@ public void sawOpcode(final int opcode) { * @return true, if the member is called within the same package */ private boolean hasToCheck(final @Nonnull ClassMember member, final @Nonnull ClassDescriptor currentClass) { - if (currentClass.equals(member.getClassDescriptor())) { - log.debug("No check: " + member.getName() + " is called within the same class: " + currentClass.getClassName()); + if (currentClass.getClassName().startsWith(member.getClassDescriptor().getClassName())) { + log.debug("No check: " + member.getName() + " is called within the same class or inner class: " + currentClass.getClassName()); // no need to check, because method is called by owner return false; } else if (!member.getPackageName().equals(currentClass.getPackageName())) {