Introduce 'reified' instead of 'erased'

This commit is contained in:
Andrey Breslav
2012-06-05 20:05:35 +04:00
parent 0ceee0a383
commit 91606a3901
98 changed files with 158 additions and 157 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ public inline fun <T> java.util.Iterator<T>.iterator() : java.util.Iterator<T> =
/**
Helper to make java.util.Enumeration usable in for
*/
public fun <erased T> java.util.Enumeration<T>.iterator(): Iterator<T> = object: Iterator<T> {
public fun <T> java.util.Enumeration<T>.iterator(): Iterator<T> = object: Iterator<T> {
override val hasNext: Boolean
get() = hasMoreElements()
@@ -9,7 +9,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock
Executes given calculation under lock
Returns result of the calculation
*/
public inline fun <erased T> Lock.withLock(action: ()->T) : T {
public inline fun <T> Lock.withLock(action: ()->T) : T {
lock()
try {
return action()
@@ -23,7 +23,7 @@ public inline fun <erased T> Lock.withLock(action: ()->T) : T {
Executes given calculation under read lock
Returns result of the calculation
*/
public inline fun <erased T> ReentrantReadWriteLock.read(action: ()->T) : T {
public inline fun <T> ReentrantReadWriteLock.read(action: ()->T) : T {
val rl = readLock().sure()
rl.lock()
try {
@@ -40,7 +40,7 @@ The method does upgrade from read to write lock if needed
If such write has been initiated by checking some condition, the condition must be rechecked inside the action to avoid possible races
Returns result of the calculation
*/
public inline fun <erased T> ReentrantReadWriteLock.write(action: ()->T) : T {
public inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
val rl = readLock().sure()
val readCount = if (getWriteHoldCount() == 0) getReadHoldCount() else 0