You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by rm...@apache.org on 2021/03/17 14:28:47 UTC
[openwebbeans] branch master updated: [OWB-1380] ensure annotated
mode works with prescanned scanner
This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 67bf3ec [OWB-1380] ensure annotated mode works with prescanned scanner
67bf3ec is described below
commit 67bf3ec0019bed9e1d0871f5bee135e2b8486cd7
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Wed Mar 17 15:28:34 2021 +0100
[OWB-1380] ensure annotated mode works with prescanned scanner
---
.../corespi/scanner/xbean/OwbAnnotationFinder.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/OwbAnnotationFinder.java b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/OwbAnnotationFinder.java
index afd4e44..c3d358e 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/OwbAnnotationFinder.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/OwbAnnotationFinder.java
@@ -22,6 +22,7 @@ import org.apache.xbean.finder.AnnotationFinder;
import org.apache.xbean.finder.archive.Archive;
import org.apache.xbean.finder.archive.ClassesArchive;
+import java.lang.reflect.Field;
import java.util.stream.Stream;
/**
@@ -43,6 +44,19 @@ public class OwbAnnotationFinder extends AnnotationFinder
public OwbAnnotationFinder(final Class<?>[] classes)
{
super(new ClassesArchive(/*empty since we want to read from reflection, not from resources*/));
+ try
+ {
+ final Field linking = AnnotationFinder.class.getDeclaredField("linking");
+ if (!linking.isAccessible())
+ {
+ linking.setAccessible(true);
+ }
+ linking.set(this, true);
+ }
+ catch (final Exception e)
+ {
+ // ignore, will not affect all cases
+ }
Stream.of(classes).forEach(c -> super.readClassDef(c));
}