Created
December 3, 2014 10:30
-
-
Save paulk-asert/10aeeb08ffb685268d9d to your computer and use it in GitHub Desktop.
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 groovy.transform.TypeChecked | |
interface ReadOnlyCollection { | |
boolean contains(Object o) | |
boolean isEmpty() | |
} | |
@TypeChecked(extensions='StructuralProvider.groovy') | |
def method() { | |
def list = ['cat', 'dog'] | |
assert !(list instanceof ReadOnlyCollection) | |
ReadOnlyCollection roc = list //as ReadOnlyCollection | |
assert !roc.isEmpty() | |
assert roc.contains('cat') | |
} | |
method() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment