Skip to content

Commit

Permalink
fix for void param error
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Jan 25, 2022
1 parent 170cdeb commit beb4803
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7084,6 +7084,42 @@ public void testShellScriptComment2() {
"----------\n");
}

@Test
public void testVoidMethodParameter() {
//@formatter:off
String[] sources = {
"Pogo.groovy",
"class Pogo {\n" +
" void m(void p) {}\n" +
"}\n",

"Pojo.java",
"class Pojo {\n" +
" void m(void p) {}\n" +
"}\n",
};
//@formatter:on

runNegativeTest(sources,
"----------\n" +
"1. ERROR in Pogo.groovy (at line 2)\n" +
"\tvoid m(void p) {}\n" +
"\t ^^^^^^^^^\n" +
"void is an invalid type for the parameter p of a method\n" +
"----------\n" +
"2. ERROR in Pogo.groovy (at line 2)\n" +
"\tvoid m(void p) {}\n" +
"\t ^\n" +
"Groovy:The parameter 'p' in method 'void m(void)' has invalid type void\n" +
"----------\n" +
"----------\n" +
"1. ERROR in Pojo.java (at line 2)\n" +
"\tvoid m(void p) {}\n" +
"\t ^^^^^^^^^\n" +
"void is an invalid type for the parameter p of a method\n" +
"----------\n");
}

//--------------------------------------------------------------------------

private void assertEventCount(int expectedCount, EventListener listener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ public void anonymousClassCannotExtendFinalClass(TypeReference reference, TypeBi
reference.sourceEnd);
}
public void argumentTypeCannotBeVoid(ASTNode methodDecl, Argument arg) {
String[] arguments = new String[] { new String(arg.name) };
String[] arguments = {null, new String(arg.name)}; // GROOVY edit
this.handle(
IProblem.ArgumentTypeCannotBeVoid,
arguments,
Expand Down

0 comments on commit beb4803

Please sign in to comment.