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
7a51c0d0
Commit
7a51c0d0
authored
Mar 10, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix signature processing for local variables
parent
8762125b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
6 deletions
+42
-6
ArgType.java
...rc/main/java/jadx/core/dex/instructions/args/ArgType.java
+1
-1
LocalVar.java
...re/src/main/java/jadx/core/dex/nodes/parser/LocalVar.java
+10
-5
TestGenerics4.java
...test/java/jadx/tests/internal/generics/TestGenerics4.java
+31
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/instructions/args/ArgType.java
View file @
7a51c0d0
...
...
@@ -374,7 +374,7 @@ public abstract class ArgType {
}
public
String
getObject
()
{
throw
new
UnsupportedOperationException
(
"ArgType.getObject()
"
);
throw
new
UnsupportedOperationException
(
"ArgType.getObject()
, call class: "
+
this
.
getClass
()
);
}
public
boolean
isObject
()
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/LocalVar.java
View file @
7a51c0d0
...
...
@@ -34,9 +34,13 @@ final class LocalVar extends RegisterArg {
private
void
init
(
String
name
,
ArgType
type
,
String
sign
)
{
if
(
sign
!=
null
)
{
ArgType
gType
=
ArgType
.
generic
(
sign
);
if
(
checkSignature
(
type
,
sign
,
gType
))
{
type
=
gType
;
try
{
ArgType
gType
=
ArgType
.
generic
(
sign
);
if
(
checkSignature
(
type
,
sign
,
gType
))
{
type
=
gType
;
}
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Can't parse signature for local variable: "
+
sign
,
e
);
}
}
TypedVar
tv
=
new
TypedVar
(
type
);
...
...
@@ -45,10 +49,10 @@ final class LocalVar extends RegisterArg {
}
private
boolean
checkSignature
(
ArgType
type
,
String
sign
,
ArgType
gType
)
{
boolean
apply
=
false
;
boolean
apply
;
ArgType
el
=
gType
.
getArrayRootElement
();
if
(
el
.
isGeneric
())
{
if
(!
type
.
getObject
().
equals
(
el
.
getObject
()))
{
if
(!
type
.
get
ArrayRootElement
().
get
Object
().
equals
(
el
.
getObject
()))
{
LOG
.
warn
(
"Generic type in debug info not equals: {} != {}"
,
type
,
gType
);
}
apply
=
true
;
...
...
@@ -56,6 +60,7 @@ final class LocalVar extends RegisterArg {
apply
=
true
;
}
else
{
LOG
.
debug
(
"Local var signature from debug info not generic: {}, parsed: {}"
,
sign
,
gType
);
apply
=
false
;
}
return
apply
;
}
...
...
jadx-core/src/test/java/jadx/tests/internal/generics/TestGenerics4.java
0 → 100644
View file @
7a51c0d0
package
jadx
.
tests
.
internal
.
generics
;
import
jadx.api.InternalJadxTest
;
import
jadx.core.dex.nodes.ClassNode
;
import
org.junit.Test
;
import
static
org
.
hamcrest
.
CoreMatchers
.
containsString
;
import
static
org
.
hamcrest
.
CoreMatchers
.
not
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestGenerics4
extends
InternalJadxTest
{
public
static
class
TestCls
{
public
static
Class
<?>
method
(
int
i
)
{
Class
<?>[]
a
=
new
Class
<?>[
0
];
return
a
[
a
.
length
-
i
];
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
System
.
out
.
println
(
code
);
assertThat
(
code
,
containsString
(
"Class<?>[] a ="
));
assertThat
(
code
,
not
(
containsString
(
"Class[] a ="
)));
}
}
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