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
b1b49e61
Commit
b1b49e61
authored
Apr 14, 2019
by
Ahmed Ashour
Committed by
skylot
Apr 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remove declaration of unused variable (PR #590)
parent
d23f4ac1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
59 deletions
+11
-59
InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+10
-5
TestAnnotationsMix.java
...adx/tests/integration/annotations/TestAnnotationsMix.java
+1
-3
TestAnonymousClass13.java
...va/jadx/tests/integration/inner/TestAnonymousClass13.java
+0
-2
TestConstructorInvoke.java
.../jadx/tests/integration/invoke/TestConstructorInvoke.java
+0
-49
No files found.
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
View file @
b1b49e61
package
jadx
.
core
.
codegen
;
import
static
jadx
.
core
.
utils
.
android
.
AndroidResourcesUtils
.
handleAppResField
;
import
java.util.ArrayList
;
import
java.util.EnumSet
;
import
java.util.Iterator
;
...
...
@@ -41,6 +43,7 @@ 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
;
...
...
@@ -52,8 +55,6 @@ import jadx.core.utils.RegionUtils;
import
jadx.core.utils.exceptions.CodegenException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
static
jadx
.
core
.
utils
.
android
.
AndroidResourcesUtils
.
handleAppResField
;
public
class
InsnGen
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
InsnGen
.
class
);
...
...
@@ -219,10 +220,14 @@ public class InsnGen {
if
(
flag
!=
Flags
.
INLINE
)
{
code
.
startLineWithNum
(
insn
.
getSourceLine
());
}
if
(
insn
.
getResult
()
!=
null
&&
!
insn
.
contains
(
AFlag
.
ARITH_ONEARG
))
{
if
(
insn
.
getResult
()
!=
null
)
{
SSAVar
var
=
insn
.
getResult
().
getSVar
();
if
((
var
==
null
||
var
.
getUseCount
()
!=
0
||
insn
.
getType
()
!=
InsnType
.
CONSTRUCTOR
)
&&
!
insn
.
contains
(
AFlag
.
ARITH_ONEARG
))
{
assignVar
(
code
,
insn
);
code
.
add
(
" = "
);
}
}
makeInsnBody
(
code
,
insn
,
state
);
if
(
flag
!=
Flags
.
INLINE
)
{
code
.
add
(
';'
);
...
...
jadx-core/src/test/java/jadx/tests/integration/annotations/TestAnnotationsMix.java
View file @
b1b49e61
...
...
@@ -10,7 +10,6 @@ import java.util.Arrays;
import
org.junit.jupiter.api.Test
;
import
jadx.NotYetImplemented
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
...
...
@@ -112,8 +111,7 @@ public class TestAnnotationsMix extends IntegrationTest {
}
@Test
@NotYetImplemented
public
void
testNYI
()
{
public
void
testDeclaration
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
...
...
jadx-core/src/test/java/jadx/tests/integration/inner/TestAnonymousClass13.java
View file @
b1b49e61
...
...
@@ -2,7 +2,6 @@ package jadx.tests.integration.inner;
import
org.junit.jupiter.api.Test
;
import
jadx.NotYetImplemented
;
import
jadx.tests.api.IntegrationTest
;
public
class
TestAnonymousClass13
extends
IntegrationTest
{
...
...
@@ -16,7 +15,6 @@ public class TestAnonymousClass13 extends IntegrationTest {
}
@Test
@NotYetImplemented
public
void
test
()
{
getClassNode
(
TestCls
.
class
);
}
...
...
jadx-core/src/test/java/jadx/tests/integration/invoke/TestConstructorInvoke.java
deleted
100644 → 0
View file @
d23f4ac1
package
jadx
.
tests
.
integration
.
invoke
;
import
org.junit.jupiter.api.Test
;
import
jadx.NotYetImplemented
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
public
class
TestConstructorInvoke
extends
IntegrationTest
{
void
test
(
String
root
,
String
name
)
{
ViewHolder
holder
=
new
ViewHolder
(
root
,
name
);
}
private
final
class
ViewHolder
{
private
ViewHolder
(
String
root
,
String
name
)
{
}
}
@Test
@NotYetImplemented
(
"Variable lost name from debug info"
)
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestConstructorInvoke
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
indent
()
+
"ViewHolder holder = new ViewHolder(root, name);"
));
}
// Remove after fix above @NYI
@Test
public
void
test2
()
{
ClassNode
cls
=
getClassNode
(
TestConstructorInvoke
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
indent
()
+
"ViewHolder viewHolder = new ViewHolder(root, name);"
));
}
@Test
public
void
testNoDebug
()
{
noDebugInfo
();
ClassNode
cls
=
getClassNode
(
TestConstructorInvoke
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
indent
()
+
"ViewHolder viewHolder = new ViewHolder("
));
}
}
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