You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/08/20 16:34:21 UTC

[groovy] branch master updated: Trivial refactoring: output bytecode with simple API

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 278f27d  Trivial refactoring: output bytecode with simple API
278f27d is described below

commit 278f27d64c6aa64b81658415435c8f7ce1797e45
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Aug 21 00:34:11 2021 +0800

    Trivial refactoring: output bytecode with simple API
---
 src/main/java/org/codehaus/groovy/control/CompilationUnit.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
index 7f5c178..af48d23 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
@@ -63,7 +63,6 @@ import java.io.InputStream;
 import java.net.URL;
 import java.security.CodeSource;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Deque;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -273,8 +272,7 @@ public class CompilationUnit extends ProcessingUnit {
 
             // create the file and write out the data
             try (FileOutputStream stream = new FileOutputStream(path)) {
-                byte[] bytes = groovyClass.getBytes();
-                stream.write(bytes, 0, bytes.length);
+                stream.write(groovyClass.getBytes());
             } catch (IOException e) {
                 getErrorCollector().addError(Message.create(e.getMessage(), this));
             }