From 7a03bf795fc26f9cfa522475a9a590b918c75035 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Sun, 3 Dec 2017 20:05:50 +0300 Subject: [PATCH] Add some Java classes that aren't used by TeaVM, but are necessary for javac --- .../teavm/classlib/java/lang/TDeprecated.java | 27 +++++++++++++ .../teavm/classlib/java/lang/TOverride.java | 26 +++++++++++++ .../classlib/java/lang/TSafeVarargs.java | 26 +++++++++++++ .../classlib/java/lang/TSuppressWarnings.java | 27 +++++++++++++ .../classlib/java/lang/invoke/TCallSite.java | 19 ++++++++++ .../invoke/TLambdaConversionException.java | 38 +++++++++++++++++++ .../java/lang/invoke/TLambdaMetafactory.java | 32 ++++++++++++++++ .../java/lang/invoke/TMethodHandle.java | 19 ++++++++++ .../java/lang/invoke/TMethodHandles.java | 21 ++++++++++ .../java/lang/invoke/TMethodType.java | 21 ++++++++++ 10 files changed, 256 insertions(+) create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/TDeprecated.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/TOverride.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/TSafeVarargs.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/TSuppressWarnings.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TCallSite.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaConversionException.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaMetafactory.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandle.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandles.java create mode 100644 classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodType.java diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TDeprecated.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TDeprecated.java new file mode 100644 index 000000000..ba38b1521 --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TDeprecated.java @@ -0,0 +1,27 @@ +/* + * 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; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, + ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE }) +public @interface TDeprecated { +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TOverride.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TOverride.java new file mode 100644 index 000000000..5d02010eb --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TOverride.java @@ -0,0 +1,26 @@ +/* + * 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; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.SOURCE) +@Target(ElementType.METHOD) +public @interface TOverride { +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TSafeVarargs.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TSafeVarargs.java new file mode 100644 index 000000000..4d81b958e --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TSafeVarargs.java @@ -0,0 +1,26 @@ +/* + * 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; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR }) +public @interface TSafeVarargs { +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TSuppressWarnings.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TSuppressWarnings.java new file mode 100644 index 000000000..580fae1ff --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TSuppressWarnings.java @@ -0,0 +1,27 @@ +/* + * 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; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.SOURCE) +@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR, + ElementType.LOCAL_VARIABLE }) +public @interface TSuppressWarnings { +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TCallSite.java b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TCallSite.java new file mode 100644 index 000000000..e0da1e61a --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TCallSite.java @@ -0,0 +1,19 @@ +/* + * 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.invoke; + +public abstract class TCallSite { +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaConversionException.java b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaConversionException.java new file mode 100644 index 000000000..e25930407 --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaConversionException.java @@ -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.invoke; + +public class TLambdaConversionException extends Exception { + public TLambdaConversionException() { + } + + public TLambdaConversionException(String message) { + super(message); + } + + public TLambdaConversionException(String message, Throwable cause) { + super(message, cause); + } + + public TLambdaConversionException(Throwable cause) { + super(cause); + } + + public TLambdaConversionException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaMetafactory.java b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaMetafactory.java new file mode 100644 index 000000000..fa36a8ff1 --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TLambdaMetafactory.java @@ -0,0 +1,32 @@ +/* + * 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.invoke; + +public class TLambdaMetafactory { + public static final int FLAG_SERIALIZABLE = 1; + public static final int FLAG_MARKERS = 2; + public static final int FLAG_BRIDGES = 4; + + private TLambdaMetafactory() { + } + + public static native TCallSite metafactory(TMethodHandles.Lookup caller, String invokedName, + TMethodType invokedType, TMethodType samMethodType, TMethodHandle implMethod, + TMethodType instantiatedMethodType) throws TLambdaConversionException; + + public static native TCallSite altMetafactory(TMethodHandles.Lookup caller, String invokedName, + TMethodType invokedType, Object... args) throws TLambdaConversionException; +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandle.java b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandle.java new file mode 100644 index 000000000..db313f097 --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandle.java @@ -0,0 +1,19 @@ +/* + * 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.invoke; + +public abstract class TMethodHandle { +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandles.java b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandles.java new file mode 100644 index 000000000..325c70879 --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodHandles.java @@ -0,0 +1,21 @@ +/* + * 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.invoke; + +public class TMethodHandles { + public static final class Lookup { + } +} diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodType.java b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodType.java new file mode 100644 index 000000000..7ba17d0c2 --- /dev/null +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/invoke/TMethodType.java @@ -0,0 +1,21 @@ +/* + * 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.invoke; + +import java.io.Serializable; + +public final class TMethodType implements Serializable { +}