|
31 | 31 | import com.eviware.soapui.support.listener.ListenerRegistry; |
32 | 32 | import org.apache.commons.lang.ObjectUtils; |
33 | 33 | import org.reflections.Reflections; |
34 | | -import org.reflections.adapters.JavaReflectionAdapter; |
35 | | -import org.reflections.scanners.SubTypesScanner; |
| 34 | +import org.reflections.scanners.Scanners; |
36 | 35 | import org.reflections.util.ClasspathHelper; |
37 | 36 | import org.reflections.util.ConfigurationBuilder; |
38 | | -import org.reflections.vfs.Vfs; |
39 | 37 | import org.slf4j.Logger; |
40 | 38 | import org.slf4j.LoggerFactory; |
41 | 39 |
|
@@ -101,8 +99,8 @@ protected Collection<? extends SoapUIFactory> registerFactories(Collection<? ext |
101 | 99 | protected void loadAutoFactories(Reflections jarFileScanner, Collection<SoapUIFactory> factories) { |
102 | 100 | ConfigurationBuilder builder = new ConfigurationBuilder(); |
103 | 101 | builder.addUrls(ClasspathHelper.forClass(AutoFactory.class)); |
104 | | - builder.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner()); |
105 | | - builder.addClassLoader(Thread.currentThread().getContextClassLoader()); |
| 102 | + builder.setScanners(Scanners.SubTypes, Scanners.TypesAnnotated); |
| 103 | + builder.addClassLoaders(Thread.currentThread().getContextClassLoader()); |
106 | 104 | Reflections autoAnnotationFinder = new Reflections(builder); |
107 | 105 |
|
108 | 106 | for (Class clazz : autoAnnotationFinder.getTypesAnnotatedWith(AutoFactory.class)) { |
@@ -373,35 +371,4 @@ private boolean isToolbarAction(SoapUIAction soapUIAction) { |
373 | 371 | return annotation != null && StringUtils.hasContent(annotation.toolbarIcon()); |
374 | 372 | } |
375 | 373 |
|
376 | | - // due to Reflections internals (or my misunderstanding of them) this class has to be |
377 | | - // named as its superclass |
378 | | - protected static class TypeAnnotationsScanner extends org.reflections.scanners.TypeAnnotationsScanner { |
379 | | - @Override |
380 | | - public boolean acceptsInput(String file) { |
381 | | - if (file.endsWith(".groovy")) { |
382 | | - return true; |
383 | | - } else { |
384 | | - return super.acceptsInput(file); |
385 | | - } |
386 | | - } |
387 | | - } |
388 | | - |
389 | | - // loads both groovy and java classes for Reflections package |
390 | | - protected static class GroovyAndJavaReflectionAdapter extends JavaReflectionAdapter { |
391 | | - |
392 | | - private final JarClassLoader jarClassLoader; |
393 | | - |
394 | | - public GroovyAndJavaReflectionAdapter(JarClassLoader jarClassLoader) { |
395 | | - this.jarClassLoader = jarClassLoader; |
396 | | - } |
397 | | - |
398 | | - @Override |
399 | | - public Class getOfCreateClassObject(Vfs.File file) throws Exception { |
400 | | - if (file.getName().endsWith(".groovy")) { |
401 | | - return jarClassLoader.loadScriptClass(file.getRelativePath()); |
402 | | - } else { |
403 | | - return super.getOfCreateClassObject(file, jarClassLoader); |
404 | | - } |
405 | | - } |
406 | | - } |
407 | 374 | } |
0 commit comments