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
2dea6f55
Commit
2dea6f55
authored
Dec 22, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add more details for variable with type inference error
parent
76cf4f05
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
SSAVar.java
...src/main/java/jadx/core/dex/instructions/args/SSAVar.java
+46
-0
TypeInferenceVisitor.java
...core/dex/visitors/typeinference/TypeInferenceVisitor.java
+1
-1
No files found.
jadx-core/src/main/java/jadx/core/dex/instructions/args/SSAVar.java
View file @
2dea6f55
package
jadx
.
core
.
dex
.
instructions
.
args
;
package
jadx
.
core
.
dex
.
instructions
.
args
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
org.jetbrains.annotations.Nullable
;
import
jadx.core.dex.attributes.AType
;
import
jadx.core.dex.attributes.AttrNode
;
import
jadx.core.dex.attributes.AttrNode
;
import
jadx.core.dex.attributes.nodes.RegDebugInfoAttr
;
import
jadx.core.dex.instructions.PhiInsn
;
import
jadx.core.dex.instructions.PhiInsn
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.visitors.typeinference.TypeInfo
;
import
jadx.core.dex.visitors.typeinference.TypeInfo
;
public
class
SSAVar
extends
AttrNode
{
public
class
SSAVar
extends
AttrNode
{
...
@@ -146,4 +152,44 @@ public class SSAVar extends AttrNode {
...
@@ -146,4 +152,44 @@ public class SSAVar extends AttrNode {
public
String
toString
()
{
public
String
toString
()
{
return
"r"
+
regNum
+
":"
+
version
+
" "
+
typeInfo
.
getType
();
return
"r"
+
regNum
+
":"
+
version
+
" "
+
typeInfo
.
getType
();
}
}
public
String
getDetailedVarInfo
(
MethodNode
mth
)
{
Set
<
ArgType
>
types
=
new
HashSet
<>();
Set
<
String
>
names
=
Collections
.
emptySet
();
List
<
RegisterArg
>
useArgs
=
new
ArrayList
<>(
1
+
useList
.
size
());
useArgs
.
add
(
assign
);
useArgs
.
addAll
(
useList
);
if
(
mth
.
contains
(
AType
.
LOCAL_VARS_DEBUG_INFO
))
{
names
=
new
HashSet
<>();
for
(
RegisterArg
arg
:
useArgs
)
{
RegDebugInfoAttr
debugInfoAttr
=
arg
.
get
(
AType
.
REG_DEBUG_INFO
);
if
(
debugInfoAttr
!=
null
)
{
names
.
add
(
debugInfoAttr
.
getName
());
types
.
add
(
debugInfoAttr
.
getRegType
());
}
}
}
for
(
RegisterArg
arg
:
useArgs
)
{
ArgType
initType
=
arg
.
getInitType
();
if
(
initType
.
isTypeKnown
())
{
types
.
add
(
initType
);
}
ArgType
type
=
arg
.
getType
();
if
(
type
.
isTypeKnown
())
{
types
.
add
(
type
);
}
}
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
'r'
).
append
(
regNum
).
append
(
'v'
).
append
(
version
);
if
(!
names
.
isEmpty
())
{
sb
.
append
(
", names: "
).
append
(
names
);
}
if
(!
types
.
isEmpty
())
{
sb
.
append
(
", types: "
).
append
(
types
);
}
return
sb
.
toString
();
}
}
}
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeInferenceVisitor.java
View file @
2dea6f55
...
@@ -60,7 +60,7 @@ public final class TypeInferenceVisitor extends AbstractVisitor {
...
@@ -60,7 +60,7 @@ public final class TypeInferenceVisitor extends AbstractVisitor {
if
(
type
!=
null
&&
!
type
.
isTypeKnown
())
{
if
(
type
!=
null
&&
!
type
.
isTypeKnown
())
{
boolean
changed
=
tryAllTypes
(
var
,
type
);
boolean
changed
=
tryAllTypes
(
var
,
type
);
if
(!
changed
)
{
if
(!
changed
)
{
mth
.
addComment
(
"JADX WARNING: type inference failed for: "
+
var
+
", bounds: "
+
typeInfo
.
getBounds
(
));
mth
.
addComment
(
"JADX WARNING: type inference failed for: "
+
var
.
getDetailedVarInfo
(
mth
));
}
}
}
}
});
});
...
...
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