forked from skylot/jadx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for 'package-info' (skylot#1967)
- Loading branch information
Showing
11 changed files
with
94 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ public enum AFlag { | |
THIS, | ||
SUPER, | ||
|
||
PACKAGE_INFO, | ||
|
||
/** | ||
* Mark Android resources class | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
jadx-core/src/test/java/jadx/tests/integration/special/TestPackageInfoSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package jadx.tests.integration.special; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.core.dex.nodes.ClassNode; | ||
import jadx.tests.api.SmaliTest; | ||
|
||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; | ||
|
||
public class TestPackageInfoSupport extends SmaliTest { | ||
|
||
@Test | ||
public void test() { | ||
disableCompilation(); | ||
List<ClassNode> classes = loadFromSmaliFiles(); | ||
assertThat(searchCls(classes, "special.pkg1.package-info")) | ||
.satisfies(cls -> assertThat(cls.getAlias()).isEqualTo("package-info")) // shouldn't be renamed | ||
.code() | ||
.containsLines( | ||
"@Deprecated", | ||
"package special.pkg1;"); | ||
assertThat(searchCls(classes, "special.pkg2.package-info")) | ||
.code() | ||
.containsLines( | ||
"@ApiStatus.Internal", | ||
"package special.pkg2;", | ||
"", | ||
"import org.jetbrains.annotations.ApiStatus;"); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
jadx-core/src/test/smali/special/TestPackageInfoSupport/pkg1.smali
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.class interface abstract synthetic Lspecial/pkg1/package-info; | ||
.super Ljava/lang/Object; | ||
.source "package-info.java" | ||
|
||
.annotation runtime Ljava/lang/Deprecated; | ||
.end annotation |
5 changes: 5 additions & 0 deletions
5
jadx-core/src/test/smali/special/TestPackageInfoSupport/pkg2.smali
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.class interface abstract synthetic Lspecial/pkg2/package-info; | ||
.super Ljava/lang/Object; | ||
|
||
.annotation runtime Lorg/jetbrains/annotations/ApiStatus$Internal; | ||
.end annotation |