Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WELD-2764 Method invokers, first impl #2864

Merged
merged 20 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3913cc0
First shot at Invokable methods implementation in Weld
manovotn Jul 17, 2023
afe8df3
Add support for BCE; add basic tests.
manovotn Aug 10, 2023
0b108b7
Add workaround enabling exception transformers to return arbitrary re…
manovotn Aug 31, 2023
c72778b
Properly support lookup with qualifiers, create test coverage for it
manovotn Sep 1, 2023
ccf5221
Small improvements related to invokable methods and new BeanManager m…
Ladicek Sep 4, 2023
0518bb2
Simplify the implemenetation of invokers with transformers
Ladicek Sep 4, 2023
0b7961d
Fix invoker cleanup actions
Ladicek Sep 6, 2023
cabcc69
Minor adjustments
manovotn Sep 6, 2023
858580b
Add playground classes that isolate certain aspects of invoker implem…
Ladicek Sep 7, 2023
99337e9
Move instance/argument lookup to the tree of method handles represent…
Ladicek Sep 7, 2023
2058aaa
Instantiate CleanupActions in the method handle tree
Ladicek Sep 7, 2023
b899df6
Fix instance lookups and handling of null values of primitive types
Ladicek Sep 7, 2023
e684bfb
Implement invoker wrapping using method handles
Ladicek Sep 8, 2023
18cb792
Use the "sneaky throw" idiom in InvokerImpl to avoid exception wrapping
Ladicek Sep 8, 2023
b2cbc5e
Share method handles for common methods instead of recreating them al…
Ladicek Sep 8, 2023
2a8c15f
Avoid creating unnecessary instances of CleanupActions
Ladicek Sep 11, 2023
9d4538c
Code formatting changes due to new formatter/impsort rules
manovotn Sep 14, 2023
9179b94
Adjust according to PR changes; @Invokable was removed, invokers can …
manovotn Oct 11, 2023
a665f08
Remove ad-hoc declaration of CDI API; update Weld API to 6.0.Alpha1
manovotn Oct 20, 2023
f5b95e7
Introduce a profile allowing to patch CDI and interceptors API jars i…
manovotn Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
JBOSS_HOME=`pwd`'/container/*'
export JBOSS_HOME=`echo $JBOSS_HOME`
mvn clean package -Pupdate-jboss-as -Dtck -f jboss-as/pom.xml
mvn clean package -Pupdate-jboss-as -Pupdate-jakarta-apis -Dtck -f jboss-as/pom.xml
- name: Zip Patched WildFly
run: |
cd container/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
*/
package org.jboss.weld.bean;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;

import jakarta.enterprise.inject.spi.AnnotatedMethod;
import jakarta.enterprise.inject.spi.BeanAttributes;
import jakarta.enterprise.inject.spi.Decorator;
import jakarta.enterprise.inject.spi.InjectionPoint;
Expand Down Expand Up @@ -49,6 +51,8 @@ public abstract class AbstractClassBean<T> extends AbstractBean<T, Class<T>> imp
protected final SlimAnnotatedType<T> annotatedType;
protected volatile EnhancedAnnotatedType<T> enhancedAnnotatedItem;

protected Collection<AnnotatedMethod<? super T>> invokableMethods;

// Injection target for the bean
private InjectionTarget<T> producer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@

import java.lang.reflect.Type;

import jakarta.enterprise.inject.spi.AnnotatedMethod;
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.ProcessManagedBean;
import jakarta.enterprise.invoke.Invoker;
import jakarta.enterprise.invoke.InvokerBuilder;

import org.jboss.weld.bean.ManagedBean;
import org.jboss.weld.invokable.InvokerBuilderImpl;
import org.jboss.weld.manager.BeanManagerImpl;

public class ProcessManagedBeanImpl<X> extends AbstractProcessClassBean<X, ManagedBean<X>> implements ProcessManagedBean<X> {
Expand All @@ -42,4 +46,10 @@ public AnnotatedType<X> getAnnotatedBeanClass() {
return getBean().getAnnotated();
}

@Override
public InvokerBuilder<Invoker<X, ?>> createInvoker(AnnotatedMethod<? super X> annotatedMethod) {
checkWithinObserverNotification();
return new InvokerBuilderImpl<>(getBean().getType(), annotatedMethod.getJavaMember(), getBeanManager());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@

import java.lang.reflect.Type;

import jakarta.enterprise.inject.spi.AnnotatedMethod;
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.ProcessSessionBean;
import jakarta.enterprise.inject.spi.SessionBeanType;
import jakarta.enterprise.invoke.Invoker;
import jakarta.enterprise.invoke.InvokerBuilder;

import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.invokable.InvokerBuilderImpl;
import org.jboss.weld.logging.BootstrapLogger;
import org.jboss.weld.manager.BeanManagerImpl;

Expand Down Expand Up @@ -63,4 +67,10 @@ public AnnotatedType<Object> getAnnotatedBeanClass() {
return getBean().getAnnotated();
}

@Override
public InvokerBuilder<Invoker<Object, ?>> createInvoker(AnnotatedMethod<? super Object> annotatedMethod) {
checkWithinObserverNotification();
return new InvokerBuilderImpl<>(getBean().getEjbDescriptor().getBeanClass(), annotatedMethod.getJavaMember(),
getBeanManager());
}
}