override fun close() = client?.disconnect()
Return type of 'close' is not a subtype of the return type of the overridden member 'public abstract fun close(): Unit defined in java.lang.AutoCloseable'
Unit? is a supertype of Unit, not a subtype.
override fun close() = client?.disconnect()
Return type of 'close' is not a subtype of the return type of the overridden member 'public abstract fun close(): Unit defined in java.lang.AutoCloseable'
Unit? is a supertype of Unit, not a subtype.
Some libraries define optional interfaces that have to be discovered by dynamic type checking and can only used after casting to the optional interface type.
For example, a "ScriptEngine" provided by the Java scripting API only provides methods for evaluating scripts.
val js : ScriptEngine = ScriptEngineManager().getEngineByName("nashorn")
js.eval("print('hello, world');")
But the "nashorn" script engine is specified to also implement the Invocable interface, that allows the host program to invoke functions defined by a script, and the Compilable interface, that allows the host program to compile a script and then execute the compiled form.
MARKDOWN_SRC:=$(shell find doc -name '*.md') | |
DIAGRAM_SRC:=$(shell find doc -name '*.plantuml') | |
MARKDOWN_FORMAT=markdown+fenced_code_blocks+fenced_code_attributes+grid_tables+footnotes | |
# Order is significant when multiple CSS files | |
CSS_SRC:=styles/style.css | |
SITE_HTML=$(MARKDOWN_SRC:doc/%.md=out/site/%.html) $(DIAGRAM_SRC:doc/%.plantuml=out/site/%.png) | |
SITE_CSS=$(CSS_SRC:styles/%=out/site/%) |
Don't write an extension method that implement the plus operator with String arguments. If you forget to import it, the code will compile, but use string append instead.
public final class String {
... public final operator fun plus(other: kotlin.Any?): kotlin.String { /* compiled code */ }
}
So, always write a conversion function from String to your own type, then implement +
on that type.
val x : SomeType? = ... // Note: nullable
val s1 : String? = x?.toString()
val s2 : String? = x.toString()
The expressions s1 and s2 are subtly different. When x is null, s1 will evaluate to null, while s2 will evaluate to the string "null".
from functools import wraps | |
from nose.plugins.attrib import attr | |
from nose.plugins.skip import SkipTest | |
def fail(message): | |
raise AssertionError(message) | |
def wip(f): | |
@wraps(f) |
import com.natpryce.krouton.* | |
import io.netty.handler.codec.http.HttpMethod | |
import io.netty.handler.codec.http.HttpMethod.GET | |
import org.wasabi.app.AppServer | |
import org.wasabi.http.Request | |
import org.wasabi.http.Response | |
import org.wasabi.http.StatusCodes | |
import org.wasabi.interceptors.Interceptor | |
import org.wasabi.routing.RouteHandler |
private static class NoisyThreadingPolicy implements ThreadingPolicy | |
{ | |
private final Thread testThread = Thread.currentThread(); | |
@Override public Invokable synchroniseAccessTo(final Invokable mockObject) | |
{ | |
final StackTraceElement[] creationStack = stackTrace(); | |
return new Invokable() | |
{ |
@article{Deignan2005, | |
abstract = {With the benefit of hindsight, it is now possible to see that one of the most important themes in the study of language to emerge in the 20 th century was developed, not by linguists, but primarily by philosophers of language such as Wittgenstein and Grice and anthropologists such as Malinowski and Rosch. This theme involves, among other things, rejection of sharply defined category boundaries and adoption instead of systems of categories built by analogy around prototypes. Central and typical examples of linguistic categories are usually easy to identify, but boundaries between categories are fuzzy grey areas on a cline, rather than sharp divisions. Metaphor is the most prototypical example of linguistic analogy, so a corpus-based study of metaphor will be a theme of central interest. In the linguistic paradigm shift just mentioned, Aristotelian-Leibnizian theories of meaning requiring the satisfaction of necessary and sufficient conditions were rejected. Instead, meaning in |