This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// Utility to catch invalid multithreaded access to non-thread-safe code. | |
/// | |
/// `MultiThreadedAccessDetector` guards a critical region, verifying that it is never invoked by two different threads. | |
/// If this happens, it crashes in debug builds. In release builds, it has no effect (and also no overhead, as long as | |
/// it’s only used within one module). | |
/// | |
/// Copies of a `MultiThreadedAccessDetector` share the same underlying mutex, and hence their critical region is the | |
/// union of the critical regions of all copies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void shouldDisposeMultiThreadedEventSourceSafely() throws Exception { | |
// event source that just pushes stuff every X ms on a thread. | |
RecurringEventSource source = new RecurringEventSource(); | |
final Builder<String, TestEvent, TestEffect> builder = Mobius | |
.loop(update, effectHandler).eventSource(source); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bash <(curl -s https://codecov.io/bash) | |
_____ _ | |
/ ____| | | | |
| | ___ __| | ___ ___ _____ __ | |
| | / _ \ / _` |/ _ \/ __/ _ \ \ / / | |
| |___| (_) | (_| | __/ (_| (_) \ V / | |
\_____\___/ \__,_|\___|\___\___/ \_/ | |
0db33a1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AutoValue | |
public abstract class EqualsBreaker { | |
EqualsBreaker() {} | |
public static EqualsBreaker create(Set<HostAndPort> hosts) { | |
return new AutoValue_EqualsBreaker(ImmutableSet.copyOf(hosts)); | |
} | |
public abstract Set<HostAndPort> hosts(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class AbstractThrowingIterator<T> extends UnmodifiableIterator<T> { | |
private State state = State.NOT_READY; | |
/** Constructor for use by subclasses. */ | |
protected AbstractThrowingIterator() {} | |
private enum State { | |
/** We have computed the next element and haven't returned it yet. */ | |
READY, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/src/main/java/cucumber/runtime/snippets/SnippetGenerator.java b/core/src/main/java/cucumber/runtime/snippets/SnippetGenerator.java | |
index 2a20435..ce647d8 100644 | |
--- a/core/src/main/java/cucumber/runtime/snippets/SnippetGenerator.java | |
+++ b/core/src/main/java/cucumber/runtime/snippets/SnippetGenerator.java | |
@@ -87,11 +87,14 @@ public abstract class SnippetGenerator { | |
protected String sanitizeFunctionName(String functionName) { | |
StringBuilder sanitized = new StringBuilder(); | |
- sanitized.append(Character.isJavaIdentifierStart(functionName.charAt(0)) ? functionName.charAt(0) : SUBST); | |
- for (int i = 1; i < functionName.length(); i++) { |