mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Adds System.setErr and LinkageError
This commit is contained in:
parent
d68f78f77d
commit
cb8f424339
|
@ -17,12 +17,10 @@ package org.teavm.classlib.java.lang;
|
|||
|
||||
import java.io.IOException;
|
||||
import org.teavm.codegen.SourceWriter;
|
||||
import org.teavm.dependency.DependencyChecker;
|
||||
import org.teavm.dependency.DependencyNode;
|
||||
import org.teavm.dependency.DependencyPlugin;
|
||||
import org.teavm.dependency.MethodDependency;
|
||||
import org.teavm.dependency.*;
|
||||
import org.teavm.javascript.ni.Generator;
|
||||
import org.teavm.javascript.ni.GeneratorContext;
|
||||
import org.teavm.model.FieldReference;
|
||||
import org.teavm.model.MethodReference;
|
||||
|
||||
/**
|
||||
|
@ -39,6 +37,11 @@ public class SystemNativeGenerator implements Generator, DependencyPlugin {
|
|||
case "currentTimeMillis":
|
||||
generateCurrentTimeMillis(writer);
|
||||
break;
|
||||
case "setErr":
|
||||
writer.appendClass("java.lang.System").append('.')
|
||||
.appendField(new FieldReference("java.lang.System", "err"))
|
||||
.ws().append('=').ws().append(context.getParameterName(1)).append(";").softNewLine();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +51,9 @@ public class SystemNativeGenerator implements Generator, DependencyPlugin {
|
|||
case "doArrayCopy":
|
||||
achieveArrayCopy(method);
|
||||
break;
|
||||
case "setErr":
|
||||
achieveSetErr(checker, method);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,4 +77,9 @@ public class SystemNativeGenerator implements Generator, DependencyPlugin {
|
|||
DependencyNode dest = method.getVariable(3);
|
||||
src.getArrayItem().connect(dest.getArrayItem());
|
||||
}
|
||||
|
||||
private void achieveSetErr(DependencyChecker checker, MethodDependency method) {
|
||||
FieldDependency fieldDep = checker.linkField(new FieldReference("java.lang.System", "err"), method.getStack());
|
||||
method.getVariable(1).connect(fieldDep.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2014 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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public class TLinkageError extends TError {
|
||||
private static final long serialVersionUID = 9176544705010852435L;
|
||||
|
||||
public TLinkageError() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TLinkageError(TString message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TLinkageError(TString message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ package org.teavm.classlib.java.lang;
|
|||
|
||||
import org.teavm.classlib.java.io.TPrintStream;
|
||||
import org.teavm.classlib.java.lang.reflect.TArray;
|
||||
import org.teavm.dependency.PluggableDependency;
|
||||
import org.teavm.javascript.ni.GeneratedBy;
|
||||
|
||||
/**
|
||||
|
@ -60,4 +61,8 @@ public final class TSystem extends TObject {
|
|||
// TODO: make implementation
|
||||
return null;
|
||||
}
|
||||
|
||||
@GeneratedBy(SystemNativeGenerator.class)
|
||||
@PluggableDependency(SystemNativeGenerator.class)
|
||||
public static native void setErr(TPrintStream err);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user