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
406d9878
Commit
406d9878
authored
Apr 26, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix invoke args skipping
parent
4e6c5cb2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
13 deletions
+87
-13
InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+5
-9
AttrNode.java
...core/src/main/java/jadx/core/dex/attributes/AttrNode.java
+5
-2
AttributeStorage.java
.../main/java/jadx/core/dex/attributes/AttributeStorage.java
+4
-0
EmptyAttrStorage.java
.../main/java/jadx/core/dex/attributes/EmptyAttrStorage.java
+5
-0
RegisterArg.java
...ain/java/jadx/core/dex/instructions/args/RegisterArg.java
+1
-0
Typed.java
.../src/main/java/jadx/core/dex/instructions/args/Typed.java
+2
-1
ModVisitor.java
...core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
+1
-1
TestAnonymousClass11.java
...va/jadx/tests/integration/inner/TestAnonymousClass11.java
+64
-0
No files found.
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
View file @
406d9878
...
...
@@ -29,7 +29,6 @@ import jadx.core.dex.instructions.args.InsnWrapArg;
import
jadx.core.dex.instructions.args.LiteralArg
;
import
jadx.core.dex.instructions.args.Named
;
import
jadx.core.dex.instructions.args.RegisterArg
;
import
jadx.core.dex.instructions.args.SSAVar
;
import
jadx.core.dex.instructions.mods.ConstructorInsn
;
import
jadx.core.dex.instructions.mods.TernaryInsn
;
import
jadx.core.dex.nodes.ClassNode
;
...
...
@@ -645,20 +644,17 @@ public class InsnGen {
boolean
overloaded
=
callMth
!=
null
&&
callMth
.
isArgsOverload
();
for
(
int
i
=
k
;
i
<
argsCount
;
i
++)
{
InsnArg
arg
=
insn
.
getArg
(
i
);
if
(
arg
.
isRegister
(
))
{
SSAVar
sVar
=
((
RegisterArg
)
arg
).
getSVar
()
;
if
(
sVar
!=
null
&&
sVar
.
contains
(
AFlag
.
SKIP_ARG
))
{
continue
;
}
if
(
arg
.
contains
(
AFlag
.
SKIP_ARG
))
{
continue
;
}
if
(
i
!=
k
)
{
code
.
add
(
", "
);
}
boolean
cast
=
overloaded
&&
processOverloadedArg
(
code
,
callMth
,
arg
,
i
-
startArgNum
);
if
(!
cast
&&
i
==
argsCount
-
1
&&
processVarArg
(
code
,
callMth
,
arg
))
{
continue
;
}
addArg
(
code
,
arg
,
false
);
if
(
i
<
argsCount
-
1
)
{
code
.
add
(
", "
);
}
}
}
code
.
add
(
')'
);
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/AttrNode.java
View file @
406d9878
...
...
@@ -27,10 +27,13 @@ public abstract class AttrNode implements IAttributeNode {
@Override
public
void
copyAttributesFrom
(
AttrNode
attrNode
)
{
initStorage
().
addAll
(
attrNode
.
storage
);
AttributeStorage
copyFrom
=
attrNode
.
storage
;
if
(!
copyFrom
.
isEmpty
())
{
initStorage
().
addAll
(
copyFrom
);
}
}
AttributeStorage
initStorage
()
{
private
AttributeStorage
initStorage
()
{
AttributeStorage
store
=
storage
;
if
(
store
==
EMPTY_ATTR_STORAGE
)
{
store
=
new
AttributeStorage
();
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/AttributeStorage.java
View file @
406d9878
...
...
@@ -111,6 +111,10 @@ public class AttributeStorage {
return
list
;
}
public
boolean
isEmpty
()
{
return
flags
.
isEmpty
()
&&
attributes
.
isEmpty
();
}
@Override
public
String
toString
()
{
List
<
String
>
list
=
getAttributeStrings
();
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/EmptyAttrStorage.java
View file @
406d9878
...
...
@@ -54,6 +54,11 @@ public final class EmptyAttrStorage extends AttributeStorage {
}
@Override
public
boolean
isEmpty
()
{
return
true
;
}
@Override
public
String
toString
()
{
return
""
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/RegisterArg.java
View file @
406d9878
...
...
@@ -79,6 +79,7 @@ public class RegisterArg extends InsnArg implements Named {
public
RegisterArg
duplicate
()
{
RegisterArg
dup
=
new
RegisterArg
(
getRegNum
(),
getType
());
dup
.
setSVar
(
sVar
);
dup
.
copyAttributesFrom
(
this
);
return
dup
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/Typed.java
View file @
406d9878
package
jadx
.
core
.
dex
.
instructions
.
args
;
import
jadx.core.dex.attributes.AttrNode
;
import
jadx.core.dex.nodes.DexNode
;
public
abstract
class
Typed
{
public
abstract
class
Typed
extends
AttrNode
{
protected
ArgType
type
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
View file @
406d9878
...
...
@@ -277,8 +277,8 @@ public class ModVisitor extends AbstractVisitor {
if
(
sVar
!=
null
)
{
sVar
.
add
(
AFlag
.
FINAL
);
sVar
.
add
(
AFlag
.
DONT_INLINE
);
sVar
.
add
(
AFlag
.
SKIP_ARG
);
}
reg
.
add
(
AFlag
.
SKIP_ARG
);
}
}
}
...
...
jadx-core/src/test/java/jadx/tests/integration/inner/TestAnonymousClass11.java
0 → 100644
View file @
406d9878
package
jadx
.
tests
.
integration
.
inner
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
java.util.Random
;
import
org.junit.Test
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
static
org
.
hamcrest
.
Matchers
.
not
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestAnonymousClass11
extends
IntegrationTest
{
public
static
class
TestCls
{
public
void
test
()
{
final
int
a
=
new
Random
().
nextInt
();
final
long
l
=
new
Random
().
nextLong
();
func
(
new
A
(
l
)
{
@Override
public
void
m
()
{
System
.
out
.
println
(
a
);
}
});
System
.
out
.
println
(
"a"
+
a
);
print
(
a
);
print2
(
1
,
a
);
print3
(
1
,
l
);
}
public
abstract
class
A
{
public
A
(
long
l
)
{
}
public
abstract
void
m
();
}
private
void
func
(
A
a
)
{
}
private
void
print
(
int
a
)
{
}
private
void
print2
(
int
i
,
int
a
)
{
}
private
void
print3
(
int
i
,
long
l
)
{
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"System.out.println(\"a\" + a);"
));
assertThat
(
code
,
containsOne
(
"print(a);"
));
assertThat
(
code
,
not
(
containsString
(
"synthetic"
)));
}
}
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