Thread: JDK 1.5 beta2 and generics

JDK 1.5 beta2 and generics

From
Kris Jurka
Date:
The recent JDK 1.5 beta2 is unable to compile the jdbc driver because it
modifies the interfaces that currently take a java.util.Map object to take
a specific type of Map.  This results in the existing classes not
implementing the interfaces anymore.  Any ideas on how to fix this
cleanly?  I don't want to see ant having to add/remove comments to all
of these files, but nothing else occurs to me.

Below are the actual compile errors and a link to one of the new method
signatures javadocs.

Kris Jurka

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Array.html#getArray(long,%20int,%20java.util.Map)

compile:
    [javac] Compiling 77 source files to
/home/jurka/cvs/pg/official/74/src/interfaces/jdbc/build
    [javac]
/home/jurka/cvs/pg/official/74/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java:35:
org.postgresql.jdbc2.Array is not abstract and does not override abstract
method
getResultSet(long,int,java.util.Map<java.lang.String,java.lang.Class<?>>)
in java.sql.Array
    [javac] public class Array implements java.sql.Array
    [javac]        ^
    [javac]
/home/jurka/cvs/pg/official/74/src/interfaces/jdbc/org/postgresql/jdbc2/optional/PGObjectFactory.java:18:
org.postgresql.jdbc2.optional.PGObjectFactory is not abstract and does not
override abstract method
getObjectInstance(java.lang.Object,javax.naming.Name,javax.naming.Context,java.util.Hashtable<java.lang.String,?>)
in javax.naming.spi.ObjectFactory
    [javac] public class PGObjectFactory implements ObjectFactory
    [javac]        ^
    [javac]
/home/jurka/cvs/pg/official/74/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java:10:
org.postgresql.jdbc3.Jdbc3CallableStatement is not abstract and does not
override abstract method
getObject(java.lang.String,java.util.Map<java.lang.String,java.lang.Class<?>>)
in java.sql.CallableStatement
    [javac] public class Jdbc3CallableStatement extends
org.postgresql.jdbc3.AbstractJdbc3Statement implements
java.sql.CallableStatement
    [javac]        ^
    [javac]
/home/jurka/cvs/pg/official/74/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java:11:
org.postgresql.jdbc3.Jdbc3Connection is not abstract and does not override
abstract method
setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>>) in
java.sql.Connection
    [javac] public class Jdbc3Connection extends
org.postgresql.jdbc3.AbstractJdbc3Connection implements
java.sql.Connection
    [javac]        ^
    [javac]
/home/jurka/cvs/pg/official/74/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java:14:
org.postgresql.jdbc3.Jdbc3ResultSet is not abstract and does not override
abstract method
getObject(java.lang.String,java.util.Map<java.lang.String,java.lang.Class<?>>)
in java.sql.ResultSet
    [javac] public class Jdbc3ResultSet extends
org.postgresql.jdbc3.AbstractJdbc3ResultSet implements java.sql.ResultSet
    [javac]        ^
    [javac] Note: * uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 5 errors


Re: JDK 1.5 beta2 and generics

From
Kris Jurka
Date:

On Thu, 17 Jun 2004, Kris Jurka wrote:

> The recent JDK 1.5 beta2 is unable to compile the jdbc driver because it
> modifies the interfaces that currently take a java.util.Map object to take
> a specific type of Map.  This results in the existing classes not
> implementing the interfaces anymore.  Any ideas on how to fix this
> cleanly?  I don't want to see ant having to add/remove comments to all
> of these files, but nothing else occurs to me.
>

After some prompting I've investigated what the actual changes required
are and the attached patch shows only minor changes to method signatures
are needed, but it does touch eight files, which is in my estimation a
lot.

Kris Jurka

Attachment

Re: JDK 1.5 beta2 and generics

From
Dave Cramer
Date:
Kris,

How does the 1.3, 1.4 driver handle this ?

Dave
On Fri, 2004-06-18 at 03:43, Kris Jurka wrote:
> On Thu, 17 Jun 2004, Kris Jurka wrote:
>
> > The recent JDK 1.5 beta2 is unable to compile the jdbc driver because it
> > modifies the interfaces that currently take a java.util.Map object to take
> > a specific type of Map.  This results in the existing classes not
> > implementing the interfaces anymore.  Any ideas on how to fix this
> > cleanly?  I don't want to see ant having to add/remove comments to all
> > of these files, but nothing else occurs to me.
> >
>
> After some prompting I've investigated what the actual changes required
> are and the attached patch shows only minor changes to method signatures
> are needed, but it does touch eight files, which is in my estimation a
> lot.
>
> Kris Jurka
>
> !DSPAM:40d2a08b226721437050288!
>
> ______________________________________________________________________
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>
>
> !DSPAM:40d2a08b226721437050288!
--
Dave Cramer
519 939 0336
ICQ # 14675561


Re: JDK 1.5 beta2 and generics

From
Kris Jurka
Date:

On Fri, 18 Jun 2004, Dave Cramer wrote:

> Kris,
>
> How does the 1.3, 1.4 driver handle this ?

In the past they haven't touched the API without a new JDBC version.  Our
model handles this cleanly with a separate directory/implementation for
the new part of the API.  The problem here is that they have changed the
method signature's specified in an interface without changing the API
version.

Note that this is only a problem for implementors, not callers.
The weak generic type checking allows for instance a method like
func(Hashtable<String,String>) to be called with func(new Hashtable()).
It doesn't require the caller to alter their passed data type only the
implementor to match the stricter method signature.

Kris Jurka