Skip to content

Commit

Permalink
Adjust ArC code to CDI 4.0.1
Browse files Browse the repository at this point in the history
(cherry picked from commit c16cfd1)
(cherry picked from commit 2bc4516)
  • Loading branch information
Ladicek authored and actions-user committed Jan 10, 2023
1 parent 4f526d3 commit 75a008c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.enterprise.context.Dependent;
import jakarta.enterprise.context.spi.AlterableContext;
import jakarta.enterprise.inject.Instance;

/**
* Represents an instance handle.
Expand All @@ -10,7 +11,7 @@
*
* @param <T>
*/
public interface InstanceHandle<T> extends AutoCloseable {
public interface InstanceHandle<T> extends AutoCloseable, Instance.Handle<T> {

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ public void destroy(Object instance) {
this.instanceDelegate.destroy(instance);
}

@Override
public Handle<Object> getHandle() {
return this.instanceDelegate.getHandle();
}

@Override
public Iterable<? extends Handle<Object>> handles() {
return this.instanceDelegate.handles();
}

@Override
public Iterator<Object> iterator() {
return instanceDelegate.iterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -31,7 +30,6 @@
import jakarta.enterprise.inject.spi.Decorator;
import jakarta.enterprise.inject.spi.Extension;
import jakarta.enterprise.inject.spi.InjectionPoint;
import jakarta.enterprise.inject.spi.InjectionTarget;
import jakarta.enterprise.inject.spi.InjectionTargetFactory;
import jakarta.enterprise.inject.spi.InterceptionFactory;
import jakarta.enterprise.inject.spi.InterceptionType;
Expand Down Expand Up @@ -117,14 +115,6 @@ public void validate(InjectionPoint injectionPoint) {
throw new UnsupportedOperationException();
}

// Deprecated method which can be safely removed once we use CDI 4.0+
@Deprecated
public void fireEvent(Object event, Annotation... qualifiers) {
Set<Annotation> eventQualifiers = new HashSet<>();
Collections.addAll(eventQualifiers, qualifiers);
new EventImpl<Object>(event.getClass(), eventQualifiers).fire(event);
}

@Override
public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... qualifiers) {
Type eventType = Types.getCanonicalType(event.getClass());
Expand Down Expand Up @@ -238,12 +228,6 @@ public <T> AnnotatedType<T> createAnnotatedType(Class<T> type) {
throw new UnsupportedOperationException();
}

// Deprecated method which can be safely removed once we use CDI 4.0+
@Deprecated
public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type) {
throw new UnsupportedOperationException();
}

@Override
public <T> InjectionTargetFactory<T> getInjectionTargetFactory(AnnotatedType<T> annotatedType) {
throw new UnsupportedOperationException();
Expand Down

0 comments on commit 75a008c

Please sign in to comment.