1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    42
    Vote Rating
    0
    obender is on a distinguished road

      0  

    Default Heterogeneous serializable containers - how to?

    Heterogeneous serializable containers - how to?


    Let say there is a following class:
    Code:
    public class DataRow implements Serializable
    {
        public void addValue( Object o ) {
            values.add( (Serializable)o );
        }
    
        public Object getValue( int idx ) {
            return values.get( idx );
        }
    
        private List<Serializable> values = new ArrayList();
    }

    And here is the service:
    Code:
    public interface TestService extends RemoteService {
        // Sample interface method of remote interface
        DataRow getDataRow();
    }
    
    public class TestServiceImpl extends RemoteServiceServlet implements TestService {
        // Implementation of sample interface method
        public DataRow getDataRow()
        {
            DataRow dr = new DataRow();
            dr.addValue( "xxx" );
            dr.addValue( new Date() );
    
            return dr;
        }
    }
    I'm getting serialization warnings when I call the service from my code.
    It is different every time but in goes somewhat like this:
    Code:
    ...
    Analyzing the fields of type 'lient.DataRow' that qualify for serialization
    private java.util.List<java.io.Serializable> values
    java.util.List<java.io.Serializable>
    Checking type argument 0 of type 'java.util.List<E>' because it is directly exposed in this type or in one of its subtypes
    java.io.Serializable
    Analyzing subclasses:
    java.util.LinkedHashSet<E> <-- this is different from time to time
    Checking parameters of 'java.util.LinkedHashSet<E>'
    Checking param 'E'
    Checking type argument 0 of type 'java.util.LinkedHashSet<E>' because it is directly exposed in this type or in one of its subtypes
    java.lang.Object
    In order to produce smaller client-side code, 'Object' is not allowed; consider using a more specific type
    Any suggestions on how to implement heterogeneous serializable containers?

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    I read somewhere (can't find it now) that GWT 1.5 RC1 has issues with objects not inherriting the serializable-ness of their parent classess... its possible that is your problem.

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    42
    Vote Rating
    0
    obender is on a distinguished road

      0  

    Default


    Well I don't think it is the case here. I put a String and a Date in to this DataRow for testing.

  4. #4
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    private List<Serializable> values = new ArrayList();

    isn't that an object that you are relying on to inherrit Serializable to the ArrayList?

  5. #5
    Ext User
    Join Date
    Apr 2008
    Posts
    42
    Vote Rating
    0
    obender is on a distinguished road

      0  

    Default


    I'm not sure I'm following you on this one.
    Btw, I've tried to replace List<Serializable> with ArrayList<Serializable> but the issue still present.

  6. #6
    Ext User
    Join Date
    May 2008
    Posts
    97
    Vote Rating
    0
    jraue is on a distinguished road

      0  

    Default


    Can only offer my vague guess: By using List<Serializable>, you allow any object of type Object in the list that fullfills Serializable. I would assume the warnings would disappear if you instead use a different class that is more precise that Object, and have that class implement Serializable.

  7. #7
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    jraue is correct. GWT is telling you that using Object or Serializable as a field type or method parameter is a bad idea as the GWT compiler would have to create serialization code for every Serializable type which would make your code size unnecessarily large. Consider using a empty tag interface to mark classes as an alternative to Object or Serializable.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi