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
efd8bd13
Commit
efd8bd13
authored
Apr 04, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: rename classes in default package
parent
051bb63a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
12 deletions
+18
-12
RenameVisitor.java
...e/src/main/java/jadx/core/dex/visitors/RenameVisitor.java
+5
-0
IntegrationTest.java
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
+12
-11
JadxSettingsAdapter.java
.../src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
+1
-1
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/RenameVisitor.java
View file @
efd8bd13
...
...
@@ -79,6 +79,11 @@ public class RenameVisitor extends AbstractVisitor {
if
(
newShortName
!=
null
)
{
classInfo
.
rename
(
cls
.
dex
(),
classInfo
.
makeFullClsName
(
newShortName
,
true
));
}
if
(
classInfo
.
getAlias
().
getPackage
().
isEmpty
())
{
String
fullName
=
classInfo
.
makeFullClsName
(
classInfo
.
getAlias
().
getShortName
(),
true
);
String
newFullName
=
Consts
.
DEFAULT_PACKAGE_NAME
+
"."
+
fullName
;
classInfo
.
rename
(
cls
.
dex
(),
newFullName
);
}
}
private
void
checkFields
(
ClassNode
cls
)
{
...
...
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
View file @
efd8bd13
...
...
@@ -29,17 +29,17 @@ import java.lang.reflect.Modifier;
import
java.net.URISyntaxException
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.jar.JarOutputStream
;
import
static
org
.
hamcrest
.
CoreMatchers
.
containsString
;
import
static
org
.
hamcrest
.
CoreMatchers
.
not
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotEquals
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
static
org
.
hamcrest
.
Matchers
.
empty
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
not
;
import
static
org
.
hamcrest
.
Matchers
.
notNullValue
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
...
...
@@ -86,8 +86,8 @@ public abstract class IntegrationTest extends TestUtils {
root
.
getResourcesNames
().
putAll
(
resMap
);
ClassNode
cls
=
root
.
searchClassByName
(
clsName
);
assert
NotNull
(
"Class not found: "
+
clsName
,
cls
);
assert
Equals
(
cls
.
getFullName
(),
clsName
);
assert
That
(
"Class not found: "
+
clsName
,
cls
,
notNullValue
()
);
assert
That
(
clsName
,
is
(
cls
.
getClassInfo
().
getFullName
())
);
if
(
unloadCls
)
{
decompile
(
d
,
cls
);
...
...
@@ -214,7 +214,7 @@ public abstract class IntegrationTest extends TestUtils {
Throwable
cause
=
ie
.
getCause
();
if
(
cause
instanceof
AssertionError
)
{
System
.
err
.
println
(
msg
);
throw
(
(
AssertionError
)
cause
)
;
throw
(
AssertionError
)
cause
;
}
else
{
cause
.
printStackTrace
();
fail
(
msg
+
cause
.
getMessage
());
...
...
@@ -283,7 +283,7 @@ public abstract class IntegrationTest extends TestUtils {
list
=
compileClass
(
cls
);
}
}
assert
NotEquals
(
"File list is empty"
,
0
,
list
.
size
(
));
assert
That
(
"File list is empty"
,
list
,
not
(
empty
()
));
File
temp
=
createTempFile
(
".jar"
);
JarOutputStream
jo
=
new
JarOutputStream
(
new
FileOutputStream
(
temp
));
...
...
@@ -354,11 +354,12 @@ public abstract class IntegrationTest extends TestUtils {
if
(!
file
.
exists
())
{
file
=
new
File
(
TEST_DIRECTORY2
,
fileName
);
}
assertTrue
(
"Test source file not found: "
+
fileName
,
file
.
exists
());
assertThat
(
"Test source file not found: "
+
fileName
,
file
.
exists
(),
is
(
true
));
List
<
File
>
compileFileList
=
Collections
.
singletonList
(
file
);
File
outTmp
=
createTempDir
(
"jadx-tmp-classes"
);
outTmp
.
deleteOnExit
();
List
<
File
>
files
=
StaticCompiler
.
compile
(
Arrays
.
asList
(
file
)
,
outTmp
,
withDebugInfo
);
List
<
File
>
files
=
StaticCompiler
.
compile
(
compileFileList
,
outTmp
,
withDebugInfo
);
// remove classes which are parents for test class
Iterator
<
File
>
iterator
=
files
.
iterator
();
while
(
iterator
.
hasNext
())
{
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
View file @
efd8bd13
...
...
@@ -46,7 +46,7 @@ public class JadxSettingsAdapter {
if
(
settings
==
null
)
{
return
new
JadxSettings
();
}
LOG
.
info
(
"Loaded settings: {}"
,
makeString
(
settings
));
LOG
.
debug
(
"Loaded settings: {}"
,
makeString
(
settings
));
return
settings
;
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Error load settings"
,
e
);
...
...
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