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
62826334
Commit
62826334
authored
May 12, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(gui): use alias for field and method types in tree view
parent
19cf7c9f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
8 deletions
+58
-8
JavaField.java
jadx-core/src/main/java/jadx/api/JavaField.java
+1
-1
JavaMethod.java
jadx-core/src/main/java/jadx/api/JavaMethod.java
+22
-2
ArgType.java
...rc/main/java/jadx/core/dex/instructions/args/ArgType.java
+27
-0
MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+1
-2
Utils.java
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
+7
-3
No files found.
jadx-core/src/main/java/jadx/api/JavaField.java
View file @
62826334
...
@@ -39,7 +39,7 @@ public final class JavaField implements JavaNode {
...
@@ -39,7 +39,7 @@ public final class JavaField implements JavaNode {
}
}
public
ArgType
getType
()
{
public
ArgType
getType
()
{
return
field
.
getType
(
);
return
ArgType
.
tryToResolveClassAlias
(
field
.
dex
(),
field
.
getType
()
);
}
}
public
int
getDecompiledLine
()
{
public
int
getDecompiledLine
()
{
...
...
jadx-core/src/main/java/jadx/api/JavaMethod.java
View file @
62826334
package
jadx
.
api
;
package
jadx
.
api
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
jadx.core.dex.info.AccessInfo
;
import
jadx.core.dex.info.AccessInfo
;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.instructions.args.RegisterArg
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.nodes.MethodNode
;
public
final
class
JavaMethod
implements
JavaNode
{
public
final
class
JavaMethod
implements
JavaNode
{
...
@@ -40,11 +44,27 @@ public final class JavaMethod implements JavaNode {
...
@@ -40,11 +44,27 @@ public final class JavaMethod implements JavaNode {
}
}
public
List
<
ArgType
>
getArguments
()
{
public
List
<
ArgType
>
getArguments
()
{
return
mth
.
getMethodInfo
().
getArgumentsTypes
();
if
(
mth
.
getMethodInfo
().
getArgumentsTypes
().
isEmpty
())
{
return
Collections
.
emptyList
();
}
List
<
RegisterArg
>
arguments
=
mth
.
getArguments
(
false
);
Stream
<
ArgType
>
argTypeStream
;
if
(
arguments
==
null
||
arguments
.
isEmpty
()
||
mth
.
isNoCode
())
{
argTypeStream
=
mth
.
getMethodInfo
().
getArgumentsTypes
().
stream
();
}
else
{
argTypeStream
=
arguments
.
stream
().
map
(
RegisterArg:
:
getType
);
}
return
argTypeStream
.
map
(
type
->
ArgType
.
tryToResolveClassAlias
(
mth
.
dex
(),
type
))
.
collect
(
Collectors
.
toList
());
}
}
public
ArgType
getReturnType
()
{
public
ArgType
getReturnType
()
{
return
mth
.
getReturnType
();
ArgType
retType
=
mth
.
getReturnType
();
if
(
retType
==
null
)
{
retType
=
mth
.
getMethodInfo
().
getReturnType
();
}
return
ArgType
.
tryToResolveClassAlias
(
mth
.
dex
(),
retType
);
}
}
public
boolean
isConstructor
()
{
public
boolean
isConstructor
()
{
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/ArgType.java
View file @
62826334
...
@@ -5,6 +5,8 @@ import java.util.Collections;
...
@@ -5,6 +5,8 @@ import java.util.Collections;
import
java.util.List
;
import
java.util.List
;
import
jadx.core.Consts
;
import
jadx.core.Consts
;
import
jadx.core.dex.info.ClassInfo
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.DexNode
;
import
jadx.core.dex.nodes.DexNode
;
import
jadx.core.dex.nodes.RootNode
;
import
jadx.core.dex.nodes.RootNode
;
import
jadx.core.dex.nodes.parser.SignatureParser
;
import
jadx.core.dex.nodes.parser.SignatureParser
;
...
@@ -620,6 +622,31 @@ public abstract class ArgType {
...
@@ -620,6 +622,31 @@ public abstract class ArgType {
return
1
;
return
1
;
}
}
public
static
ArgType
tryToResolveClassAlias
(
DexNode
dex
,
ArgType
type
)
{
if
(!
type
.
isObject
()
||
type
.
isGenericType
())
{
return
type
;
}
ClassNode
cls
=
dex
.
resolveClass
(
type
);
if
(
cls
==
null
)
{
return
type
;
}
ClassInfo
clsInfo
=
cls
.
getClassInfo
();
if
(!
clsInfo
.
hasAlias
())
{
return
type
;
}
String
aliasFullName
=
clsInfo
.
getAliasFullName
();
if
(
type
.
isGeneric
())
{
if
(
type
instanceof
GenericObject
)
{
return
new
GenericObject
(
aliasFullName
,
type
.
getGenericTypes
());
}
if
(
type
instanceof
WildcardType
)
{
return
new
WildcardType
(
ArgType
.
object
(
aliasFullName
),
type
.
getWildcardBounds
());
}
}
return
ArgType
.
object
(
aliasFullName
);
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"ARG_TYPE"
;
return
"ARG_TYPE"
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
View file @
62826334
...
@@ -91,9 +91,8 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
...
@@ -91,9 +91,8 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
if
(
noCode
)
{
if
(
noCode
)
{
return
;
return
;
}
}
retType
=
null
;
// don't unload retType and argsList, will be used in jadx-gui after class unload
thisArg
=
null
;
thisArg
=
null
;
argsList
=
Collections
.
emptyList
();
sVars
=
Collections
.
emptyList
();
sVars
=
Collections
.
emptyList
();
genericMap
=
null
;
genericMap
=
null
;
instructions
=
null
;
instructions
=
null
;
...
...
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
View file @
62826334
...
@@ -65,17 +65,21 @@ public class Utils {
...
@@ -65,17 +65,21 @@ public class Utils {
}
}
public
static
String
typeFormat
(
String
name
,
ArgType
type
)
{
public
static
String
typeFormat
(
String
name
,
ArgType
type
)
{
return
"<html><body><nobr>"
+
name
return
"<html><body><nobr>"
+
escapeHtml
(
name
)
+
"<span style='color:#888888;'>
: "
+
typeStr
(
type
)
+
"</span>"
+
"<span style='color:#888888;'>
"
+
escapeHtml
(
typeStr
(
type
)
)
+
"</span>"
+
"</nobr></body></html>"
;
+
"</nobr></body></html>"
;
}
}
public
static
String
escapeHtml
(
String
str
)
{
return
str
.
replace
(
"<"
,
"<"
);
}
public
static
String
typeStr
(
ArgType
type
)
{
public
static
String
typeStr
(
ArgType
type
)
{
if
(
type
==
null
)
{
if
(
type
==
null
)
{
return
"null"
;
return
"null"
;
}
}
if
(
type
.
isObject
())
{
if
(
type
.
isObject
())
{
String
cls
=
type
.
getObject
();
String
cls
=
type
.
toString
();
int
dot
=
cls
.
lastIndexOf
(
'.'
);
int
dot
=
cls
.
lastIndexOf
(
'.'
);
if
(
dot
!=
-
1
)
{
if
(
dot
!=
-
1
)
{
return
cls
.
substring
(
dot
+
1
);
return
cls
.
substring
(
dot
+
1
);
...
...
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