Skip to content

Commit

Permalink
GROOVY-11356
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Apr 9, 2024
1 parent 2927b89 commit edb36c0
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ public void testSuperFieldReference1() {
}

@Test
public void testSuperFieldReference1a() {
public void testSuperFieldReference2() {
String contents =
"class A {\n" +
" public Number field\n" +
Expand All @@ -1156,7 +1156,7 @@ public void testSuperFieldReference1a() {
}

@Test
public void testSuperFieldReference1b() {
public void testSuperFieldReference3() {
String contents =
"class A {\n" +
" public Number field\n" +
Expand All @@ -1170,7 +1170,7 @@ public void testSuperFieldReference1b() {
}

@Test
public void testSuperFieldReference1c() {
public void testSuperFieldReference4() {
String contents =
"class A {\n" +
" public Number field\n" +
Expand All @@ -1184,7 +1184,7 @@ public void testSuperFieldReference1c() {
}

@Test
public void testSuperFieldReference1d() {
public void testSuperFieldReference5() {
String contents =
"class A {\n" +
" public Number field\n" +
Expand All @@ -1198,7 +1198,7 @@ public void testSuperFieldReference1d() {
}

@Test
public void testSuperFieldReference2() {
public void testSuperFieldReference6() {
String contents =
"class A {\n" +
" protected Number field\n" +
Expand All @@ -1212,7 +1212,7 @@ public void testSuperFieldReference2() {
}

@Test
public void testSuperFieldReference2a() {
public void testSuperFieldReference7() {
String contents =
"class A {\n" +
" protected Number field\n" +
Expand All @@ -1226,7 +1226,7 @@ public void testSuperFieldReference2a() {
}

@Test
public void testSuperFieldReference2b() {
public void testSuperFieldReference8() {
String contents =
"class A {\n" +
" protected Number field\n" +
Expand All @@ -1240,7 +1240,7 @@ public void testSuperFieldReference2b() {
}

@Test
public void testSuperFieldReference2c() {
public void testSuperFieldReference9() {
String contents =
"class A {\n" +
" protected Number field\n" +
Expand All @@ -1254,7 +1254,7 @@ public void testSuperFieldReference2c() {
}

@Test
public void testSuperFieldReference2d() {
public void testSuperFieldReference10() {
String contents =
"class A {\n" +
" protected Number field\n" +
Expand All @@ -1268,7 +1268,7 @@ public void testSuperFieldReference2d() {
}

@Test // https://github.com/groovy/groovy-eclipse/issues/815
public void testSuperFieldReference3() {
public void testSuperFieldReference11() {
String contents =
"class A {\n" +
" private String field\n" +
Expand All @@ -1282,7 +1282,7 @@ public void testSuperFieldReference3() {
}

@Test // https://github.com/groovy/groovy-eclipse/issues/815
public void testSuperFieldReference3a() {
public void testSuperFieldReference12() {
String contents =
"class A {\n" +
" private Number field\n" +
Expand All @@ -1296,7 +1296,7 @@ public void testSuperFieldReference3a() {
}

@Test // https://github.com/groovy/groovy-eclipse/issues/815
public void testSuperFieldReference3b() {
public void testSuperFieldReference13() {
String contents =
"class A {\n" +
" private Number field\n" +
Expand All @@ -1310,7 +1310,7 @@ public void testSuperFieldReference3b() {
}

@Test // https://github.com/groovy/groovy-eclipse/issues/815
public void testSuperFieldReference3c() {
public void testSuperFieldReference14() {
String contents =
"class A {\n" +
" private Number field\n" +
Expand All @@ -1324,7 +1324,7 @@ public void testSuperFieldReference3c() {
}

@Test // https://github.com/groovy/groovy-eclipse/issues/815
public void testSuperFieldReference3d() {
public void testSuperFieldReference15() {
String contents =
"class A {\n" +
" private Number field\n" +
Expand All @@ -1338,7 +1338,7 @@ public void testSuperFieldReference3d() {
}

@Test
public void testSuperFieldReference4() {
public void testSuperFieldReference16() {
String contents =
"public interface Constants {\n" +
" int FIRST = 1;\n" +
Expand All @@ -1352,7 +1352,7 @@ public void testSuperFieldReference4() {
}

@Test
public void testSuperFieldReference5() {
public void testSuperFieldReference17() {
createJavaUnit("foo", "Bar",
"package foo;\n" +
"public class Bar {\n" +
Expand All @@ -1371,7 +1371,7 @@ public void testSuperFieldReference5() {
}

@Test
public void testSuperFieldReference5a() {
public void testSuperFieldReference18() {
createJavaUnit("foo", "Bar",
"package foo;\n" +
"public class Bar {\n" +
Expand All @@ -1390,7 +1390,7 @@ public void testSuperFieldReference5a() {
}

@Test
public void testSuperFieldReference5b() {
public void testSuperFieldReference19() {
createJavaUnit("foo", "Bar",
"package foo;\n" +
"public class Bar {\n" +
Expand Down Expand Up @@ -1500,7 +1500,7 @@ public void testSuperPropertyReference6() {
}

@Test // GROOVY-1736
public void testSuperPropertyReference6a() {
public void testSuperPropertyReference7() {
for (String qual : new String[] {"", "this.", "super."}) {
String contents =
"class A {\n" +
Expand All @@ -1522,7 +1522,7 @@ public void testSuperPropertyReference6a() {
}

@Test
public void testSuperPropertyReference6b() {
public void testSuperPropertyReference8() {
for (String qual : new String[] {"", "this.", "super."}) {
String contents =
"class A {\n" +
Expand All @@ -1540,7 +1540,7 @@ public void testSuperPropertyReference6b() {
}

@Test // isX only applies to [Bb]oolean
public void testSuperPropertyReference7() {
public void testSuperPropertyReference9() {
for (String qual : new String[] {"", "this.", "super."}) {
String contents =
"class A {\n" +
Expand All @@ -1558,7 +1558,7 @@ public void testSuperPropertyReference7() {
}

@Test
public void testSuperPropertyReference8() {
public void testSuperPropertyReference10() {
for (String qual : new String[] {"", "this.", "super."}) {
String contents =
"class A {\n" +
Expand All @@ -1578,7 +1578,7 @@ public void testSuperPropertyReference8() {
}

@Test // GROOVY-6097
public void testSuperPropertyReference9() {
public void testSuperPropertyReference11() {
for (String qual : new String[] {"", "this.", "super."}) {
String contents =
"class A {\n" +
Expand All @@ -1602,7 +1602,7 @@ public void testSuperPropertyReference9() {
}

@Test
public void testSuperPropertyReference9a() {
public void testSuperPropertyReference12() {
for (String qual : new String[] {"", "this.", "super."}) {
String contents =
"class A {\n" +
Expand All @@ -1622,6 +1622,70 @@ public void testSuperPropertyReference9a() {
}
}

@Test
public void testSuperPropertyReference13() {
for (String mods : new String[] {"", "public ", "protected "}) {
createJavaUnit("A",
"public abstract class A {\n" +
" " + mods + "int getValue() {\n" +
" return 0;\n" +
" }\n" +
"}\n");

String contents =
"class B extends A {\n" +
" void test() {\n" +
" value\n" +
" getValue()\n" +
" }\n" +
"}\n";
int offset = contents.lastIndexOf("value");
assertDeclaration(contents, offset, offset + 5, "A", "getValue", DeclarationKind.METHOD);
/**/offset = contents.lastIndexOf("getValue");
assertDeclaration(contents, offset, offset + 8, "A", "getValue", DeclarationKind.METHOD);
}
}

@Test
public void testSuperPropertyReference14() {
for (String mods : new String[] {"", "public ", "protected "}) {
createJavaUnit("p", "A",
"public abstract class A {\n" +
" " + mods + "int getValue() {\n" +
" return 0;\n" +
" }\n" +
"}\n");

String contents =
"class B extends p.A {\n" +
" void test() {\n" +
" value\n" +
" getValue()\n" +
" }\n" +
"}\n";
int offset = contents.lastIndexOf("value");
assertDeclaration(contents, offset, offset + 5, "p.A", "getValue", DeclarationKind.METHOD);
/**/offset = contents.lastIndexOf("getValue");
assertDeclaration(contents, offset, offset + 8, "p.A", "getValue", DeclarationKind.METHOD);
}
}

@Test // GROOVY-11356
public void testSuperPropertyReference15() {
String contents =
"class A {\n" +
" private getValue() {}\n" +
"}\n" +
"class B extends A {\n" +
" void test() {\n" +
" value\n" +
" getValue()\n" +
" }\n" +
"}\n";
assertUnknown(contents, "value");
assertUnknown(contents, "getValue");
}

@Test
public void testSuperClassMethod1() {
String contents =
Expand Down
Loading

0 comments on commit edb36c0

Please sign in to comment.