Skip to content

Commit 1b4760f

Browse files
committed
GROOVY-9905
1 parent 3d3fa51 commit 1b4760f

File tree

5 files changed

+780
-3
lines changed

5 files changed

+780
-3
lines changed

base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/InnerClassTests.java

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2020 the original author or authors.
2+
* Copyright 2009-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -2022,4 +2022,31 @@ public void testAccessOuterClassMemberFromInnerClassMethod4() {
20222022

20232023
runConformTest(sources, "value");
20242024
}
2025+
2026+
@Test // // https://issues.apache.org/jira/browse/GROOVY-9905
2027+
public void testAccessOuterClassMemberFromInnerClassMethod5() {
2028+
//@formatter:off
2029+
String[] sources = {
2030+
"Script.groovy",
2031+
"abstract class A {\n" +
2032+
" protected final f = 'x'\n" +
2033+
" abstract static class B {}\n" +
2034+
"}\n" +
2035+
"class C extends A {\n" +
2036+
" private class D extends A.B {\n" + // B is static inner
2037+
" String toString() {\n" +
2038+
" println(f)\n" + // No such property: f for class: A
2039+
" return 'y'\n" +
2040+
" }\n" +
2041+
" }\n" +
2042+
" def m() {\n" +
2043+
" new D().toString()\n" +
2044+
" }\n" +
2045+
"}\n" +
2046+
"new C().m()\n",
2047+
};
2048+
//@formatter:on
2049+
2050+
runConformTest(sources, "x");
2051+
}
20252052
}

base/org.codehaus.groovy30/.checkstyle

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<file-match-pattern match-pattern="groovy/classgen/AsmClassGenerator.java" include-pattern="false" />
4343
<file-match-pattern match-pattern="groovy/classgen/EnumVisitor.java" include-pattern="false" />
4444
<file-match-pattern match-pattern="groovy/classgen/ExtendedVerifier.java" include-pattern="false" />
45-
<file-match-pattern match-pattern="groovy/classgen/InnerClassVisitorHelper.java" include-pattern="false" />
45+
<file-match-pattern match-pattern="groovy/classgen/InnerClass(CompletionVisitor|VisitorHelper).java" include-pattern="false" />
4646
<file-match-pattern match-pattern="groovy/classgen/ReturnAdder.java" include-pattern="false" />
4747
<file-match-pattern match-pattern="groovy/classgen/Verifier.java" include-pattern="false" />
4848
<file-match-pattern match-pattern="groovy/classgen/asm/CallSiteWriter.java" include-pattern="false" />

0 commit comments

Comments
 (0)