Exemple #1
0
    public static object getMemberVMInfo(MemberName self)
    {
#if FIRST_PASS
        return(null);
#else
        if (self.isField())
        {
            return(new object[] { java.lang.Long.valueOf(0), self.getDeclaringClass() });
        }
        if (MethodHandleNatives.refKindDoesDispatch(self.getReferenceKind()))
        {
            return(new object[] { java.lang.Long.valueOf(0), self });
        }
        return(new object[] { java.lang.Long.valueOf(-1), self });
#endif
    }
Exemple #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private Member reflectUnchecked() throws ReflectiveOperationException
        private Member ReflectUnchecked()
        {
            sbyte refKind  = (sbyte)ReferenceKind;
            Class defc     = DeclaringClass;
            bool  isPublic = Modifier.IsPublic(Modifiers);

            if (MethodHandleNatives.RefKindIsMethod(refKind))
            {
                if (isPublic)
                {
                    return(defc.GetMethod(Name, MethodType.ParameterArray()));
                }
                else
                {
                    return(defc.GetDeclaredMethod(Name, MethodType.ParameterArray()));
                }
            }
            else if (MethodHandleNatives.RefKindIsConstructor(refKind))
            {
                if (isPublic)
                {
                    return(defc.GetConstructor(MethodType.ParameterArray()));
                }
                else
                {
                    return(defc.GetDeclaredConstructor(MethodType.ParameterArray()));
                }
            }
            else if (MethodHandleNatives.RefKindIsField(refKind))
            {
                if (isPublic)
                {
                    return(defc.GetField(Name));
                }
                else
                {
                    return(defc.GetDeclaredField(Name));
                }
            }
            else
            {
                throw new IllegalArgumentException("referenceKind=" + refKind);
            }
        }