[openwebbeans] branch master updated: [OWB-1364] ensure we ignore non proxied Object class when computing stable proxy names
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 c5103b0 [OWB-1364] ensure we ignore non proxied Object class when computing stable proxy names c5103b0 is described below commit c5103b076723075832cdb981aedc085d7467b548 Author: Romain Manni-Bucau AuthorDate: Wed Dec 30 14:48:01 2020 +0100 [OWB-1364] ensure we ignore non proxied Object class when computing stable proxy names --- .../apache/webbeans/corespi/scanner/xbean/OwbAnnotationFinder.java | 4 ++-- .../main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java| 5 - .../test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) 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 1b4b13c..afd4e44 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 @@ -42,8 +42,8 @@ public class OwbAnnotationFinder extends AnnotationFinder public OwbAnnotationFinder(final Class[] classes) { -super(new ClassesArchive(/*empty since we want to read from reflection, not form resources*/)); -Stream.of(classes).forEach(super::readClassDef); +super(new ClassesArchive(/*empty since we want to read from reflection, not from resources*/)); +Stream.of(classes).forEach(c -> super.readClassDef(c)); } public ClassInfo getClassInfo(String className) diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java index f9625f1..6be6ee3 100644 --- a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java +++ b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java @@ -252,7 +252,10 @@ public abstract class AbstractProxyFactory proxiedMethods == null ? Stream.empty() : Stream.of(proxiedMethods).map(Method::toGenericString).sorted(), notProxiedMethods == null ? Stream.empty() : - Stream.of(notProxiedMethods).map(Method::toGenericString).map(it -> "" + it).sorted() +Stream.of(notProxiedMethods) +.filter(it -> it.getDeclaringClass() != Object.class) +.map(Method::toGenericString) +.map(it -> "" + it).sorted() ).collect(joining("_"); } // else unsafe - 1 proxy per class max! diff --git a/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java b/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java index 38f3945..0ff1ecd 100644 --- a/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java +++ b/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java @@ -123,7 +123,7 @@ public class ProxyFactoryTest extends AbstractUnitTest final ABean bean1 = getInstance("bean1"); final ABean bean2 = getInstance("bean2"); assertEquals( - "org.apache.webbeans.test.managed.ProxyFactoryTest$ABean$$OwbNormalScopeProxy8050522010792129812", + "org.apache.webbeans.test.managed.ProxyFactoryTest$ABean$$OwbNormalScopeProxy5751833139562769786", bean1.getClass().getName()); assertEquals( "org.apache.webbeans.test.managed.ProxyFactoryTest$ABean$$OwbInterceptProxy5751833139562769786",
[openwebbeans] branch master updated: [OWB-1363] prescanned cdi se scanner - enable to reuse addClassesDeploymentUrl instead of doing it manually outside
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 520cd58 [OWB-1363] prescanned cdi se scanner - enable to reuse addClassesDeploymentUrl instead of doing it manually outside 520cd58 is described below commit 520cd5819a71c394daf1baa2f25c30f60dbb7eaf Author: Romain Manni-Bucau AuthorDate: Wed Dec 30 14:35:52 2020 +0100 [OWB-1363] prescanned cdi se scanner - enable to reuse addClassesDeploymentUrl instead of doing it manually outside --- .../openwebbeans/se/CDISeScannerService.java | 31 +- .../se/PreScannedCDISeScannerService.java | 1 + 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/webbeans-se/src/main/java/org/apache/openwebbeans/se/CDISeScannerService.java b/webbeans-se/src/main/java/org/apache/openwebbeans/se/CDISeScannerService.java index e61ce8b..9780a78 100644 --- a/webbeans-se/src/main/java/org/apache/openwebbeans/se/CDISeScannerService.java +++ b/webbeans-se/src/main/java/org/apache/openwebbeans/se/CDISeScannerService.java @@ -89,21 +89,26 @@ public class CDISeScannerService extends AbstractMetaDataDiscovery if (!classes.isEmpty()) { -try +addClassesDeploymentUrl(); +} +} + +protected void addClassesDeploymentUrl() +{ +try +{ +addDeploymentUrl(CDISeBeanArchiveService.EMBEDDED_URL, new URL("openwebbeans", null, 0, "cdise", new URLStreamHandler() { -addDeploymentUrl(CDISeBeanArchiveService.EMBEDDED_URL, new URL("openwebbeans", null, 0, "cdise", new URLStreamHandler() +@Override +protected URLConnection openConnection(URL u) throws IOException { -@Override -protected URLConnection openConnection(URL u) throws IOException -{ -return null; -} -})); -} -catch (MalformedURLException e) -{ -throw new IllegalArgumentException(e); // quite unlikely -} +return null; +} +})); +} +catch (MalformedURLException e) +{ +throw new IllegalArgumentException(e); // quite unlikely } } diff --git a/webbeans-se/src/main/java/org/apache/openwebbeans/se/PreScannedCDISeScannerService.java b/webbeans-se/src/main/java/org/apache/openwebbeans/se/PreScannedCDISeScannerService.java index 80130b0..14f7897 100644 --- a/webbeans-se/src/main/java/org/apache/openwebbeans/se/PreScannedCDISeScannerService.java +++ b/webbeans-se/src/main/java/org/apache/openwebbeans/se/PreScannedCDISeScannerService.java @@ -61,6 +61,7 @@ public class PreScannedCDISeScannerService extends CDISeScannerService throw new IllegalArgumentException(e); } }).toArray(Class[]::new); +addClassesDeploymentUrl(); final BeanArchiveService beanArchiveService = webBeansContext.getBeanArchiveService(); archive = new CdiArchive( beanArchiveService, WebBeansUtil.getCurrentClassLoader(),
[openwebbeans] branch master updated: [OWB-1363] prescanned cdi se 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 a6e47d6 [OWB-1363] prescanned cdi se scanner a6e47d6 is described below commit a6e47d6cf5dffb12c92783b25003fd26f2c42883 Author: Romain Manni-Bucau AuthorDate: Wed Dec 30 14:30:15 2020 +0100 [OWB-1363] prescanned cdi se scanner --- .../webbeans/corespi/scanner/xbean/CdiArchive.java | 2 +- .../corespi/scanner/xbean/OwbAnnotationFinder.java | 9 ++ .../se/PreScannedCDISeScannerService.java | 96 ++ 3 files changed, 106 insertions(+), 1 deletion(-) diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/CdiArchive.java b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/CdiArchive.java index b77aaf0..dfb1e11 100644 --- a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/CdiArchive.java +++ b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/CdiArchive.java @@ -104,7 +104,7 @@ public class CdiArchive implements Archive return delegate.iterator(); } -public final class FoundClasses +public static final class FoundClasses { private URL url; private Collection classNames; 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 7dd86f4..1b4b13c 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 @@ -20,6 +20,9 @@ package org.apache.webbeans.corespi.scanner.xbean; import org.apache.xbean.finder.AnnotationFinder; import org.apache.xbean.finder.archive.Archive; +import org.apache.xbean.finder.archive.ClassesArchive; + +import java.util.stream.Stream; /** * We just extend the default AnnotationFinder to get Access to the original ClassInfo @@ -37,6 +40,12 @@ public class OwbAnnotationFinder extends AnnotationFinder super(archive); } +public OwbAnnotationFinder(final Class[] classes) +{ +super(new ClassesArchive(/*empty since we want to read from reflection, not form resources*/)); +Stream.of(classes).forEach(super::readClassDef); +} + public ClassInfo getClassInfo(String className) { return classInfos.get(className); diff --git a/webbeans-se/src/main/java/org/apache/openwebbeans/se/PreScannedCDISeScannerService.java b/webbeans-se/src/main/java/org/apache/openwebbeans/se/PreScannedCDISeScannerService.java new file mode 100644 index 000..80130b0 --- /dev/null +++ b/webbeans-se/src/main/java/org/apache/openwebbeans/se/PreScannedCDISeScannerService.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openwebbeans.se; + +import org.apache.webbeans.config.OpenWebBeansConfiguration; +import org.apache.webbeans.config.WebBeansContext; +import org.apache.webbeans.corespi.scanner.xbean.CdiArchive; +import org.apache.webbeans.corespi.scanner.xbean.OwbAnnotationFinder; +import org.apache.webbeans.spi.BeanArchiveService; +import org.apache.webbeans.util.WebBeansUtil; +import org.apache.xbean.finder.AnnotationFinder; + +import java.net.URL; +import java.util.Map; +import java.util.stream.Stream; + +import static java.util.Collections.emptyMap; +import static java.util.stream.Collectors.toList; + +public class PreScannedCDISeScannerService extends CDISeScannerService +{ +@Override +protected AnnotationFinder initFinder() +{ +if (finder != null) +{ +return finder; +} + +// todo: support to read beanDeploymentUrls from the conf as well +// -> for now we use a full programmatic deployment (single in mem archive) +final WebBeansContext webBeansContext = webBeansContext(); +final OpenWebBeansConfiguration conf =
[openwebbeans] branch master updated: [OWB-1362] avoid NPE when XxHash64 naming is used for proxies
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 146a896 [OWB-1362] avoid NPE when XxHash64 naming is used for proxies 146a896 is described below commit 146a8966e32fc3e3dc8dd0637bc63d76a06ddadc Author: Romain Manni-Bucau AuthorDate: Wed Dec 30 12:32:26 2020 +0100 [OWB-1362] avoid NPE when XxHash64 naming is used for proxies --- .../main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java index efb5932..f9625f1 100644 --- a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java +++ b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java @@ -249,8 +249,10 @@ public abstract class AbstractProxyFactory // xxhash64 has very low collision so for this kind of has it is safe enough // and enables to avoid a big concatenation for names return Long.toString(Math.abs(XxHash64.apply(Stream.concat( - Stream.of(proxiedMethods).map(Method::toGenericString).sorted(), - Stream.of(notProxiedMethods).map(Method::toGenericString).map(it -> "" + it).sorted() +proxiedMethods == null ? Stream.empty() : + Stream.of(proxiedMethods).map(Method::toGenericString).sorted(), +notProxiedMethods == null ? Stream.empty() : + Stream.of(notProxiedMethods).map(Method::toGenericString).map(it -> "" + it).sorted() ).collect(joining("_"); } // else unsafe - 1 proxy per class max!
svn commit: r1069625 - in /websites: production/openwebbeans/content/index.html staging/openwebbeans/trunk/content/index.html
Author: buildbot Date: Wed Dec 30 10:35:07 2020 New Revision: 1069625 Log: Dynamic update by buildbot for openwebbeans Modified: websites/production/openwebbeans/content/index.html websites/staging/openwebbeans/trunk/content/index.html Modified: websites/production/openwebbeans/content/index.html == (empty) Modified: websites/staging/openwebbeans/trunk/content/index.html == (empty)