You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2018/01/17 05:46:00 UTC
[jira] [Comment Edited] (GROOVY-8447) It is allowed to define local
variable of void type
[ https://issues.apache.org/jira/browse/GROOVY-8447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16328293#comment-16328293 ]
Paul King edited comment on GROOVY-8447 at 1/17/18 5:45 AM:
------------------------------------------------------------
Actually this was already fixed on the 2_5_X branch via GROOVY-8046 with slightly better error messages. For this example:
{code:java}
class MyClass {
void field
}
void localVar = 1
println localVar
{code}
It used to say:
{noformat}
3 compilation errors:
The field 'field' has invalid type void
at line: 2, column: 3
The parameter 'value' in method 'void setField(void)' has invalid type void
at line: -1, column: -1
The variable 'localVar' has invalid type void
at line: 5, column: 1
{noformat}
Now we get:
{noformat}
1 compilation error:
void is not allowed here at line: 2, column: 3
{noformat}
[~daniel_sun], do you think we can improve error messages with the new parser? Or not easy? I'll have a look next week if you don't know off the top of your head and don't have time to investigate.
was (Author: paulk):
Actually this was already fixed on the 2_5_X branch via GROOVY-8046 with slightly better error messages. For this example:
{code:java}
class MyClass {
void field
}
void localVar = 1
println localVar
{code}
It used to say:
{noformat}
3 compilation errors:
The field 'field' has invalid type void
at line: 2, column: 3
The parameter 'value' in method 'void setField(void)' has invalid type void
at line: -1, column: -1
The variable 'localVar' has invalid type void
at line: 5, column: 1
{noformat}
Now we get:
{noformat}
1 compilation error:
void is not allowed here at line: 2, column: 3
{noformat}
Daniel, do you think we can improve error messages with the new parser? Or not easy? I'll have a look next week if you don't know off the top of your head and don't have time to investigate.
> It is allowed to define local variable of void type
> ---------------------------------------------------
>
> Key: GROOVY-8447
> URL: https://issues.apache.org/jira/browse/GROOVY-8447
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.4.13
> Reporter: Daniil Ovchinnikov
> Assignee: Daniel Sun
> Priority: Major
> Fix For: 2.6.0-alpha-3, 3.0.0-alpha-2
>
>
> {code:title=bugs.groovy}
> void ff = 1
> println ff
> {code}
> {noformat}
> java.lang.ClassFormatError: Field "ff" in class bugs has illegal signature "V"
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)