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
a55f4c59
Commit
a55f4c59
authored
Apr 25, 2013
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix self constructor call
parent
4e7ef9f4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
12 deletions
+29
-12
RegionGen.java
src/main/java/jadx/codegen/RegionGen.java
+3
-6
ConstructorInsn.java
...main/java/jadx/dex/instructions/mods/ConstructorInsn.java
+5
-4
RegionMaker.java
src/main/java/jadx/dex/visitors/regions/RegionMaker.java
+4
-1
TestInvoke.java
src/samples/java/jadx/samples/TestInvoke.java
+17
-1
No files found.
src/main/java/jadx/codegen/RegionGen.java
View file @
a55f4c59
...
...
@@ -211,15 +211,12 @@ public class RegionGen extends InsnGen {
private
void
makeCaseBlock
(
IContainer
c
,
CodeWriter
code
)
throws
CodegenException
{
if
(
RegionUtils
.
notEmpty
(
c
))
{
boolean
closeBlock
=
RegionUtils
.
hasExitEdge
(
c
);
if
(
closeBlock
)
{
code
.
add
(
" {"
);
}
code
.
add
(
" {"
);
makeRegionIndent
(
code
,
c
);
if
(
closeBlock
)
{
if
(
RegionUtils
.
hasExitEdge
(
c
)
)
{
code
.
startLine
(
1
,
"break;"
);
code
.
startLine
(
'}'
);
}
code
.
startLine
(
'}'
);
}
else
{
code
.
startLine
(
1
,
"break;"
);
}
...
...
src/main/java/jadx/dex/instructions/mods/ConstructorInsn.java
View file @
a55f4c59
...
...
@@ -19,7 +19,7 @@ public class ConstructorInsn extends InsnNode {
SELF
// call itself
}
private
final
CallType
callType
;
private
CallType
callType
;
public
ConstructorInsn
(
MethodNode
mth
,
InvokeNode
invoke
)
{
super
(
InsnType
.
CONSTRUCTOR
,
invoke
.
getArgsCount
()
-
1
);
...
...
@@ -28,16 +28,17 @@ public class ConstructorInsn extends InsnNode {
if
(
invoke
.
getArg
(
0
).
isThis
())
{
if
(
classType
.
equals
(
mth
.
getParentClass
().
getClassInfo
()))
{
// self constructor
if
(
callMth
.
getShortId
().
equals
(
mth
.
getMethodInfo
().
getShortId
()))
{
// self constructor
callType
=
CallType
.
SELF
;
}
else
{
}
else
if
(
mth
.
getMethodInfo
().
isConstructor
())
{
callType
=
CallType
.
THIS
;
}
}
else
{
callType
=
CallType
.
SUPER
;
}
}
else
{
}
if
(
callType
==
null
)
{
callType
=
CallType
.
CONSTRUCTOR
;
setResult
((
RegisterArg
)
invoke
.
getArg
(
0
));
}
...
...
src/main/java/jadx/dex/visitors/regions/RegionMaker.java
View file @
a55f4c59
...
...
@@ -207,7 +207,10 @@ public class RegionMaker {
// found cross
if
(
next
.
getCleanSuccessors
().
size
()
==
1
)
{
BlockNode
r
=
BlockUtils
.
getNextBlock
(
next
);
if
(
r
!=
null
&&
r
.
getAttributes
().
contains
(
AttributeFlag
.
RETURN
))
{
if
(
r
!=
null
&&
r
.
getAttributes
().
contains
(
AttributeFlag
.
RETURN
)
&&
r
.
getInstructions
().
size
()
>
0
&&
r
.
getInstructions
().
get
(
0
).
getType
()
==
InsnType
.
RETURN
)
{
next
.
getAttributes
().
add
(
new
ForceReturnAttr
(
r
.
getInstructions
().
get
(
0
)));
}
else
{
next
.
getAttributes
().
add
(
AttributeFlag
.
BREAK
);
...
...
src/samples/java/jadx/samples/TestInvoke.java
View file @
a55f4c59
...
...
@@ -3,9 +3,16 @@ package jadx.samples;
import
java.util.Arrays
;
public
class
TestInvoke
extends
AbstractTest
{
private
int
f
;
public
TestInvoke
()
{
this
(-
1
);
}
public
TestInvoke
(
int
f
)
{
this
.
f
=
f
;
}
private
void
parse
(
String
[]
args
)
{
if
(
args
.
length
>
0
)
f
=
Integer
.
parseInt
(
args
[
0
]);
...
...
@@ -30,6 +37,13 @@ public class TestInvoke extends AbstractTest {
return
s
;
}
public
TestInvoke
testConstructor
(
int
flag
)
{
if
(
getF
()
==
flag
)
return
new
TestInvoke
(
flag
);
else
return
this
;
}
@Override
public
boolean
testRun
()
throws
Exception
{
TestInvoke
inv
=
new
TestInvoke
();
...
...
@@ -41,6 +55,8 @@ public class TestInvoke extends AbstractTest {
assertTrue
(
inv
.
testVarArgs
(
"a"
,
"2"
,
"III"
));
assertTrue
(
inv
.
testVarArgs2
(
"a"
.
toCharArray
(),
new
char
[]
{
'1'
,
'2'
}).
equals
(
"a12"
));
assertTrue
(
testConstructor
(
f
)
!=
this
);
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