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
89b80900
Commit
89b80900
authored
Apr 04, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: produce more deterministic code
parent
f1539d2e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
18 deletions
+27
-18
ClassGen.java
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
+3
-3
AttributeStorage.java
.../main/java/jadx/core/dex/attributes/AttributeStorage.java
+2
-0
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+6
-4
DependencyCollector.java
...main/java/jadx/core/dex/visitors/DependencyCollector.java
+12
-4
TypeInferenceVisitor.java
...core/dex/visitors/typeinference/TypeInferenceVisitor.java
+4
-7
No files found.
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
View file @
89b80900
...
...
@@ -332,7 +332,7 @@ public class ClassGen {
private
void
insertDecompilationProblems
(
CodeWriter
code
,
AttrNode
node
)
{
List
<
JadxError
>
errors
=
node
.
getAll
(
AType
.
JADX_ERROR
);
if
(!
errors
.
isEmpty
())
{
errors
.
forEach
(
err
->
{
errors
.
stream
().
sorted
().
forEach
(
err
->
{
code
.
startLine
(
"/* JADX ERROR: "
).
add
(
err
.
getError
());
Throwable
cause
=
err
.
getCause
();
if
(
cause
!=
null
)
{
...
...
@@ -345,8 +345,8 @@ public class ClassGen {
}
List
<
String
>
warns
=
node
.
getAll
(
AType
.
JADX_WARN
);
if
(!
warns
.
isEmpty
())
{
warns
.
stream
().
distinct
()
.
forEach
(
warn
->
code
.
startLine
(
"/* JADX WARNING: "
).
addMultiLine
(
warn
).
add
(
" */"
));
warns
.
stream
().
distinct
()
.
sorted
()
.
forEach
(
warn
->
code
.
startLine
(
"/* JADX WARNING: "
).
addMultiLine
(
warn
).
add
(
" */"
));
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/AttributeStorage.java
View file @
89b80900
...
...
@@ -2,6 +2,7 @@ package jadx.core.dex.attributes;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.EnumSet
;
import
java.util.IdentityHashMap
;
import
java.util.List
;
...
...
@@ -121,6 +122,7 @@ public class AttributeStorage {
if
(
list
.
isEmpty
())
{
return
""
;
}
list
.
sort
(
String:
:
compareTo
);
return
"A["
+
Utils
.
listToString
(
list
)
+
']'
;
}
}
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
89b80900
...
...
@@ -3,10 +3,8 @@ package jadx.core.dex.nodes;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
com.android.dex.ClassData
;
import
com.android.dex.ClassData.Field
;
...
...
@@ -60,7 +58,7 @@ public class ClassNode extends LineAttrNode implements ILoadable, ICodeNode {
private
ClassNode
parentClass
;
private
ProcessState
state
=
ProcessState
.
NOT_LOADED
;
private
final
Set
<
ClassNode
>
dependencies
=
new
HashSet
<>
();
private
List
<
ClassNode
>
dependencies
=
Collections
.
emptyList
();
// cache maps
private
Map
<
MethodInfo
,
MethodNode
>
mthInfoMap
=
Collections
.
emptyMap
();
...
...
@@ -527,10 +525,14 @@ public class ClassNode extends LineAttrNode implements ILoadable, ICodeNode {
this
.
state
=
state
;
}
public
Se
t
<
ClassNode
>
getDependencies
()
{
public
Lis
t
<
ClassNode
>
getDependencies
()
{
return
dependencies
;
}
public
void
setDependencies
(
List
<
ClassNode
>
dependencies
)
{
this
.
dependencies
=
dependencies
;
}
@Override
public
int
hashCode
()
{
return
clsInfo
.
hashCode
();
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/DependencyCollector.java
View file @
89b80900
package
jadx
.
core
.
dex
.
visitors
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
jadx.core.dex.attributes.AType
;
...
...
@@ -26,12 +30,16 @@ public class DependencyCollector extends AbstractVisitor {
@Override
public
boolean
visit
(
ClassNode
cls
)
throws
JadxException
{
DexNode
dex
=
cls
.
dex
();
Set
<
ClassNode
>
dep
List
=
cls
.
getDependencies
();
processClass
(
cls
,
dex
,
dep
Lis
t
);
Set
<
ClassNode
>
dep
Set
=
new
HashSet
<>
();
processClass
(
cls
,
dex
,
dep
Se
t
);
for
(
ClassNode
inner
:
cls
.
getInnerClasses
())
{
processClass
(
inner
,
dex
,
dep
Lis
t
);
processClass
(
inner
,
dex
,
dep
Se
t
);
}
depList
.
remove
(
cls
);
depSet
.
remove
(
cls
);
List
<
ClassNode
>
depList
=
new
ArrayList
<>(
depSet
);
depList
.
sort
(
Comparator
.
comparing
(
c
->
c
.
getClassInfo
().
getFullName
()));
cls
.
setDependencies
(
depList
);
return
false
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeInferenceVisitor.java
View file @
89b80900
...
...
@@ -90,18 +90,15 @@ public final class TypeInferenceVisitor extends AbstractVisitor {
}
private
void
runMultiVariableSearch
(
MethodNode
mth
)
{
long
startTime
=
System
.
currentTimeMillis
();
TypeSearch
typeSearch
=
new
TypeSearch
(
mth
);
boolean
success
;
try
{
success
=
typeSearch
.
run
();
boolean
success
=
typeSearch
.
run
();
if
(!
success
)
{
mth
.
addWarn
(
"Multi-variable type inference failed"
);
}
}
catch
(
Exception
e
)
{
success
=
false
;
mth
.
addWarn
(
"Multi-variable type inference failed. Error: "
+
Utils
.
getStackTrace
(
e
));
}
long
time
=
System
.
currentTimeMillis
()
-
startTime
;
mth
.
addComment
(
"JADX DEBUG: Multi-variable type inference result: "
+
(
success
?
"success"
:
"failure"
)
+
", time: "
+
time
+
" ms"
);
}
private
boolean
setImmutableType
(
SSAVar
ssaVar
)
{
...
...
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