mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Add minor stuff to classlib
This commit is contained in:
parent
74be67038d
commit
ffbfd7df79
|
@ -53,6 +53,10 @@ public abstract class TClassLoader extends TObject {
|
||||||
return dataString == null ? null : new ByteArrayInputStream(Base64.decode(dataString));
|
return dataString == null ? null : new ByteArrayInputStream(Base64.decode(dataString));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static InputStream getSystemResourceAsStream(String name) {
|
||||||
|
return getSystemClassLoader().getResourceAsStream(name);
|
||||||
|
}
|
||||||
|
|
||||||
@JSBody(params = "resource", script = "return resource !== null && resource !== void 0 ? resource : null;")
|
@JSBody(params = "resource", script = "return resource !== null && resource !== void 0 ? resource : null;")
|
||||||
private static native String resourceToString(JSObject resource);
|
private static native String resourceToString(JSObject resource);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2017 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.teavm.classlib.java.lang.ref;
|
||||||
|
|
||||||
|
public class TSoftReference<T> extends TReference<T> {
|
||||||
|
private T value;
|
||||||
|
|
||||||
|
public TSoftReference(T value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TSoftReference(T value, @SuppressWarnings("unused") TReferenceQueue<T> queue) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T get() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
value = null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,11 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.classlib.java.lang.ref;
|
package org.teavm.classlib.java.lang.ref;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
* @param <T>
|
|
||||||
*/
|
|
||||||
public class TWeakReference<T> extends TReference<T> {
|
public class TWeakReference<T> extends TReference<T> {
|
||||||
private T value;
|
private T value;
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class ResourceBundleTest {
|
||||||
// would be loaded.
|
// would be loaded.
|
||||||
ResourceBundle.getBundle("org.apache.harmony.luni.tests.java.util.ResourceBundleTest$GetBundleTest");
|
ResourceBundle.getBundle("org.apache.harmony.luni.tests.java.util.ResourceBundleTest$GetBundleTest");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getBundleLjava_lang_String() {
|
public void getBundleLjava_lang_String() {
|
||||||
|
@ -95,10 +95,4 @@ public class ResourceBundleTest {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUp() {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void tearDown() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,6 +518,10 @@ public class TeaVMTool implements BaseTeaVMTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printStats() {
|
private void printStats() {
|
||||||
|
if (vm == null || vm.getWrittenClasses() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int classCount = vm.getWrittenClasses().getClassNames().size();
|
int classCount = vm.getWrittenClasses().getClassNames().size();
|
||||||
int methodCount = 0;
|
int methodCount = 0;
|
||||||
for (String className : vm.getWrittenClasses().getClassNames()) {
|
for (String className : vm.getWrittenClasses().getClassNames()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user