Skip to content

Commit

Permalink
Adjust ArC code to CDI 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicek committed Aug 31, 2022
1 parent 1fd0447 commit c16cfd1
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 @@ -69,6 +69,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 @@ -23,7 +23,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 All @@ -35,7 +34,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 @@ -115,14 +113,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 @@ -236,12 +226,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 c16cfd1

Please sign in to comment.