Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
baea5247
Commit
baea5247
authored
May 11, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: type inference issue (#462)
parent
0ca2789a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
0 deletions
+154
-0
TestTypeResolver8.java
.../java/jadx/tests/integration/types/TestTypeResolver8.java
+47
-0
A.smali
jadx-core/src/test/smali/types/TestTypeResolver8/A.smali
+23
-0
B.smali
jadx-core/src/test/smali/types/TestTypeResolver8/B.smali
+23
-0
TestCls.smali
...core/src/test/smali/types/TestTypeResolver8/TestCls.smali
+61
-0
No files found.
jadx-core/src/test/java/jadx/tests/integration/types/TestTypeResolver8.java
0 → 100644
View file @
baea5247
package
jadx
.
tests
.
integration
.
types
;
import
org.junit.jupiter.api.Test
;
import
jadx.NotYetImplemented
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.SmaliTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
public
class
TestTypeResolver8
extends
SmaliTest
{
// @formatter:off
/*
public class A {}
public class B {
public B(A a) {
}
}
public static class TestCls {
private A f;
public void test() {
A x = this.f;
if (x != null) {
x = new B(x); // different types, type of 'x' can't be resolved
}
use(x);
}
private void use(B b) {}
}
*/
// @formatter:on
@Test
@NotYetImplemented
public
void
test
()
{
ClassNode
cls
=
getClassNodeFromSmaliFiles
(
"types"
,
"TestTypeResolver8"
,
"TestCls"
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"use(a != null ? new B(a) : null);"
));
}
}
jadx-core/src/test/smali/types/TestTypeResolver8/A.smali
0 → 100644
View file @
baea5247
.class public Ltypes/TestCls$A;
.super Ljava/lang/Object;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Ljadx/tests/integration/types/TestTypeResolver8$TestCls;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x9
name = "A"
.end annotation
# direct methods
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
jadx-core/src/test/smali/types/TestTypeResolver8/B.smali
0 → 100644
View file @
baea5247
.class public Ltypes/TestCls$B;
.super Ljava/lang/Object;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Ltypes/TestCls;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x9
name = "B"
.end annotation
# direct methods
.method public constructor <init>(Ltypes/A;)V
.registers 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
jadx-core/src/test/smali/types/TestTypeResolver8/TestCls.smali
0 → 100644
View file @
baea5247
.class public Ltypes/TestCls;
.super Ljava/lang/Object;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Ljadx/tests/integration/types/TestTypeResolver8;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x9
name = "TestCls"
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Ltypes/TestCls$B;,
Ltypes/TestCls$A;
}
.end annotation
# instance fields
.field private f:Ltypes/TestCls$A;
# direct methods
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private use(Ltypes/TestCls$B;)V
.registers 2
return-void
.end method
# virtual methods
.method public test()V
.registers 3
iget-object v1, p0, Ltypes/TestCls;->f:Ltypes/TestCls$A;
if-eqz v1, :cond_a
new-instance v0, Ltypes/TestCls$B;
invoke-direct {v0, v1}, Ltypes/TestCls$B;-><init>(Ltypes/TestCls$A;)V
move v1, v0
:cond_a
invoke-direct {p0, v1}, Ltypes/TestCls;->use(Ltypes/TestCls$B;)V
return-void
.end method
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment