Skip to content

Instantly share code, notes, and snippets.

import java.util.List;
sealed interface ListState {}
interface Empty extends ListState { }
interface NonEmpty extends ListState { }
class MyList<ListStatus,E> {
public List<E> getDelegate() {
return delegate;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am paulk-asert on github.
  • I am paulk_asert (https://keybase.io/paulk_asert) on keybase.
  • I have a public key whose fingerprint is 3444 1E50 4A93 7F43 EB0D AEF9 6A65 176A 0FB1 CD0B

To claim this, I am signing this object:

@Grab('org.scala-stm:scala-stm_2.10:0.7')
import scala.concurrent.stm.TxnUnknown$
import static scala.concurrent.stm.japi.STM.*
import static scala.concurrent.stm.Txn.*
void retry() {
def txn = findCurrent(TxnUnknown$.MODULE$).get()
retry(txn)
}

Keybase proof

I hereby claim:

  • I am paulk-asert on github.
  • I am paulk_asert (https://keybase.io/paulk_asert) on keybase.
  • I have a public key whose fingerprint is CBCC A1D2 E040 C571 9368 5C76 976A 7A21 D768 D38B

To claim this, I am signing this object:

@groovy.transform.TypeChecked
def myMethod() {
def s = 'The 3 quick\nbrown 4 fox'
def expected = 'The _ QUICK|brown _ FOX|'
def result = ''
new StringReader(s).splitEachLine(~/\d/){ result += "${it[0]}_${it[1].toUpperCase()}|" }
assert result == expected; result = ''
new StringReader(s).splitEachLine(~/\d/){ parts -> result += "${parts[0]}_${parts[1].toUpperCase()}|" }
assert result == expected; result = ''
new StringReader(s).splitEachLine(~/\d/){ List parts -> result += "${parts[0]}_${parts[1].toUpperCase()}|" }
Index: src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1252
===================================================================
--- src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java (revision 03d9c2673947d44cd01cf1e3ec5bf32459e0b39c)
+++ src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java (revision )
@@ -25,6 +25,7 @@
import groovy.transform.stc.ClosureParams;
import groovy.transform.stc.FirstParam;
import org.codehaus.groovy.ast.expr.*
incompatibleAssignment { lhsType, rhsType, expr ->
if (!(expr instanceof DeclarationExpression)) return
Expression orig = expr.rightExpression
def ce = new CastExpression(lhsType, orig)
ce.coerce = true
expr.setRightExpression(ce)
storeType(expr, lhsType)
handled = true