Add some stub classes to run Scala

This commit is contained in:
Alexey Andreev 2015-10-03 14:10:11 +03:00
parent 2ca32a514b
commit 97bdd35617
6 changed files with 173 additions and 0 deletions

View File

@ -0,0 +1,36 @@
/*
* Copyright 2015 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;
import org.teavm.classlib.java.io.TEOFException;
import org.teavm.classlib.java.io.TIOException;
import org.teavm.classlib.java.io.TInputStream;
/**
*
* @author Alexey Andreev
*/
class TConsoleInputStream extends TInputStream {
@Override
public int read(byte[] b) throws TIOException {
throw new TEOFException();
}
@Override
public int read() throws TIOException {
throw new TEOFException();
}
}

View File

@ -0,0 +1,26 @@
/*
* Copyright 2015 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
*/
public class TInheritableThreadLocal<T> extends TThreadLocal<T> {
protected T childValue(T parentValue) {
return parentValue;
}
}

View File

@ -16,6 +16,7 @@
package org.teavm.classlib.java.lang;
import org.teavm.classlib.java.io.TConsole;
import org.teavm.classlib.java.io.TInputStream;
import org.teavm.classlib.java.io.TPrintStream;
import org.teavm.classlib.java.lang.reflect.TArray;
import org.teavm.dependency.PluggableDependency;
@ -28,6 +29,7 @@ import org.teavm.javascript.spi.GeneratedBy;
public final class TSystem extends TObject {
public static final TPrintStream out = new TPrintStream(new TConsoleOutputStreamStdout(), false);
public static final TPrintStream err = new TPrintStream(new TConsoleOutputStreamStderr(), false);
public static final TInputStream in = new TConsoleInputStream();
private TSystem() {
}

View File

@ -0,0 +1,41 @@
/*
* Copyright 2015 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.security;
import org.teavm.classlib.java.lang.TSecurityException;
import org.teavm.classlib.java.lang.TString;
/**
*
* @author Alexey Andreev
*/
public class TAccessControlException extends TSecurityException {
private static final long serialVersionUID = 8282514874369266797L;
private TPermission permission;
public TAccessControlException(TString message) {
super(message);
}
public TAccessControlException(String s, TPermission permission) {
super((TString) (Object) s);
this.permission = permission;
}
public TPermission getPermission() {
return permission;
}
}

View File

@ -0,0 +1,26 @@
/*
* Copyright 2015 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.security;
import org.teavm.classlib.java.lang.TSecurityException;
/**
*
* @author Alexey Andreev
*/
public interface TGuard {
void checkGuard(Object object) throws TSecurityException;
}

View File

@ -0,0 +1,42 @@
/*
* Copyright 2015 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.security;
import org.teavm.classlib.java.lang.TSecurityException;
/**
*
* @author Alexey Andreev
*/
public abstract class TPermission implements TGuard {
private String name;
public TPermission(String name) {
this.name = name;
}
@Override
public void checkGuard(Object object) throws TSecurityException {
}
public abstract boolean implies(TPermission permission);
public String getName() {
return name;
}
public abstract String getActions();
}