Skip to content

Commit bd41c8a

Browse files
committed
Make most of the bushe classes package-private
The goal is not to add new SciJava Common API, but merely to vendor the org.bushe:eventbus code for internal use. Unfortunately, we don't have JPMS yet, and cannot fully hide the package. But we can get pretty close.
1 parent 66c98fd commit bd41c8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+57
-57
lines changed

src/main/java/org/scijava/event/DefaultEventBus.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
import org.scijava.thread.ThreadService;
4242

4343
/**
44-
* An {@link org.scijava.event.bushe.EventService} implementation for SciJava.
44+
* An {@code org.scijava.event.bushe.EventService} implementation for SciJava.
4545
* <p>
4646
* It is called "DefaultEventBus" rather than "DefaultEventService" to avoid a
4747
* name clash with {@link DefaultEventService}, which is not an
48-
* {@link org.scijava.event.bushe.EventService} but rather a SciJava
48+
* {@code org.scijava.event.bushe.EventService} but rather a SciJava
4949
* {@link Service} implementation.
5050
* </p>
5151
*

src/main/java/org/scijava/event/DefaultEventService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
import org.scijava.Priority;
4444
import org.scijava.event.bushe.AbstractProxySubscriber;
45-
import org.scijava.event.bushe.BaseProxySubscriber;
4645
import org.scijava.event.bushe.ReferenceStrength;
4746
import org.scijava.log.LogService;
4847
import org.scijava.plugin.Parameter;
@@ -262,9 +261,10 @@ private synchronized void keepIt(final Object o, final ProxySubscriber<?> subscr
262261
/**
263262
* Helper class used by {@link #subscribe(Object)}.
264263
* <p>
265-
* Recapitulates some logic from {@link BaseProxySubscriber}, because that
266-
* class implements {@link org.scijava.event.bushe.IEventSubscriber} as a raw
267-
* type, which is incompatible with this class implementing SciJava's
264+
* Recapitulates some logic from
265+
* {@code org.scijava.event.bushe.BaseProxySubscriber}, because that class
266+
* implements {@link org.scijava.event.bushe.IEventSubscriber} as a raw type,
267+
* which is incompatible with this class implementing SciJava's
268268
* {@link EventSubscriber} as a typed interface; it becomes impossible to
269269
* implement both {@code onEvent(Object)} and {@code onEvent(E)}.
270270
* </p>

src/main/java/org/scijava/event/EventHandler.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
* handling methods and annotating each with @{@link EventHandler}.
4141
* <p>
4242
* Note to developers: This annotation serves exactly the same purpose as
43-
* EventBus's {@link org.scijava.event.bushe.EventSubscriber}
44-
* annotation, recapitulating a subset of the same functionality. We do this to
45-
* avoid third party code depending directly on EventBus. That is, we do not
46-
* wish to require SciJava developers to {@code import org.scijava.event.bushe.*}
47-
* or similar. In this way, EventBus is isolated as only a transitive dependency
48-
* of downstream code, rather than a direct dependency. Unfortunately, because
49-
* Java annotation interfaces cannot utilize inheritance, we have to
50-
* recapitulate the functionality rather than extend it (as we are able to do
51-
* with {@link EventSubscriber}).
43+
* EventBus's {@code org.scijava.event.bushe.EventSubscriber} annotation,
44+
* recapitulating a subset of the same functionality. We do this to avoid third
45+
* party code depending directly on EventBus. That is, we do not wish to require
46+
* SciJava developers to {@code import org.scijava.event.bushe.*} or similar. In
47+
* this way, EventBus is isolated as only a transitive dependency of downstream
48+
* code, rather than a direct dependency. Unfortunately, because Java annotation
49+
* interfaces cannot utilize inheritance, we have to recapitulate the
50+
* functionality rather than extend it (as we are able to do with
51+
* {@link EventSubscriber}).
5252
* </p>
5353
*
5454
* @author Curtis Rueden

src/main/java/org/scijava/event/bushe/AbstractEventServiceEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* @author Michael Bushe michael@bushe.com
2424
*/
25-
public abstract class AbstractEventServiceEvent implements EventServiceEvent, PublicationStatusTracker {
25+
abstract class AbstractEventServiceEvent implements EventServiceEvent, PublicationStatusTracker {
2626

2727
private Object source = null;
2828
protected final Object stateLock = new Object();

src/main/java/org/scijava/event/bushe/AnnotationProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* code. <li>In a Annotation Processing Tool plugin, when it becomes available. </ul> Support for these other methods
3737
* are not yet implemented.
3838
*/
39-
public class AnnotationProcessor {
39+
class AnnotationProcessor {
4040

4141
protected static final Logger LOG = Logger.getLogger(EventService.class.getName());
4242

src/main/java/org/scijava/event/bushe/BaseProxySubscriber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.lang.reflect.Method;
55

66
/** A class is subscribed to an EventService on behalf of another object. */
7-
public class BaseProxySubscriber extends AbstractProxySubscriber
7+
class BaseProxySubscriber extends AbstractProxySubscriber
88
implements org.scijava.event.bushe.IEventSubscriber, VetoEventListener {
99
private Class subscriptionClass;
1010

src/main/java/org/scijava/event/bushe/ContainerEventServiceAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* @see EventServiceAction for further documentation
4040
* @see ContainerEventServiceFinder on how the service is found
4141
*/
42-
public class ContainerEventServiceAction extends EventServiceAction {
42+
class ContainerEventServiceAction extends EventServiceAction {
4343
public ContainerEventServiceAction() {
4444
}
4545

src/main/java/org/scijava/event/bushe/ContainerEventServiceFinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
*
3939
* @author Michael Bushe michael@bushe.com
4040
*/
41-
public class ContainerEventServiceFinder {
41+
class ContainerEventServiceFinder {
4242
/** The client property used to put a new SwingEventService on top-level components. */
4343
public static final String CLIENT_PROPERTY_KEY_TOP_LEVEL_EVENT_SERVICE = "ContainerEventServiceFinder.createdService";
4444

src/main/java/org/scijava/event/bushe/ContainerEventServiceRegistrar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*
3636
* @author Michael Bushe michael@bushe.com
3737
*/
38-
public class ContainerEventServiceRegistrar {
38+
class ContainerEventServiceRegistrar {
3939
private JComponent jComp;
4040
private IEventSubscriber eventSubscriber;
4141
private VetoEventListener vetoSubscriber;

src/main/java/org/scijava/event/bushe/ContainerEventServiceSupplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
*
3838
* @author Michael Bushe michael@bushe.com
3939
*/
40-
public interface ContainerEventServiceSupplier {
40+
interface ContainerEventServiceSupplier {
4141
public EventService getContainerEventService();
4242
}

0 commit comments

Comments
 (0)