jaroslav@1646: /* jaroslav@1646: * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. jaroslav@1646: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@1646: * jaroslav@1646: * This code is free software; you can redistribute it and/or modify it jaroslav@1646: * under the terms of the GNU General Public License version 2 only, as jaroslav@1646: * published by the Free Software Foundation. Oracle designates this jaroslav@1646: * particular file as subject to the "Classpath" exception as provided jaroslav@1646: * by Oracle in the LICENSE file that accompanied this code. jaroslav@1646: * jaroslav@1646: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@1646: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@1646: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@1646: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@1646: * accompanied this code). jaroslav@1646: * jaroslav@1646: * You should have received a copy of the GNU General Public License version jaroslav@1646: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@1646: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@1646: * jaroslav@1646: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@1646: * or visit www.oracle.com if you need additional information or have any jaroslav@1646: * questions. jaroslav@1646: */ jaroslav@1646: jaroslav@1646: package java.lang.invoke; jaroslav@1646: jaroslav@1646: /** jaroslav@1646: * Thrown to indicate that code has attempted to call a method handle jaroslav@1646: * via the wrong method type. As with the bytecode representation of jaroslav@1646: * normal Java method calls, method handle calls are strongly typed jaroslav@1646: * to a specific type descriptor associated with a call site. jaroslav@1646: *

jaroslav@1646: * This exception may also be thrown when two method handles are jaroslav@1646: * composed, and the system detects that their types cannot be jaroslav@1646: * matched up correctly. This amounts to an early evaluation jaroslav@1646: * of the type mismatch, at method handle construction time, jaroslav@1646: * instead of when the mismatched method handle is called. jaroslav@1646: * jaroslav@1646: * @author John Rose, JSR 292 EG jaroslav@1646: * @since 1.7 jaroslav@1646: */ jaroslav@1646: public class WrongMethodTypeException extends RuntimeException { jaroslav@1646: private static final long serialVersionUID = 292L; jaroslav@1646: jaroslav@1646: /** jaroslav@1646: * Constructs a {@code WrongMethodTypeException} with no detail message. jaroslav@1646: */ jaroslav@1646: public WrongMethodTypeException() { jaroslav@1646: super(); jaroslav@1646: } jaroslav@1646: jaroslav@1646: /** jaroslav@1646: * Constructs a {@code WrongMethodTypeException} with the specified jaroslav@1646: * detail message. jaroslav@1646: * jaroslav@1646: * @param s the detail message. jaroslav@1646: */ jaroslav@1646: public WrongMethodTypeException(String s) { jaroslav@1646: super(s); jaroslav@1646: } jaroslav@1646: jaroslav@1646: /** jaroslav@1646: * Constructs a {@code WrongMethodTypeException} with the specified jaroslav@1646: * detail message and cause. jaroslav@1646: * jaroslav@1646: * @param s the detail message. jaroslav@1646: * @param cause the cause of the exception, or null. jaroslav@1646: */ jaroslav@1646: //FIXME: make this public in MR1 jaroslav@1646: /*non-public*/ WrongMethodTypeException(String s, Throwable cause) { jaroslav@1646: super(s, cause); jaroslav@1646: } jaroslav@1646: jaroslav@1646: /** jaroslav@1646: * Constructs a {@code WrongMethodTypeException} with the specified jaroslav@1646: * cause. jaroslav@1646: * jaroslav@1646: * @param cause the cause of the exception, or null. jaroslav@1646: */ jaroslav@1646: //FIXME: make this public in MR1 jaroslav@1646: /*non-public*/ WrongMethodTypeException(Throwable cause) { jaroslav@1646: super(cause); jaroslav@1646: } jaroslav@1646: }