Skip to content

Commit

Permalink
Fixed a generics-related bug reported in #207, hopefully without intr…
Browse files Browse the repository at this point in the history
…oducing a new one.
  • Loading branch information
romix committed Apr 3, 2014
1 parent c2c75cc commit 6ebf7bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/com/esotericsoftware/kryo/Generics.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public void setParentScope (Generics scope) {
public Generics getParentScope () {
return parentScope;
}

public Map<String, Class> getMappings() {
return typeVar2class;
}

public String toString () {
return typeVar2class.toString();
Expand Down
3 changes: 3 additions & 0 deletions src/com/esotericsoftware/kryo/Kryo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,9 @@ static final class DefaultSerializerEntry {
public void pushGenericsScope (Class type, Generics generics) {
if (TRACE) trace("kryo", "Settting a new generics scope for class " + type.getName() + ": " + generics);
Generics currentScope = genericsScope;
if (generics.getParentScope() != null) {
generics = new Generics(generics.getMappings());
}
genericsScope = generics;
genericsScope.setParentScope(currentScope);
}
Expand Down

0 comments on commit 6ebf7bb

Please sign in to comment.