Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Android/art/art/test/952-invoke-custom/src/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 4 kB image not shown  

Quelle  Main.java

  Sprache: JAVA
 

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * 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.
 */


import java.lang.invoke.CallSite;
import java.lang.invoke.MethodType;
import java.lang.invoke.MutableCallSite;

public class Main extends TestBase {

    private static void TestUninitializedCallSite() throws Throwable {
        CallSite callSite = new MutableCallSite(MethodType.methodType(int.class));
        try {
            callSite.getTarget().invoke();
            fail();
        } catch (IllegalStateException e) {
            System.out.println("Caught exception from uninitialized call site");
        }

        callSite = new MutableCallSite(MethodType.methodType(String.classint.classchar.class));
        try {
            callSite.getTarget().invoke(1535'd');
            fail();
        } catch (IllegalStateException e) {
            System.out.println("Caught exception from uninitialized call site");
        }
    }

    private static void TestLinkerMethodMultipleArgumentTypes() throws Throwable {
        TestLinkerMethodMultipleArgumentTypes.test(3367);
        TestLinkerMethodMultipleArgumentTypes.test(-100001000);
        TestLinkerMethodMultipleArgumentTypes.test(-100010000);
    }

    private static void TestLinkerMethodWithRange() throws Throwable {
        TestLinkerMethodWithRange.test(012345);
        TestLinkerMethodWithRange.test(-101, -79113917229);
        TestLinkerMethodWithRange.test(81182394796710871093);

        TestLinkerMethodWithRange.test(nullnullnullnullnullnull);
        TestLinkerMethodWithRange.test(Double.valueOf(1.0), nullDouble.valueOf(3.0), null,
                                       Double.valueOf(37.0), null);
        TestLinkerMethodWithRange.test(nullDouble.valueOf(3.0), null,
                                       Double.valueOf(37.0), nullDouble.valueOf(113.0));
        TestLinkerMethodWithRange.test(Double.valueOf(1.0), Double.valueOf(2.0),
                                       Double.valueOf(3.0), Double.valueOf(5.0),
                                       Double.valueOf(7.0), Double.valueOf(11.0));
    }

    private static void TestLinkerMethodMinimalArguments() throws Throwable {
        try {
            TestLinkerMethodMinimalArguments.test(
                    TestLinkerMethodMinimalArguments.FAILURE_TYPE_LINKER_METHOD_RETURNS_NULL,
                    10,
                    10);
            assertNotReached();
        } catch (BootstrapMethodError e) {
            assertEquals(e.getCause().getClass(), ClassCastException.class);
        }

        try {
            TestLinkerMethodMinimalArguments.test(
                    TestLinkerMethodMinimalArguments.FAILURE_TYPE_LINKER_METHOD_THROWS, 1011);
            assertNotReached();
        } catch (BootstrapMethodError e) {
            assertEquals(e.getCause().getClass(), InstantiationException.class);
        }

        try {
            TestLinkerMethodMinimalArguments.test(
                    TestLinkerMethodMinimalArguments.FAILURE_TYPE_TARGET_METHOD_THROWS, 1012);
            assertNotReached();
        } catch (ArithmeticException e) {
        }

        TestLinkerMethodMinimalArguments.test(
                TestLinkerMethodMinimalArguments.FAILURE_TYPE_NONE, 1013);
    }

    public static void main(String[] args) throws Throwable {
        TestUninitializedCallSite();
        TestLinkerMethodMinimalArguments();
        TestLinkerMethodMultipleArgumentTypes();
        TestLinkerMethodWithRange();
        TestLinkerUnrelatedBSM.test();
        TestInvokeCustomWithConcurrentThreads.test();
        TestInvocationKinds.test();
        TestDynamicBootstrapArguments.test();
        TestBadBootstrapArguments.test();
        TestVariableArityLinkerMethod.test();
    }
}

Messung V0.5 in Prozent
C=81 H=94 G=87

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-29) ¤

*© 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.