|
1 | 1 | /*
|
2 |
| - * Licensed to the Apache Software Foundation (ASF) under one |
3 |
| - * or more contributor license agreements. See the NOTICE file |
4 |
| - * distributed with this work for additional information |
5 |
| - * regarding copyright ownership. The ASF licenses this file |
6 |
| - * to you under the Apache License, Version 2.0 (the |
7 |
| - * "License"); you may not use this file except in compliance |
8 |
| - * with the License. You may obtain a copy of the License at |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license |
| 3 | + * agreements. See the NOTICE file distributed with this work for additional information regarding |
| 4 | + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the |
| 5 | + * "License"); you may not use this file except in compliance with the License. You may obtain a |
| 6 | + * copy of the License at |
9 | 7 | *
|
10 |
| - * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software distributed under the License |
| 11 | + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 12 | + * or implied. See the License for the specific language governing permissions and limitations under |
| 13 | + * the License. |
| 14 | + */ |
| 15 | +/* |
| 16 | + * @todo multi threaded compiling of the same class but with different roots for compilation... T1 |
| 17 | + * compiles A, which uses B, T2 compiles B... mark A and B as parsed and then synchronize |
| 18 | + * compilation. Problems: How to synchronize? How to get error messages? |
11 | 19 | *
|
12 |
| - * Unless required by applicable law or agreed to in writing, |
13 |
| - * software distributed under the License is distributed on an |
14 |
| - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 |
| - * KIND, either express or implied. See the License for the |
16 |
| - * specific language governing permissions and limitations |
17 |
| - * under the License. |
18 | 20 | */
|
19 | 21 | package groovy.lang;
|
20 | 22 |
|
21 |
| -public class GroovyClassLoader { |
| 23 | +import java.io.File; |
| 24 | +import java.io.IOException; |
| 25 | +import java.io.InputStream; |
| 26 | +import java.io.Reader; |
| 27 | +import java.net.URL; |
| 28 | +import java.net.URLClassLoader; |
| 29 | +import java.util.Enumeration; |
| 30 | +import org.codehaus.groovy.ast.ClassNode; |
| 31 | +import org.codehaus.groovy.control.CompilationFailedException; |
| 32 | +import org.codehaus.groovy.control.CompilerConfiguration; |
| 33 | + |
| 34 | +public class GroovyClassLoader extends URLClassLoader { |
22 | 35 | public GroovyClassLoader() {
|
| 36 | + super(null); |
| 37 | + } |
| 38 | + |
| 39 | + public GroovyClassLoader(ClassLoader loader) { |
| 40 | + super(null); |
| 41 | + } |
| 42 | + |
| 43 | + public GroovyClassLoader(GroovyClassLoader parent) { |
| 44 | + super(null); |
| 45 | + } |
| 46 | + |
| 47 | + public GroovyClassLoader(ClassLoader parent, CompilerConfiguration config, |
| 48 | + boolean useConfigurationClasspath) { |
| 49 | + super(null); |
| 50 | + } |
| 51 | + |
| 52 | + public GroovyClassLoader(ClassLoader loader, CompilerConfiguration config) { |
| 53 | + super(null); |
| 54 | + } |
| 55 | + |
| 56 | + |
| 57 | + public Class defineClass(ClassNode classNode, String file, String newCodeBase) { |
| 58 | + return null; |
| 59 | + } |
| 60 | + |
| 61 | + public boolean hasCompatibleConfiguration(CompilerConfiguration config) { |
| 62 | + return false; |
| 63 | + } |
| 64 | + |
| 65 | + public Class parseClass(File file) throws CompilationFailedException, IOException { |
| 66 | + return null; |
| 67 | + } |
| 68 | + |
| 69 | + public Class parseClass(final String text, final String fileName) |
| 70 | + throws CompilationFailedException { |
| 71 | + return null; |
| 72 | + } |
| 73 | + |
| 74 | + public Class parseClass(String text) throws CompilationFailedException { |
| 75 | + return null; |
| 76 | + } |
| 77 | + |
| 78 | + public synchronized String generateScriptName() { |
| 79 | + return null; |
| 80 | + } |
| 81 | + |
| 82 | + public Class parseClass(final Reader reader, final String fileName) |
| 83 | + throws CompilationFailedException { |
| 84 | + return null; |
| 85 | + } |
| 86 | + |
| 87 | + public Class parseClass(final InputStream in, final String fileName) |
| 88 | + throws CompilationFailedException { |
| 89 | + return null; |
| 90 | + } |
| 91 | + |
| 92 | + public Class parseClass(GroovyCodeSource codeSource) throws CompilationFailedException { |
| 93 | + return null; |
| 94 | + } |
| 95 | + |
| 96 | + public Class parseClass(final GroovyCodeSource codeSource, boolean shouldCacheSource) |
| 97 | + throws CompilationFailedException { |
| 98 | + return null; |
| 99 | + } |
| 100 | + |
| 101 | + public static class InnerLoader extends GroovyClassLoader { |
| 102 | + public InnerLoader(GroovyClassLoader delegate) {} |
| 103 | + |
| 104 | + @Override |
| 105 | + public void addClasspath(String path) {} |
| 106 | + |
| 107 | + @Override |
| 108 | + public void clearCache() {} |
| 109 | + |
| 110 | + @Override |
| 111 | + public URL findResource(String name) { |
| 112 | + return null; |
| 113 | + } |
| 114 | + |
| 115 | + @Override |
| 116 | + public Enumeration<URL> findResources(String name) throws IOException { |
| 117 | + return null; |
| 118 | + } |
| 119 | + |
| 120 | + @Override |
| 121 | + public Class[] getLoadedClasses() { |
| 122 | + return null; |
| 123 | + } |
| 124 | + |
| 125 | + @Override |
| 126 | + public URL getResource(String name) { |
| 127 | + return null; |
| 128 | + } |
| 129 | + |
| 130 | + @Override |
| 131 | + public InputStream getResourceAsStream(String name) { |
| 132 | + return null; |
| 133 | + } |
| 134 | + |
| 135 | + @Override |
| 136 | + public URL[] getURLs() { |
| 137 | + return null; |
| 138 | + } |
| 139 | + |
| 140 | + @Override |
| 141 | + public Class loadClass(String name, boolean lookupScriptFiles, |
| 142 | + boolean preferClassOverScript, boolean resolve) |
| 143 | + throws ClassNotFoundException, CompilationFailedException { |
| 144 | + return null; |
| 145 | + } |
| 146 | + |
| 147 | + @Override |
| 148 | + public Class parseClass(GroovyCodeSource codeSource, boolean shouldCache) |
| 149 | + throws CompilationFailedException { |
| 150 | + return null; |
| 151 | + } |
| 152 | + |
| 153 | + @Override |
| 154 | + public void addURL(URL url) {} |
| 155 | + |
| 156 | + @Override |
| 157 | + public Class defineClass(ClassNode classNode, String file, String newCodeBase) { |
| 158 | + return null; |
| 159 | + } |
| 160 | + |
| 161 | + @Override |
| 162 | + public Class parseClass(File file) throws CompilationFailedException, IOException { |
| 163 | + return null; |
| 164 | + } |
| 165 | + |
| 166 | + @Override |
| 167 | + public Class parseClass(String text, String fileName) throws CompilationFailedException { |
| 168 | + return null; |
| 169 | + } |
| 170 | + |
| 171 | + @Override |
| 172 | + public Class parseClass(String text) throws CompilationFailedException { |
| 173 | + return null; |
| 174 | + } |
| 175 | + |
| 176 | + @Override |
| 177 | + public String generateScriptName() { |
| 178 | + return null; |
| 179 | + } |
| 180 | + |
| 181 | + @Override |
| 182 | + public Class parseClass(Reader reader, String fileName) throws CompilationFailedException { |
| 183 | + return null; |
| 184 | + } |
| 185 | + |
| 186 | + @Override |
| 187 | + public Class parseClass(InputStream in, String fileName) throws CompilationFailedException { |
| 188 | + return null; |
| 189 | + } |
| 190 | + |
| 191 | + @Override |
| 192 | + public Class parseClass(GroovyCodeSource codeSource) throws CompilationFailedException { |
| 193 | + return null; |
| 194 | + } |
| 195 | + |
| 196 | + @Override |
| 197 | + public Class defineClass(String name, byte[] b) { |
| 198 | + return null; |
| 199 | + } |
| 200 | + |
| 201 | + @Override |
| 202 | + public Class loadClass(String name, boolean lookupScriptFiles, |
| 203 | + boolean preferClassOverScript) |
| 204 | + throws ClassNotFoundException, CompilationFailedException { |
| 205 | + return null; |
| 206 | + } |
| 207 | + |
| 208 | + @Override |
| 209 | + public void setShouldRecompile(Boolean mode) {} |
| 210 | + |
| 211 | + @Override |
| 212 | + public Boolean isShouldRecompile() { |
| 213 | + return null; |
| 214 | + } |
| 215 | + |
| 216 | + @Override |
| 217 | + public Class<?> loadClass(String name) throws ClassNotFoundException { |
| 218 | + return null; |
| 219 | + } |
| 220 | + |
| 221 | + @Override |
| 222 | + public Enumeration<URL> getResources(String name) throws IOException { |
| 223 | + return null; |
| 224 | + } |
| 225 | + |
| 226 | + @Override |
| 227 | + public void setDefaultAssertionStatus(boolean enabled) {} |
| 228 | + |
| 229 | + @Override |
| 230 | + public void setPackageAssertionStatus(String packageName, boolean enabled) {} |
| 231 | + |
| 232 | + @Override |
| 233 | + public void setClassAssertionStatus(String className, boolean enabled) {} |
| 234 | + |
| 235 | + @Override |
| 236 | + public void clearAssertionStatus() {} |
| 237 | + |
| 238 | + @Override |
| 239 | + public void close() throws IOException {} |
| 240 | + |
| 241 | + public long getTimeStamp() { |
| 242 | + return 0; |
| 243 | + } |
| 244 | + |
| 245 | + } |
| 246 | + |
| 247 | + public Class defineClass(String name, byte[] b) { |
| 248 | + return null; |
23 | 249 | }
|
24 | 250 |
|
25 |
| - public Class parseClass(String text) { |
| 251 | + public Class loadClass(final String name, boolean lookupScriptFiles, |
| 252 | + boolean preferClassOverScript) |
| 253 | + throws ClassNotFoundException, CompilationFailedException { |
26 | 254 | return null;
|
27 | 255 | }
|
28 | 256 |
|
29 |
| - public Class parseClass(GroovyCodeSource gcs) { |
| 257 | + public void addURL(URL url) {} |
| 258 | + |
| 259 | + public void setShouldRecompile(Boolean mode) {} |
| 260 | + |
| 261 | + public Boolean isShouldRecompile() { |
30 | 262 | return null;
|
31 | 263 | }
|
| 264 | + |
| 265 | + public Class loadClass(final String name, boolean lookupScriptFiles, |
| 266 | + boolean preferClassOverScript, boolean resolve) |
| 267 | + throws ClassNotFoundException, CompilationFailedException { |
| 268 | + return null; |
| 269 | + } |
| 270 | + |
| 271 | + @Override |
| 272 | + public Class<?> loadClass(String name) throws ClassNotFoundException { |
| 273 | + return null; |
| 274 | + } |
| 275 | + |
| 276 | + public void addClasspath(final String path) {} |
| 277 | + |
| 278 | + public Class[] getLoadedClasses() { |
| 279 | + return null; |
| 280 | + } |
| 281 | + |
| 282 | + public void clearCache() {} |
| 283 | + |
| 284 | + @Override |
| 285 | + public void close() throws IOException {} |
| 286 | + |
32 | 287 | }
|
0 commit comments