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
1d81cab4
Commit
1d81cab4
authored
Mar 29, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: change anonymous class marking
parent
2815cef1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
5 deletions
+26
-5
Consts.java
jadx-core/src/main/java/jadx/core/Consts.java
+1
-1
ClassGen.java
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
+2
-2
InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+1
-1
AFlag.java
jadx-core/src/main/java/jadx/core/dex/attributes/AFlag.java
+1
-0
ClassInfo.java
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
+8
-0
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+5
-1
ClassModifier.java
...e/src/main/java/jadx/core/dex/visitors/ClassModifier.java
+8
-0
No files found.
jadx-core/src/main/java/jadx/core/Consts.java
View file @
1d81cab4
...
...
@@ -18,7 +18,7 @@ public class Consts {
public
static
final
String
DALVIK_ANNOTATION_DEFAULT
=
"dalvik.annotation.AnnotationDefault"
;
public
static
final
String
DEFAULT_PACKAGE_NAME
=
"defpackage"
;
public
static
final
String
ANONYMOUS_CLASS_PREFIX
=
"AnonymousClass
_
"
;
public
static
final
String
ANONYMOUS_CLASS_PREFIX
=
"AnonymousClass"
;
public
static
final
String
MTH_TOSTRING_SIGNATURE
=
"toString()Ljava/lang/String;"
;
}
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
View file @
1d81cab4
...
...
@@ -231,7 +231,7 @@ public class ClassGen {
private
void
addInnerClasses
(
CodeWriter
code
,
ClassNode
cls
)
throws
CodegenException
{
for
(
ClassNode
innerCls
:
cls
.
getInnerClasses
())
{
if
(
innerCls
.
contains
(
AFlag
.
DONT_GENERATE
)
||
innerCls
.
isAnonymous
(
))
{
||
innerCls
.
contains
(
AFlag
.
ANONYMOUS_CLASS
))
{
continue
;
}
ClassGen
inClGen
=
new
ClassGen
(
innerCls
,
getParentGen
());
...
...
@@ -243,7 +243,7 @@ public class ClassGen {
private
boolean
isInnerClassesPresents
()
{
for
(
ClassNode
innerCls
:
cls
.
getInnerClasses
())
{
if
(!
innerCls
.
isAnonymous
(
))
{
if
(!
innerCls
.
contains
(
AFlag
.
ANONYMOUS_CLASS
))
{
return
true
;
}
}
...
...
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
View file @
1d81cab4
...
...
@@ -530,7 +530,7 @@ public class InsnGen {
private
void
makeConstructor
(
ConstructorInsn
insn
,
CodeWriter
code
)
throws
CodegenException
{
ClassNode
cls
=
mth
.
dex
().
resolveClass
(
insn
.
getClassType
());
if
(
cls
!=
null
&&
cls
.
isAnonymous
(
)
&&
!
fallback
)
{
if
(
cls
!=
null
&&
cls
.
contains
(
AFlag
.
ANONYMOUS_CLASS
)
&&
!
fallback
)
{
// anonymous class construction
ArgType
parent
;
if
(
cls
.
getInterfaces
().
size
()
==
1
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/AFlag.java
View file @
1d81cab4
...
...
@@ -23,6 +23,7 @@ public enum AFlag {
SKIP_FIRST_ARG
,
ANONYMOUS_CONSTRUCTOR
,
ANONYMOUS_CLASS
,
ELSE_IF_CHAIN
,
...
...
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
View file @
1d81cab4
...
...
@@ -138,6 +138,14 @@ public final class ClassInfo {
return
parentClass
;
}
public
ClassInfo
getTopParentClass
()
{
if
(
parentClass
!=
null
)
{
ClassInfo
topCls
=
parentClass
.
getTopParentClass
();
return
topCls
!=
null
?
topCls
:
parentClass
;
}
return
null
;
}
public
boolean
isInner
()
{
return
parentClass
!=
null
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
1d81cab4
...
...
@@ -240,6 +240,10 @@ public class ClassNode extends LineAttrNode implements ILoadable {
&&
fileName
.
endsWith
(
"$"
+
name
))
{
return
;
}
ClassInfo
parentClass
=
clsInfo
.
getTopParentClass
();
if
(
parentClass
!=
null
&&
fileName
.
equals
(
parentClass
.
getShortName
()))
{
return
;
}
}
this
.
addAttr
(
new
SourceFileAttr
(
fileName
));
LOG
.
debug
(
"Class '{}' compiled from '{}'"
,
this
,
fileName
);
...
...
@@ -434,7 +438,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
public
boolean
isAnonymous
()
{
return
clsInfo
.
isInner
()
&&
clsInfo
.
getShortName
().
startsWith
(
Consts
.
ANONYMOUS_CLASS_PREFIX
)
&&
clsInfo
.
get
Alias
().
get
ShortName
().
startsWith
(
Consts
.
ANONYMOUS_CLASS_PREFIX
)
&&
getDefaultConstructor
()
!=
null
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ClassModifier.java
View file @
1d81cab4
...
...
@@ -40,9 +40,17 @@ public class ClassModifier extends AbstractVisitor {
removeEmptyMethods
(
cls
);
checkFieldsInit
(
cls
);
markAnonymousClass
(
cls
);
return
false
;
}
private
void
markAnonymousClass
(
ClassNode
cls
)
{
if
(
cls
.
isAnonymous
())
{
cls
.
add
(
AFlag
.
ANONYMOUS_CLASS
);
}
}
private
static
void
removeSyntheticFields
(
ClassNode
cls
)
{
if
(!
cls
.
getClassInfo
().
isInner
()
||
cls
.
getAccessFlags
().
isStatic
())
{
return
;
...
...
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