src/share/classes/java/lang/invoke/MethodHandleInfo.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7087570 Cdiff src/share/classes/java/lang/invoke/MethodHandleInfo.java

src/share/classes/java/lang/invoke/MethodHandleInfo.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 27,37 **** import java.lang.invoke.MethodHandleNatives.Constants; //Not yet public: public class MethodHandleInfo { public static final int - REF_NONE = Constants.REF_NONE, REF_getField = Constants.REF_getField, REF_getStatic = Constants.REF_getStatic, REF_putField = Constants.REF_putField, REF_putStatic = Constants.REF_putStatic, REF_invokeVirtual = Constants.REF_invokeVirtual, --- 27,36 ----
*** 43,58 **** private final Class<?> declaringClass; private final String name; private final MethodType methodType; private final int referenceKind; ! public MethodHandleInfo(MethodHandle mh) throws ReflectiveOperationException { MemberName mn = mh.internalMemberName(); this.declaringClass = mn.getDeclaringClass(); this.name = mn.getName(); ! this.methodType = mn.getMethodType(); ! this.referenceKind = mn.getReferenceKind(); } public Class<?> getDeclaringClass() { return declaringClass; } --- 42,62 ---- private final Class<?> declaringClass; private final String name; private final MethodType methodType; private final int referenceKind; ! public MethodHandleInfo(MethodHandle mh) { MemberName mn = mh.internalMemberName(); + if (mn == null) throw new IllegalArgumentException("not a direct method handle"); this.declaringClass = mn.getDeclaringClass(); this.name = mn.getName(); ! this.methodType = mn.getMethodOrFieldType(); ! byte refKind = mn.getReferenceKind(); ! if (refKind == REF_invokeSpecial && !mh.isInvokeSpecial()) ! // Devirtualized method invocation is usually formally virtual. ! refKind = REF_invokeVirtual; ! this.referenceKind = refKind; } public Class<?> getDeclaringClass() { return declaringClass; }
src/share/classes/java/lang/invoke/MethodHandleInfo.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File