Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
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
68d074ae
Commit
68d074ae
authored
Feb 27, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: change type update collection to produce deterministic results
parent
0df5aa80
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
11 deletions
+48
-11
TypeUpdate.java
...java/jadx/core/dex/visitors/typeinference/TypeUpdate.java
+2
-3
TypeUpdateEntry.java
...jadx/core/dex/visitors/typeinference/TypeUpdateEntry.java
+31
-0
TypeUpdateInfo.java
.../jadx/core/dex/visitors/typeinference/TypeUpdateInfo.java
+15
-8
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeUpdate.java
View file @
68d074ae
...
...
@@ -18,7 +18,6 @@ import jadx.core.dex.instructions.args.InsnArg;
import
jadx.core.dex.instructions.args.PrimitiveType
;
import
jadx.core.dex.instructions.args.RegisterArg
;
import
jadx.core.dex.instructions.args.SSAVar
;
import
jadx.core.dex.instructions.args.Typed
;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.dex.nodes.RootNode
;
import
jadx.core.utils.exceptions.JadxOverflowException
;
...
...
@@ -57,11 +56,11 @@ public final class TypeUpdate {
if
(
result
==
REJECT
)
{
return
result
;
}
Map
<
InsnArg
,
ArgType
>
updates
=
updateInfo
.
getUpdates
();
List
<
TypeUpdateEntry
>
updates
=
updateInfo
.
getUpdates
();
if
(
updates
.
isEmpty
())
{
return
SAME
;
}
updates
.
forEach
(
Type
d:
:
setType
);
updates
.
forEach
(
Type
UpdateEntry:
:
apply
);
return
CHANGED
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeUpdateEntry.java
0 → 100644
View file @
68d074ae
package
jadx
.
core
.
dex
.
visitors
.
typeinference
;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.instructions.args.InsnArg
;
public
final
class
TypeUpdateEntry
{
private
final
InsnArg
arg
;
private
final
ArgType
type
;
public
TypeUpdateEntry
(
InsnArg
arg
,
ArgType
type
)
{
this
.
arg
=
arg
;
this
.
type
=
type
;
}
public
void
apply
()
{
arg
.
setType
(
type
);
}
public
InsnArg
getArg
()
{
return
arg
;
}
public
ArgType
getType
()
{
return
type
;
}
@Override
public
String
toString
()
{
return
"TypeUpdateEntry{"
+
arg
+
" -> "
+
type
+
'}'
;
}
}
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeUpdateInfo.java
View file @
68d074ae
package
jadx
.
core
.
dex
.
visitors
.
typeinference
;
import
java.util.
IdentityHashMap
;
import
java.util.
Map
;
import
java.util.
ArrayList
;
import
java.util.
List
;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.instructions.args.InsnArg
;
public
class
TypeUpdateInfo
{
private
final
Map
<
InsnArg
,
ArgType
>
updates
=
new
IdentityHashMap
<>();
private
final
List
<
TypeUpdateEntry
>
updates
=
new
ArrayList
<>();
public
void
requestUpdate
(
InsnArg
arg
,
ArgType
changeType
)
{
updates
.
put
(
arg
,
changeType
);
updates
.
add
(
new
TypeUpdateEntry
(
arg
,
changeType
)
);
}
public
boolean
isProcessed
(
InsnArg
arg
)
{
return
updates
.
containsKey
(
arg
);
if
(
updates
.
isEmpty
())
{
return
false
;
}
for
(
TypeUpdateEntry
entry
:
updates
)
{
if
(
entry
.
getArg
()
==
arg
)
{
return
true
;
}
}
return
false
;
}
public
void
rollbackUpdate
(
InsnArg
arg
)
{
updates
.
remove
(
arg
);
updates
.
remove
If
(
updateEntry
->
updateEntry
.
getArg
()
==
arg
);
}
public
Map
<
InsnArg
,
ArgType
>
getUpdates
()
{
public
List
<
TypeUpdateEntry
>
getUpdates
()
{
return
updates
;
}
}
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