diff --git a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingDependencyListener.java b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingDependencyListener.java index 537782e68..4c620ccd5 100644 --- a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingDependencyListener.java +++ b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingDependencyListener.java @@ -107,7 +107,7 @@ public class MetaprogrammingDependencyListener extends AbstractDependencyListene ValueType type = usageEntry.getKey(); String typeName = type instanceof ValueType.Object ? ((ValueType.Object) type).getClassName() - : type.toString(); + : type.toString().replace('/', '.'); choice.option(typeName, () -> { MethodReference implMethod = usageEntry.getValue(); ValueEmitter[] castParamVars = new ValueEmitter[paramVars.length]; diff --git a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/model/MethodDescriber.java b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/model/MethodDescriber.java index 7ddfd94d8..b8fe1f3c2 100644 --- a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/model/MethodDescriber.java +++ b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/model/MethodDescriber.java @@ -94,7 +94,6 @@ public class MethodDescriber { int classParamIndex = -1; for (int i = 0; i < method.parameterCount(); ++i) { ValueType proxyParam = meta.parameterType(i + paramOffset); - ValueType param = method.parameterType(i); if (proxyParam.isObject(ReflectClass.class)) { if (classParamIndex == -1) { classParamIndex = i; diff --git a/tests/src/test/java/org/teavm/metaprogramming/test/MetaprogrammingTest.java b/tests/src/test/java/org/teavm/metaprogramming/test/MetaprogrammingTest.java index ca80fccd7..8c9c0f332 100644 --- a/tests/src/test/java/org/teavm/metaprogramming/test/MetaprogrammingTest.java +++ b/tests/src/test/java/org/teavm/metaprogramming/test/MetaprogrammingTest.java @@ -414,6 +414,18 @@ public class MetaprogrammingTest { private static int counter = 0; + @Test + public void arrayTypeSelected() { + assertEquals(String[].class, createInstance(String.class, 1).getClass()); + assertEquals(String[][].class, createInstance(String[].class, 1).getClass()); + } + + @Meta + private static native Object createInstance(Class cls, int size); + private static void createInstance(ReflectClass cls, Value size) { + exit(() -> cls.createArray(size.get())); + } + static class Context { public int a; public int b;