diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleInputStream.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleInputStream.java new file mode 100644 index 000000000..3adb7022c --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleInputStream.java @@ -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(); + } +} diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TInheritableThreadLocal.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TInheritableThreadLocal.java new file mode 100644 index 000000000..2fd8511d5 --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TInheritableThreadLocal.java @@ -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 extends TThreadLocal { + protected T childValue(T parentValue) { + return parentValue; + } +} diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java index 6ee2400d9..ad8a033e6 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java @@ -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() { } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TAccessControlException.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TAccessControlException.java new file mode 100644 index 000000000..c20cdaa6e --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TAccessControlException.java @@ -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; + } +} diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TGuard.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TGuard.java new file mode 100644 index 000000000..27fb3ee26 --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TGuard.java @@ -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; +} diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TPermission.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TPermission.java new file mode 100644 index 000000000..eeb4ead72 --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/security/TPermission.java @@ -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(); +}