356 lines
10 KiB
Smali
356 lines
10 KiB
Smali
.class public Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;
|
|
.super Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
.source "VersionFieldSerializer.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer$Since;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">",
|
|
"Lcom/esotericsoftware/kryo/serializers/FieldSerializer<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field public compatible:Z
|
|
|
|
.field public fieldVersion:[I
|
|
|
|
.field public typeVersion:I
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lcom/esotericsoftware/kryo/Kryo;Ljava/lang/Class;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1, p2}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;-><init>(Lcom/esotericsoftware/kryo/Kryo;Ljava/lang/Class;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
iput p1, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->typeVersion:I
|
|
|
|
const/4 p1, 0x1
|
|
|
|
iput-boolean p1, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->compatible:Z
|
|
|
|
invoke-virtual {p0}, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->initializeCachedFields()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Lcom/esotericsoftware/kryo/Kryo;Ljava/lang/Class;Z)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1, p2}, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;-><init>(Lcom/esotericsoftware/kryo/Kryo;Ljava/lang/Class;)V
|
|
|
|
iput-boolean p3, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->compatible:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public initializeCachedFields()V
|
|
.locals 6
|
|
|
|
invoke-virtual {p0}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getFields()[Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;
|
|
|
|
move-result-object v0
|
|
|
|
array-length v1, v0
|
|
|
|
new-array v1, v1, [I
|
|
|
|
iput-object v1, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->fieldVersion:[I
|
|
|
|
array-length v1, v0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
const/4 v3, 0x0
|
|
|
|
:goto_0
|
|
if-ge v3, v1, :cond_1
|
|
|
|
aget-object v4, v0, v3
|
|
|
|
invoke-virtual {v4}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;->getField()Ljava/lang/reflect/Field;
|
|
|
|
move-result-object v4
|
|
|
|
const-class v5, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer$Since;
|
|
|
|
invoke-virtual {v4, v5}, Ljava/lang/reflect/Field;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer$Since;
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
iget-object v5, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->fieldVersion:[I
|
|
|
|
invoke-interface {v4}, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer$Since;->value()I
|
|
|
|
move-result v4
|
|
|
|
aput v4, v5, v3
|
|
|
|
iget-object v4, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->fieldVersion:[I
|
|
|
|
aget v4, v4, v3
|
|
|
|
iget v5, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->typeVersion:I
|
|
|
|
invoke-static {v4, v5}, Ljava/lang/Math;->max(II)I
|
|
|
|
move-result v4
|
|
|
|
iput v4, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->typeVersion:I
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
iget-object v4, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->fieldVersion:[I
|
|
|
|
aput v2, v4, v3
|
|
|
|
:goto_1
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->removedFields:Ljava/util/HashSet;
|
|
|
|
invoke-virtual {v0}, Ljava/util/HashSet;->clear()V
|
|
|
|
sget-boolean v0, Lf/f/a/a;->c:Z
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
const-string v0, "Version for type "
|
|
|
|
invoke-static {v0}, Lf/e/b/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getType()Ljava/lang/Class;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, " is "
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
iget v1, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->typeVersion:I
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Lf/f/a/a;->a(Ljava/lang/String;)V
|
|
|
|
:cond_2
|
|
return-void
|
|
.end method
|
|
|
|
.method public read(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;)Ljava/lang/Object;
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/esotericsoftware/kryo/Kryo;",
|
|
"Lcom/esotericsoftware/kryo/io/Input;",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;)TT;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p0, p1, p2, p3}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->create(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;)Ljava/lang/Object;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-virtual {p1, p3}, Lcom/esotericsoftware/kryo/Kryo;->reference(Ljava/lang/Object;)V
|
|
|
|
const/4 p1, 0x1
|
|
|
|
invoke-virtual {p2, p1}, Lcom/esotericsoftware/kryo/io/Input;->readVarInt(Z)I
|
|
|
|
move-result p1
|
|
|
|
iget-boolean v0, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->compatible:Z
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
iget v0, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->typeVersion:I
|
|
|
|
if-ne p1, v0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
new-instance p2, Lcom/esotericsoftware/kryo/KryoException;
|
|
|
|
const-string p3, "Version not compatible: "
|
|
|
|
const-string v0, " <-> "
|
|
|
|
invoke-static {p3, p1, v0}, Lf/e/b/a/a;->F(Ljava/lang/String;ILjava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
iget p3, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->typeVersion:I
|
|
|
|
invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p2, p1}, Lcom/esotericsoftware/kryo/KryoException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p2
|
|
|
|
:cond_1
|
|
:goto_0
|
|
invoke-virtual {p0}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getFields()[Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;
|
|
|
|
move-result-object v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
array-length v2, v0
|
|
|
|
:goto_1
|
|
if-ge v1, v2, :cond_4
|
|
|
|
iget-object v3, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->fieldVersion:[I
|
|
|
|
aget v3, v3, v1
|
|
|
|
if-le v3, p1, :cond_2
|
|
|
|
sget-boolean v3, Lf/f/a/a;->c:Z
|
|
|
|
if-eqz v3, :cond_3
|
|
|
|
const-string v3, "Skip field "
|
|
|
|
invoke-static {v3}, Lf/e/b/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v3
|
|
|
|
aget-object v4, v0, v1
|
|
|
|
invoke-virtual {v4}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;->getField()Ljava/lang/reflect/Field;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4}, Ljava/lang/reflect/Field;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v3}, Lf/f/a/a;->a(Ljava/lang/String;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
aget-object v3, v0, v1
|
|
|
|
invoke-virtual {v3, p2, p3}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;->read(Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Object;)V
|
|
|
|
:cond_3
|
|
:goto_2
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_4
|
|
return-object p3
|
|
.end method
|
|
|
|
.method public removeField(Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;)V
|
|
.locals 0
|
|
|
|
invoke-super {p0, p1}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->removeField(Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;)V
|
|
|
|
invoke-virtual {p0}, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->initializeCachedFields()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public removeField(Ljava/lang/String;)V
|
|
.locals 0
|
|
|
|
invoke-super {p0, p1}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->removeField(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0}, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->initializeCachedFields()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public write(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Object;)V
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/esotericsoftware/kryo/Kryo;",
|
|
"Lcom/esotericsoftware/kryo/io/Output;",
|
|
"TT;)V"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p0}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getFields()[Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;
|
|
|
|
move-result-object p1
|
|
|
|
iget v0, p0, Lcom/esotericsoftware/kryo/serializers/VersionFieldSerializer;->typeVersion:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-virtual {p2, v0, v1}, Lcom/esotericsoftware/kryo/io/Output;->writeVarInt(IZ)I
|
|
|
|
array-length v0, p1
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
if-ge v1, v0, :cond_0
|
|
|
|
aget-object v2, p1, v1
|
|
|
|
invoke-virtual {v2, p2, p3}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;->write(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Object;)V
|
|
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|