Issue Details (XML | Word | Printable)

Key: GDS-150
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Franck Wolff
Reporter: zhong shigang
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
GraniteDS

gas3 can't generate uid incorrently when class hierarchy higher 2 levels

Created: 31/Jul/08 03:32 PM   Updated: 06/Aug/08 01:17 PM   Resolved: 06/Aug/08 01:16 PM
Component/s: AS3 code generation
Affects Version/s: 1.1.0_RC3
Fix Version/s: 1.1.0_RC4

Environment: windows xp sp2,flex builder 3
Issue Links:
Duplicate
 


 Description  « Hide
There are three classes,for example,ClassA,ClassB and ClassC

@Entity(name = "ClassA")
public class ClassA implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private Long id;
...
@GeneratedValue
@Id
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}
...
}

@Entity(name = "ClassB")
public class ClassB extends ClassA implements java.io.Serializable {
...
}

...ClassC extends ClassB ...

Notes that ClassB and ClassC have no id property.
gas3 generates such actionscript as following code(ClassABase.as,ClassBBase.as and ClassCBase.as are almost the same):
       ...
        public function set uid(value:String):void {
            // noop...
        }
        public function get uid():String {
            if (isNaN(_id))
                return "ClassA";
            return "ClassA:" + String(_id);
        }
        ...
The question is that:
1 uid should be overrided in ClassBBase.as
2 _id should be changed to id,because _id is private in super class.(in ClassBBase.as)
3 whether or not you add override befor uid in ClassCBase,it will be error. In som sense it should be added override.
  But in ClassBBase.as uid has already added it,and override can not be used again in inheritance hierarchy.
  
question 3 is new,question 1 and 2 have been post in http://www.graniteds.org/jira/browse/GDS-149,but i can't find valid entry to post a comment.

zhong shigang added a comment - 01/Aug/08 08:54 AM
It can work using public override instead of override public

Franck Wolff added a comment - 06/Aug/08 01:16 PM
Bug in tideEntityBase.gsp (new code below):

        // Only generates uid block for the class that owns the id...
        if (jClass.hasIdentifiers()) {%>

        public function set uid(value:String):void {
            // noop...
        }
        public function get uid():String {
            if (<%= (identifier.as3Type.name == "Number") ?
                    "isNaN(_" + identifier.name + ")" :
                    "!_" + identifier.name %>)
                return "${jClass.as3Type.qualifiedName}";
            return "${jClass.as3Type.qualifiedName}:" + String(_${identifier.name});
        }<%