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
ec8309af
Commit
ec8309af
authored
Aug 20, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix processing 'if' at loop end
parent
627a4dc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
2 deletions
+50
-2
IfMakerHelper.java
...in/java/jadx/core/dex/visitors/regions/IfMakerHelper.java
+2
-2
TestLoopDetection4.java
...st/java/jadx/tests/internal/loops/TestLoopDetection4.java
+48
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/regions/IfMakerHelper.java
View file @
ec8309af
...
...
@@ -47,8 +47,8 @@ public class IfMakerHelper {
info
.
setOutBlock
(
null
);
return
info
;
}
boolean
badThen
=
!
allPathsFromIf
(
thenBlock
,
info
);
boolean
badElse
=
!
allPathsFromIf
(
elseBlock
,
info
);
boolean
badThen
=
thenBlock
.
contains
(
AFlag
.
LOOP_START
)
||
!
allPathsFromIf
(
thenBlock
,
info
);
boolean
badElse
=
elseBlock
.
contains
(
AFlag
.
LOOP_START
)
||
!
allPathsFromIf
(
elseBlock
,
info
);
if
(
badThen
&&
badElse
)
{
LOG
.
debug
(
"Stop processing blocks after 'if': {}, method: {}"
,
info
.
getIfBlock
(),
mth
);
return
null
;
...
...
jadx-core/src/test/java/jadx/tests/internal/loops/TestLoopDetection4.java
0 → 100644
View file @
ec8309af
package
jadx
.
tests
.
internal
.
loops
;
import
jadx.api.InternalJadxTest
;
import
jadx.core.dex.nodes.ClassNode
;
import
java.util.Iterator
;
import
org.junit.Test
;
import
static
jadx
.
tests
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestLoopDetection4
extends
InternalJadxTest
{
public
static
class
TestCls
{
private
Iterator
<
String
>
iterator
;
private
SomeCls
filter
;
private
String
test
()
{
while
(
iterator
.
hasNext
())
{
String
next
=
iterator
.
next
();
String
filtered
=
filter
.
filter
(
next
);
if
(
filtered
!=
null
)
{
return
filtered
;
}
}
return
null
;
}
private
class
SomeCls
{
public
String
filter
(
String
str
)
{
return
str
;
}
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
System
.
out
.
println
(
code
);
assertThat
(
code
,
containsOne
(
"while (this.iterator.hasNext()) {"
));
assertThat
(
code
,
containsOne
(
"if (filtered != null) {"
));
assertThat
(
code
,
containsOne
(
"return filtered;"
));
assertThat
(
code
,
containsOne
(
"return null;"
));
}
}
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