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
61675275
Commit
61675275
authored
Apr 21, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix some issues reported by sonar
parent
dc004f37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
63 deletions
+3
-63
IfCondition.java
...in/java/jadx/core/dex/regions/conditions/IfCondition.java
+1
-1
ProcessVariables.java
...core/dex/visitors/regions/variables/ProcessVariables.java
+2
-62
No files found.
jadx-core/src/main/java/jadx/core/dex/regions/conditions/IfCondition.java
View file @
61675275
...
@@ -298,7 +298,7 @@ public final class IfCondition {
...
@@ -298,7 +298,7 @@ public final class IfCondition {
if
(
mode
!=
other
.
mode
)
{
if
(
mode
!=
other
.
mode
)
{
return
false
;
return
false
;
}
}
return
Objects
.
equals
(
other
.
args
,
other
.
args
)
return
Objects
.
equals
(
args
,
other
.
args
)
&&
Objects
.
equals
(
compare
,
other
.
compare
);
&&
Objects
.
equals
(
compare
,
other
.
compare
);
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/variables/ProcessVariables.java
View file @
61675275
...
@@ -103,10 +103,8 @@ public class ProcessVariables extends AbstractVisitor {
...
@@ -103,10 +103,8 @@ public class ProcessVariables extends AbstractVisitor {
if
(
checkDeclareAtAssign
(
usageList
,
mergedUsage
))
{
if
(
checkDeclareAtAssign
(
usageList
,
mergedUsage
))
{
return
;
return
;
}
}
// search closest region for declare
// TODO: search closest region for declare
if
(
searchDeclareRegion
(
mergedUsage
,
codeVar
))
{
return
;
}
// region not found, declare at method start
// region not found, declare at method start
declareVarInRegion
(
mth
.
getRegion
(),
codeVar
);
declareVarInRegion
(
mth
.
getRegion
(),
codeVar
);
}
}
...
@@ -233,38 +231,6 @@ public class ProcessVariables extends AbstractVisitor {
...
@@ -233,38 +231,6 @@ public class ProcessVariables extends AbstractVisitor {
return
true
;
return
true
;
}
}
private
boolean
searchDeclareRegion
(
VarUsage
u
,
CodeVar
codeVar
)
{
/*
Set<IRegion> set = u.getUseRegions();
for (Iterator<IRegion> it = set.iterator(); it.hasNext(); ) {
IRegion r = it.next();
IRegion parent = r.getParent();
if (parent != null && set.contains(parent)) {
it.remove();
}
}
IRegion region = null;
if (!set.isEmpty()) {
region = set.iterator().next();
} else if (!u.getAssigns().isEmpty()) {
region = u.getAssigns().iterator().next();
}
if (region == null) {
return false;
}
IRegion parent = region;
while (parent != null) {
if (canDeclareAt(u, region)) {
declareVarInRegion(region, codeVar);
return true;
}
region = parent;
parent = region.getParent();
}
*/
return
false
;
}
private
static
void
declareVarInRegion
(
IContainer
region
,
CodeVar
var
)
{
private
static
void
declareVarInRegion
(
IContainer
region
,
CodeVar
var
)
{
if
(
var
.
isDeclared
())
{
if
(
var
.
isDeclared
())
{
LOG
.
warn
(
"Try to declare already declared variable: {}"
,
var
);
LOG
.
warn
(
"Try to declare already declared variable: {}"
,
var
);
...
@@ -278,30 +244,4 @@ public class ProcessVariables extends AbstractVisitor {
...
@@ -278,30 +244,4 @@ public class ProcessVariables extends AbstractVisitor {
dv
.
addVar
(
var
);
dv
.
addVar
(
var
);
var
.
setDeclared
(
true
);
var
.
setDeclared
(
true
);
}
}
private
static
boolean
isAllRegionsAfter
(
IRegion
region
,
Set
<
IRegion
>
others
)
{
IRegion
parent
=
region
.
getParent
();
if
(
parent
==
null
)
{
return
true
;
}
// lazy init for
int
regionIndex
=
-
2
;
List
<
IContainer
>
subBlocks
=
Collections
.
emptyList
();
for
(
IRegion
r
:
others
)
{
if
(
parent
==
r
.
getParent
())
{
// on same level, check order by index
if
(
regionIndex
==
-
2
)
{
subBlocks
=
parent
.
getSubBlocks
();
regionIndex
=
subBlocks
.
indexOf
(
region
);
}
int
rIndex
=
subBlocks
.
indexOf
(
r
);
if
(
regionIndex
>
rIndex
)
{
return
false
;
}
}
else
if
(!
RegionUtils
.
isRegionContainsRegion
(
region
,
r
))
{
return
false
;
}
}
return
true
;
}
}
}
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