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
85ab0956
Commit
85ab0956
authored
Feb 26, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix class imports
parent
1b5f0f6a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
2 deletions
+39
-2
ClassGen.java
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
+7
-2
TestImports.java
jadx-samples/src/main/java/jadx/samples/TestImports.java
+25
-0
A.java
jadx-samples/src/main/java/jadx/samples/otherpkg/A.java
+7
-0
No files found.
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
View file @
85ab0956
...
...
@@ -379,12 +379,17 @@ public class ClassGen {
if
(
classInfo
.
getPackage
().
equals
(
useCls
.
getPackage
())
&&
!
classInfo
.
isInner
())
{
return
shortName
;
}
if
(
classInfo
.
getPackage
().
equals
(
useCls
.
getPackage
()))
{
fullName
=
classInfo
.
getNameWithoutPackage
();
// don't add import if class not public (must be accessed using inheritance)
ClassNode
classNode
=
cls
.
dex
().
resolveClass
(
classInfo
);
if
(
classNode
!=
null
&&
!
classNode
.
getAccessFlags
().
isPublic
())
{
return
shortName
;
}
if
(
searchCollision
(
cls
.
dex
(),
useCls
,
shortName
))
{
return
fullName
;
}
if
(
classInfo
.
getPackage
().
equals
(
useCls
.
getPackage
()))
{
fullName
=
classInfo
.
getNameWithoutPackage
();
}
for
(
ClassInfo
importCls
:
imports
)
{
if
(!
importCls
.
equals
(
classInfo
)
&&
importCls
.
getShortName
().
equals
(
shortName
))
{
...
...
jadx-samples/src/main/java/jadx/samples/TestImports.java
0 → 100644
View file @
85ab0956
package
jadx
.
samples
;
import
jadx.samples.otherpkg.A
;
/**
* Tests:
* - class B not imported
*/
public
class
TestImports
extends
AbstractTest
{
public
class
C
extends
A
{
public
B
getB
()
{
return
null
;
}
}
@Override
public
boolean
testRun
()
{
return
true
;
}
public
static
void
main
(
String
[]
args
)
{
new
TestImports
().
testRun
();
}
}
jadx-samples/src/main/java/jadx/samples/otherpkg/A.java
0 → 100644
View file @
85ab0956
package
jadx
.
samples
.
otherpkg
;
public
class
A
{
protected
class
B
{
}
}
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