Skip to content

Commit

Permalink
[#5395] Fix covariance and contravariance on various Converter API us…
Browse files Browse the repository at this point in the history
…ages
  • Loading branch information
lukaseder committed Jul 6, 2016
1 parent bd42189 commit 5df74b0
Show file tree
Hide file tree
Showing 22 changed files with 135 additions and 133 deletions.
Expand Up @@ -68,5 +68,5 @@ public interface BindingGetResultSetContext<U> extends Scope {
/**
* Create a new context from this one using a converter.
*/
<T> BindingGetResultSetContext<T> convert(Converter<T, U> converter);
<T> BindingGetResultSetContext<T> convert(Converter<? super T, ? extends U> converter);
}
2 changes: 1 addition & 1 deletion jOOQ/src/main/java/org/jooq/BindingGetSQLInputContext.java
Expand Up @@ -63,5 +63,5 @@ public interface BindingGetSQLInputContext<U> extends Scope {
/**
* Create a new context from this one using a converter.
*/
<T> BindingGetSQLInputContext<T> convert(Converter<T, U> converter);
<T> BindingGetSQLInputContext<T> convert(Converter<? super T, ? extends U> converter);
}
Expand Up @@ -68,5 +68,5 @@ public interface BindingGetStatementContext<U> extends Scope {
/**
* Create a new context from this one using a converter.
*/
<T> BindingGetStatementContext<T> convert(Converter<T, U> converter);
<T> BindingGetStatementContext<T> convert(Converter<? super T, ? extends U> converter);
}
2 changes: 1 addition & 1 deletion jOOQ/src/main/java/org/jooq/BindingRegisterContext.java
Expand Up @@ -64,5 +64,5 @@ public interface BindingRegisterContext<U> extends Scope {
/**
* Create a new context from this one using a converter.
*/
<T> BindingRegisterContext<T> convert(Converter<T, U> converter);
<T> BindingRegisterContext<T> convert(Converter<? super T, ? extends U> converter);
}
2 changes: 1 addition & 1 deletion jOOQ/src/main/java/org/jooq/BindingSQLContext.java
Expand Up @@ -66,5 +66,5 @@ public interface BindingSQLContext<U> extends Scope {
/**
* Create a new context from this one using a converter.
*/
<T> BindingSQLContext<T> convert(Converter<T, U> converter);
<T> BindingSQLContext<T> convert(Converter<? extends T, ? super U> converter);
}
Expand Up @@ -63,5 +63,5 @@ public interface BindingSetSQLOutputContext<U> extends Scope {
/**
* Create a new context from this one using a converter.
*/
<T> BindingSetSQLOutputContext<T> convert(Converter<T, U> converter);
<T> BindingSetSQLOutputContext<T> convert(Converter<? extends T, ? super U> converter);
}
Expand Up @@ -68,5 +68,5 @@ public interface BindingSetStatementContext<U> extends Scope {
/**
* Create a new context from this one using a converter.
*/
<T> BindingSetStatementContext<T> convert(Converter<T, U> converter);
<T> BindingSetStatementContext<T> convert(Converter<? extends T, ? super U> converter);
}
16 changes: 8 additions & 8 deletions jOOQ/src/main/java/org/jooq/Record.java
Expand Up @@ -1479,7 +1479,7 @@ <T> T getValue(Field<?> field, Class<? extends T> type, T defaultValue) throws I
*
* @see #get(Field, Converter)
*/
<T, U> U getValue(Field<T> field, Converter<? super T, U> converter) throws IllegalArgumentException,
<T, U> U getValue(Field<T> field, Converter<? super T, ? extends U> converter) throws IllegalArgumentException,
DataTypeException;

/**
Expand All @@ -1500,7 +1500,7 @@ <T, U> U getValue(Field<T> field, Converter<? super T, U> converter) throws Ille
* @deprecated - 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
*/
@Deprecated
<T, U> U getValue(Field<T> field, Converter<? super T, U> converter, U defaultValue)
<T, U> U getValue(Field<T> field, Converter<? super T, ? extends U> converter, U defaultValue)
throws IllegalArgumentException, DataTypeException;

/**
Expand Down Expand Up @@ -1567,7 +1567,7 @@ <T> T getValue(String fieldName, Class<? extends T> type, T defaultValue) throws
*
* @see {@link #get(String, Converter)}
*/
<U> U getValue(String fieldName, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> U getValue(String fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Get a converted value from this record, providing a field name.
Expand All @@ -1586,7 +1586,7 @@ <T> T getValue(String fieldName, Class<? extends T> type, T defaultValue) throws
* @deprecated - 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
*/
@Deprecated
<U> U getValue(String fieldName, Converter<?, U> converter, U defaultValue) throws IllegalArgumentException,
<U> U getValue(String fieldName, Converter<?, ? extends U> converter, U defaultValue) throws IllegalArgumentException,
DataTypeException;

/**
Expand Down Expand Up @@ -1619,7 +1619,7 @@ <U> U getValue(String fieldName, Converter<?, U> converter, U defaultValue) thro
*
* @see #get(Name, Converter)
*/
<U> U getValue(Name fieldName, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> U getValue(Name fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Get a value from this record, providing a field index.
Expand Down Expand Up @@ -1685,7 +1685,7 @@ <T> T getValue(int index, Class<? extends T> type, T defaultValue) throws Illega
*
* @see #get(int, Converter)
*/
<U> U getValue(int index, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> U getValue(int index, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Get a converted value from this record, providing a field index.
Expand All @@ -1704,7 +1704,7 @@ <T> T getValue(int index, Class<? extends T> type, T defaultValue) throws Illega
* @deprecated - 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
*/
@Deprecated
<U> U getValue(int index, Converter<?, U> converter, U defaultValue) throws IllegalArgumentException,
<U> U getValue(int index, Converter<?, ? extends U> converter, U defaultValue) throws IllegalArgumentException,
DataTypeException;

/**
Expand All @@ -1727,5 +1727,5 @@ <U> U getValue(int index, Converter<?, U> converter, U defaultValue) throws Ille
*
* @see #set(Field, Object, Converter)
*/
<T, U> void setValue(Field<T> field, U value, Converter<T, ? super U> converter);
<T, U> void setValue(Field<T> field, U value, Converter<? extends T, ? super U> converter);
}
24 changes: 12 additions & 12 deletions jOOQ/src/main/java/org/jooq/Result.java
Expand Up @@ -324,7 +324,7 @@ Object getValue(int index, String fieldName, Object defaultValue) throws IndexOu
* @throws IllegalArgumentException If the argument field is not contained
* in {@link #fieldsRow()}
*/
<T, U> List<U> getValues(Field<T> field, Converter<? super T, U> converter) throws IllegalArgumentException;
<T, U> List<U> getValues(Field<T> field, Converter<? super T, ? extends U> converter) throws IllegalArgumentException;

/**
* Convenience method to fetch all values for a given field. This is
Expand Down Expand Up @@ -367,7 +367,7 @@ Object getValue(int index, String fieldName, Object defaultValue) throws IndexOu
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> List<U> getValues(int fieldIndex, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> List<U> getValues(int fieldIndex, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Convenience method to fetch all values for a given field. This is
Expand Down Expand Up @@ -410,7 +410,7 @@ Object getValue(int index, String fieldName, Object defaultValue) throws IndexOu
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> List<U> getValues(String fieldName, Converter<?, U> converter) throws IllegalArgumentException,
<U> List<U> getValues(String fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException,
DataTypeException;

/**
Expand Down Expand Up @@ -454,7 +454,7 @@ <U> List<U> getValues(String fieldName, Converter<?, U> converter) throws Illega
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> List<U> getValues(Name fieldName, Converter<?, U> converter) throws IllegalArgumentException,
<U> List<U> getValues(Name fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException,
DataTypeException;

/**
Expand Down Expand Up @@ -2392,7 +2392,7 @@ <E, S extends Record> Map<S, List<E>> intoGroups(Table<S> table, RecordMapper<?
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> U[] intoArray(int fieldIndex, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> U[] intoArray(int fieldIndex, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Return all values for a field name from the result.
Expand Down Expand Up @@ -2437,7 +2437,7 @@ <E, S extends Record> Map<S, List<E>> intoGroups(Table<S> table, RecordMapper<?
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> U[] intoArray(String fieldName, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> U[] intoArray(String fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Return all values for a field name from the result.
Expand Down Expand Up @@ -2482,7 +2482,7 @@ <E, S extends Record> Map<S, List<E>> intoGroups(Table<S> table, RecordMapper<?
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> U[] intoArray(Name fieldName, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> U[] intoArray(Name fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Return all values for a field from the result.
Expand Down Expand Up @@ -2525,7 +2525,7 @@ <E, S extends Record> Map<S, List<E>> intoGroups(Table<S> table, RecordMapper<?
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<T, U> U[] intoArray(Field<T> field, Converter<? super T, U> converter) throws IllegalArgumentException,
<T, U> U[] intoArray(Field<T> field, Converter<? super T, ? extends U> converter) throws IllegalArgumentException,
DataTypeException;

/**
Expand Down Expand Up @@ -2562,7 +2562,7 @@ <T, U> U[] intoArray(Field<T> field, Converter<? super T, U> converter) throws I
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> Set<U> intoSet(int fieldIndex, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> Set<U> intoSet(int fieldIndex, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Return all values for a field name from the result.
Expand Down Expand Up @@ -2598,7 +2598,7 @@ <T, U> U[] intoArray(Field<T> field, Converter<? super T, U> converter) throws I
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> Set<U> intoSet(String fieldName, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> Set<U> intoSet(String fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Return all values for a field name from the result.
Expand Down Expand Up @@ -2634,7 +2634,7 @@ <T, U> U[] intoArray(Field<T> field, Converter<? super T, U> converter) throws I
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<U> Set<U> intoSet(Name fieldName, Converter<?, U> converter) throws IllegalArgumentException, DataTypeException;
<U> Set<U> intoSet(Name fieldName, Converter<?, ? extends U> converter) throws IllegalArgumentException, DataTypeException;

/**
* Return all values for a field from the result.
Expand Down Expand Up @@ -2668,7 +2668,7 @@ <T, U> U[] intoArray(Field<T> field, Converter<? super T, U> converter) throws I
* @throws DataTypeException wrapping any data type conversion exception
* that might have occurred
*/
<T, U> Set<U> intoSet(Field<T> field, Converter<? super T, U> converter) throws IllegalArgumentException,
<T, U> Set<U> intoSet(Field<T> field, Converter<? super T, ? extends U> converter) throws IllegalArgumentException,
DataTypeException;

/**
Expand Down

0 comments on commit 5df74b0

Please sign in to comment.