Skip to content

Commit

Permalink
GROOVY-8859
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Sep 16, 2023
1 parent 653f746 commit 240d2d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ public void testPrivateMethod1() {
assertExprType(source, "check", "java.lang.Boolean");
}

@Test
@Test // https://issues.apache.org/jira/browse/GROOVY-8859
public void testPrivateMethod2() {
//@formatter:off
String contents =
Expand All @@ -943,8 +943,8 @@ public void testPrivateMethod2() {
"}";
//@formatter:on

assertDeclType(contents, "method", "B");
assertExprType(contents, "method", "java.lang.Void");
int offset = contents.lastIndexOf("method");
assertUnknownConfidence(contents, offset, offset + 6);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ protected MethodNode findMethodDeclaration(final String name, final ClassNode de
for (ClassNode type : types) {
MethodNode innerCandidate = null;
List<MethodNode> candidates = getMethods(name, type);
candidates.removeIf(m -> m.isPrivate() && !m.getDeclaringClass().equals(declaringType)); // GROOVY-8859
if (!candidates.isEmpty()) {
innerCandidate = findMethodDeclaration0(candidates, argumentTypes, isStaticExpression);
if (innerCandidate != null) {
Expand Down Expand Up @@ -1179,7 +1180,7 @@ protected static boolean isCompatible(final AnnotatedNode declaration, final boo
}

protected static boolean isNotThisOrOuterClass(final ClassNode thisType, final ClassNode declaringClass) {
return (!thisType.equals(declaringClass) && !thisType.getOuterClasses().contains(declaringClass) && !(implementsTrait(thisType) && thisType.implementsInterface(declaringClass)));
return !thisType.equals(declaringClass) && !thisType.getOuterClasses().contains(declaringClass) && !(implementsTrait(thisType) && thisType.implementsInterface(declaringClass));
}

/**
Expand Down

0 comments on commit 240d2d3

Please sign in to comment.