diff --git a/.idea/artifacts/teavm_samples_benchmark_war_exploded.xml b/.idea/artifacts/teavm_samples_benchmark_war_exploded.xml index 17bb430d8..7f2cc8e9d 100644 --- a/.idea/artifacts/teavm_samples_benchmark_war_exploded.xml +++ b/.idea/artifacts/teavm_samples_benchmark_war_exploded.xml @@ -8,7 +8,7 @@ - + diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 4dc2fa861..dc58687b2 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -167,6 +167,13 @@ + + + + + + + @@ -182,6 +189,7 @@ + diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 176a491da..a57555a96 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -9,6 +9,7 @@ + diff --git a/.idea/modules.xml b/.idea/modules.xml index a6391bb86..4fd4e8a02 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -17,6 +17,7 @@ + diff --git a/.idea/scopes/classlib.xml b/.idea/scopes/classlib.xml new file mode 100644 index 000000000..80ba2584f --- /dev/null +++ b/.idea/scopes/classlib.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/classlib_emu.xml b/.idea/scopes/classlib_emu.xml new file mode 100644 index 000000000..8240d5cd0 --- /dev/null +++ b/.idea/scopes/classlib_emu.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/jso_apis.xml b/.idea/scopes/jso_apis.xml new file mode 100644 index 000000000..2101ab3cd --- /dev/null +++ b/.idea/scopes/jso_apis.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/classlib/teavm-classlib.iml b/classlib/teavm-classlib.iml index f3c0d6ffe..e0ac077cc 100644 --- a/classlib/teavm-classlib.iml +++ b/classlib/teavm-classlib.iml @@ -33,24 +33,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/core/teavm-core.iml b/core/teavm-core.iml index d18675547..4f8549b6a 100644 --- a/core/teavm-core.iml +++ b/core/teavm-core.iml @@ -28,18 +28,6 @@ - - - - - - - - - - - - diff --git a/extras-slf4j/teavm-extras-slf4j.iml b/extras-slf4j/teavm-extras-slf4j.iml index 17153eb8e..ff38459f4 100644 --- a/extras-slf4j/teavm-extras-slf4j.iml +++ b/extras-slf4j/teavm-extras-slf4j.iml @@ -10,12 +10,6 @@ - - - - - - diff --git a/html4j/teavm-html4j.iml b/html4j/teavm-html4j.iml index a8c758eda..ed9502aa5 100644 --- a/html4j/teavm-html4j.iml +++ b/html4j/teavm-html4j.iml @@ -19,38 +19,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jso/apis/teavm-jso-apis.iml b/jso/apis/teavm-jso-apis.iml index c82942cf3..62b52a573 100644 --- a/jso/apis/teavm-jso-apis.iml +++ b/jso/apis/teavm-jso-apis.iml @@ -10,10 +10,6 @@ - - - - diff --git a/jso/core/teavm-jso.iml b/jso/core/teavm-jso.iml index 44dcc203d..c68f06c77 100644 --- a/jso/core/teavm-jso.iml +++ b/jso/core/teavm-jso.iml @@ -11,9 +11,5 @@ - - - - \ No newline at end of file diff --git a/jso/impl/teavm-jso-impl.iml b/jso/impl/teavm-jso-impl.iml index 2fd4fcc1b..a448936fb 100644 --- a/jso/impl/teavm-jso-impl.iml +++ b/jso/impl/teavm-jso-impl.iml @@ -11,16 +11,6 @@ - - - - - - - - - - diff --git a/metaprogramming-api/pom.xml b/metaprogramming-api/pom.xml new file mode 100644 index 000000000..17925f49c --- /dev/null +++ b/metaprogramming-api/pom.xml @@ -0,0 +1,63 @@ + + + + + 4.0.0 + + + org.teavm + teavm + 1.0.0-SNAPSHOT + + teavm-metaprogramming-api + + TeaVM metaprogramming API + Declaration of interfaces and annotations for TeaVM metaprogramming + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + ../checkstyle.xml + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + org.teavm.metaprogramming.* + teavm-metaprogramming-api + + + + + + \ No newline at end of file diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Action.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Action.java new file mode 100644 index 000000000..c8424c6f6 --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Action.java @@ -0,0 +1,21 @@ +/* + * Copyright 2016 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.metaprogramming; + +@SuppressWarnings("unused") +public interface Action { + void run(); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/CompileTime.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/CompileTime.java new file mode 100644 index 000000000..7900c7b98 --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/CompileTime.java @@ -0,0 +1,26 @@ +/* + * Copyright 2016 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.metaprogramming; + +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.TYPE, ElementType.PACKAGE }) +public @interface CompileTime { +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Computation.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Computation.java new file mode 100644 index 000000000..92c7d238d --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Computation.java @@ -0,0 +1,21 @@ +/* + * Copyright 2016 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.metaprogramming; + +@SuppressWarnings("unused") +public interface Computation { + T compute(); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Diagnostics.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Diagnostics.java new file mode 100644 index 000000000..c4f412dc6 --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Diagnostics.java @@ -0,0 +1,22 @@ +/* + * Copyright 2016 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.metaprogramming; + +public interface Diagnostics { + void error(SourceLocation location, String error, Object... params); + + void warning(SourceLocation location, String error, Object... params); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/InvocationHandler.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/InvocationHandler.java new file mode 100644 index 000000000..2fbbaf4fa --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/InvocationHandler.java @@ -0,0 +1,22 @@ +/* + * Copyright 2016 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.metaprogramming; + +import org.teavm.metaprogramming.reflect.ReflectMethod; + +public interface InvocationHandler { + void invoke(Value proxy, ReflectMethod method, Value[] args); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/LazyComputation.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/LazyComputation.java new file mode 100644 index 000000000..869319d0b --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/LazyComputation.java @@ -0,0 +1,21 @@ +/* + * Copyright 2016 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.metaprogramming; + +@SuppressWarnings("unused") +public interface LazyComputation { + Value compute(); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Metaprogramming.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Metaprogramming.java new file mode 100644 index 000000000..09bbd1dd1 --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Metaprogramming.java @@ -0,0 +1,93 @@ +/* + * Copyright 2016 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.metaprogramming; + +@SuppressWarnings("unused") +public final class Metaprogramming { + private Metaprogramming() { + } + + public static Value emit(Computation computation) { + unsupported(); + return null; + } + + public static void emit(Action action) { + unsupported(); + } + + public static Value lazyFragment(LazyComputation computation) { + unsupported(); + return null; + } + + public static Value lazy(Computation computation) { + unsupported(); + return null; + } + + public static Scope currentScope() { + unsupported(); + return null; + } + + public static void location(String fileName, int lineNumber) { + unsupported(); + } + + public static void defaultLocation() { + unsupported(); + } + + public static ReflectClass findClass(String name) { + unsupported(); + return null; + } + + public static ReflectClass findClass(Class cls) { + unsupported(); + return null; + } + + public static ClassLoader getClassLoader() { + unsupported(); + return null; + } + + public static ReflectClass arrayClass(ReflectClass componentType) { + unsupported(); + return null; + } + + public static ReflectClass createClass(byte[] bytecode) { + unsupported(); + return null; + } + + public static Value proxy(Class type, InvocationHandler handler) { + return proxy(findClass(type), handler); + } + + public static Value proxy(ReflectClass type, InvocationHandler handler) { + unsupported(); + return null; + } + + private static void unsupported() { + throw new UnsupportedOperationException("This operation is only supported from TeaVM compile-time " + + "environment"); + } +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/ReflectClass.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/ReflectClass.java new file mode 100644 index 000000000..37e596faa --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/ReflectClass.java @@ -0,0 +1,98 @@ +/* + * Copyright 2016 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.metaprogramming; + +import java.util.Arrays; +import org.teavm.metaprogramming.reflect.ReflectField; +import org.teavm.metaprogramming.reflect.ReflectMethod; + +public interface ReflectClass { + boolean isPrimitive(); + + boolean isInterface(); + + boolean isArray(); + + boolean isAnnotation(); + + boolean isEnum(); + + T[] getEnumConstants(); + + int getModifiers(); + + ReflectClass getComponentType(); + + String getName(); + + ReflectClass getSuperclass(); + + ReflectClass[] getInterfaces(); + + boolean isInstance(Object obj); + + T cast(Object obj); + + ReflectClass asSubclass(Class cls); + + default boolean isAssignableFrom(ReflectClass cls) { + return cls == this + || cls.getSuperclass() != null && this.isAssignableFrom(cls.getSuperclass()) + || Arrays.stream(cls.getInterfaces()).anyMatch(this::isAssignableFrom); + } + + default boolean isAssignableFrom(Class cls) { + return isAssignableFrom(Metaprogramming.findClass(cls)); + } + + ReflectMethod[] getDeclaredMethods(); + + ReflectMethod[] getMethods(); + + ReflectMethod getDeclaredMethod(String name, ReflectClass... parameterTypes); + + default ReflectMethod getDeclaredJMethod(String name, Class... parameterTypes) { + ReflectClass[] mappedParamTypes = Arrays.stream(parameterTypes) + .map(Metaprogramming::findClass) + .toArray(ReflectClass[]::new); + return getDeclaredMethod(name, mappedParamTypes); + } + + ReflectMethod getMethod(String name, ReflectClass... parameterTypes); + + default ReflectMethod getJMethod(String name, Class... parameterTypes) { + ReflectClass[] mappedParamTypes = Arrays.stream(parameterTypes) + .map(Metaprogramming::findClass) + .toArray(ReflectClass[]::new); + return getMethod(name, mappedParamTypes); + } + + ReflectField[] getDeclaredFields(); + + ReflectField[] getFields(); + + ReflectField getDeclaredField(String name); + + ReflectField getField(String name); + + T[] createArray(int size); + + T getArrayElement(Object array, int index); + + int getArrayLength(Object array); + + Class asJavaClass(); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Scope.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Scope.java new file mode 100644 index 000000000..192f4a96d --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Scope.java @@ -0,0 +1,20 @@ +/* + * Copyright 2016 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.metaprogramming; + +public interface Scope { + void exit(Object returnValue); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/SourceLocation.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/SourceLocation.java new file mode 100644 index 000000000..74877ae8f --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/SourceLocation.java @@ -0,0 +1,71 @@ +/* + * Copyright 2016 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.metaprogramming; + +import java.util.Objects; +import org.teavm.metaprogramming.reflect.ReflectMethod; + +public class SourceLocation { + private ReflectMethod method; + private String fileName; + private int lineNumber; + + public SourceLocation(ReflectMethod method, String fileName, int lineNumber) { + this.method = method; + this.fileName = fileName; + this.lineNumber = lineNumber; + } + + public SourceLocation(ReflectMethod method) { + this(method, null, -1); + } + + public ReflectMethod getMethod() { + return method; + } + + public String getFileName() { + return fileName; + } + + public int getLineNumber() { + return lineNumber; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof SourceLocation)) { + return false; + } + SourceLocation other = (SourceLocation) obj; + return method == other.method && Objects.equals(fileName, other.fileName) && lineNumber == other.lineNumber; + } + + @Override + public int hashCode() { + return Objects.hash(method, fileName, lineNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(method.getName()); + return lineNumber > 0 ? fileName + ":" + lineNumber : fileName; + } +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Value.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Value.java new file mode 100644 index 000000000..d25e68640 --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/Value.java @@ -0,0 +1,21 @@ +/* + * Copyright 2016 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.metaprogramming; + +@SuppressWarnings("unused") +public interface Value { + T get(); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectAnnotatedElement.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectAnnotatedElement.java new file mode 100644 index 000000000..1ee9e78ce --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectAnnotatedElement.java @@ -0,0 +1,22 @@ +/* + * Copyright 2016 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.metaprogramming.reflect; + +import java.lang.annotation.Annotation; + +public interface ReflectAnnotatedElement { + T getAnnotation(Class type); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectField.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectField.java new file mode 100644 index 000000000..e0587edfd --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectField.java @@ -0,0 +1,28 @@ +/* + * Copyright 2016 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.metaprogramming.reflect; + +import org.teavm.metaprogramming.ReflectClass; + +public interface ReflectField extends ReflectMember { + boolean isEnumConstant(); + + ReflectClass getType(); + + Object get(Object target); + + void set(Object target, Object value); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectMember.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectMember.java new file mode 100644 index 000000000..f02124c3c --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectMember.java @@ -0,0 +1,26 @@ +/* + * Copyright 2016 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.metaprogramming.reflect; + +import org.teavm.metaprogramming.ReflectClass; + +public interface ReflectMember { + ReflectClass getDeclaringClass(); + + String getName(); + + int getModifiers(); +} diff --git a/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectMethod.java b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectMethod.java new file mode 100644 index 000000000..0f5a417fe --- /dev/null +++ b/metaprogramming-api/src/main/java/org/teavm/metaprogramming/reflect/ReflectMethod.java @@ -0,0 +1,36 @@ +/* + * Copyright 2016 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.metaprogramming.reflect; + +import org.teavm.metaprogramming.ReflectClass; + +public interface ReflectMethod extends ReflectMember { + boolean isConstructor(); + + ReflectClass getReturnType(); + + ReflectClass[] getParameterTypes(); + + ReflectClass getParameterType(int index); + + ReflectAnnotatedElement getParameterAnnotations(int index); + + int getParameterCount(); + + Object invoke(Object obj, Object... args); + + Object construct(Object... args); +} diff --git a/metaprogramming-api/teavm-metaprogramming-api.iml b/metaprogramming-api/teavm-metaprogramming-api.iml new file mode 100644 index 000000000..dae5c19b8 --- /dev/null +++ b/metaprogramming-api/teavm-metaprogramming-api.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/platform/teavm-platform.iml b/platform/teavm-platform.iml index 47b6f49c6..869f418fe 100644 --- a/platform/teavm-platform.iml +++ b/platform/teavm-platform.iml @@ -23,14 +23,6 @@ - - - - - - - - diff --git a/pom.xml b/pom.xml index 67d6b0c72..d7ffdeebc 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,7 @@ + metaprogramming-api core classlib jso/core diff --git a/samples/async/teavm-samples-async.iml b/samples/async/teavm-samples-async.iml index 9d3bc6ab3..828605ef2 100644 --- a/samples/async/teavm-samples-async.iml +++ b/samples/async/teavm-samples-async.iml @@ -22,18 +22,6 @@ - - - - - - - - - - - - diff --git a/samples/benchmark/teavm-samples-benchmark.iml b/samples/benchmark/teavm-samples-benchmark.iml index 736795dab..d87c614cb 100644 --- a/samples/benchmark/teavm-samples-benchmark.iml +++ b/samples/benchmark/teavm-samples-benchmark.iml @@ -32,50 +32,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -91,18 +47,17 @@ - + - - - + + - - + + diff --git a/samples/hello/teavm-samples-hello.iml b/samples/hello/teavm-samples-hello.iml index 4dd65253b..385ff00b0 100644 --- a/samples/hello/teavm-samples-hello.iml +++ b/samples/hello/teavm-samples-hello.iml @@ -22,20 +22,6 @@ - - - - - - - - - - - - - - diff --git a/samples/kotlin/teavm-samples-kotlin.iml b/samples/kotlin/teavm-samples-kotlin.iml index f9226f334..e8088e5f8 100644 --- a/samples/kotlin/teavm-samples-kotlin.iml +++ b/samples/kotlin/teavm-samples-kotlin.iml @@ -26,26 +26,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/samples/scala/teavm-samples-scala.iml b/samples/scala/teavm-samples-scala.iml index 42958b542..843b73782 100644 --- a/samples/scala/teavm-samples-scala.iml +++ b/samples/scala/teavm-samples-scala.iml @@ -22,20 +22,6 @@ - - - - - - - - - - - - - - diff --git a/samples/storage/teavm-samples-storage.iml b/samples/storage/teavm-samples-storage.iml index 7b7a0d5f7..c3ee46956 100644 --- a/samples/storage/teavm-samples-storage.iml +++ b/samples/storage/teavm-samples-storage.iml @@ -22,20 +22,6 @@ - - - - - - - - - - - - - - diff --git a/samples/video/teavm-samples-video.iml b/samples/video/teavm-samples-video.iml index 7b7a0d5f7..c3ee46956 100644 --- a/samples/video/teavm-samples-video.iml +++ b/samples/video/teavm-samples-video.iml @@ -22,20 +22,6 @@ - - - - - - - - - - - - - - diff --git a/tests/teavm-tests.iml b/tests/teavm-tests.iml index f82fca9c6..5e8336242 100644 --- a/tests/teavm-tests.iml +++ b/tests/teavm-tests.iml @@ -10,22 +10,6 @@ - - - - - - - - - - - - - - - - diff --git a/tools/chrome-rdp/teavm-chrome-rdp.iml b/tools/chrome-rdp/teavm-chrome-rdp.iml index 36b89f4b8..698c7b466 100644 --- a/tools/chrome-rdp/teavm-chrome-rdp.iml +++ b/tools/chrome-rdp/teavm-chrome-rdp.iml @@ -44,64 +44,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/cli/teavm-cli.iml b/tools/cli/teavm-cli.iml index f84234540..f1df25985 100644 --- a/tools/cli/teavm-cli.iml +++ b/tools/cli/teavm-cli.iml @@ -9,12 +9,6 @@ - - - - - - diff --git a/tools/core/teavm-tooling.iml b/tools/core/teavm-tooling.iml index a07eab557..fe89ce587 100644 --- a/tools/core/teavm-tooling.iml +++ b/tools/core/teavm-tooling.iml @@ -23,12 +23,6 @@ - - - - - - diff --git a/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java b/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java index dc57071c7..394450e58 100644 --- a/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java +++ b/tools/idea/jps-plugin/src/main/java/org/teavm/idea/jps/model/TeaVMJpsConfiguration.java @@ -27,7 +27,7 @@ public class TeaVMJpsConfiguration extends JpsElementBase private boolean enabled; private String mainClass; private String targetDirectory; - private boolean minifying = false; + private boolean minifying; private boolean sourceMapsFileGenerated = true; private boolean sourceFilesCopied = true; diff --git a/tools/idea/src/main/java/org/teavm/idea/TeaVMConfigurationStorage.java b/tools/idea/src/main/java/org/teavm/idea/TeaVMConfigurationStorage.java index 179ece01b..03481ea7e 100644 --- a/tools/idea/src/main/java/org/teavm/idea/TeaVMConfigurationStorage.java +++ b/tools/idea/src/main/java/org/teavm/idea/TeaVMConfigurationStorage.java @@ -18,8 +18,6 @@ package org.teavm.idea; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.module.ModuleComponent; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.teavm.idea.jps.model.TeaVMJpsConfiguration; diff --git a/tools/maven/plugin/teavm-maven-plugin.iml b/tools/maven/plugin/teavm-maven-plugin.iml index 31142ceae..66a1d1672 100644 --- a/tools/maven/plugin/teavm-maven-plugin.iml +++ b/tools/maven/plugin/teavm-maven-plugin.iml @@ -40,154 +40,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -