Skip to content

Commit a5c9fed

Browse files
Can not enforce PropertyConverter in Property constructors.
If using generics the customType is e.g. List.class, not e.g. List<String>.class. Follow-up to Enforce db and Java types match for PropertyConverter in Property constructors.
1 parent 23631c0 commit a5c9fed

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

objectbox-java/src/main/java/io/objectbox/Property.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@ public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, S
6969
this(entity, ordinal, id, type, name, isId, dbName, null, null);
7070
}
7171

72-
public <P, D> Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<D> type, String name, boolean isId,
73-
@Nullable String dbName, @Nullable Class<? extends PropertyConverter<P, D>> converterClass,
74-
@Nullable Class<P> customType) {
72+
// Note: types of PropertyConverter might not exactly match type and customtype, e.g. if using generics like List.class.
73+
public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, String name, boolean isId,
74+
@Nullable String dbName, @Nullable Class<? extends PropertyConverter<?, ?>> converterClass,
75+
@Nullable Class<?> customType) {
7576
this(entity, ordinal, id, type, name, isId, false, dbName, converterClass, customType);
7677
}
7778

78-
public <P, D> Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<D> type, String name, boolean isId,
79+
public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, String name, boolean isId,
7980
boolean isVirtual, @Nullable String dbName,
80-
@Nullable Class<? extends PropertyConverter<P, D>> converterClass, @Nullable Class<P> customType) {
81+
@Nullable Class<? extends PropertyConverter<?, ?>> converterClass, @Nullable Class<?> customType) {
8182
this.entity = entity;
8283
this.ordinal = ordinal;
8384
this.id = id;

0 commit comments

Comments
 (0)