Java Code Examples for java.lang.reflect.Method#getClass()
The following examples show how to use
java.lang.reflect.Method#getClass() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemberName.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 2
Source File: MemberName.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 3
Source File: MemberName.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); } }
Example 4
Source File: MemberName.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 5
Source File: MemberName.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 6
Source File: MemberName.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 7
Source File: MemberName.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 8
Source File: MemberName.java From hottub with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 9
Source File: MemberName.java From Java8CN with Apache License 2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 10
Source File: MemberName.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 11
Source File: MemberName.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 12
Source File: MemberName.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 13
Source File: Util.java From proxy with MIT License | 5 votes |
static void cleanMethodNameField(Method met) throws NoSuchFieldException, IllegalAccessException { if (met.getName().startsWith("_")) { final Class<?> secretClass = met.getClass(); final Field namefield = secretClass.getDeclaredField("name"); namefield.setAccessible(true); namefield.set(met, met.getName().replaceFirst("_.\\d*", "")); } }
Example 14
Source File: MemberName.java From JDKSourceCode1.8 with MIT License | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 15
Source File: MemberName.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 16
Source File: MemberName.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }
Example 17
Source File: MemberName.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { m.getClass(); // NPE check // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed if (m.getDeclaringClass() == MethodHandle.class && isMethodHandleInvokeName(m.getName())) { // The JVM did not reify this signature-polymorphic instance. // Need a special case here. // See comments on MethodHandleNatives.linkMethod. MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes()); int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual); init(MethodHandle.class, m.getName(), type, flags); if (isMethodHandleInvoke()) return; } throw new LinkageError(m.toString()); } assert(isResolved() && this.clazz != null); this.name = m.getName(); if (this.type == null) this.type = new Object[] { m.getReturnType(), m.getParameterTypes() }; if (wantSpecial) { if (isAbstract()) throw new AbstractMethodError(this.toString()); if (getReferenceKind() == REF_invokeVirtual) changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual); else if (getReferenceKind() == REF_invokeInterface) // invokeSpecial on a default method changeReferenceKind(REF_invokeSpecial, REF_invokeInterface); } }