Skip to content

Commit

Permalink
ref-0.10.3 (#418)
Browse files Browse the repository at this point in the history
* Bump maven-bundle-plugin from 5.1.2 to 5.1.8 (#408)

Bumps maven-bundle-plugin from 5.1.2 to 5.1.8.

---
updated-dependencies:
- dependency-name: org.apache.felix:maven-bundle-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump gson from 2.8.8 to 2.9.1 (#417)

Bumps [gson](https://github.com/google/gson) from 2.8.8 to 2.9.1.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md)
- [Commits](google/gson@gson-parent-2.8.8...gson-parent-2.9.1)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump slf4j-simple from 1.7.32 to 1.7.36 (#416)

Bumps [slf4j-simple](https://github.com/qos-ch/slf4j) from 1.7.32 to 1.7.36.
- [Release notes](https://github.com/qos-ch/slf4j/releases)
- [Commits](qos-ch/slf4j@v_1.7.32...v_1.7.36)

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-simple
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump slf4j-api from 1.7.32 to 1.7.36 (#415)

Bumps [slf4j-api](https://github.com/qos-ch/slf4j) from 1.7.32 to 1.7.36.
- [Release notes](https://github.com/qos-ch/slf4j/releases)
- [Commits](qos-ch/slf4j@v_1.7.32...v_1.7.36)

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump junit-jupiter-engine from 5.8.1 to 5.9.0 (#406)

Bumps [junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.8.1 to 5.9.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](junit-team/junit5@r5.8.1...r5.9.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jboss-vfs from 3.2.15.Final to 3.2.17.Final (#399)

Bumps [jboss-vfs](https://github.com/jbossas/jboss-vfs) from 3.2.15.Final to 3.2.17.Final.
- [Release notes](https://github.com/jbossas/jboss-vfs/releases)
- [Commits](jbossas/jboss-vfs@3.2.15.Final...3.2.17.Final)

---
updated-dependencies:
- dependency-name: org.jboss:jboss-vfs
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Issue with new releases of OpenJDK and Zulu.  fix #395 (#396)

* fix #395

* Refactor to use VirtualJarInputStream.root instead of JarInputDir which is much slower. fix #395

Co-authored-by: Dominik Kessler <dominik.kessler@ergon.ch>

* Bump maven-jar-plugin from 3.2.0 to 3.2.2 (#381)

Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.0 to 3.2.2.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](apache/maven-jar-plugin@maven-jar-plugin-3.2.0...maven-jar-plugin-3.2.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Make URL more accurate (#302)

* rev

* null check params, update jdk tests, auto close dir

* remove jdk tests

* Improve MAVEN build Performance (#363)

Co-authored-by: fdse <fdse@node2>
Co-authored-by: ronmamo <2588829+ronmamo@users.noreply.github.com>

* synthetic/lambda cherry-picked from PR #290 by @ziqin

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kesslerd <kesslerd@users.noreply.github.com>
Co-authored-by: Dominik Kessler <dominik.kessler@ergon.ch>
Co-authored-by: Chen <chenguopingdota@163.com>
Co-authored-by: ronma <ronma@>
Co-authored-by: ChenZhangg <32891042+ChenZhangg@users.noreply.github.com>
Co-authored-by: fdse <fdse@node2>
  • Loading branch information
7 people committed Jun 15, 2023
1 parent 0569496 commit a566ac6
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 290 deletions.
17 changes: 5 additions & 12 deletions pom.xml
Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
<version>1.7.36</version>
</dependency>

<dependency>
Expand All @@ -94,25 +94,18 @@
<optional>true</optional> <!-- case: when no servlet environment -->
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.32</version>
<optional>true</optional> <!-- case: when other logging implementation used or logging is not needed -->
</dependency>

<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
<version>3.2.15.Final</version>
<version>3.2.17.Final</version>
<scope>provided</scope>
<optional>true</optional><!-- case: when using jboss-vfs -->
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.1</version>
<version>5.9.0</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -204,7 +197,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.2</version>
<version>5.1.8</version>
<executions>
<execution>
<id>bundle-manifest</id>
Expand All @@ -228,7 +221,7 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.2.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/org/reflections/Reflections.java
Expand Up @@ -171,9 +171,7 @@ protected Map<String, Map<String, Set<String>>> scan() {
Set<URL> urls = configuration.getUrls();

(configuration.isParallel() ? urls.stream().parallel() : urls.stream()).forEach(url -> {
Vfs.Dir dir = null;
try {
dir = Vfs.fromURL(url);
try (Vfs.Dir dir = Vfs.fromURL(url)) {
for (Vfs.File file : dir.getFiles()) {
if (doFilter(file, configuration.getInputsFilter())) {
ClassFile classFile = null;
Expand All @@ -188,15 +186,13 @@ protected Map<String, Map<String, Set<String>>> scan() {
if (entries != null) collect.get(scanner.index()).addAll(entries);
}
} catch (Exception e) {
if (log != null) log.trace("could not scan file {} with scanner {}", file.getRelativePath(), scanner.getClass().getSimpleName(), e);
if (log != null) log.debug("could not scan file {} with scanner {}", file.getRelativePath(), scanner.getClass().getSimpleName(), e);
}
}
}
}
} catch (Exception e) {
if (log != null) log.warn("could not create Vfs.Dir from url. ignoring the exception and continuing", e);
} finally {
if (dir != null) dir.close();
}
});

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/reflections/util/ClasspathHelper.java
Expand Up @@ -110,7 +110,7 @@ public static Collection<URL> forResource(String resourceName, ClassLoader... cl
final URL url = urls.nextElement();
int index = url.toExternalForm().lastIndexOf(resourceName);
if (index != -1) {
// Add old url as contextUrl to support exotic url handlers
// Add old url as contextUrl to support exotic url handlers
result.add(new URL(url, url.toExternalForm().substring(0, index)));
} else {
result.add(url);
Expand Down Expand Up @@ -186,6 +186,7 @@ public static Collection<URL> forClassLoader(ClassLoader... classLoaders) {
final ClassLoader[] loaders = classLoaders(classLoaders);
for (ClassLoader classLoader : loaders) {
while (classLoader != null) {

if (classLoader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) classLoader).getURLs();
if (urls != null) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/reflections/util/ConfigurationBuilder.java
Expand Up @@ -70,9 +70,11 @@ public static ConfigurationBuilder build(Object... params) {
// flatten
List<Object> parameters = new ArrayList<>();
for (Object param : params) {
if (param.getClass().isArray()) { for (Object p : (Object[]) param) parameters.add(p); }
else if (param instanceof Iterable) { for (Object p : (Iterable) param) parameters.add(p); }
else parameters.add(param);
if (param != null) {
if (param.getClass().isArray()) { for (Object p : (Object[]) param) parameters.add(p); }
else if (param instanceof Iterable) { for (Object p : (Iterable) param) parameters.add(p); }
else parameters.add(param);
}
}

ClassLoader[] loaders = Stream.of(params).filter(p -> p instanceof ClassLoader).distinct().toArray(ClassLoader[]::new);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/reflections/util/NameHelper.java
Expand Up @@ -108,7 +108,7 @@ default Member forMember(String descriptor, ClassLoader... loaders) throws Refle
String memberKey = p0 != -1 ? descriptor.substring(0, p0) : descriptor;
String methodParameters = p0 != -1 ? descriptor.substring(p0 + 1, descriptor.lastIndexOf(')')) : "";

int p1 = Math.max(memberKey.lastIndexOf('.'), memberKey.lastIndexOf("$"));
int p1 = memberKey.lastIndexOf('.');
String className = memberKey.substring(0, p1);
String memberName = memberKey.substring(p1 + 1);

Expand Down
12 changes: 10 additions & 2 deletions src/main/java/org/reflections/vfs/JbossDir.java
@@ -1,7 +1,9 @@
package org.reflections.vfs;

import org.jboss.vfs.VirtualFile;
import org.jboss.vfs.VirtualJarInputStream;

import java.lang.reflect.Field;
import java.net.URL;
import java.util.Iterator;
import java.util.Stack;
Expand All @@ -16,8 +18,14 @@ private JbossDir(VirtualFile virtualFile) {
}

public static Vfs.Dir createDir(URL url) throws Exception {
VirtualFile virtualFile = (VirtualFile) url.openConnection().getContent();
if(virtualFile.isFile()) {
Object content = url.openConnection().getContent();
if (content instanceof VirtualJarInputStream) {
Field root = content.getClass().getDeclaredField("root");
root.setAccessible(true);
content = root.get(content);
}
VirtualFile virtualFile = (VirtualFile) content;
if (virtualFile.isFile()) {
return new ZipDir(new JarFile(virtualFile.getPhysicalFile()));
}
return new JbossDir(virtualFile);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/reflections/vfs/Vfs.java
Expand Up @@ -56,7 +56,7 @@ public abstract class Vfs {
private static List<UrlType> defaultUrlTypes = new ArrayList<>(Arrays.asList(DefaultUrlTypes.values()));

/** an abstract vfs dir */
public interface Dir {
public interface Dir extends AutoCloseable {
String getPath();
Iterable<File> getFiles();
default void close() {}
Expand Down Expand Up @@ -124,8 +124,8 @@ public static Dir fromURL(final URL url, final UrlType... urlTypes) {
/** return an iterable of all {@link org.reflections.vfs.Vfs.File} in given urls, starting with given packagePrefix and matching nameFilter */
public static Iterable<File> findFiles(final Collection<URL> inUrls, final String packagePrefix, final Predicate<String> nameFilter) {
Predicate<File> fileNamePredicate = file -> {
String path = file.getRelativePath();
if (path.startsWith(packagePrefix)) {
String path = file.toString().replace('\\','/');
if (path.contains(packagePrefix)) {
String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length());
return !filename.isEmpty() && nameFilter.test(filename.substring(1));
} else {
Expand Down

0 comments on commit a566ac6

Please sign in to comment.