Skip to content

Commit

Permalink
Remove mention of jcip-annotations from NOTICE.txt
Browse files Browse the repository at this point in the history
Reduce diffs
  • Loading branch information
kcooney committed Feb 14, 2013
1 parent 2873269 commit 10c5130
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 46 deletions.
4 changes: 1 addition & 3 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
== Notices and attributions required by libraries that the project depends on ==
===================================================================================

The JUnit depends on Java Hamcrest (http://hamcrest.org/JavaHamcrest).

The JUnit depends on net.jcip:jcip-annotations:1.0 (http://jcip.net).
JUnit depends on Java Hamcrest (http://hamcrest.org/JavaHamcrest).
17 changes: 0 additions & 17 deletions src/main/java/org/junit/experimental/annotations/ThreadSafe.java

This file was deleted.

31 changes: 16 additions & 15 deletions src/main/java/org/junit/runner/notification/RunNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@
* @since 4.0
*/
public class RunNotifier {
private final List<RunListener> fListeners = new CopyOnWriteArrayList<RunListener>();
private final List<RunListener> fListeners = new CopyOnWriteArrayList<RunListener>();
private volatile boolean fPleaseStop = false;

/**
* Internal use only
*/
public void addListener(RunListener listener) {
if (listener == null) {
throw new NullPointerException("Cannot add a null listener");
}
fListeners.add(SynchronizedRunListener.wrapIfNotThreadSafe(listener));
if (listener == null) {
throw new NullPointerException("Cannot add a null listener");
}
fListeners.add(SynchronizedRunListener.wrapIfNotThreadSafe(listener));
}

/**
* Internal use only
*/
public void removeListener(RunListener listener) {
if (listener == null) {
throw new NullPointerException("Cannot remove a null listener");
}
fListeners.remove(SynchronizedRunListener.wrapIfNotThreadSafe(listener));
if (listener == null) {
throw new NullPointerException("Cannot remove a null listener");
}
fListeners.remove(SynchronizedRunListener.wrapIfNotThreadSafe(listener));
}

private abstract class SafeNotifier {
private final List<RunListener> currentListeners;

public SafeNotifier() {
SafeNotifier() {
this(fListeners);
}

public SafeNotifier(List<RunListener> currentListeners) {
SafeNotifier(List<RunListener> currentListeners) {
this.currentListeners = currentListeners;
}

Expand Down Expand Up @@ -124,7 +124,8 @@ public void fireTestFailure(Failure failure) {
fireTestFailures(fListeners, asList(failure));
}

private void fireTestFailures(List<RunListener> listeners, final Collection<Failure> failures) {
private void fireTestFailures(List<RunListener> listeners,
final List<Failure> failures) {
if (!failures.isEmpty()) {
new SafeNotifier(listeners) {
@Override
Expand Down Expand Up @@ -198,8 +199,8 @@ public void pleaseStop() {
*/
public void addFirstListener(RunListener listener) {
if (listener == null) {
throw new NullPointerException("Cannot remove a null listener");
}
fListeners.add(0, SynchronizedRunListener.wrapIfNotThreadSafe(listener));
throw new NullPointerException("Cannot remove a null listener");
}
fListeners.add(0, SynchronizedRunListener.wrapIfNotThreadSafe(listener));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
import org.junit.runner.Result;

/**
* SynchronizedRunListener decorates {@link RunListener}, has all methods
* synchronized and is <em>not</em> public.
*
* <p>Due to backward compatibility, this synchronized listener behaves thread
* safe as {@link RunListener} in the old synchronized {@link RunNotifier}.
* Thread-safe decorator for {@link RunListener} implementations that synchronizes
* calls to the delegate.
*
* @author Tibor Digana (tibor17)
* @author Kevin Cooney (kcooney)
* @version 4.12
* @since 4.12
*
* @see RunNotifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private static class ConcurrentRunListener extends RunListener {
final AtomicInteger testStarted = new AtomicInteger(0);

@Override
public void testStarted(Description description) throws Exception {
public void testStarted(Description description) throws Exception {
testStarted.incrementAndGet();
}
}
Expand Down Expand Up @@ -66,14 +66,14 @@ private static class ExaminedListener extends RunListener {
}

@Override
public void testStarted(Description description) throws Exception {
public void testStarted(Description description) throws Exception {
if (!useMe) {
throw new Exception();
}
}

@Override
public void testFailure(Failure failure) throws Exception {
public void testFailure(Failure failure) throws Exception {
hasTestFailure = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* other tests (including causing failed tests to appear to be passing).
*/
public class RunNotifierTest extends TestCase {
private RunNotifier notifier;
private RunNotifier notifier;

@Override
protected void setUp() throws Exception {
Expand Down Expand Up @@ -108,7 +108,7 @@ private static class CountingListener extends RunListener {
final AtomicInteger testStarted = new AtomicInteger(0);

@Override
public void testStarted(Description description) throws Exception {
public void testStarted(Description description) throws Exception {
testStarted.incrementAndGet();
}
}
Expand Down

0 comments on commit 10c5130

Please sign in to comment.