From 4e9005d7c5a8ee110d8792d7d4dde5d9680a6a64 Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Thu, 16 Jun 2016 00:25:52 +0200 Subject: [PATCH] Add test for signature polymorphic methods --- build.xml | 12 +++++++- src/test/antunit/Java7MethodHandles.class | Bin 0 -> 1235 bytes src/test/antunit/Java7MethodHandles.java | 30 +++++++++++++++++++ src/test/antunit/TestJava7.xml | 34 ++++++++++++++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/test/antunit/Java7MethodHandles.class create mode 100644 src/test/antunit/Java7MethodHandles.java create mode 100644 src/test/antunit/TestJava7.xml diff --git a/build.xml b/build.xml index 59be6336..3156c7ad 100644 --- a/build.xml +++ b/build.xml @@ -633,6 +633,9 @@ + + + @@ -655,6 +658,13 @@ nowarn="true" source="1.6" target="1.6" debug="true" deprecation="false" encoding="${build.encoding}"/> + + + + + + @@ -662,7 +672,7 @@ nowarn="true" source="1.8" target="1.8" debug="true" deprecation="false" encoding="${build.encoding}"/> - + diff --git a/src/test/antunit/Java7MethodHandles.class b/src/test/antunit/Java7MethodHandles.class new file mode 100644 index 0000000000000000000000000000000000000000..bb770fdbef87f27bb6258fc274a3fe760a2f99cf GIT binary patch literal 1235 zcmaJ>>rN9v6#k|yU07Cb<$kw-wxCo+L@k0!Fk*_D&@>_bnzmy*u$^tTyQpvA>*x<4 zn)m=dl=19tO&8nJWOvT>`_4IYw!i=U_yu4C&vo=;LB}F)YDo5CsSnFo(Qym6b)=Bi z5%t`wSkrJv!(E2>wp7yDVTh*E1%}w3RTd0`IjO{3w^kH(o)=BBjO45mHw)aBp58RZ zoT_XvjOO0(Grn~woT^oR%~jbHjVxi+xKs?|sSmjm@@Gu0Dw!k4ma3BVxwu`S>_i7Q zL!?$^SO_Ibb!MH4Oqhf?;!!rXr z*rgG+GcgRcaNiYAM2T8Sv`qP`ZG8$ZV7_JTFbbNZQFn``Eafcg)U8ul{{-VeDPixK zywMO8mQJNZqv`~;9AwhqhFhEm$`KV|)2-%@-|v$v1ma^;_)IJO3U2;Ood&Jf{QU@& z7pb=VHbd7sJqV&(=|b1sz-Ai^{U4<&7o_dD++^U_GB?*VR7+bY*{*d3#8lbbwUyD` z1fUF?;bN|??LnC4s*65v?>qN?5qfA(!7xBlhE7Ij&*}x(H{U%-@3?QA#1P3w5P)Hf zkoFY`j1q{KEYU;%4#3hSA_+uCV)Xiso=e2fq2<YhHT>mH%8zSm?YXHJyVz_x*4*^NSh^jj^qgD@qkX9Y$@vQKBoQx4c|g? literal 0 HcmV?d00001 diff --git a/src/test/antunit/Java7MethodHandles.java b/src/test/antunit/Java7MethodHandles.java new file mode 100644 index 00000000..df40bc87 --- /dev/null +++ b/src/test/antunit/Java7MethodHandles.java @@ -0,0 +1,30 @@ +/* + * (C) Copyright Uwe Schindler (Generics Policeman) and others. + * + * 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. + */ + +/* The binary class file is packaged together with the source distribution. + */ + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; + +class Java7MethodHandles { + static void main(String... args) throws Throwable { + MethodHandle mh = MethodHandles.publicLookup().findVirtual(StringBuilder.class, "append", + MethodType.methodType(StringBuilder.class, int.class)); + StringBuilder result = (StringBuilder) mh.invoke(new StringBuilder(), 1); + } +} diff --git a/src/test/antunit/TestJava7.xml b/src/test/antunit/TestJava7.xml new file mode 100644 index 00000000..659c0e08 --- /dev/null +++ b/src/test/antunit/TestJava7.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + java.lang.invoke.MethodHandle#invoke(java.lang.Object[]) @ Forbidden signature polymorphic method + + + + + + +