Skip to content

Commit

Permalink
Fix #198 by removing defaultStrategy for instantiators.
Browse files Browse the repository at this point in the history
  • Loading branch information
romix committed Apr 4, 2014
1 parent 6ebf7bb commit acf4dfe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
6 changes: 0 additions & 6 deletions src/com/esotericsoftware/kryo/Kryo.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public class Kryo {
private final ClassResolver classResolver;
private int nextRegisterID;
private ClassLoader classLoader = getClass().getClassLoader();
private InstantiatorStrategy defaultStrategy = new DefaultInstantiatorStrategy();
private InstantiatorStrategy strategy = new DefaultInstantiatorStrategy();
private boolean registrationRequired;

Expand Down Expand Up @@ -338,8 +337,6 @@ public Serializer getDefaultSerializer (Class type) {
DefaultSerializerEntry entry = defaultSerializers.get(i);
if (entry.type.isAssignableFrom(type)) {
Serializer defaultSerializer = entry.serializerFactory.makeSerializer(this, type);
// Remember that it is a default serializer set internally by Kryo
if (i > n - lowPriorityDefaultSerializerCount) defaultSerializer.setDefaultSerializer(true);
return defaultSerializer;
}
}
Expand Down Expand Up @@ -1058,9 +1055,6 @@ public <T> T newInstance (Class<T> type) {
Registration registration = getRegistration(type);
ObjectInstantiator instantiator = registration.getInstantiator();
if (instantiator == null) {
if (registration.getSerializer().isDefaultSerializer())
instantiator = defaultStrategy.newInstantiatorOf(type);
else
instantiator = newInstantiator(type);
registration.setInstantiator(instantiator);
}
Expand Down
12 changes: 1 addition & 11 deletions src/com/esotericsoftware/kryo/Serializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/** Reads and writes objects to and from bytes.
* @author Nathan Sweet <[email protected]> */
public abstract class Serializer<T> {
private boolean acceptsNull, immutable, defaultSerializer;
private boolean acceptsNull, immutable;

public Serializer () {
}
Expand Down Expand Up @@ -65,16 +65,6 @@ public void setImmutable (boolean immutable) {
this.immutable = immutable;
}


public boolean isDefaultSerializer () {
return defaultSerializer;
}

/** If true, this is a default serializer */
public void setDefaultSerializer (boolean defaultSerializer) {
this.defaultSerializer = defaultSerializer;
}

/** Sets the generic types of the field or method this serializer will be used for on the next call to read or write. Subsequent
* calls to read and write must not use this generic type information. The default implementation does nothing. Subclasses may
* use the information provided to this method for more efficient serialization, eg to use the same type for all items in a
Expand Down

0 comments on commit acf4dfe

Please sign in to comment.