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
e5b84d94
Commit
e5b84d94
authored
Feb 15, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix types for constant replace
parent
22e9ac22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+8
-2
ConstInlinerVisitor.java
...main/java/jadx/core/dex/visitors/ConstInlinerVisitor.java
+10
-1
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
e5b84d94
...
...
@@ -279,10 +279,16 @@ public class ClassNode extends LineAttrNode implements ILoadable {
if
(
field
==
null
&&
searchGlobal
)
{
field
=
dex
.
getConstFields
().
get
(
obj
);
}
if
(
field
==
null
&&
obj
instanceof
Integer
)
{
if
(
obj
instanceof
Integer
)
{
String
str
=
dex
.
root
().
getResourcesNames
().
get
(
obj
);
if
(
str
!=
null
)
{
return
new
ResRefField
(
dex
,
str
.
replace
(
'/'
,
'.'
));
ResRefField
resField
=
new
ResRefField
(
dex
,
str
.
replace
(
'/'
,
'.'
));
if
(
field
==
null
)
{
return
resField
;
}
if
(!
field
.
getName
().
equals
(
resField
.
getName
()))
{
field
=
resField
;
}
}
}
return
field
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ConstInlinerVisitor.java
View file @
e5b84d94
...
...
@@ -9,12 +9,14 @@ import jadx.core.dex.instructions.InvokeType;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.instructions.args.InsnArg
;
import
jadx.core.dex.instructions.args.LiteralArg
;
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.nodes.BlockNode
;
import
jadx.core.dex.nodes.FieldNode
;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.visitors.typeinference.PostTypeInference
;
import
jadx.core.utils.InstructionRemover
;
import
jadx.core.utils.exceptions.JadxException
;
...
...
@@ -124,7 +126,13 @@ public class ConstInlinerVisitor extends AbstractVisitor {
fixTypes
(
mth
,
useInsn
,
litArg
);
replaceCount
++;
FieldNode
f
=
mth
.
getParentClass
().
getConstFieldByLiteralArg
(
litArg
);
FieldNode
f
=
null
;
ArgType
litArgType
=
litArg
.
getType
();
if
(
litArgType
.
isTypeKnown
())
{
f
=
mth
.
getParentClass
().
getConstFieldByLiteralArg
(
litArg
);
}
else
if
(
litArgType
.
contains
(
PrimitiveType
.
INT
))
{
f
=
mth
.
getParentClass
().
getConstField
((
int
)
literal
,
false
);
}
if
(
f
!=
null
)
{
litArg
.
wrapInstruction
(
new
IndexInsnNode
(
InsnType
.
SGET
,
f
.
getFieldInfo
(),
0
));
}
...
...
@@ -138,6 +146,7 @@ public class ConstInlinerVisitor extends AbstractVisitor {
* but contains some expensive operations needed only after constant inline
*/
private
static
void
fixTypes
(
MethodNode
mth
,
InsnNode
insn
,
LiteralArg
litArg
)
{
PostTypeInference
.
process
(
mth
,
insn
);
switch
(
insn
.
getType
())
{
case
CONST:
insn
.
getArg
(
0
).
merge
(
insn
.
getResult
());
...
...
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