jdk/test/java/lang/invoke/8009222/Test8009222.java
author rfield
Tue, 03 Sep 2013 21:42:56 -0700
changeset 19804 83170920c07b
parent 16484 f24cb2927b7a
child 29094 a4fd2b5e49f8
permissions -rw-r--r--
8008688: Make MethodHandleInfo public Summary: A major overhaul to MethodHandleInfo and method handles in general. Reviewed-by: vlivanov, twisti Contributed-by: john.r.rose@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16484
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     1
/*
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     4
 *
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     8
 *
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    13
 * accompanied this code).
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    14
 *
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    18
 *
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    21
 * questions.
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    22
 *
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    23
 */
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    24
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    25
/**
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    26
 * @test
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    27
 * @bug 8009222
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    28
 * @summary java.lang.IllegalArgumentException: not invocable, no method type
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    29
 * when attempting to get getter method handle for a static field
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    30
 *
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    31
 * @run main/othervm Test8009222
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    32
 */
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    33
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    34
import java.lang.invoke.MethodHandle;
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    35
import java.lang.invoke.MethodHandles;
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    36
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    37
interface Intf {
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    38
    static int i = 0;
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    39
}
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    40
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    41
public class Test8009222 {
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    42
    public static void main(String[] args) throws Exception {
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    43
        MethodHandles.lookup()
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    44
                .findStaticGetter(Intf.class, "i", int.class)
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    45
                .getClass(); // null check
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    46
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    47
        System.out.println("TEST PASSED");
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    48
    }
f24cb2927b7a 8009222: java.lang.IllegalArgumentException: not invocable, no method type when attempting to get getter method handle for a static field
vlivanov
parents:
diff changeset
    49
}