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
56c0a588
Commit
56c0a588
authored
Mar 02, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix imports for inner classes with same names
parent
47d65fcd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
6 deletions
+69
-6
ClassGen.java
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
+15
-6
TestImports2.java
jadx-samples/src/main/java/jadx/samples/TestImports2.java
+40
-0
C.java
jadx-samples/src/main/java/jadx/samples/otherpkg/C.java
+7
-0
D.java
jadx-samples/src/main/java/jadx/samples/otherpkg/D.java
+7
-0
No files found.
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
View file @
56c0a588
...
...
@@ -397,10 +397,15 @@ public class ClassGen {
if
(
classInfo
.
getPackage
().
equals
(
useCls
.
getPackage
()))
{
fullName
=
classInfo
.
getNameWithoutPackage
();
}
for
(
ClassInfo
importCls
:
imports
)
{
for
(
ClassInfo
importCls
:
getImports
()
)
{
if
(!
importCls
.
equals
(
classInfo
)
&&
importCls
.
getShortName
().
equals
(
shortName
))
{
return
fullName
;
if
(
classInfo
.
isInner
())
{
String
parent
=
useClassInternal
(
useCls
,
classInfo
.
getParentClass
());
return
parent
+
"."
+
shortName
;
}
else
{
return
fullName
;
}
}
}
addImport
(
classInfo
);
...
...
@@ -416,6 +421,14 @@ public class ClassGen {
}
}
private
Set
<
ClassInfo
>
getImports
()
{
if
(
parentGen
!=
null
)
{
return
parentGen
.
getImports
();
}
else
{
return
imports
;
}
}
private
static
boolean
isClassInnerFor
(
ClassInfo
inner
,
ClassInfo
parent
)
{
if
(
inner
.
isInner
())
{
ClassInfo
p
=
inner
.
getParentClass
();
...
...
@@ -449,10 +462,6 @@ public class ClassGen {
}
}
public
Set
<
ClassInfo
>
getImports
()
{
return
imports
;
}
public
ClassGen
getParentGen
()
{
return
parentGen
;
}
...
...
jadx-samples/src/main/java/jadx/samples/TestImports2.java
0 → 100644
View file @
56c0a588
package
jadx
.
samples
;
import
jadx.samples.otherpkg.C.E
;
import
jadx.samples.otherpkg.D
;
public
class
TestImports2
extends
AbstractTest
{
public
Object
f1
()
{
return
new
E
()
{
@Override
public
String
toString
()
{
return
"C.E"
;
}
};
}
public
Object
f2
()
{
return
new
D
.
E
()
{
@Override
public
String
toString
()
{
return
"D.E"
;
}
};
}
public
static
class
X1
extends
E
{
}
public
static
class
X2
extends
D
.
E
{
}
@Override
public
boolean
testRun
()
{
return
true
;
}
public
static
void
main
(
String
[]
args
)
{
new
TestImports2
().
testRun
();
}
}
jadx-samples/src/main/java/jadx/samples/otherpkg/C.java
0 → 100644
View file @
56c0a588
package
jadx
.
samples
.
otherpkg
;
public
class
C
{
public
static
class
E
{
}
}
jadx-samples/src/main/java/jadx/samples/otherpkg/D.java
0 → 100644
View file @
56c0a588
package
jadx
.
samples
.
otherpkg
;
public
class
D
{
public
static
class
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