Skip to content

Commit

Permalink
fix: compare api
Browse files Browse the repository at this point in the history
  • Loading branch information
tmznwnel00 committed Jun 23, 2024
1 parent d6a7dfe commit d3250a4
Showing 1 changed file with 0 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public AnalyzeResponseDTO compareCarbonEmissions(AnalyzeRequestDTO request) thro
private double calculateCarbonEmissions(String code) throws Exception {
String codeInfo = CodeInfo(code);

if (codeInfo == null) {
System.out.println("Compilation failed.");
return -1;
}

// 소스 코드를 파일로 저장
File sourceFile = new File("Code.java");
try (PrintWriter writer = new PrintWriter(sourceFile)) {
Expand All @@ -58,14 +53,6 @@ private double calculateCarbonEmissions(String code) throws Exception {
JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits);
boolean success = task.call();

if (!success) {
for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
System.out.format("Error on line %d%n", diagnostic.getLineNumber());
}
System.out.println("Compilation failed.");
return -1;
}

// 실행
Process process = Runtime.getRuntime().exec("java Code");

Expand Down

0 comments on commit d3250a4

Please sign in to comment.