You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "shadogray (via GitHub)" <gi...@apache.org> on 2024/02/19 12:27:12 UTC
[PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
shadogray opened a new pull request, #147:
URL: https://github.com/apache/deltaspike/pull/147
## Weld5 (Wildfly-31) - Deltaspike fails on Detection of Scope
```
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.annotation.Annotation.annotationType()" because the return value of "java.util.Iterator.next()" is null
at org.jboss.weld.core@5.1.2.Final//org.jboss.weld.bootstrap.events.configurator.BeanAttributesConfiguratorImpl.initScope(BeanAttributesConfiguratorImpl.java:252)
at org.jboss.weld.core@5.1.2.Final//org.jboss.weld.bootstrap.events.configurator.BeanAttributesConfiguratorImpl.complete(BeanAttributesConfiguratorImpl.java:227)
at org.jboss.weld.core@5.1.2.Final//org.jboss.weld.bootstrap.events.configurator.BeanConfiguratorImpl$ImmutableBean.<init>(BeanConfiguratorImpl.java:498)
at org.jboss.weld.core@5.1.2.Final//org.jboss.weld.bootstrap.events.configurator.BeanConfiguratorImpl.complete(BeanConfiguratorImpl.java:333)
at org.jboss.weld.core@5.1.2.Final//org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl$BeanRegistration.initBean(AfterBeanDiscoveryImpl.java:337)
```
## Intermediate generic(!) Repository implementations are not correctly identitfied by MetadataInitializer
A structure of:
AppEntityRepository<Entity, Long> extends AbstractAppEntityRepository<E extends BaseEntity,
S extends Serializable> extends AbstractEntityRepository<E,S>
will lead to:
```
Caused by: java.lang.ClassCastException: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to class java.lang.Class (sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl and java.lang.Class are in module java.base of loader 'bootstrap')
at deployment.archive-web.war//org.apache.deltaspike.data.impl.meta.EntityMetadataInitializer.extract(EntityMetadataInitializer.java:82)
at deployment.archive-web.war//org.apache.deltaspike.data.impl.meta.EntityMetadataInitializer.extract(EntityMetadataInitializer.java:90)
at deployment.archive-web.war//org.apache.deltaspike.data.impl.meta.EntityMetadataInitializer.init(EntityMetadataInitializer.java:37)
at deployment.archive-web.war//org.apache.deltaspike.data.impl.meta.EntityMetadataInitializer$Proxy$_$$_WeldClientProxy.init(Unknown Source)
at deployment.archive-web.war//org.apache.deltaspike.data.impl.meta.RepositoryMetadataInitializer.init(RepositoryMetadataInitializer.java:83)
at deployment.archive-web.war//org.apache.deltaspike.data.impl.meta.RepositoryMetadataInitializer$Proxy$_$$_WeldClientProxy.init(Unknown Source)
at deployment.archive-web.war//org.apache.deltaspike.data.impl.meta.RepositoryMetadataHandler.init(RepositoryMetadataHandler.java:50)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by Thomas Frühbeck <t....@gmail.com>.
I absolutely agree, no problem!
I had added classes to produce the problem, but astonishingly failed.
There is definitely a difference between Weld5 standalone and
Wildfly-DeploymentScanner-deployment,
but I was not able to track this down :-/
Am Mo., 19. Feb. 2024 um 14:36 Uhr schrieb Thomas Andraschko <
andraschko.thomas@gmail.com>:
> I would suggest the following:
>
> 1) we revert your PR
> 2) you add your testcase in a new PR and you try to fail our Weld CI build
> 3) when it fails, we can debug together and work on a fix
>
> Am Mo., 19. Feb. 2024 um 14:32 Uhr schrieb Thomas Frühbeck <
> t.fruehbeck@gmail.com>:
>
> > the intermediate Repository class:
> >
> > *// no annotation present!!*
> >
> > public abstract class AbstractElementRepository<E extends Element, PK
> > extends Serializable> extends AbstractFullEntityRepository<E, PK>
> > implements
> > ElementRelated {
> >
> >
> > in RepsitoryExtension: for the intermediate AbstractElementRepository
> class
> > (no Annotation!!!) Weld will find:
> > event.getAnnotatedType().getJavaClass(): class
> > at.telekom.archive.repository.AbstractElementRepository
> > and:
> >
> >
> event.getAnnotatedType().getJavaClass().isAnnotationPresent(Repository.class)
> > == true
> >
> > Help very much appreciated, else application broken!!!
> >
> >
> > Am Mo., 19. Feb. 2024 um 14:07 Uhr schrieb tandraschko (via GitHub) <
> > git@apache.org>:
> >
> > >
> > > tandraschko commented on code in PR #147:
> > > URL:
> > https://github.com/apache/deltaspike/pull/147#discussion_r1494524740
> > >
> > >
> > > ##########
> > >
> > >
> >
> deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
> > > ##########
> > > @@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
> > > LOG.log(Level.FINER, "Class {0} is Deactivated",
> > > repositoryClass);
> > > return;
> > > }
> > > + if
> (repositoryClass.getDeclaredAnnotation(Repository.class)
> > > == null)
> > >
> > > Review Comment:
> > > the outer if should already exact do this code
> > >
> > >
> > >
> > > ##########
> > >
> > >
> >
> deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
> > > ##########
> > > @@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
> > > LOG.log(Level.FINER, "Class {0} is Deactivated",
> > > repositoryClass);
> > > return;
> > > }
> > > + if
> (repositoryClass.getDeclaredAnnotation(Repository.class)
> > > == null)
> > >
> > > Review Comment:
> > > the outer if should already exact do this check in #isRepository
> > >
> > >
> > >
> > > --
> > > This is an automated message from the Apache Git Service.
> > > To respond to the message, please log on to GitHub and use the
> > > URL above to go to the specific comment.
> > >
> > > To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
> > >
> > > For queries about this service, please contact Infrastructure at:
> > > users@infra.apache.org
> > >
> > >
> >
>
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by Thomas Andraschko <an...@gmail.com>.
I would suggest the following:
1) we revert your PR
2) you add your testcase in a new PR and you try to fail our Weld CI build
3) when it fails, we can debug together and work on a fix
Am Mo., 19. Feb. 2024 um 14:32 Uhr schrieb Thomas Frühbeck <
t.fruehbeck@gmail.com>:
> the intermediate Repository class:
>
> *// no annotation present!!*
>
> public abstract class AbstractElementRepository<E extends Element, PK
> extends Serializable> extends AbstractFullEntityRepository<E, PK>
> implements
> ElementRelated {
>
>
> in RepsitoryExtension: for the intermediate AbstractElementRepository class
> (no Annotation!!!) Weld will find:
> event.getAnnotatedType().getJavaClass(): class
> at.telekom.archive.repository.AbstractElementRepository
> and:
>
> event.getAnnotatedType().getJavaClass().isAnnotationPresent(Repository.class)
> == true
>
> Help very much appreciated, else application broken!!!
>
>
> Am Mo., 19. Feb. 2024 um 14:07 Uhr schrieb tandraschko (via GitHub) <
> git@apache.org>:
>
> >
> > tandraschko commented on code in PR #147:
> > URL:
> https://github.com/apache/deltaspike/pull/147#discussion_r1494524740
> >
> >
> > ##########
> >
> >
> deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
> > ##########
> > @@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
> > LOG.log(Level.FINER, "Class {0} is Deactivated",
> > repositoryClass);
> > return;
> > }
> > + if (repositoryClass.getDeclaredAnnotation(Repository.class)
> > == null)
> >
> > Review Comment:
> > the outer if should already exact do this code
> >
> >
> >
> > ##########
> >
> >
> deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
> > ##########
> > @@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
> > LOG.log(Level.FINER, "Class {0} is Deactivated",
> > repositoryClass);
> > return;
> > }
> > + if (repositoryClass.getDeclaredAnnotation(Repository.class)
> > == null)
> >
> > Review Comment:
> > the outer if should already exact do this check in #isRepository
> >
> >
> >
> > --
> > This is an automated message from the Apache Git Service.
> > To respond to the message, please log on to GitHub and use the
> > URL above to go to the specific comment.
> >
> > To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
> >
> > For queries about this service, please contact Infrastructure at:
> > users@infra.apache.org
> >
> >
>
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by Thomas Frühbeck <t....@gmail.com>.
the intermediate Repository class:
*// no annotation present!!*
public abstract class AbstractElementRepository<E extends Element, PK
extends Serializable> extends AbstractFullEntityRepository<E, PK> implements
ElementRelated {
in RepsitoryExtension: for the intermediate AbstractElementRepository class
(no Annotation!!!) Weld will find:
event.getAnnotatedType().getJavaClass(): class
at.telekom.archive.repository.AbstractElementRepository
and:
event.getAnnotatedType().getJavaClass().isAnnotationPresent(Repository.class)
== true
Help very much appreciated, else application broken!!!
Am Mo., 19. Feb. 2024 um 14:07 Uhr schrieb tandraschko (via GitHub) <
git@apache.org>:
>
> tandraschko commented on code in PR #147:
> URL: https://github.com/apache/deltaspike/pull/147#discussion_r1494524740
>
>
> ##########
>
> deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
> ##########
> @@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
> LOG.log(Level.FINER, "Class {0} is Deactivated",
> repositoryClass);
> return;
> }
> + if (repositoryClass.getDeclaredAnnotation(Repository.class)
> == null)
>
> Review Comment:
> the outer if should already exact do this code
>
>
>
> ##########
>
> deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
> ##########
> @@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
> LOG.log(Level.FINER, "Class {0} is Deactivated",
> repositoryClass);
> return;
> }
> + if (repositoryClass.getDeclaredAnnotation(Repository.class)
> == null)
>
> Review Comment:
> the outer if should already exact do this check in #isRepository
>
>
>
> --
> This is an automated message from the Apache Git Service.
> To respond to the message, please log on to GitHub and use the
> URL above to go to the specific comment.
>
> To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
>
> For queries about this service, please contact Infrastructure at:
> users@infra.apache.org
>
>
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on PR #147:
URL: https://github.com/apache/deltaspike/pull/147#issuecomment-1952386563
Hi,
is it intentional to not use `Annotated` but pure reflection there? We can't mark repos with an extension anymore? :thinking:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by "tandraschko (via GitHub)" <gi...@apache.org>.
tandraschko commented on code in PR #147:
URL: https://github.com/apache/deltaspike/pull/147#discussion_r1494523800
##########
deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/EntityMetadataInitializer.java:
##########
@@ -45,6 +49,10 @@ public EntityMetadata init(RepositoryMetadata metadata)
private EntityMetadata extract(Class<?> repositoryClass)
{
+ if (!repositoryClass.isAnnotationPresent(Repository.class))
Review Comment:
couldn't you just switch to
```
if (respository == null) {
return null;
}
```
in next line?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by "shadogray (via GitHub)" <gi...@apache.org>.
shadogray commented on PR #147:
URL: https://github.com/apache/deltaspike/pull/147#issuecomment-1952423368
thank you for question,
no, it is maybe due to lack of competence of submitter :-/
any comments welcome to evade the definit problem to handle intermediate
generic Repsitory classes.
Am Mo., 19. Feb. 2024 um 13:51 Uhr schrieb Romain Manni-Bucau <
***@***.***>:
> Hi,
>
> is it intentional to not use Annotated but pure reflection there? We
> can't mark repos with an extension anymore? 🤔
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/deltaspike/pull/147#issuecomment-1952386563>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAKNWX7I3RVX5OPYUAHQWK3YUNDEDAVCNFSM6AAAAABDPLYB5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJSGM4DMNJWGM>
> .
> You are receiving this because you modified the open/close state.Message
> ID: ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by "tandraschko (via GitHub)" <gi...@apache.org>.
tandraschko commented on PR #147:
URL: https://github.com/apache/deltaspike/pull/147#issuecomment-1952408155
@shadogray please dont just merge such PRs instantly and give other contributors some time for feedback
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by "tandraschko (via GitHub)" <gi...@apache.org>.
tandraschko commented on code in PR #147:
URL: https://github.com/apache/deltaspike/pull/147#discussion_r1494524740
##########
deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
##########
@@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
LOG.log(Level.FINER, "Class {0} is Deactivated", repositoryClass);
return;
}
+ if (repositoryClass.getDeclaredAnnotation(Repository.class) == null)
Review Comment:
the outer if should already exact do this code
##########
deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java:
##########
@@ -90,6 +90,11 @@ else if (isRepository(event.getAnnotatedType()))
LOG.log(Level.FINER, "Class {0} is Deactivated", repositoryClass);
return;
}
+ if (repositoryClass.getDeclaredAnnotation(Repository.class) == null)
Review Comment:
the outer if should already exact do this check in #isRepository
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Weld5 - add Dependent scope to @Repository, skip intermediate generic… [deltaspike]
Posted by "shadogray (via GitHub)" <gi...@apache.org>.
shadogray merged PR #147:
URL: https://github.com/apache/deltaspike/pull/147
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@deltaspike.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org