-
-
Notifications
You must be signed in to change notification settings - Fork 271
fix: Replace dex input streams with file references #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,8 +90,8 @@ public final class app/revanced/patcher/PatcherResult { | |
| } | ||
|
|
||
| public final class app/revanced/patcher/PatcherResult$PatchedDexFile { | ||
| public final fun getFile ()Ljava/io/File; | ||
| public final fun getName ()Ljava/lang/String; | ||
| public final fun getStream ()Ljava/io/InputStream; | ||
| } | ||
|
|
||
| public final class app/revanced/patcher/PatcherResult$PatchedResources { | ||
|
|
@@ -171,9 +171,12 @@ public final class app/revanced/patcher/patch/BytecodePatchContext : app/revance | |
| public final class app/revanced/patcher/patch/Option { | ||
| public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure where these changes came from. Maybe previous merge that didn't run apiDump? |
||
| public final fun getDefault ()Ljava/lang/Object; | ||
| public final fun getDescription ()Ljava/lang/String; | ||
| public final fun getKey ()Ljava/lang/String; | ||
| public final fun getName ()Ljava/lang/String; | ||
| public final fun getRequired ()Z | ||
| public final fun getTitle ()Ljava/lang/String; | ||
| public final fun getType ()Lkotlin/reflect/KType; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,7 +152,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi | |
| DexIO.DEFAULT_MAX_DEX_POOL_SIZE, | ||
| ) { _, entryName, _ -> logger.info { "Compiled $entryName" } } | ||
| }.listFiles(FileFilter { it.isFile })!!.map { | ||
| PatcherResult.PatchedDexFile(it.name, it.inputStream()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The input stream can be simply closed here via a use block. No need to convert to a file.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just adding a This is why I advocate passing around a file reference instead of an open stream; it's much easier to reason about.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fact that Patcher is dumping the dex to a file is not something that any other library should take advantage of. It is merely done for caching purposes and no other purpose. In the most basic form patcher has no "requirements" for or does not require anyone to work with files. A stream is all that's needed. If a consuming library needs to convert it to a file it's free to, if one doesn't then there is no reason to require working with files in the first place. If the stream needs to be open, then the use block should not be used here and whatever consumes the stream should simply close the stream. |
||
| PatcherResult.PatchedDexFile(it.name, it) | ||
| }.toSet() | ||
|
|
||
| System.gc() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks API, please add this back with a deprecated annotation