Skip to content

Commit 6b4f5d2

Browse files
committed
GROOVY-8715
1 parent 774c722 commit 6b4f5d2

File tree

2 files changed

+29
-7
lines changed
  • base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/internal/compiler/ast
  • base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic

2 files changed

+29
-7
lines changed

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

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2021 the original author or authors.
2+
* Copyright 2009-2022 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.
@@ -300,8 +300,28 @@ public void testInnerClass5() {
300300
runConformTest(sources);
301301
}
302302

303-
@Test // https://github.com/groovy/groovy-eclipse/issues/708
303+
@Test // GROOVY-8715
304304
public void testInnerClass6() {
305+
//@formatter:off
306+
String[] sources = {
307+
"p/Script.groovy",
308+
"package p\n" +
309+
"Outer.Inner[] array\n",
310+
311+
"p/Outer.groovy",
312+
"package p\n" +
313+
"class Outer {\n" +
314+
" static class Inner {\n" +
315+
" }\n" +
316+
"}\n",
317+
};
318+
//@formatter:on
319+
320+
runConformTest(sources);
321+
}
322+
323+
@Test // https://github.com/groovy/groovy-eclipse/issues/708, GROOVY-10455
324+
public void testInnerClass7() {
305325
//@formatter:off
306326
String[] sources = {
307327
"Script.groovy",
@@ -328,7 +348,7 @@ public void testInnerClass6() {
328348
}
329349

330350
@Test
331-
public void testInnerClass7() {
351+
public void testInnerClass8() {
332352
//@formatter:off
333353
String[] sources = {
334354
"Script.groovy",
@@ -350,7 +370,7 @@ public void testInnerClass7() {
350370
}
351371

352372
@Test // GROOVY-8947
353-
public void testInnerClass8() {
373+
public void testInnerClass9() {
354374
assumeTrue(isParrotParser());
355375

356376
//@formatter:off
@@ -374,7 +394,7 @@ public void testInnerClass8() {
374394
}
375395

376396
@Test
377-
public void testInnerClass9() {
397+
public void testInnerClass10() {
378398
//@formatter:off
379399
String[] sources = {
380400
"Script.groovy",
@@ -397,7 +417,7 @@ public void testInnerClass9() {
397417
}
398418

399419
@Test // GROOVY-10289
400-
public void testInnerClass10() {
420+
public void testInnerClass11() {
401421
//@formatter:off
402422
String[] sources = {
403423
"Script.groovy",

base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/internal/compiler/ast/JDTResolver.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2021 the original author or authors.
2+
* Copyright 2009-2022 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.
@@ -457,6 +457,8 @@ protected boolean resolveToOuter(ClassNode type) {
457457
protected boolean resolveToInner(ClassNode type) {
458458
ModuleNode module = currentClass.getModule();
459459
if (module != null) {
460+
while (type.isArray()) type = type.getComponentType(); //GROOVY-8715
461+
460462
String name = type.getName();
461463
int i = name.lastIndexOf('.');
462464
if (i > 0 && module.hasPackageName()) {

0 commit comments

Comments
 (0)