Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
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
ab7b6fc2
Commit
ab7b6fc2
authored
Jan 21, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: don't use additional class for jadx warnings
parent
41973651
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
30 deletions
+11
-30
ClassGen.java
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
+3
-3
AType.java
jadx-core/src/main/java/jadx/core/dex/attributes/AType.java
+1
-2
JadxWarn.java
...rc/main/java/jadx/core/dex/attributes/nodes/JadxWarn.java
+0
-21
CodegenUtils.java
jadx-core/src/main/java/jadx/core/utils/CodegenUtils.java
+6
-2
ErrorsCounter.java
jadx-core/src/main/java/jadx/core/utils/ErrorsCounter.java
+1
-2
No files found.
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
View file @
ab7b6fc2
...
...
@@ -18,7 +18,6 @@ import jadx.core.dex.attributes.AttrNode;
import
jadx.core.dex.attributes.nodes.EnumClassAttr
;
import
jadx.core.dex.attributes.nodes.EnumClassAttr.EnumField
;
import
jadx.core.dex.attributes.nodes.JadxError
;
import
jadx.core.dex.attributes.nodes.JadxWarn
;
import
jadx.core.dex.attributes.nodes.LineAttrNode
;
import
jadx.core.dex.attributes.nodes.SourceFileAttr
;
import
jadx.core.dex.info.AccessInfo
;
...
...
@@ -327,7 +326,6 @@ public class ClassGen {
private
void
insertDecompilationProblems
(
CodeWriter
code
,
AttrNode
node
)
{
List
<
JadxError
>
errors
=
node
.
getAll
(
AType
.
JADX_ERROR
);
List
<
JadxWarn
>
warns
=
node
.
getAll
(
AType
.
JADX_WARN
);
if
(!
errors
.
isEmpty
())
{
errors
.
forEach
(
err
->
{
code
.
startLine
(
"/* JADX ERROR: "
).
add
(
err
.
getError
());
...
...
@@ -340,8 +338,10 @@ public class ClassGen {
code
.
add
(
"*/"
);
});
}
List
<
String
>
warns
=
node
.
getAll
(
AType
.
JADX_WARN
);
if
(!
warns
.
isEmpty
())
{
warns
.
forEach
(
warn
->
code
.
startLine
(
"/* JADX WARNING: "
).
addMultiLine
(
warn
.
getWarn
()).
add
(
" */"
));
warns
.
stream
().
distinct
()
.
forEach
(
warn
->
code
.
startLine
(
"/* JADX WARNING: "
).
addMultiLine
(
warn
).
add
(
" */"
));
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/AType.java
View file @
ab7b6fc2
...
...
@@ -10,7 +10,6 @@ import jadx.core.dex.attributes.nodes.FieldReplaceAttr;
import
jadx.core.dex.attributes.nodes.ForceReturnAttr
;
import
jadx.core.dex.attributes.nodes.IgnoreEdgeAttr
;
import
jadx.core.dex.attributes.nodes.JadxError
;
import
jadx.core.dex.attributes.nodes.JadxWarn
;
import
jadx.core.dex.attributes.nodes.JumpInfo
;
import
jadx.core.dex.attributes.nodes.LocalVarsDebugInfoAttr
;
import
jadx.core.dex.attributes.nodes.LoopInfo
;
...
...
@@ -37,7 +36,7 @@ public class AType<T extends IAttribute> {
public
static
final
AType
<
AttrList
<
EdgeInsnAttr
>>
EDGE_INSN
=
new
AType
<>();
public
static
final
AType
<
AttrList
<
JadxError
>>
JADX_ERROR
=
new
AType
<>();
// code failed to decompile completely
public
static
final
AType
<
AttrList
<
JadxWarn
>>
JADX_WARN
=
new
AType
<>();
// mark code as inconsistent (code can be viewed)
public
static
final
AType
<
AttrList
<
String
>>
JADX_WARN
=
new
AType
<>();
// mark code as inconsistent (code can be viewed)
public
static
final
AType
<
AttrList
<
String
>>
COMMENTS
=
new
AType
<>();
// any additional info about decompilation
public
static
final
AType
<
ExcHandlerAttr
>
EXC_HANDLER
=
new
AType
<>();
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/nodes/JadxWarn.java
deleted
100644 → 0
View file @
41973651
package
jadx
.
core
.
dex
.
attributes
.
nodes
;
import
java.util.Objects
;
public
class
JadxWarn
{
private
final
String
warn
;
public
JadxWarn
(
String
warn
)
{
this
.
warn
=
Objects
.
requireNonNull
(
warn
);
}
public
String
getWarn
()
{
return
warn
;
}
@Override
public
String
toString
()
{
return
"JadxWarn: "
+
warn
;
}
}
jadx-core/src/main/java/jadx/core/utils/CodegenUtils.java
View file @
ab7b6fc2
package
jadx
.
core
.
utils
;
import
java.util.List
;
import
jadx.core.codegen.CodeWriter
;
import
jadx.core.dex.attributes.AType
;
import
jadx.core.dex.attributes.AttrNode
;
...
...
@@ -7,8 +9,10 @@ import jadx.core.dex.attributes.AttrNode;
public
class
CodegenUtils
{
public
static
void
addComments
(
CodeWriter
code
,
AttrNode
node
)
{
for
(
String
comment
:
node
.
getAll
(
AType
.
COMMENTS
))
{
code
.
startLine
(
"/* "
).
addMultiLine
(
comment
).
add
(
" */"
);
List
<
String
>
comments
=
node
.
getAll
(
AType
.
COMMENTS
);
if
(!
comments
.
isEmpty
())
{
comments
.
stream
().
distinct
()
.
forEach
(
comment
->
code
.
startLine
(
"/* "
).
addMultiLine
(
comment
).
add
(
" */"
));
}
}
}
jadx-core/src/main/java/jadx/core/utils/ErrorsCounter.java
View file @
ab7b6fc2
...
...
@@ -14,7 +14,6 @@ import jadx.core.dex.attributes.AFlag;
import
jadx.core.dex.attributes.AType
;
import
jadx.core.dex.attributes.IAttributeNode
;
import
jadx.core.dex.attributes.nodes.JadxError
;
import
jadx.core.dex.attributes.nodes.JadxWarn
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.IDexNode
;
import
jadx.core.dex.nodes.MethodNode
;
...
...
@@ -60,7 +59,7 @@ public class ErrorsCounter {
warnNodes
.
add
(
node
);
warnsCount
++;
node
.
addAttr
(
AType
.
JADX_WARN
,
new
JadxWarn
(
warn
)
);
node
.
addAttr
(
AType
.
JADX_WARN
,
warn
);
if
(!
node
.
contains
(
AType
.
JADX_ERROR
))
{
node
.
add
(
AFlag
.
INCONSISTENT_CODE
);
}
...
...
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