X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=blobdiff_plain;f=examples%2FReflection.java;h=0918964c6fa547d29581b8c8518cffba5e5eefc9;hp=ac036c2282b337771991cf372ab8676d508d54f5;hb=4d28cfc6820e0586a53f824fe6ca9e81acabd621;hpb=35d417be7f1f93cc60e23c86c11bbe8cd69d51db diff --git a/examples/Reflection.java b/examples/Reflection.java index ac036c2..0918964 100644 --- a/examples/Reflection.java +++ b/examples/Reflection.java @@ -54,13 +54,13 @@ public class Reflection { public static void main(String[] args) { - BigInteger bi = new BigInteger("-1"); - System.out.println(bi); + //BigInteger bi = new BigInteger("-1"); + //System.out.println(bi); - /* TODO: Enumerate all methods in Class.class - Method[] methods = Class.class.getMethods(); + /* TODO: Enumerate all methods in Class.class */ + Method[] methods = Collection.class.getMethods(); for(Method mth : methods) { - //System.out.println("==========================="); + System.out.println("==========================="); //System.out.println("Method: " + mth.getName()); Type[] parameters = mth.getGenericParameterTypes(); for (int i = 0; i < parameters.length; i++) { @@ -69,30 +69,22 @@ public class Reflection { System.out.println(); Type returnType = mth.getGenericReturnType(); System.out.println(returnType + "\n"); - }*/ + } - Method[] methods = Collection.class.getMethods(); + /*Method[] methods = Collection.class.getMethods(); // Method[] methods = Class.class.getMethods(); Method method = null; for(Method meth : methods) { - System.out.println("==========================="); - //System.out.println("Method: " + meth.toString()); - Type[] parameters = meth.getGenericParameterTypes(); - for (int i = 0; i < parameters.length; i++) { - System.out.println(parameters[i]); - } - Type returnType = meth.getGenericReturnType(); - System.out.println(returnType); - System.out.println("==========================="); - } - Type[] parameters = method.getGenericParameterTypes(); - //Type[] parameters = methods[0].getGenericParameterTypes(); - for (int i = 0; i < parameters.length; i++) { - System.out.println(parameters[i]); - } - System.out.println(); - Type returnType = method.getGenericReturnType(); - System.out.println(returnType); + System.out.println("==========================="); + //System.out.println("Method: " + meth.toString()); + Type[] parameters = meth.getGenericParameterTypes(); + for (int i = 0; i < parameters.length; i++) { + System.out.println(parameters[i]); + } + Type returnType = meth.getGenericReturnType(); + System.out.println(returnType); + System.out.println("==========================="); + }*/ /* TODO: This is an excerpt of the BigInteger library int radix = 10; @@ -170,11 +162,11 @@ public class Reflection { System.out.println(interfaces[i]); }*/ - /* - Method[] methods = Collection.class.getMethods(); + + /*Method[] methods = Map.class.getMethods(); Method method = null; for(Method mth : methods) { - if (mth.getName().equals("toArray")) { + if (mth.getName().equals("putAll")) { //if (mth.getName().equals("isAssignableFrom")) { //if (mth.getName().equals("getSuperclass")) { method = mth;