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
3a798cb2
Commit
3a798cb2
authored
Nov 23, 2018
by
Marcin Kamionowski
Committed by
skylot
Nov 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: return type lost after type inference (#396)
parent
1fc92d2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
5 deletions
+41
-5
TypeInference.java
...a/jadx/core/dex/visitors/typeinference/TypeInference.java
+7
-5
TestArrays4.java
.../test/java/jadx/tests/integration/arrays/TestArrays4.java
+34
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeInference.java
View file @
3a798cb2
...
...
@@ -56,11 +56,13 @@ public class TypeInference extends AbstractVisitor {
}
ArgType
type
=
assign
.
getType
();
for
(
RegisterArg
arg
:
useList
)
{
ArgType
useType
=
arg
.
getType
();
ArgType
newType
=
ArgType
.
merge
(
dex
,
type
,
useType
);
if
(
newType
!=
null
)
{
type
=
newType
;
}
ArgType
useType
=
arg
.
getType
();
if
(!
type
.
isTypeKnown
()
||
!
useType
.
isTypeKnown
())
{
ArgType
newType
=
ArgType
.
merge
(
dex
,
type
,
useType
);
if
(
newType
!=
null
)
{
type
=
newType
;
}
}
}
return
type
;
}
...
...
jadx-core/src/test/java/jadx/tests/integration/arrays/TestArrays4.java
0 → 100644
View file @
3a798cb2
package
jadx
.
tests
.
integration
.
arrays
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.SmaliTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
org.junit.Test
;
public
class
TestArrays4
extends
SmaliTest
{
public
static
class
TestCls
{
char
[]
payload
;
public
TestCls
(
byte
[]
bytes
)
{
char
[]
a
=
toChars
(
bytes
);
this
.
payload
=
new
char
[
a
.
length
];
System
.
arraycopy
(
a
,
0
,
this
.
payload
,
0
,
bytes
.
length
);
}
private
static
char
[]
toChars
(
byte
[]
bArr
)
{
return
new
char
[
bArr
.
length
];
}
}
@Test
public
void
testArrayTypeInference
()
{
noDebugInfo
();
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"char[] toChars = toChars(bArr);"
));
}
}
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