Skip to content

Commit

Permalink
AnnotatedElementHandler is not used anywhere, it is just a redundant …
Browse files Browse the repository at this point in the history
…iface

- it's only implementor is AnnotationContext, they should become one soon
  to simplify the system
- the method getHandler(Class<H> handlerType) wasn't used anywhere

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Sep 18, 2022
1 parent 159c72a commit 9909f9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.glassfish.apf;

import org.glassfish.apf.context.AnnotationContext;
import org.glassfish.api.deployment.archive.ReadableArchive;

/**
Expand Down Expand Up @@ -66,7 +67,7 @@ public interface ProcessingContext {
*
* @param handler the new events handler.
*/
void pushHandler(AnnotatedElementHandler handler);
void pushHandler(AnnotationContext handler);

/**
* Return the current handler (if any) receving all the annotated elements
Expand All @@ -83,16 +84,6 @@ public interface ProcessingContext {
*/
AnnotatedElementHandler popHandler();

/**
* Return the top handler casted to the requested handler type
*
* @param handlerType requested handler type
* @param <H> desired {@link AnnotatedElementHandler} type.
* @return the top handler
* @throws ClassCastException if the top handler cannot be casted to the requested handler type.
*/
<H extends AnnotatedElementHandler> H getHandler(Class<H> handlerType) throws ClassCastException;

/**
* Sets the ErrorHandler instance for all errors/warnings that may be raised
* during the annotation processing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ public void setArchive(ReadableArchive archive) {


@Override
public void pushHandler(AnnotatedElementHandler handler) {
if (handler instanceof AnnotationContext) {
((AnnotationContext) handler).setProcessingContext(this);
}
public void pushHandler(AnnotationContext handler) {
LOG.log(Level.FINEST, "pushHandler: {0}", handler);
handler.setProcessingContext(this);
handlers.push(handler);
}

Expand All @@ -96,20 +95,6 @@ public AnnotatedElementHandler popHandler() {
}


/**
* @return the previously set ClientContext casted to the requestd
* type if possible or throw an exception otherwise.
*/
@Override
public <U extends AnnotatedElementHandler> U getHandler(Class<U> contextType) throws ClassCastException {
if (handlers.isEmpty()) {
return null;
}
LOG.log(Level.FINER, "Top handler is {0}", handlers.peek());
return contextType.cast(handlers.peek());
}


@Override
public Scanner getProcessingInput() {
return scanner;
Expand Down

0 comments on commit 9909f9c

Please sign in to comment.