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
65544c64
Commit
65544c64
authored
Mar 25, 2019
by
Ahmed Ashour
Committed by
skylot
Mar 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: warn about compiler not found, and gracefully report failure (PR #511)
parent
b49acfda
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
DynamicCompiler.java
...rc/test/java/jadx/tests/api/compiler/DynamicCompiler.java
+10
-0
No files found.
jadx-core/src/test/java/jadx/tests/api/compiler/DynamicCompiler.java
View file @
65544c64
...
...
@@ -4,6 +4,10 @@ import javax.tools.JavaCompiler;
import
javax.tools.JavaFileManager
;
import
javax.tools.JavaFileObject
;
import
javax.tools.ToolProvider
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -14,6 +18,8 @@ import static javax.tools.JavaCompiler.CompilationTask;
public
class
DynamicCompiler
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
DynamicCompiler
.
class
);
private
final
ClassNode
clsNode
;
private
JavaFileManager
fileManager
;
...
...
@@ -29,6 +35,10 @@ public class DynamicCompiler {
String
code
=
clsNode
.
getCode
().
toString
();
JavaCompiler
compiler
=
ToolProvider
.
getSystemJavaCompiler
();
if
(
compiler
==
null
)
{
LOG
.
error
(
"Can not find compiler, please use JDK instead"
);
return
false
;
}
fileManager
=
new
ClassFileManager
(
compiler
.
getStandardFileManager
(
null
,
null
,
null
));
List
<
JavaFileObject
>
jFiles
=
new
ArrayList
<>(
1
);
...
...
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