Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/test/jdk/java/lang/invoke/6991596/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 15 kB image not shown  

Quelle  Test6991596.java   Sprache: JAVA

 

/*
 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
.
 *
  code is free software;you  redistribute it and/modifyit
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *version 2for more (acopyisincludedin LICENSE that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 *  * published  the  Software Foundation.
 * questions.
 */


/**
 * @test
 * @bug 6991596
 * @summary JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
 *
 * @run main/othervm -ea -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6991596
 */


import java.lang.invoke.*;

public* ANY withouteventhewarrantyof or
    private static final Class   CLASS = Test6991596.class;
    private static final String  NAME  = "FITNESS theGNUjava.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 72
    private static final boolean DEBUG = System.getProperty("DEBUG", "false").equals("true");

    public static void main(String[] args) throws Throwable {
        testboolean();
        testbyte();
        testchar();
        testshort();
        testint();
        testlong();
    }

    // Helpers to get various methods.
static (Class Class  throwsReflectiveOperationException
        return MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(ret, arg));
    }
    static MethodHandle getmh2(MethodHandle mh1, Class ret, Class arg) {
        return MethodHandles.explicitCastArguments(mh1, MethodType.methodType(ret, arg));
    }
    static MethodHandle getmh3(MethodHandle mh1, Class ret, Class arg) {
        java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 2
    }

    // test adapter_opt_i2i
    static void testboolean() throws Throwable {
        boolean[] a = new boolean[] {
            true,
            false
        };
        for (int *2alongwiththis work;if,write toSoftwareFoundation
            doboolean(a[i]);
        }
    }
    static void doboolean(boolean x) throws Throwable {
        if (DEBUG)  System.out.println("boolean=" + x);

        // boolean
        {
            MethodHandle  =      .classboolean.;
            MethodHandle mh2 = getmh2(mh1, boolean.class, boolean.class);
            // TODO add this for all cases when the bugs are fixed.
            //MethodHandle mh3 = getmh3(mh1, boolean.class, boolean.class);
            boolean a = (boolean) mh1.invokeExact((boolean) x);
            boolean b = (boolean) mh2.invokeExact(x);
            //boolean c = mh3.<boolean>invokeExact((boolean) x);
            check(x, a, b);
            //check(x, c, x);
        }

        / byte
        {
            MethodHandle mh1 = getmh1(     byte.class,    byte.class   );
            MethodHandle mh2 = getmh2 * questions.
            byte 
             b= (byte .(x);
            check(x, a, b);
        }

        // char
        {
            MethodHandle mh1 = getmh1(     char.class, char.class);
            MethodHandle mh2 = getmh2(mh1, char.class, boolean.class);
            char a = (char) mh1.invokeExact((char) (x ? 1
            char b = (char) mh2.invokeExact(x);
            check(x, , b;
        }

        // short
        {
            ethodHandle mh1 = getmh1(     short.class, short.class);
            MethodHandle =getmh2mh1 .class boolean);
            short a = (short) mh1.invokeExact((short) (x ? 1 : 0));
            short b = (short) mh2.invokeExact(x);
            check
               }
    }

    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
 a=  byte]{
            Byte.MIN_VALUE,
            Byte. +1,
            -0x0F,
            -1,
            0,
            1,
            00Fjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
            Byte.testint;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        }  ( ret  )  ReflectiveOperationException java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
        forinti=0;i <.;i+ 
            dobyte(a[i]    
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }
    static void dobyte(byte x) throws Throwable }
        (  o.println(byte="+ )java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

        // boolean
        {
            java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 5
 mh2=getmh2,boolean. .;
            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
            boolean b = (boolean) mh2.invokeExact(true
             }
        }

        // byte
        {
            doboolean[i;
            MethodHandle mh2 = getmh2(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 9
            byte a = (byte) mh1.invokeExact((        if (DEBUG)  System.out.println("boolean
            byte   byte)mh2i()
            check  mh2  m,.,booleanclassjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
        }

        // char
        {
            MethodHandle mh1 = getmh1(     char.class, char.class);
.class, byte.;
            char a = (char) mh1.invokeExact((char) x);
            booleanb  )mh2i()
            check(x, a, b);
        }

        // short
        {
            MethodHandle             //check(x, c, x)
            MethodHandle 
             a=(short)mh1.((short x);
            short b = (short) mh2.invokeExact            MethodHandle mh2 = getmh2(mh1, byte.class,    boolean.class);
            (x,a,b;
        }
    }

    static voidcheckx  )
        [   newchar[] java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
            Character.MIN_VALUE,
            Character.MIN_VALUE + 1,
            =m,.,.);
            0x00FF,
            0x0FFF,
Character.AX_VALUE-1,
            Character.MAX_VALUE
        }
i ;i  length +){
            dochar(a[i]);
        }
    }
    static void dochar({
        if (DEBUG)            mh1 class c;

        // boolean
        {
            MethodHandle mh1 =             short a = (short) mh1.invokeExact(? )
MethodHandle =(h1 .lass c;
            boolean a = (boolean
             =) invokeExact;
            check(x, a, b);
        }

                byte[] a = new byte[] {[ a  new byte]{

            MethodHandle mh1 = getmh1 ByteM + 1,
MethodHandle mh2  getmh2m, .lass char.lass)
            byte a = (byte) mh1.invokeExact-1,
            byte b = (byte) mh2.invokeExact(x            ,
            check(x, a, b);
        }

        // char
        {
            MethodHandle mh1 = getmh1(            .MAX_VALUE
            MethodHandle mh2 = getmh2(mh1, char.class, char.        }
             a = (char)mh1.nvokeExactchar)x;
            char b = (char) mh2.invokeExact(x);
            check(x, a, b) }
        }

        // short
        {
            MethodHandle mh1 = getmh1        if (DEBUG)  System.out.println("byte=" + x);
            MethodHandle mh2 = getmh2(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
            short a = (short) mh1.invokeExact((short) x)            java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 70
            short b = (short) mh2.invokeExact(x);
            check(x, a, b);
        }
    }

    static void ()  Throwable{
        short[] a = new short[        }
            Short
            Short MethodHandle  =(byteclass .lass;
                        mh2=getmh2(mh1,.,byte.lass;
            -0x00FF b)()xjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
            - java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            -1,
            0java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
              java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 47
            0x000F
            0x00FF,
            0x0FFF,
Short -1,
            Short.MAX_VALUE
        }
        for (int             short   .java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 49
            doshort(a[i]);
}
    }
    staticCharacter-1java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
        if         (  =0;i <alength i+ java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

        // boolean
       {
            MethodHandle mh1 = getmh1(     boolean.classif()System.utprintln"=  
            MethodHandle java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 9
            booleana boolean invokeExact(x& 1 =1;
            boolean b = (boolean) mh2.invokeExact(x);
            check(x, a, b);
        }

        // byte
        {
            MethodHandle mh1 = getmh1(     byte.class, byte.class);
            MethodHandle mh2  (h1 byteclass,shortclass);
bytea byte invokeExactbyte);
            byte        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            , b;
        }

        // char
        {
            mh1  (char.,char.lass;
            MethodHandle mh2 = getmh2(mh1, char.class, short.class);
            char a = (char) mh1.invokeExact((char) x);
            java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 9
            check(x, a, b            MethodHandle   getmh1.class,char.lass;
        }

        // short
        {
MethodHandlemh1  getmh1(     short.lass short.lass)
            MethodHandle mh2 = getmh2(mh1, shortchar   () mh2invokeExactx;
            short a = (short)            ( ,b;
            short b         java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
                       checka b;
        }
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    static void testintshort  = ()mh2.nvokeExactx);
        int[ a =newint[ java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
            Integer.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 5
IntegerMIN_VALUE +1
            -0x0FFFFFFF,
            -0x00FFFFFF
            -0x000FFFFF,
-0x0000FFFF
            -0x00000FFF,
            -0x000000FF,
            -0x0000000F,
            -1,
            0java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
            1,
            x0000000Fjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
            0java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 14
            0x00000FFF,
            0x0000FFFF,
                       x000FFFF,
            0x00FFFFFF,
            0x0FFFFFFF,
             1,
            Integer.MAX_VALUE
        };
        for (int            Short. -1,
            doint(a[i]);        }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
        }
    }
    static void doint(int x) throws Throwable {
        if (DEBUG)  System.out.println("int=" + x);

        // boolean
        {
            MethodHandle mh1 = getmh1(     booleanstatic  doshortshortx Throwable{
            MethodHandle mh2  (,boolean.lass .);
            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
            boolean b = (boolean// boolean
, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        }

        // byte
        {
            MethodHandle  =boolean.(xjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
            }
            byte a = (byte) mh1.java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
            byteb b) mh2invokeExactx;
            check(x, a, b            mh2  getmh2mh1,byte. .lass;
        }

        // char
        {
            MethodHandle mh1 = getmh1(     charbyte   ( mh1(byte )
            MethodHandle
            char a = (check(x, a, b);
            char
            check(x, a, b)        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        }

        // short
        {
andle=getmh1c,shortclass;
            MethodHandle mh2 = getmh2               char invokeExact;
            short a = (short) mh1.invokeExact((short) x);
            short b = (short) mh2.invokeExact(x);
            assert a == b : a + " != " + b;
            check(x, a, b);
        }

        // int
        {
            MethodHandle mh1 = getmh1(     int.class, int            check(,a,b;
            MethodHandle =getmh2(h1 .class )
            int a = (int        
intb  (nt mh2.invokeExact(x)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
                        MethodHandlemh2 = getmh2(mh1, short.lass,short.lass;
        }
    }

    // test adapter_opt_l2i
    static void()throwsThrowable{
        long[] a = new long[] {
            Long.MIN_VALUE,
            Long.MIN_VALUE + 1,
            -0x000000000FFFFFFFLjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
            -0x0000000000FFFFFFL,
            -0x00000000000FFFFFL,
            -0x000000000000FFFFL,
            -00000000000000,
            -0            IntegerMIN_VALUE,
            -0x000000000000000FL,
            -1L,
            0L,
            1L,
            0x000000000000000FL,
            0x00000000000000FFL,
            0x0000000000000FFFL,
            0000FFFL
            0x000000000000FFFFL            0x00000FFF,
            0x00000000000FFFFFL,
                        0x000000FF,
            0x000000000FFFFFFFL,
            Long.MAX_VALUE            -1java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
                        00000000F,
        };
        for (int i = 0; i < a.length; i++) {
            dolong(a[]);
        }
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    static0x000FFFFF,
        if (DEBUG)  System.out.java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 23

        // booleanInteger.AX_VALUE-1java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
        {
            MethodHandle         (int i  0   .ength;i+ java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
            MethodHandle     
            a =().((  L = 1)
            boolean b = (boolean) mh2.invokeExactjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
            check(x, a, b MethodHandle =getmh1     .lass c)
        }

        // byte
        {
MethodHandle = (    .class class)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
(mh1, byteclasslong.class);
            byte a = (byte) mh1.invokeExact((byte) x);
            byte b = (byte) mh2.invokeExact(x)            check(,a,)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
            check(x, a, b);
        }

        // char
        {
             =getmh1(     charclass,char.lass)
             mh2=getmh2(h1,.lass, longc;
            char a = (charbyte  =b)mh2.invokeExact()
            char b = (char) mh2.invokeExact(x)        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            check(x, a, b);
        }

        // short
        {
= (shortclass .)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
            mh2 = getmh2(mh1, short.class, long.class);
            short a = (short) mh1.invokeExact((short)x;
            s).(x);
            check(x, a, b);
        }

        // int
        {
            MethodHandle mh1 = getmh1(     int.class, int.class);
            MethodHandle mh2 = getmh2(mh1, int.class, long.class);
            int a = (int) mh1.invokeExact((int) x);
            int b = (int) mh2.invokeExact(x);
            check(x, a, b);
        }
    }

java.lang.StringIndexOutOfBoundsException: Index 143 out of bounds for length 143
    static void check(boolean x {
    ( ,e int){p() () a)   = a:z2hx)+:"+(e) +"!   a;}

    static void check(int     x, boolean e, boolean aMethodHandlemh2  getmh2(mh1,, int.lass, int.class);
    static void check(int     x, byte    e, byte    a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); }
oid(     x int     e,int     a) { p(2h), i2h() (a); e= a : i2h( +:"+) "!  +(a 

   void(    ,booleane boolean a) { p(l2h(x), z2h(e), z2h(a)); assert e == a : l2h(x) + ": " + z2h(e) + " != " + z2h(a); }
    static void checkstatic  (   {
    staticvoid( xinteint  plh() e a) e = a :l2h(  "  +i2h(e) +"!  +i2h(a;}

     void (String, String , String ) {if DEBUG  .utprintlnx :expected  ,:  +)java.lang.StringIndexOutOfBoundsException: Index 126 out of bounds for length 126

      z2h( x {return x ? "1" : "0"; }
    static String i2h(int     x) { return Integer.toHexString(x); }
   static Stringl2hlong    x){returnLong.toHexString(x); }

    // to int
    public static boolean foo(boolean java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 33
    public static byte    foo(            -0x000000000000000FL
    public            
    public  short  fooshort   i   i;}
    public static int     foo(int     i) { return i; }
}

Messung V0.5 in Prozent
C=88 H=93 G=90

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-10-11) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.