Examples of MethodData


Examples of org.fakereplace.data.MethodData

            }

            Method[] meth = clazz.getMethods();
            List<Method> visible = new ArrayList<Method>(meth.length);
            for (int i = 0; i < meth.length; ++i) {
                MethodData mData = cd.getData(meth[i]);
                if (mData == null || mData.getType() == MemberType.NORMAL) {
                    visible.add(meth[i]);
                }
            }

            ClassData cta = cd;
View Full Code Here

Examples of org.fakereplace.data.MethodData

        if (cd == null) {
            Method meth = clazz.getMethod(name, parameters);
            return meth;
        }
        String args = '(' + DescriptorUtils.classArrayToDescriptorString(parameters) + ')';
        MethodData md = cd.getMethodData(name, args);
        Class<?> superClass = clazz;
        while (superClass.getSuperclass() != null && md == null && superClass != Object.class) {
            superClass = superClass.getSuperclass();
            cd = ClassDataStore.instance().getModifiedClassData(superClass.getClassLoader(), Descriptor.toJvmName(superClass.getName()));
            if (cd != null) {
                md = cd.getMethodData(name, args);
            }
        }

        if (md == null) {
            Method meth = clazz.getMethod(name, parameters);
            return meth;
        }

        switch (md.getType()) {
            case NORMAL:
                Method meth = superClass.getMethod(name, parameters);
                return meth;
            case FAKE:
                try {
                    if (!AccessFlag.isPublic(md.getAccessFlags())) {
                        throw new NoSuchMethodException(clazz.getName() + "." + name);
                    }
                    Class<?> c = superClass.getClassLoader().loadClass(md.getClassName());
                    meth = c.getMethod(name, parameters);
                    return meth;
                } catch (NoSuchMethodException e) {
                    throw e;
                } catch (Exception e) {
View Full Code Here

Examples of org.fakereplace.data.MethodData

        if (parameters != null) {
            args = '(' + DescriptorUtils.classArrayToDescriptorString(parameters) + ')';
        } else {
            args = "()";
        }
        MethodData md = cd.getMethodData(name, args);
        if (md == null) {
            Method meth = clazz.getDeclaredMethod(name, parameters);
            return meth;
        }

        switch (md.getType()) {
            case NORMAL:
                Method meth = clazz.getDeclaredMethod(name, parameters);
                return meth;
            case FAKE:
                try {
                    Class<?> c = clazz.getClassLoader().loadClass(md.getClassName());
                    meth = c.getDeclaredMethod(name, parameters);

                    return meth;
                } catch (NoSuchMethodException e) {
                    throw e;
View Full Code Here

Examples of org.fakereplace.data.MethodData

public class ConstructorReflection {

    @SuppressWarnings("restriction")
    public static Object newInstance(Constructor<?> method, Object... args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException {
        final MethodData data = ClassDataStore.instance().getMethodInformation(method.getDeclaringClass().getName());
        final Class<?> info = ClassDataStore.instance().getRealClassFromProxyName(method.getDeclaringClass().getName());
        try {
            final Constructor<?> invoke = info.getConstructor(int.class, Object[].class, ConstructorArgument.class);
            Object ar = args;
            if (ar == null) {
                ar = new Object[0];
            }
            if (!Modifier.isPublic(method.getModifiers()) && !method.isAccessible()) {
                Class<?> caller = sun.reflect.Reflection.getCallerClass(2);
                Reflection.ensureMemberAccess(caller, method.getDeclaringClass(), null, method.getModifiers());
            }
            return invoke.newInstance(data.getMethodNo(), ar, null);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (SecurityException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of org.fakereplace.data.MethodData

        if (cd == null || !cd.isReplaceable()) {
            Constructor<?> meth = clazz.getConstructor(parameters);
            return meth;
        }
        String args = '(' + DescriptorUtils.classArrayToDescriptorString(parameters) + ')';
        MethodData md = cd.getMethodData("<init>", args);
        if (md == null) {
            Constructor<?> meth = clazz.getConstructor(parameters);
            return meth;
        }

        switch (md.getType()) {
            case NORMAL:
                Constructor<?> meth = clazz.getConstructor(parameters);
                return meth;
            case FAKE_CONSTRUCTOR:
                try {
                    Class<?> c = clazz.getClassLoader().loadClass(md.getClassName());
                    meth = c.getConstructor(parameters);
                    return meth;
                } catch (NoSuchMethodException e) {
                    throw e;
                } catch (Exception e) {
View Full Code Here

Examples of org.fakereplace.data.MethodData

        if (cd == null || !cd.isReplaceable()) {
            Constructor<?> meth = clazz.getDeclaredConstructor(parameters);
            return meth;
        }
        String args = '(' + DescriptorUtils.classArrayToDescriptorString(parameters) + ')';
        MethodData md = cd.getMethodData("<init>", args);
        if (md == null) {
            Constructor<?> meth = clazz.getDeclaredConstructor(parameters);
            return meth;
        }

        switch (md.getType()) {
            case NORMAL:
                Constructor<?> meth = clazz.getDeclaredConstructor(parameters);
                return meth;
            case FAKE_CONSTRUCTOR:
                try {
                    Class<?> c = clazz.getClassLoader().loadClass(md.getClassName());
                    meth = c.getDeclaredConstructor(parameters);
                    return meth;
                } catch (NoSuchMethodException e) {
                    throw e;
                } catch (Exception e) {
View Full Code Here

Examples of org.jruby.runtime.ivars.MethodData

    }
   
    @Override
    public MethodData getMethodData() {
        if (methodData == null){
            methodData = new MethodData(name, "dummyfile", Arrays.asList(name));
        }
        return methodData;
    }
View Full Code Here

Examples of org.jruby.runtime.ivars.MethodData

    }
   
    @Override
    public MethodData getMethodData() {
        if (methodData == null){
            methodData = new MethodData(name, "dummyfile", Arrays.asList(variableName));
        }
        return methodData;
    }
View Full Code Here

Examples of org.jruby.runtime.ivars.MethodData

    public Set<String> discoverInstanceVariables() {
        HashSet<String> set = new HashSet();
        RubyModule cls = this;
        while (cls != null) {
            for (DynamicMethod method : cls.getNonIncludedClass().getMethodLocation().getMethods().values()) {
                MethodData methodData = method.getMethodData();
                set.addAll(methodData.getIvarNames());
            }
           
            if (cls instanceof RubyClass) {
                cls = ((RubyClass)cls).getSuperClass();
            } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.