[PostGIS] #193: PGgeometry.hashCode() does not satisfy certain requirements that are standard in Java

View: New views
4 Messages — Rating Filter:   Alert me  

[PostGIS] #193: PGgeometry.hashCode() does not satisfy certain requirements that are standard in Java

by PostGIS-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#193: PGgeometry.hashCode() does not satisfy certain requirements that are
standard in Java
------------------------+---------------------------------------------------
 Reporter:  danpodeanu  |       Owner:  pramsey
     Type:  defect      |      Status:  new    
 Priority:  medium      |   Milestone:        
Component:  postgis     |     Version:  1.3.X  
 Keywords:              |  
------------------------+---------------------------------------------------
 The org.postgis.PGgeometry class from the PostGIS JDBC extension violates
 certain standard requirements of Java: for any two Java objects o1 and o2,
 it should be the case that o1.equals(o2) implies
 o1.hashCode()==o2.hashCode(). Thus, the following code should print 'true'
 and 'true'; however, it prints 'true' and 'false' with the 1.3.6 version
 of the PostGIS JDBC extension:

 {{{
 PGgeometry g1=new PGgeometry("SRID=4326;POINT(2.15426 41.4033)");
 PGgeometry g2=new PGgeometry("SRID=4326;POINT(2.15426 41.4033)");
 System.out.println(g1.equals(g2));
 System.out.println(g1.hashCode()==g2.hashCode());
 }}}

 The error can be demonstrated with the 1.3.6 version of the PostGIS JDBC
 extension (I am using the postgis_1.3.6.jar file from the official
 distribution of PostGIS 1.3.6). I have also tried using an SVN version of
 the 1.4.0 version of the extension and the error persists.

 The effect of this error is that PGgeometry objects do not work with Java
 collections as expected. For example, if g1 from the above example is
 added to a Java hash-set, the set does not necessarily contain g2, and
 this is counterintuive since g1 and g2 are equal. In this sense,
 PGgeometry behaves differently from, say, java.lang.Integer, and this is
 counterintuitive as well because both classes simply wrap a datatype.

--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/193>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: [PostGIS] #193: PGgeometry.hashCode() does not satisfy certain requirements that are standard in Java

by PostGIS-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#193: PGgeometry.hashCode() does not satisfy certain requirements that are
standard in Java
-------------------------+--------------------------------------------------
  Reporter:  danpodeanu  |       Owner:  pramsey      
      Type:  defect      |      Status:  new          
  Priority:  medium      |   Milestone:  postgis 1.4.1
 Component:  postgis     |     Version:  1.3.X        
Resolution:              |    Keywords:              
-------------------------+--------------------------------------------------
Changes (by pramsey):

  * milestone:  => postgis 1.4.1

--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/193#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: [PostGIS] #193: PGgeometry.hashCode() does not satisfy certain requirements that are standard in Java

by PostGIS-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#193: PGgeometry.hashCode() does not satisfy certain requirements that are
standard in Java
-------------------------+--------------------------------------------------
  Reporter:  danpodeanu  |       Owner:  pramsey      
      Type:  defect      |      Status:  new          
  Priority:  medium      |   Milestone:  postgis 1.4.1
 Component:  postgis     |     Version:  1.3.X        
Resolution:              |    Keywords:              
-------------------------+--------------------------------------------------
Comment (by pramsey):

 I have little way to test, does the attached patch help? I'll accept
 patches... note that the hashCode() implementation in Geometry is
 commented as "Buggy!" so since this patch depends on it, it might not
 help.

--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/193#comment:2>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: [PostGIS] #193: PGgeometry.hashCode() does not satisfy certain requirements that are standard in Java

by PostGIS-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#193: PGgeometry.hashCode() does not satisfy certain requirements that are
standard in Java
-------------------------+--------------------------------------------------
  Reporter:  danpodeanu  |       Owner:  pramsey      
      Type:  defect      |      Status:  new          
  Priority:  medium      |   Milestone:  postgis 1.4.2
 Component:  postgis     |     Version:  1.3.X        
Resolution:              |    Keywords:              
-------------------------+--------------------------------------------------
Changes (by pramsey):

  * milestone:  postgis 1.4.1 => postgis 1.4.2

Comment:

 Moving forward, absent feedback on patch or fix from Java people.

--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/193#comment:3>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel