123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- .class public abstract Lcom/google/gson/internal/UnsafeAllocator;
- .super Ljava/lang/Object;
- .source ""
- # direct methods
- .method public constructor <init>()V
- .locals 0
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
- .end method
- .method static assertInstantiable(Ljava/lang/Class;)V
- .locals 3
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "(",
- "Ljava/lang/Class<",
- "*>;)V"
- }
- .end annotation
- invoke-virtual {p0}, Ljava/lang/Class;->getModifiers()I
- move-result v0
- invoke-static {v0}, Ljava/lang/reflect/Modifier;->isInterface(I)Z
- move-result v1
- if-nez v1, :cond_1
- invoke-static {v0}, Ljava/lang/reflect/Modifier;->isAbstract(I)Z
- move-result v0
- if-nez v0, :cond_0
- return-void
- :cond_0
- new-instance v0, Ljava/lang/UnsupportedOperationException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "Abstract class can\'t be instantiated! Class name: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {p0}, Ljava/lang/Class;->getName()Ljava/lang/String;
- move-result-object p0
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_1
- new-instance v0, Ljava/lang/UnsupportedOperationException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "Interface can\'t be instantiated! Interface name: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {p0}, Ljava/lang/Class;->getName()Ljava/lang/String;
- move-result-object p0
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
- throw v0
- .end method
- .method public static create()Lcom/google/gson/internal/UnsafeAllocator;
- .locals 9
- const-string v0, "newInstance"
- const-string v1, "sun.misc.Unsafe"
- const/4 v2, 0x0
- const/4 v3, 0x0
- const/4 v4, 0x1
- :try_start_0
- invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
- move-result-object v1
- const-string v5, "theUnsafe"
- invoke-virtual {v1, v5}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
- move-result-object v5
- invoke-virtual {v5, v4}, Ljava/lang/reflect/Field;->setAccessible(Z)V
- invoke-virtual {v5, v2}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
- move-result-object v5
- const-string v6, "allocateInstance"
- new-array v7, v4, [Ljava/lang/Class;
- const-class v8, Ljava/lang/Class;
- aput-object v8, v7, v3
- invoke-virtual {v1, v6, v7}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
- move-result-object v1
- new-instance v6, Lcom/google/gson/internal/UnsafeAllocator$1;
- invoke-direct {v6, v1, v5}, Lcom/google/gson/internal/UnsafeAllocator$1;-><init>(Ljava/lang/reflect/Method;Ljava/lang/Object;)V
- :try_end_0
- .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
- return-object v6
- :catch_0
- const/4 v1, 0x2
- :try_start_1
- const-class v5, Ljava/io/ObjectStreamClass;
- const-string v6, "getConstructorId"
- new-array v7, v4, [Ljava/lang/Class;
- const-class v8, Ljava/lang/Class;
- aput-object v8, v7, v3
- invoke-virtual {v5, v6, v7}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
- move-result-object v5
- invoke-virtual {v5, v4}, Ljava/lang/reflect/Method;->setAccessible(Z)V
- new-array v6, v4, [Ljava/lang/Object;
- const-class v7, Ljava/lang/Object;
- aput-object v7, v6, v3
- invoke-virtual {v5, v2, v6}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
- move-result-object v2
- check-cast v2, Ljava/lang/Integer;
- invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I
- move-result v2
- const-class v5, Ljava/io/ObjectStreamClass;
- new-array v6, v1, [Ljava/lang/Class;
- const-class v7, Ljava/lang/Class;
- aput-object v7, v6, v3
- sget-object v7, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
- aput-object v7, v6, v4
- invoke-virtual {v5, v0, v6}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
- move-result-object v5
- invoke-virtual {v5, v4}, Ljava/lang/reflect/Method;->setAccessible(Z)V
- new-instance v6, Lcom/google/gson/internal/UnsafeAllocator$2;
- invoke-direct {v6, v5, v2}, Lcom/google/gson/internal/UnsafeAllocator$2;-><init>(Ljava/lang/reflect/Method;I)V
- :try_end_1
- .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1
- return-object v6
- :catch_1
- :try_start_2
- const-class v2, Ljava/io/ObjectInputStream;
- new-array v1, v1, [Ljava/lang/Class;
- const-class v5, Ljava/lang/Class;
- aput-object v5, v1, v3
- const-class v3, Ljava/lang/Class;
- aput-object v3, v1, v4
- invoke-virtual {v2, v0, v1}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
- move-result-object v0
- invoke-virtual {v0, v4}, Ljava/lang/reflect/Method;->setAccessible(Z)V
- new-instance v1, Lcom/google/gson/internal/UnsafeAllocator$3;
- invoke-direct {v1, v0}, Lcom/google/gson/internal/UnsafeAllocator$3;-><init>(Ljava/lang/reflect/Method;)V
- :try_end_2
- .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_2
- return-object v1
- :catch_2
- new-instance v0, Lcom/google/gson/internal/UnsafeAllocator$4;
- invoke-direct {v0}, Lcom/google/gson/internal/UnsafeAllocator$4;-><init>()V
- return-object v0
- .end method
- # virtual methods
- .method public abstract newInstance(Ljava/lang/Class;)Ljava/lang/Object;
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "<T:",
- "Ljava/lang/Object;",
- ">(",
- "Ljava/lang/Class<",
- "TT;>;)TT;"
- }
- .end annotation
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/lang/Exception;
- }
- .end annotation
- .end method
|