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 2019/12/13 01:40:05 UTC

[groovy] branch master updated: Remove deprecated methods of `GroovyClassLoader`

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 feef283  Remove deprecated methods of `GroovyClassLoader`
feef283 is described below

commit feef283ff89cf68698f6b6a96117e1c29ae659cf
Author: Daniel.Sun <re...@hotmail.com>
AuthorDate: Fri Dec 13 08:19:44 2019 +0800

    Remove deprecated methods of `GroovyClassLoader`
---
 src/main/java/groovy/lang/GroovyClassLoader.java | 28 ------------------------
 1 file changed, 28 deletions(-)

diff --git a/src/main/java/groovy/lang/GroovyClassLoader.java b/src/main/java/groovy/lang/GroovyClassLoader.java
index abc6da0..27e7038 100644
--- a/src/main/java/groovy/lang/GroovyClassLoader.java
+++ b/src/main/java/groovy/lang/GroovyClassLoader.java
@@ -288,28 +288,6 @@ public class GroovyClassLoader extends URLClassLoader {
         return parseClass(gcs);
     }
 
-    /**
-     * @deprecated Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues.
-     * Use {@link #parseClass(Reader, String) parseClass} instead
-     */
-    @Deprecated
-    public Class parseClass(final InputStream in, final String fileName) throws CompilationFailedException {
-        // For generic input streams, provide a catch-all codebase of GroovyScript
-        // Security for these classes can be administered via policy grants with
-        // a codebase of file:groovy.script
-        GroovyCodeSource gcs = AccessController.doPrivileged((PrivilegedAction<GroovyCodeSource>) () -> {
-            try {
-                String scriptText = config.getSourceEncoding() != null ?
-                        IOGroovyMethods.getText(in, config.getSourceEncoding()) :
-                        IOGroovyMethods.getText(in);
-                return new GroovyCodeSource(scriptText, fileName, "/groovy/script");
-            } catch (IOException e) {
-                throw new RuntimeException("Impossible to read the content of the input stream for file named: " + fileName, e);
-            }
-        });
-        return parseClass(gcs);
-    }
-
     public Class parseClass(GroovyCodeSource codeSource) throws CompilationFailedException {
         return parseClass(codeSource, codeSource.isCachable());
     }
@@ -572,12 +550,6 @@ public class GroovyClassLoader extends URLClassLoader {
         }
 
         @Override
-        @Deprecated
-        public Class parseClass(InputStream in, String fileName) throws CompilationFailedException {
-            return delegate.parseClass(in, fileName);
-        }
-
-        @Override
         public Class parseClass(GroovyCodeSource codeSource) throws CompilationFailedException {
             return delegate.parseClass(codeSource);
         }