今奥全景相机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

699 lines
18 KiB

.class final Lcom/google/common/reflect/ClassPath$Scanner;
.super Ljava/lang/Object;
.source "ClassPath.java"
# annotations
.annotation build Lcom/google/common/annotations/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/google/common/reflect/ClassPath;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x18
name = "Scanner"
.end annotation
# instance fields
.field private final resources:Lcom/google/common/collect/ImmutableSortedSet$Builder;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/google/common/collect/ImmutableSortedSet$Builder",
"<",
"Lcom/google/common/reflect/ClassPath$ResourceInfo;",
">;"
}
.end annotation
.end field
.field private final scannedUris:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set",
"<",
"Ljava/net/URI;",
">;"
}
.end annotation
.end field
# direct methods
.method constructor <init>()V
.locals 2
.prologue
.line 303
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 305
new-instance v0, Lcom/google/common/collect/ImmutableSortedSet$Builder;
invoke-static {}, Lcom/google/common/collect/Ordering;->usingToString()Lcom/google/common/collect/Ordering;
move-result-object v1
invoke-direct {v0, v1}, Lcom/google/common/collect/ImmutableSortedSet$Builder;-><init>(Ljava/util/Comparator;)V
iput-object v0, p0, Lcom/google/common/reflect/ClassPath$Scanner;->resources:Lcom/google/common/collect/ImmutableSortedSet$Builder;
.line 307
invoke-static {}, Lcom/google/common/collect/Sets;->newHashSet()Ljava/util/HashSet;
move-result-object v0
iput-object v0, p0, Lcom/google/common/reflect/ClassPath$Scanner;->scannedUris:Ljava/util/Set;
return-void
.end method
.method static getClassPathEntry(Ljava/io/File;Ljava/lang/String;)Ljava/net/URI;
.locals 4
.annotation build Lcom/google/common/annotations/VisibleForTesting;
.end annotation
.prologue
.line 431
new-instance v0, Ljava/net/URI;
invoke-direct {v0, p1}, Ljava/net/URI;-><init>(Ljava/lang/String;)V
.line 432
invoke-virtual {v0}, Ljava/net/URI;->isAbsolute()Z
move-result v1
if-eqz v1, :cond_0
.line 435
:goto_0
return-object v0
:cond_0
new-instance v0, Ljava/io/File;
invoke-virtual {p0}, Ljava/io/File;->getParentFile()Ljava/io/File;
move-result-object v1
const/16 v2, 0x2f
sget-char v3, Ljava/io/File;->separatorChar:C
invoke-virtual {p1, v2, v3}, Ljava/lang/String;->replace(CC)Ljava/lang/String;
move-result-object v2
invoke-direct {v0, v1, v2}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
invoke-virtual {v0}, Ljava/io/File;->toURI()Ljava/net/URI;
move-result-object v0
goto :goto_0
.end method
.method static getClassPathFromManifest(Ljava/io/File;Ljava/util/jar/Manifest;)Lcom/google/common/collect/ImmutableSet;
.locals 6
.param p1 # Ljava/util/jar/Manifest;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation build Lcom/google/common/annotations/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/io/File;",
"Ljava/util/jar/Manifest;",
")",
"Lcom/google/common/collect/ImmutableSet",
"<",
"Ljava/net/URI;",
">;"
}
.end annotation
.prologue
.line 401
if-nez p1, :cond_0
.line 402
invoke-static {}, Lcom/google/common/collect/ImmutableSet;->of()Lcom/google/common/collect/ImmutableSet;
move-result-object v0
.line 420
:goto_0
return-object v0
.line 404
:cond_0
invoke-static {}, Lcom/google/common/collect/ImmutableSet;->builder()Lcom/google/common/collect/ImmutableSet$Builder;
move-result-object v1
.line 405
invoke-virtual {p1}, Ljava/util/jar/Manifest;->getMainAttributes()Ljava/util/jar/Attributes;
move-result-object v0
sget-object v2, Ljava/util/jar/Attributes$Name;->CLASS_PATH:Ljava/util/jar/Attributes$Name;
invoke-virtual {v2}, Ljava/util/jar/Attributes$Name;->toString()Ljava/lang/String;
move-result-object v2
invoke-virtual {v0, v2}, Ljava/util/jar/Attributes;->getValue(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
.line 407
if-eqz v0, :cond_1
.line 408
invoke-static {}, Lcom/google/common/reflect/ClassPath;->access$200()Lcom/google/common/base/Splitter;
move-result-object v2
invoke-virtual {v2, v0}, Lcom/google/common/base/Splitter;->split(Ljava/lang/CharSequence;)Ljava/lang/Iterable;
move-result-object v0
invoke-interface {v0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object v2
:goto_1
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_1
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/String;
.line 411
:try_start_0
invoke-static {p0, v0}, Lcom/google/common/reflect/ClassPath$Scanner;->getClassPathEntry(Ljava/io/File;Ljava/lang/String;)Ljava/net/URI;
:try_end_0
.catch Ljava/net/URISyntaxException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v0
.line 417
invoke-virtual {v1, v0}, Lcom/google/common/collect/ImmutableSet$Builder;->add(Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet$Builder;
goto :goto_1
.line 412
:catch_0
move-exception v3
.line 414
invoke-static {}, Lcom/google/common/reflect/ClassPath;->access$100()Ljava/util/logging/Logger;
move-result-object v3
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "Invalid Class-Path entry: "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v3, v0}, Ljava/util/logging/Logger;->warning(Ljava/lang/String;)V
goto :goto_1
.line 420
:cond_1
invoke-virtual {v1}, Lcom/google/common/collect/ImmutableSet$Builder;->build()Lcom/google/common/collect/ImmutableSet;
move-result-object v0
goto :goto_0
.end method
.method private scanDirectory(Ljava/io/File;Ljava/lang/ClassLoader;)V
.locals 2
.prologue
.line 332
const-string v0, ""
invoke-static {}, Lcom/google/common/collect/ImmutableSet;->of()Lcom/google/common/collect/ImmutableSet;
move-result-object v1
invoke-direct {p0, p1, p2, v0, v1}, Lcom/google/common/reflect/ClassPath$Scanner;->scanDirectory(Ljava/io/File;Ljava/lang/ClassLoader;Ljava/lang/String;Lcom/google/common/collect/ImmutableSet;)V
.line 333
return-void
.end method
.method private scanDirectory(Ljava/io/File;Ljava/lang/ClassLoader;Ljava/lang/String;Lcom/google/common/collect/ImmutableSet;)V
.locals 7
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/io/File;",
"Ljava/lang/ClassLoader;",
"Ljava/lang/String;",
"Lcom/google/common/collect/ImmutableSet",
"<",
"Ljava/io/File;",
">;)V"
}
.end annotation
.prologue
.line 338
invoke-virtual {p1}, Ljava/io/File;->getCanonicalFile()Ljava/io/File;
move-result-object v0
.line 339
invoke-virtual {p4, v0}, Lcom/google/common/collect/ImmutableSet;->contains(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_1
.line 364
:cond_0
:goto_0
return-void
.line 343
:cond_1
invoke-virtual {p1}, Ljava/io/File;->listFiles()[Ljava/io/File;
move-result-object v1
.line 344
if-nez v1, :cond_2
.line 345
invoke-static {}, Lcom/google/common/reflect/ClassPath;->access$100()Ljava/util/logging/Logger;
move-result-object v0
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Cannot read directory "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/util/logging/Logger;->warning(Ljava/lang/String;)V
goto :goto_0
.line 349
:cond_2
invoke-static {}, Lcom/google/common/collect/ImmutableSet;->builder()Lcom/google/common/collect/ImmutableSet$Builder;
move-result-object v2
invoke-virtual {v2, p4}, Lcom/google/common/collect/ImmutableSet$Builder;->addAll(Ljava/lang/Iterable;)Lcom/google/common/collect/ImmutableSet$Builder;
move-result-object v2
invoke-virtual {v2, v0}, Lcom/google/common/collect/ImmutableSet$Builder;->add(Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet$Builder;
move-result-object v0
invoke-virtual {v0}, Lcom/google/common/collect/ImmutableSet$Builder;->build()Lcom/google/common/collect/ImmutableSet;
move-result-object v2
.line 353
array-length v3, v1
const/4 v0, 0x0
:goto_1
if-ge v0, v3, :cond_0
aget-object v4, v1, v0
.line 354
invoke-virtual {v4}, Ljava/io/File;->getName()Ljava/lang/String;
move-result-object v5
.line 355
invoke-virtual {v4}, Ljava/io/File;->isDirectory()Z
move-result v6
if-eqz v6, :cond_4
.line 356
new-instance v6, Ljava/lang/StringBuilder;
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v6, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
invoke-virtual {v6, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
const-string v6, "/"
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v5
invoke-direct {p0, v4, p2, v5, v2}, Lcom/google/common/reflect/ClassPath$Scanner;->scanDirectory(Ljava/io/File;Ljava/lang/ClassLoader;Ljava/lang/String;Lcom/google/common/collect/ImmutableSet;)V
.line 353
:cond_3
:goto_2
add-int/lit8 v0, v0, 0x1
goto :goto_1
.line 358
:cond_4
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v4, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
.line 359
const-string v5, "META-INF/MANIFEST.MF"
invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v5
if-nez v5, :cond_3
.line 360
iget-object v5, p0, Lcom/google/common/reflect/ClassPath$Scanner;->resources:Lcom/google/common/collect/ImmutableSortedSet$Builder;
invoke-static {v4, p2}, Lcom/google/common/reflect/ClassPath$ResourceInfo;->of(Ljava/lang/String;Ljava/lang/ClassLoader;)Lcom/google/common/reflect/ClassPath$ResourceInfo;
move-result-object v4
invoke-virtual {v5, v4}, Lcom/google/common/collect/ImmutableSortedSet$Builder;->add(Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSortedSet$Builder;
goto :goto_2
.end method
.method private scanJar(Ljava/io/File;Ljava/lang/ClassLoader;)V
.locals 5
.prologue
.line 369
:try_start_0
new-instance v1, Ljava/util/jar/JarFile;
invoke-direct {v1, p1}, Ljava/util/jar/JarFile;-><init>(Ljava/io/File;)V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
.line 375
:try_start_1
invoke-virtual {v1}, Ljava/util/jar/JarFile;->getManifest()Ljava/util/jar/Manifest;
move-result-object v0
invoke-static {p1, v0}, Lcom/google/common/reflect/ClassPath$Scanner;->getClassPathFromManifest(Ljava/io/File;Ljava/util/jar/Manifest;)Lcom/google/common/collect/ImmutableSet;
move-result-object v0
invoke-virtual {v0}, Lcom/google/common/collect/ImmutableSet;->iterator()Ljava/util/Iterator;
move-result-object v2
:goto_0
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_0
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/net/URI;
.line 376
invoke-virtual {p0, v0, p2}, Lcom/google/common/reflect/ClassPath$Scanner;->scan(Ljava/net/URI;Ljava/lang/ClassLoader;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_0
.line 387
:catchall_0
move-exception v0
.line 388
:try_start_2
invoke-virtual {v1}, Ljava/util/jar/JarFile;->close()V
:try_end_2
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1
.line 389
:goto_1
throw v0
.line 378
:cond_0
:try_start_3
invoke-virtual {v1}, Ljava/util/jar/JarFile;->entries()Ljava/util/Enumeration;
move-result-object v2
.line 379
:cond_1
:goto_2
invoke-interface {v2}, Ljava/util/Enumeration;->hasMoreElements()Z
move-result v0
if-eqz v0, :cond_2
.line 380
invoke-interface {v2}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/jar/JarEntry;
.line 381
invoke-virtual {v0}, Ljava/util/jar/JarEntry;->isDirectory()Z
move-result v3
if-nez v3, :cond_1
invoke-virtual {v0}, Ljava/util/jar/JarEntry;->getName()Ljava/lang/String;
move-result-object v3
const-string v4, "META-INF/MANIFEST.MF"
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-nez v3, :cond_1
.line 384
iget-object v3, p0, Lcom/google/common/reflect/ClassPath$Scanner;->resources:Lcom/google/common/collect/ImmutableSortedSet$Builder;
invoke-virtual {v0}, Ljava/util/jar/JarEntry;->getName()Ljava/lang/String;
move-result-object v0
invoke-static {v0, p2}, Lcom/google/common/reflect/ClassPath$ResourceInfo;->of(Ljava/lang/String;Ljava/lang/ClassLoader;)Lcom/google/common/reflect/ClassPath$ResourceInfo;
move-result-object v0
invoke-virtual {v3, v0}, Lcom/google/common/collect/ImmutableSortedSet$Builder;->add(Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSortedSet$Builder;
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0
goto :goto_2
.line 388
:cond_2
:try_start_4
invoke-virtual {v1}, Ljava/util/jar/JarFile;->close()V
:try_end_4
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_0
.line 391
:goto_3
return-void
.line 389
:catch_0
move-exception v0
goto :goto_3
:catch_1
move-exception v1
goto :goto_1
.line 370
:catch_2
move-exception v0
goto :goto_3
.end method
# virtual methods
.method getResources()Lcom/google/common/collect/ImmutableSortedSet;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lcom/google/common/collect/ImmutableSortedSet",
"<",
"Lcom/google/common/reflect/ClassPath$ResourceInfo;",
">;"
}
.end annotation
.prologue
.line 310
iget-object v0, p0, Lcom/google/common/reflect/ClassPath$Scanner;->resources:Lcom/google/common/collect/ImmutableSortedSet$Builder;
invoke-virtual {v0}, Lcom/google/common/collect/ImmutableSortedSet$Builder;->build()Lcom/google/common/collect/ImmutableSortedSet;
move-result-object v0
return-object v0
.end method
.method scan(Ljava/net/URI;Ljava/lang/ClassLoader;)V
.locals 2
.prologue
.line 314
invoke-virtual {p1}, Ljava/net/URI;->getScheme()Ljava/lang/String;
move-result-object v0
const-string v1, "file"
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/google/common/reflect/ClassPath$Scanner;->scannedUris:Ljava/util/Set;
invoke-interface {v0, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
.line 315
new-instance v0, Ljava/io/File;
invoke-direct {v0, p1}, Ljava/io/File;-><init>(Ljava/net/URI;)V
invoke-virtual {p0, v0, p2}, Lcom/google/common/reflect/ClassPath$Scanner;->scanFrom(Ljava/io/File;Ljava/lang/ClassLoader;)V
.line 317
:cond_0
return-void
.end method
.method scanFrom(Ljava/io/File;Ljava/lang/ClassLoader;)V
.locals 1
.annotation build Lcom/google/common/annotations/VisibleForTesting;
.end annotation
.prologue
.line 321
invoke-virtual {p1}, Ljava/io/File;->exists()Z
move-result v0
if-nez v0, :cond_0
.line 329
:goto_0
return-void
.line 324
:cond_0
invoke-virtual {p1}, Ljava/io/File;->isDirectory()Z
move-result v0
if-eqz v0, :cond_1
.line 325
invoke-direct {p0, p1, p2}, Lcom/google/common/reflect/ClassPath$Scanner;->scanDirectory(Ljava/io/File;Ljava/lang/ClassLoader;)V
goto :goto_0
.line 327
:cond_1
invoke-direct {p0, p1, p2}, Lcom/google/common/reflect/ClassPath$Scanner;->scanJar(Ljava/io/File;Ljava/lang/ClassLoader;)V
goto :goto_0
.end method