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
9c90699c
Commit
9c90699c
authored
Jun 15, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix parsing of generic signature with inner classes
parent
b67cd50e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
11 deletions
+27
-11
SignatureParser.java
...main/java/jadx/core/dex/nodes/parser/SignatureParser.java
+8
-3
Utils.java
jadx-core/src/main/java/jadx/core/utils/Utils.java
+1
-2
TestSignatureParser.groovy
...ore/src/test/groovy/jadx/tests/TestSignatureParser.groovy
+18
-6
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/parser/SignatureParser.java
View file @
9c90699c
...
...
@@ -6,7 +6,6 @@ import jadx.core.dex.attributes.annotations.Annotation;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedList
;
...
...
@@ -159,7 +158,13 @@ public class SignatureParser {
}
while
(
ch
!=
'<'
&&
ch
!=
';'
);
if
(
ch
==
';'
)
{
return
ArgType
.
object
(
incompleteType
?
slice
()
:
inclusiveSlice
());
String
obj
;
if
(
incompleteType
)
{
obj
=
slice
().
replace
(
'/'
,
'.'
);
}
else
{
obj
=
inclusiveSlice
();
}
return
ArgType
.
object
(
obj
);
}
else
{
// generic type start ('<')
String
obj
=
slice
();
...
...
@@ -184,7 +189,7 @@ public class SignatureParser {
}
private
ArgType
[]
consumeGenericArgs
()
{
List
<
ArgType
>
list
=
new
ArrayList
<
ArgType
>(
1
);
List
<
ArgType
>
list
=
new
LinkedList
<
ArgType
>(
);
ArgType
type
;
do
{
if
(
lookAhead
(
'*'
))
{
...
...
jadx-core/src/main/java/jadx/core/utils/Utils.java
View file @
9c90699c
...
...
@@ -16,9 +16,8 @@ public class Utils {
int
last
=
obj
.
length
()
-
1
;
if
(
obj
.
charAt
(
0
)
==
'L'
&&
obj
.
charAt
(
last
)
==
';'
)
{
return
obj
.
substring
(
1
,
last
).
replace
(
'/'
,
'.'
);
}
else
{
return
obj
;
}
return
obj
;
}
public
static
String
makeQualifiedObjectName
(
String
obj
)
{
...
...
jadx-core/src/test/groovy/jadx/tests/TestSignatureParser.groovy
View file @
9c90699c
...
...
@@ -26,12 +26,14 @@ class TestSignatureParser extends Specification {
new
SignatureParser
(
str
).
consumeType
()
==
result
where:
str
|
result
"TD;"
|
genericType
(
"D"
)
"La<TV;Lb;>;"
|
generic
(
"La;"
,
genericType
(
"V"
),
object
(
"b"
))
"La<Lb<Lc;>;>;"
|
generic
(
"La;"
,
generic
(
"Lb;"
,
object
(
"Lc;"
)))
"La<TD;>.c;"
|
genericInner
(
generic
(
"La;"
,
genericType
(
"D"
)),
"c"
,
null
)
"La<Lb;>.c<TV;>;"
|
genericInner
(
generic
(
"La;"
,
object
(
"Lb;"
)),
"c"
,
genericType
(
"V"
))
str
|
result
"TD;"
|
genericType
(
"D"
)
"La<TV;Lb;>;"
|
generic
(
"La;"
,
genericType
(
"V"
),
object
(
"b"
))
"La<Lb<Lc;>;>;"
|
generic
(
"La;"
,
generic
(
"Lb;"
,
object
(
"Lc;"
)))
"La/b/C<Ld/E<Lf/G;>;>;"
|
generic
(
"La/b/C;"
,
generic
(
"Ld/E;"
,
object
(
"Lf/G;"
)))
"La<TD;>.c;"
|
genericInner
(
generic
(
"La;"
,
genericType
(
"D"
)),
"c"
,
null
)
"La<TD;>.c/d;"
|
genericInner
(
generic
(
"La;"
,
genericType
(
"D"
)),
"c.d"
,
null
)
"La<Lb;>.c<TV;>;"
|
genericInner
(
generic
(
"La;"
,
object
(
"Lb;"
)),
"c"
,
genericType
(
"V"
))
}
def
"inner generic"
()
{
...
...
@@ -85,6 +87,16 @@ class TestSignatureParser extends Specification {
argTypes
.
get
(
0
)
==
generic
(
"Ljava/util/List;"
,
wildcard
())
}
def
"method args 2"
()
{
when:
def
argTypes
=
new
SignatureParser
(
"(La/b/C<TT;>.d/E;)V"
).
consumeMethodArgs
()
then:
argTypes
.
size
()
==
1
def
argType
=
argTypes
.
get
(
0
)
argType
.
getObject
().
indexOf
(
'/'
)
==
-
1
argTypes
.
get
(
0
)
==
genericInner
(
generic
(
"La/b/C;"
,
genericType
(
"T"
)),
"d.E"
,
null
)
}
def
"generic map: bad signature"
()
{
when:
def
map
=
new
SignatureParser
(
"<A:Ljava/lang/Object;B"
).
consumeGenericMap
()
...
...
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