java.lang.ref.SoftReference Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-rt Show documentation
Show all versions of jtransc-rt Show documentation
JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.
package java.lang.ref;
public class SoftReference extends Reference {
private long time;
static private long getTime() {
return System.currentTimeMillis();
}
public SoftReference(T referent) {
super(referent);
this.time = getTime();
}
public SoftReference(T referent, ReferenceQueue super T> q) {
super(referent, q);
this.time = getTime();
}
public T get() {
T o = super.get();
long current = getTime();
if (o != null && this.time != current) this.time = current;
return o;
}
}