Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.5
-
Fix Version/s: 1.8.6, 2.0-beta-3
-
Component/s: Ant integration, Stub generator / Joint compiler
-
Labels:None
-
Number of attachments :
Description
The problem manifests when a long value is effectively being changed to an 'int' and results in an exception during compilation.
Example class:
class AnObject {
public static final long serialVersionUID = -5239748510188117876L
}
Using groovy 1.8.5, the generated stub (during joint compilation using the 'Groovyc' ant taskdef) looks like (sans imports):
public class AnObject implements groovy.lang.GroovyObject { public static final long serialVersionUID = -5239748510188117876; }
The problem is that this yields a compilation exception 'integer number too large'.
If you exclude the 'public' keyword on the member definition and re-compile, the stub instead looks like:
public class AnObject implements groovy.lang.GroovyObject { public static final long getSerialVersionUID() { return (long)0;} }
This can then compile successfully.
Activity
Cedric Champeau
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Cedric Champeau [ melix ] |
Cedric Champeau
made changes -
| Summary | groovyc stub generation changes when public keyword is included for class member - results in error with long (i.e. serialVersionUID) value | Groovyc stub generation doesn't handle all primitive types properly |
| Fix Version/s | 2.0-beta-3 [ 18244 ] | |
| Fix Version/s | 1.8.6 [ 18245 ] | |
| Description |
The problem manifests when a long value is effectively being changed to an 'int' and results in an exception during compilation.
Example class: class AnObject { public static final long serialVersionUID = -5239748510188117876L } Using groovy 1.8.5, the generated stub (during joint compilation using the 'Groovyc' ant taskdef) looks like (sans imports): public class AnObject implements groovy.lang.GroovyObject { public static final long serialVersionUID = -5239748510188117876; } The problem is that this yields a compilation exception 'integer number too large'. If you exclude the 'public' keyword on the member definition and re-compile, the stub instead looks like: public class AnObject implements groovy.lang.GroovyObject { public static final long getSerialVersionUID() { return (long)0;} } This can then compile successfully. |
The problem manifests when a long value is effectively being changed to an 'int' and results in an exception during compilation.
Example class: {code} class AnObject { public static final long serialVersionUID = -5239748510188117876L } {code} Using groovy 1.8.5, the generated stub (during joint compilation using the 'Groovyc' ant taskdef) looks like (sans imports): {code} public class AnObject implements groovy.lang.GroovyObject { public static final long serialVersionUID = -5239748510188117876; } {code} The problem is that this yields a compilation exception 'integer number too large'. If you exclude the 'public' keyword on the member definition and re-compile, the stub instead looks like: {code} public class AnObject implements groovy.lang.GroovyObject { public static final long getSerialVersionUID() { return (long)0;} } {code} This can then compile successfully. |
Cedric Champeau
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |