mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix Class.initialize. Fix html4j tests
This commit is contained in:
parent
d968b20e4c
commit
c9c9c15dfe
|
@ -15,16 +15,23 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.classlib.java.lang;
|
package org.teavm.classlib.java.lang;
|
||||||
|
|
||||||
|
import org.teavm.dependency.ClassDependency;
|
||||||
import org.teavm.dependency.DependencyAgent;
|
import org.teavm.dependency.DependencyAgent;
|
||||||
import org.teavm.dependency.DependencyPlugin;
|
import org.teavm.dependency.DependencyPlugin;
|
||||||
import org.teavm.dependency.MethodDependency;
|
import org.teavm.dependency.MethodDependency;
|
||||||
|
import org.teavm.model.CallLocation;
|
||||||
|
|
||||||
public class ClassDependencyListener implements DependencyPlugin {
|
public class ClassDependencyListener implements DependencyPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void methodReached(DependencyAgent agent, MethodDependency method) {
|
public void methodReached(DependencyAgent agent, MethodDependency method) {
|
||||||
switch (method.getMethod().getName()) {
|
switch (method.getMethod().getName()) {
|
||||||
case "initialize":
|
case "initialize":
|
||||||
method.getVariable(0).getClassValueNode().addConsumer(type -> agent.linkClass(type.getName()));
|
method.getVariable(0).getClassValueNode().addConsumer(type -> {
|
||||||
|
ClassDependency classDep = agent.linkClass(type.getName());
|
||||||
|
if (classDep != null) {
|
||||||
|
classDep.initClass(new CallLocation(method.getReference()));
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "getSimpleNameCacheLowLevel":
|
case "getSimpleNameCacheLowLevel":
|
||||||
method.getResult().propagate(agent.getType("java.lang.String"));
|
method.getResult().propagate(agent.getType("java.lang.String"));
|
||||||
|
|
|
@ -71,7 +71,7 @@ class TypeSet {
|
||||||
|
|
||||||
DependencyType[] getTypes() {
|
DependencyType[] getTypes() {
|
||||||
if (this.types != null) {
|
if (this.types != null) {
|
||||||
DependencyType[] types = new DependencyType[typesCount];
|
DependencyType[] types = new DependencyType[this.types.cardinality()];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int index = this.types.nextSetBit(0); index >= 0; index = this.types.nextSetBit(index + 1)) {
|
for (int index = this.types.nextSetBit(0); index >= 0; index = this.types.nextSetBit(index + 1)) {
|
||||||
DependencyType type = dependencyAnalyzer.types.get(index);
|
DependencyType type = dependencyAnalyzer.types.get(index);
|
||||||
|
|
|
@ -63,6 +63,33 @@
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
<artifactId>asm-commons</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
<artifactId>asm-util</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.carrotsearch</groupId>
|
||||||
|
<artifactId>hppc</artifactId>
|
||||||
|
<version>0.7.3</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mozilla</groupId>
|
||||||
|
<artifactId>rhino</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user