renamed all modules

This commit is contained in:
Andy Clement
2014-01-15 11:36:24 -08:00
parent 342420b2ed
commit ceef61cf98
1055 changed files with 301 additions and 259 deletions

20
testdata/src/main/java/iri/Ctor.java vendored Normal file
View File

@@ -0,0 +1,20 @@
package iri;
import java.lang.reflect.Constructor;
public class Ctor {
public Ctor(String s, int i) {
}
public static String run() throws Exception {
Constructor<Ctor> c = Ctor.class.getDeclaredConstructor(String.class, Integer.TYPE);
Ctor instance = (Ctor) c.newInstance("abc", 3);
return instance.toString();
}
public String toString() {
return "instance";
}
}

View File

@@ -0,0 +1,96 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class FormattingHelper {
public String format(Annotation[] as) {
List<String> names = new ArrayList<String>();
for (Annotation f : as) {
names.add(f.toString());
}
return sortAndPrintNames(names);
}
public String format(Field[] fs) {
List<String> names = new ArrayList<String>();
for (Field f : fs) {
names.add(f.getName());
}
return sortAndPrintNames(names);
}
public String format(Field f) {
return f.getName();
}
public String format(Method[] ms) {
List<String> list = new ArrayList<String>();
for (Method m : ms) {
list.add(format(m));
}
return sortAndPrintNames(list);
}
public String format(Method m) {
StringBuilder s = new StringBuilder();
s.append(m.getName());
Class<?>[] ps = m.getParameterTypes();
if (ps == null) {
s.append("()");
} else {
s.append("(");
for (int i = 0; i < ps.length; i++) {
if (i > 0) {
s.append(",");
}
s.append(ps[i].getSimpleName());
}
s.append(")");
}
return s.toString().trim();
}
public String format(Constructor<?>[] ms) {
List<String> list = new ArrayList<String>();
for (Constructor<?> m : ms) {
list.add(format(m));
}
return sortAndPrintNames(list);
}
public String format(Constructor<?> m) {
StringBuilder s = new StringBuilder();
s.append(m.getName());
Class<?>[] ps = m.getParameterTypes();
if (ps == null) {
s.append("()");
} else {
s.append("(");
for (int i = 0; i < ps.length; i++) {
if (i > 0) {
s.append(",");
}
s.append(ps[i].getSimpleName());
}
s.append(")");
}
return s.toString().trim();
}
public String sortAndPrintNames(List<String> names) {
StringBuilder s = new StringBuilder();
Collections.sort(names);
s.append(names.size()).append(":");
for (String n : names) {
s.append(n).append(" ");
}
return s.toString().trim();
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
@AnnoT
public class JLCGetAnnotation extends FormattingHelper {
public JLCGetAnnotation() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("getAnnotation", Class.class);
Annotation a = (Annotation) m.invoke(JLCGetAnnotation.class, AnnoT.class);
Annotation b = (Annotation) m.invoke(JLCGetAnnotation.class, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetAnnotation().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
@Deprecated
public class JLCGetAnnotation2 extends FormattingHelper {
public JLCGetAnnotation2() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("getAnnotation", Class.class);
Annotation a = (Annotation) m.invoke(JLCGetAnnotation2.class, AnnoT.class);
Annotation b = (Annotation) m.invoke(JLCGetAnnotation2.class, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetAnnotation2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
@AnnoT
public class JLCGetAnnotations extends FormattingHelper {
public JLCGetAnnotations() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("getAnnotations");
Annotation[] o = (Annotation[]) m.invoke(JLCGetAnnotations.class);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetAnnotations().run());
}
}

View File

@@ -0,0 +1,23 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@Deprecated
public class JLCGetAnnotations2 extends FormattingHelper {
public JLCGetAnnotations2() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredAnnotations");
Annotation[] o = (Annotation[]) m.invoke(JLCGetAnnotations2.class);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetAnnotations2().run());
}
}

View File

@@ -0,0 +1,23 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetConstructor extends FormattingHelper {
public JLCGetConstructor() {
}
public String run() throws Exception {
JLCGetConstructor.class.getConstructor();
Method m = Class.class.getMethod("getConstructor", Class[].class);
Constructor<?> o = (Constructor<?>) m.invoke(JLCGetConstructor.class, (Object) null);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetConstructor().run());
}
}

View File

@@ -0,0 +1,27 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetConstructor2 extends FormattingHelper {
public JLCGetConstructor2() {
}
public JLCGetConstructor2(String s) {
}
public String run() throws Exception {
JLCGetConstructor2.class.getConstructor();
Method m = Class.class.getMethod("getConstructor", Class[].class);
Constructor<?> o = (Constructor<?>) m.invoke(JLCGetConstructor2.class, (Object) new Class[] { String.class });
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetConstructor2().run());
}
}

View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Constructor;
public class JLCGetConstructorB extends FormattingHelper {
public JLCGetConstructorB() {
}
public String run() throws Exception {
Constructor<JLCGetConstructorB> o = JLCGetConstructorB.class.getConstructor();
// Method m = Class.class.getMethod("getConstructor", Class[].class);
// Constructor<?> o = (Constructor<?>) m.invoke(JLCGetConstructorB.class, (Object) null);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetConstructorB().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.reflect.Constructor;
public class JLCGetConstructorB2 extends FormattingHelper {
public JLCGetConstructorB2() {
}
@SuppressWarnings("unused")
private JLCGetConstructorB2(String s) {
}
public String run() throws Exception {
Constructor<?> o = JLCGetConstructorB2.class.getConstructor(String.class);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetConstructorB2().run());
}
}

View File

@@ -0,0 +1,29 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetConstructors extends FormattingHelper {
public JLCGetConstructors() {
}
@SuppressWarnings("rawtypes")
public String run() throws Exception {
Method m = Class.class.getMethod("getConstructors");
Constructor[] o = (Constructor[]) m.invoke(JLCGetConstructors.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(o);
}
public void foo() {
// public void foo(String s, int i) {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetConstructors().run());
}
}

View File

@@ -0,0 +1,29 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetConstructors2 extends FormattingHelper {
public JLCGetConstructors2() {
}
// not in original
public JLCGetConstructors2(String s) {
}
@SuppressWarnings("rawtypes")
public String run() throws Exception {
Method m = Class.class.getMethod("getConstructors");
Constructor[] o = (Constructor[]) m.invoke(JLCGetConstructors2.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetConstructors2().run());
}
}

View File

@@ -0,0 +1,23 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@Deprecated
public class JLCGetDecAnnotations extends FormattingHelper {
public JLCGetDecAnnotations() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredAnnotations");
Annotation[] o = (Annotation[]) m.invoke(JLCGetDecAnnotations.class);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecAnnotations().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
@AnnoT
public class JLCGetDecAnnotations2 extends FormattingHelper {
public JLCGetDecAnnotations2() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredAnnotations");
Annotation[] o = (Annotation[]) m.invoke(JLCGetDecAnnotations2.class);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecAnnotations2().run());
}
}

View File

@@ -0,0 +1,23 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetDecConstructor extends FormattingHelper {
public JLCGetDecConstructor() {
}
public String run() throws Exception {
JLCGetDecConstructor.class.getConstructor();
Method m = Class.class.getMethod("getDeclaredConstructor", Class[].class);
Constructor<?> o = (Constructor<?>) m.invoke(JLCGetDecConstructor.class, (Object) null);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecConstructor().run());
}
}

View File

@@ -0,0 +1,27 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetDecConstructor2 extends FormattingHelper {
public JLCGetDecConstructor2() {
}
public JLCGetDecConstructor2(String s) {
}
public String run() throws Exception {
JLCGetDecConstructor2.class.getConstructor();
Method m = Class.class.getMethod("getDeclaredConstructor", Class[].class);
Constructor<?> o = (Constructor<?>) m.invoke(JLCGetDecConstructor2.class, (Object) new Class[] { String.class });
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecConstructor2().run());
}
}

View File

@@ -0,0 +1,29 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetDecConstructors extends FormattingHelper {
public JLCGetDecConstructors() {
}
@SuppressWarnings("rawtypes")
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredConstructors");
Constructor[] o = (Constructor[]) m.invoke(JLCGetDecConstructors.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(o);
}
public void foo() {
// public void foo(String s, int i) {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecConstructors().run());
}
}

View File

@@ -0,0 +1,28 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLCGetDecConstructors2 extends FormattingHelper {
public JLCGetDecConstructors2() {
}
// not in original
public JLCGetDecConstructors2(String s) {
}
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredConstructors");
Constructor[] o = (Constructor[]) m.invoke(JLCGetDecConstructors2.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecConstructors2().run());
}
}

View File

@@ -0,0 +1,21 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetDecField extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredField", String.class);
Field f = (Field) m.invoke(JLCGetDecField.class, "foo");
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(f);
}
String foo;
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecField().run());
}
}

View File

@@ -0,0 +1,21 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetDecField2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredField", String.class);
Field f = (Field) m.invoke(JLCGetDecField2.class, "bar");
return format(f);
}
// this wasn't in the original type
int bar;
public static void main(String[] argv) throws Exception {
new JLCGetDecField2().run();
}
}

View File

@@ -0,0 +1,16 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetDecFields extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredFields");
Field[] fs = (Field[]) m.invoke(JLCGetDecFields.class);
return format(fs);
}
String aString;
}

View File

@@ -0,0 +1,18 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetDecFields2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredFields");
Field[] fs = (Field[]) m.invoke(JLCGetDecFields2.class);
return format(fs);
}
String aString;
int anInt;
}

View File

@@ -0,0 +1,23 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetDecMethod extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredMethod", String.class, Class[].class);
Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", null);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
// public void foo(String s, int i) {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecMethod().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetDecMethod2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredMethod", String.class, Class[].class);
Method m2 = (Method) m.invoke(JLCGetDecMethod2.class, "bar", null);
return format(m2);
}
public void foo() {
}
// this method wasn't in the original type
public void bar() {
}
public static void main(String[] argv) throws Exception {
new JLCGetDecMethod2().run();
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetDecMethod3 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredMethod", String.class, Class[].class);
Method m2 = (Method) m.invoke(JLCGetDecMethod3.class, "bar2", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
}
// this method wasn't in the original type
public void bar2(String s, int i) {
}
public static void main(String[] argv) throws Exception {
new JLCGetDecMethod3().run();
}
}

View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetDecMethods extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredMethods");
Method[] m2 = (Method[]) m.invoke(JLCGetDecMethods.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecMethods().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetDecMethods2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getDeclaredMethods");
Method[] m2 = (Method[]) m.invoke(JLCGetDecMethods2.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
}
public void bar(String s) {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetDecMethods2().run());
}
}

View File

@@ -0,0 +1,21 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetField extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getField", String.class);
Field f = (Field) m.invoke(JLCGetField.class, "foo");
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(f);
}
public String foo;
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetField().run());
}
}

View File

@@ -0,0 +1,21 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetField2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getField", String.class);
Field f = (Field) m.invoke(JLCGetField2.class, "bar");
return format(f);
}
// this wasn't in the original type
public int bar;
public static void main(String[] argv) throws Exception {
new JLCGetField2().run();
}
}

View File

@@ -0,0 +1,16 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetFields extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getFields");
Field[] fs = (Field[]) m.invoke(JLCGetFields.class);
return format(fs);
}
String aString;
}

View File

@@ -0,0 +1,18 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLCGetFields2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getFields");
Field[] fs = (Field[]) m.invoke(JLCGetFields2.class);
return format(fs);
}
String aString;
public int anInt;
}

View File

@@ -0,0 +1,23 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetMethod extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getMethod", String.class, Class[].class);
Method m2 = (Method) m.invoke(JLCGetMethod.class, "foo", null);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
// public void foo(String s, int i) {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetMethod().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetMethod2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getMethod", String.class, Class[].class);
Method m2 = (Method) m.invoke(JLCGetMethod2.class, "bar", null);
return format(m2);
}
public void foo() {
}
// this method wasn't in the original type
public void bar() {
}
public static void main(String[] argv) throws Exception {
new JLCGetMethod2().run();
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetMethod3 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getMethod", String.class, Class[].class);
Method m2 = (Method) m.invoke(JLCGetMethod3.class, "bar2", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
}
// this method wasn't in the original type
public void bar2(String s, int i) {
}
public static void main(String[] argv) throws Exception {
new JLCGetMethod3().run();
}
}

View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetMethods extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getMethods");
Method[] m2 = (Method[]) m.invoke(JLCGetMethods.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetMethods().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetMethods2 extends FormattingHelper {
public String run() throws Exception {
Method m = Class.class.getMethod("getMethods");
Method[] m2 = (Method[]) m.invoke(JLCGetMethods2.class);
// Method m2 = (Method) m.invoke(JLCGetDecMethod.class, "foo", new Class[] { String.class, Integer.TYPE });
return format(m2);
}
public void foo() {
}
public void bar(String s) {
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetMethods2().run());
}
}

View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Method;
public class JLCGetModifiers extends FormattingHelper {
public String run() throws Exception {
JLCGetModifiers.class.getConstructor();
Method m = Class.class.getMethod("getModifiers");
int o = (Integer) m.invoke(Helper.class);
return Integer.toString(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCGetModifiers().run());
}
}
class Helper {
}

View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Method;
@Deprecated
public class JLCIsAnnotationPresent extends FormattingHelper {
public JLCIsAnnotationPresent() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("isAnnotationPresent", Class.class);
boolean b = (Boolean) m.invoke(JLCIsAnnotationPresent.class, Deprecated.class);
return Boolean.toString(b);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCIsAnnotationPresent().run());
}
}

View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Method;
//@Deprecated
public class JLCIsAnnotationPresent2 extends FormattingHelper {
public JLCIsAnnotationPresent2() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("isAnnotationPresent", Class.class);
boolean b = (Boolean) m.invoke(JLCIsAnnotationPresent2.class, Deprecated.class);
return Boolean.toString(b);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCIsAnnotationPresent2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.reflect.Method;
public class JLCNewInstance extends FormattingHelper {
public JLCNewInstance() {
}
public String run() throws Exception {
Method m = Class.class.getMethod("newInstance");
Object o = m.invoke(JLCNewInstance.class);
return o.toString();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLCNewInstance().run());
}
public String toString() {
return "I am an instance";
}
}

View File

@@ -0,0 +1,28 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCGetAnnotation extends FormattingHelper {
@AnnoT
public JLRCGetAnnotation() {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("getAnnotation", Class.class);
Constructor<JLRCGetAnnotation> c = JLRCGetAnnotation.class.getDeclaredConstructor();
Annotation a = ((Annotation) m.invoke(c, AnnoT.class));
Annotation b = ((Annotation) m.invoke(c, Deprecated.class));
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetAnnotation().run());
}
}

View File

@@ -0,0 +1,33 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCGetAnnotation2 extends FormattingHelper {
@AnnoT
public JLRCGetAnnotation2() {
}
@Deprecated
public JLRCGetAnnotation2(String s) {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("getAnnotation", Class.class);
Constructor<JLRCGetAnnotation2> c = JLRCGetAnnotation2.class.getDeclaredConstructor(String.class);
Annotation a = ((Annotation) m.invoke(c, AnnoT.class));
Annotation b = ((Annotation) m.invoke(c, Deprecated.class));
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetAnnotation2().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCGetAnnotations extends FormattingHelper {
@AnnoT
public JLRCGetAnnotations() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getAnnotations");
Constructor<JLRCGetAnnotations> c = JLRCGetAnnotations.class.getDeclaredConstructor();
Annotation[] o = (Annotation[]) m.invoke(c);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetAnnotations().run());
}
}

View File

@@ -0,0 +1,31 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCGetAnnotations2 extends FormattingHelper {
@AnnoT
public JLRCGetAnnotations2() {
}
@Deprecated
public JLRCGetAnnotations2(String s) {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getAnnotations");
Constructor<JLRCGetAnnotations2> c = JLRCGetAnnotations2.class.getDeclaredConstructor(String.class);
Annotation[] o = (Annotation[]) m.invoke(c);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetAnnotations2().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCGetDecAnnotations extends FormattingHelper {
@AnnoT
public JLRCGetDecAnnotations() {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("getDeclaredAnnotations");
Constructor<JLRCGetDecAnnotations> c = JLRCGetDecAnnotations.class.getDeclaredConstructor();
Annotation[] o = (Annotation[]) m.invoke(c);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetDecAnnotations().run());
}
}

View File

@@ -0,0 +1,31 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCGetDecAnnotations2 extends FormattingHelper {
@AnnoT
public JLRCGetDecAnnotations2() {
}
@Deprecated
public JLRCGetDecAnnotations2(String s) {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("getDeclaredAnnotations");
Constructor<JLRCGetDecAnnotations2> c = JLRCGetDecAnnotations2.class.getDeclaredConstructor(String.class);
Annotation[] o = (Annotation[]) m.invoke(c);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetDecAnnotations2().run());
}
}

View File

@@ -0,0 +1,36 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
import reflection.AnnoT2;
public class JLRCGetParameterAnnotations extends FormattingHelper {
public JLRCGetParameterAnnotations() {
}
public JLRCGetParameterAnnotations(@AnnoT String s, int i, @AnnoT2 int j) {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("getParameterAnnotations");
Constructor<JLRCGetParameterAnnotations> c = JLRCGetParameterAnnotations.class.getDeclaredConstructor(String.class,
Integer.TYPE, Integer.TYPE);
Annotation[][] arrayofannos = (Annotation[][]) m.invoke(c);
StringBuilder s = new StringBuilder();
for (Annotation[] annos : arrayofannos) {
s.append("[");
s.append(format(annos));
s.append("]");
}
return s.toString().trim();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetParameterAnnotations("a", 1, 2).run());
}
}

View File

@@ -0,0 +1,39 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
import reflection.AnnoT2;
public class JLRCGetParameterAnnotations2 extends FormattingHelper {
public JLRCGetParameterAnnotations2() {
}
public JLRCGetParameterAnnotations2(@AnnoT String s, int i, @AnnoT2 int j) {
}
public JLRCGetParameterAnnotations2(@AnnoT2 int s, @AnnoT float i, int j) {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("getParameterAnnotations");
Constructor<JLRCGetParameterAnnotations2> c = JLRCGetParameterAnnotations2.class.getDeclaredConstructor(Integer.TYPE,
Float.TYPE, Integer.TYPE);
Annotation[][] arrayofannos = (Annotation[][]) m.invoke(c);
StringBuilder s = new StringBuilder();
for (Annotation[] annos : arrayofannos) {
s.append("[");
s.append(format(annos));
s.append("]");
}
return s.toString().trim();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCGetParameterAnnotations2("a", 1, 2).run());
}
}

View File

@@ -0,0 +1,27 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCIsAnnotationPresent extends FormattingHelper {
@Deprecated
public JLRCIsAnnotationPresent() {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("isAnnotationPresent", Class.class);
Constructor<JLRCIsAnnotationPresent> c = JLRCIsAnnotationPresent.class.getDeclaredConstructor();
boolean b = (Boolean) m.invoke(c, Deprecated.class);
boolean cc = (Boolean) m.invoke(c, AnnoT.class);
return Boolean.toString(b) + Boolean.toString(cc);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCIsAnnotationPresent().run());
}
}

View File

@@ -0,0 +1,32 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRCIsAnnotationPresent2 extends FormattingHelper {
@Deprecated
public JLRCIsAnnotationPresent2() {
}
@AnnoT
public JLRCIsAnnotationPresent2(String s) {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("isAnnotationPresent", Class.class);
Constructor<JLRCIsAnnotationPresent2> c = JLRCIsAnnotationPresent2.class.getDeclaredConstructor(String.class);
boolean b = (Boolean) m.invoke(c, Deprecated.class);
boolean cc = (Boolean) m.invoke(c, AnnoT.class);
return Boolean.toString(b) + Boolean.toString(cc);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCIsAnnotationPresent2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLRCNewInstance extends FormattingHelper {
public JLRCNewInstance() {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("newInstance", Object[].class);
Constructor<JLRCNewInstance> c = JLRCNewInstance.class.getDeclaredConstructor();
JLRCNewInstance a = (JLRCNewInstance) m.invoke(c, new Object[] { (Object[]) null });
return a.toString();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCNewInstance().run());
}
public String toString() {
return "instance";
}
}

View File

@@ -0,0 +1,29 @@
package iri;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class JLRCNewInstance2 extends FormattingHelper {
public JLRCNewInstance2() {
}
public JLRCNewInstance2(String s) {
}
public String run() throws Exception {
Method m = Constructor.class.getMethod("newInstance", Object[].class);
Constructor<JLRCNewInstance2> c = JLRCNewInstance2.class.getDeclaredConstructor(String.class);
JLRCNewInstance2 a = (JLRCNewInstance2) m.invoke(c, new Object[] { new Object[] { "abc" } });
return a.toString();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRCNewInstance2().run());
}
public String toString() {
return "instance";
}
}

22
testdata/src/main/java/iri/JLRFGet.java vendored Normal file
View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFGet extends FormattingHelper {
public String string;
public String run() throws Exception {
Method m = Field.class.getMethod("get", Object.class);
Field f = JLRFGet.class.getDeclaredField("string");
this.string = "hello";
String o = (String) m.invoke(f, this);
return o;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGet().run());
}
}

View File

@@ -0,0 +1,24 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFGet2 extends FormattingHelper {
public String string;
public String string2;
public String run() throws Exception {
Method m = Field.class.getMethod("get", Object.class);
Field f = JLRFGet2.class.getDeclaredField("string2");
this.string2 = "goodbye";
String o = (String) m.invoke(f, this);
return o;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGet2().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRFGetAnnotation extends FormattingHelper {
@AnnoT
String string;
public String run() throws Exception {
Method m = Field.class.getMethod("getAnnotation", Class.class);
Field f = JLRFGetAnnotation.class.getDeclaredField("string");
Annotation a = (Annotation) m.invoke(f, AnnoT.class);
Annotation b = (Annotation) m.invoke(f, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetAnnotation().run());
}
}

View File

@@ -0,0 +1,29 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRFGetAnnotation2 extends FormattingHelper {
@AnnoT
String string;
@Deprecated
int i;
public String run() throws Exception {
Method m = Field.class.getMethod("getAnnotation", Class.class);
Field f = JLRFGetAnnotation2.class.getDeclaredField("i");
Annotation a = (Annotation) m.invoke(f, AnnoT.class);
Annotation b = (Annotation) m.invoke(f, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetAnnotation2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRFGetAnnotations extends FormattingHelper {
@AnnoT
public String string;
public String run() throws Exception {
Method m = Field.class.getMethod("getAnnotations");
Field f = JLRFGetAnnotations.class.getDeclaredField("string");
Annotation[] o = (Annotation[]) m.invoke(f);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetAnnotations().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFGetAnnotations2 extends FormattingHelper {
public String string;
@Deprecated
public int i;
public String run() throws Exception {
Method m = Field.class.getMethod("getAnnotations");
Field f = JLRFGetAnnotations2.class.getDeclaredField("i");
Annotation[] o = (Annotation[]) m.invoke(f);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetAnnotations2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRFGetDecAnnotations extends FormattingHelper {
@AnnoT
public String string;
public String run() throws Exception {
Method m = Field.class.getMethod("getDeclaredAnnotations");
Field f = JLRFGetDecAnnotations.class.getDeclaredField("string");
Annotation[] o = (Annotation[]) m.invoke(f);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetDecAnnotations().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFGetDecAnnotations2 extends FormattingHelper {
public String string;
@Deprecated
public int i;
public String run() throws Exception {
Method m = Field.class.getMethod("getAnnotations");
Field f = JLRFGetDecAnnotations2.class.getDeclaredField("i");
Annotation[] o = (Annotation[]) m.invoke(f);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetDecAnnotations2().run());
}
}

View File

@@ -0,0 +1,91 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFGetTheRest extends FormattingHelper {
public boolean z;
public byte b;
public char c;
public double d;
public float f;
public int i;
public long j;
public short s;
public String run() throws Exception {
z = true;
b = (byte) 123;
c = 'a';
d = 3.141d;
f = 33f;
i = 12345;
j = 444L;
s = (short) 99;
StringBuilder s = new StringBuilder();
s.append(getBoolean()).append(" ");
s.append(getByte()).append(" ");
s.append(getChar()).append(" ");
s.append(getDouble()).append(" ");
s.append(getFloat()).append(" ");
s.append(getInt()).append(" ");
s.append(getLong()).append(" ");
s.append(getShort()).append(" ");
return s.toString().trim();
}
public String getBoolean() throws Exception {
Method m = Field.class.getMethod("getBoolean", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("z");
return ((Boolean) m.invoke(f, this)).toString();
}
public String getByte() throws Exception {
Method m = Field.class.getMethod("getByte", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("b");
return ((Byte) m.invoke(f, this)).toString();
}
public String getChar() throws Exception {
Method m = Field.class.getMethod("getChar", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("c");
m.invoke(f, this);
return Character.toString(c);
}
public String getDouble() throws Exception {
Method m = Field.class.getMethod("getDouble", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("d");
return ((Double) m.invoke(f, this)).toString();
}
public String getFloat() throws Exception {
Method m = Field.class.getMethod("getFloat", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("f");
return ((Float) m.invoke(f, this)).toString();
}
public String getInt() throws Exception {
Method m = Field.class.getMethod("getInt", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("i");
return ((Integer) m.invoke(f, this)).toString();
}
public String getLong() throws Exception {
Method m = Field.class.getMethod("getLong", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("j");
return ((Long) m.invoke(f, this)).toString();
}
public String getShort() throws Exception {
Method m = Field.class.getMethod("getShort", Object.class);
Field f = JLRFGetTheRest.class.getDeclaredField("s");
return ((Short) m.invoke(f, this)).toString();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetTheRest().run());
}
}

View File

@@ -0,0 +1,99 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFGetTheRest2 extends FormattingHelper {
public boolean z;
public byte b;
public char c;
public double d;
public float f;
public int i;
public long j;
public short s;
public boolean z2;
public byte b2;
public char c2;
public double d2;
public float f2;
public int i2;
public long j2;
public short s2;
public String run() throws Exception {
z2 = true;
b2 = (byte) 23;
c2 = 'b';
d2 = 4.141d;
f2 = 43f;
i2 = 22345;
j2 = 544L;
s2 = (short) 999;
StringBuilder s = new StringBuilder();
s.append(getBoolean()).append(" ");
s.append(getByte()).append(" ");
s.append(getChar()).append(" ");
s.append(getDouble()).append(" ");
s.append(getFloat()).append(" ");
s.append(getInt()).append(" ");
s.append(getLong()).append(" ");
s.append(getShort()).append(" ");
return s.toString().trim();
}
public String getBoolean() throws Exception {
Method m = Field.class.getMethod("getBoolean", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("z2");
return ((Boolean) m.invoke(f, this)).toString();
}
public String getByte() throws Exception {
Method m = Field.class.getMethod("getByte", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("b2");
return ((Byte) m.invoke(f, this)).toString();
}
public String getChar() throws Exception {
Method m = Field.class.getMethod("getChar", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("c2");
return ((Character) m.invoke(f, this)).toString();
}
public String getDouble() throws Exception {
Method m = Field.class.getMethod("getDouble", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("d2");
return ((Double) m.invoke(f, this)).toString();
}
public String getFloat() throws Exception {
Method m = Field.class.getMethod("getFloat", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("f2");
return ((Float) m.invoke(f, this)).toString();
}
public String getInt() throws Exception {
Method m = Field.class.getMethod("getInt", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("i2");
return ((Integer) m.invoke(f, this)).toString();
}
public String getLong() throws Exception {
Method m = Field.class.getMethod("getLong", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("j2");
return ((Long) m.invoke(f, this)).toString();
}
public String getShort() throws Exception {
Method m = Field.class.getMethod("getShort", Object.class);
Field f = JLRFGetTheRest2.class.getDeclaredField("s2");
return ((Short) m.invoke(f, this)).toString();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFGetTheRest2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRFIsAnnotationPresent extends FormattingHelper {
@Deprecated
public String string;
public String run() throws Exception {
Method m = Field.class.getMethod("isAnnotationPresent", Class.class);
Field f = JLRFIsAnnotationPresent.class.getDeclaredField("string");
boolean b = (Boolean) m.invoke(f, Deprecated.class);
boolean c = (Boolean) m.invoke(f, AnnoT.class);
return Boolean.toString(b) + Boolean.toString(c);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFIsAnnotationPresent().run());
}
}

View File

@@ -0,0 +1,28 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRFIsAnnotationPresent2 extends FormattingHelper {
@Deprecated
public String string;
@AnnoT
public int i;
public String run() throws Exception {
Method m = Field.class.getMethod("isAnnotationPresent", Class.class);
Field f = JLRFIsAnnotationPresent2.class.getDeclaredField("i");
boolean b = (Boolean) m.invoke(f, Deprecated.class);
boolean c = (Boolean) m.invoke(f, AnnoT.class);
return Boolean.toString(b) + Boolean.toString(c);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFIsAnnotationPresent2().run());
}
}

22
testdata/src/main/java/iri/JLRFSet.java vendored Normal file
View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFSet extends FormattingHelper {
public String string;
public String run() throws Exception {
Method m = Field.class.getMethod("set", Object.class, Object.class);
Field f = JLRFSet.class.getDeclaredField("string");
m.invoke(f, this, "hello");
System.out.println(string);
return string;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFSet().run());
}
}

View File

@@ -0,0 +1,30 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import reflection.AnnoT;
@AnnoT
public class JLRFSet2 extends FormattingHelper {
public JLRFSet2() {
}
public String string;
public String string2;
public String run() throws Exception {
Method m = Field.class.getMethod("set", Object.class, Object.class);
Field f = JLRFSet2.class.getDeclaredField("string2");
m.invoke(f, this, "goodbye");
return string2;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFSet2().run());
}
}

View File

@@ -0,0 +1,90 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFSetTheRest extends FormattingHelper {
public boolean z;
public byte b;
public char c;
public double d;
public float f;
public int i;
public long j;
public short s;
public String run() throws Exception {
StringBuilder s = new StringBuilder();
s.append(setBoolean()).append(" ");
s.append(setByte()).append(" ");
s.append(setChar()).append(" ");
s.append(setDouble()).append(" ");
s.append(setFloat()).append(" ");
s.append(setInt()).append(" ");
s.append(setLong()).append(" ");
s.append(setShort()).append(" ");
return s.toString().trim();
}
public String setBoolean() throws Exception {
Method m = Field.class.getMethod("setBoolean", Object.class, Boolean.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("z");
m.invoke(f, this, true);
return Boolean.toString(z);
}
public String setByte() throws Exception {
Method m = Field.class.getMethod("setByte", Object.class, Byte.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("b");
m.invoke(f, this, (byte) 123);
return Byte.toString(b);
}
public String setChar() throws Exception {
Method m = Field.class.getMethod("setChar", Object.class, Character.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("c");
m.invoke(f, this, 'a');
return Character.toString(c);
}
public String setDouble() throws Exception {
Method m = Field.class.getMethod("setDouble", Object.class, Double.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("d");
m.invoke(f, this, 3.14d);
return Double.toString(d);
}
public String setFloat() throws Exception {
Method m = Field.class.getMethod("setFloat", Object.class, Float.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("f");
m.invoke(f, this, 6.5f);
return Float.toString(this.f);
}
public String setInt() throws Exception {
Method m = Field.class.getMethod("setInt", Object.class, Integer.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("i");
m.invoke(f, this, 32767);
return Integer.toString(i);
}
public String setLong() throws Exception {
Method m = Field.class.getMethod("setLong", Object.class, Long.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("j");
m.invoke(f, this, 555L);
return Long.toString(j);
}
public String setShort() throws Exception {
Method m = Field.class.getMethod("setShort", Object.class, Short.TYPE);
Field f = JLRFSetTheRest.class.getDeclaredField("s");
m.invoke(f, this, (short) 333);
return Short.toString(s);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFSetTheRest().run());
}
}

View File

@@ -0,0 +1,99 @@
package iri;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JLRFSetTheRest2 extends FormattingHelper {
public boolean z;
public byte b;
public char c;
public double d;
public float f;
public int i;
public long j;
public short s;
public boolean z2;
public byte b2;
public char c2;
public double d2;
public float f2;
public int i2;
public long j2;
public short s2;
public String run() throws Exception {
StringBuilder s = new StringBuilder();
s.append(setBoolean()).append(" ");
s.append(setByte()).append(" ");
s.append(setChar()).append(" ");
s.append(setDouble()).append(" ");
s.append(setFloat()).append(" ");
s.append(setInt()).append(" ");
s.append(setLong()).append(" ");
s.append(setShort()).append(" ");
return s.toString().trim();
}
public String setBoolean() throws Exception {
Method m = Field.class.getMethod("setBoolean", Object.class, Boolean.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("z2");
m.invoke(f, this, true);
return Boolean.toString(z2);
}
public String setByte() throws Exception {
Method m = Field.class.getMethod("setByte", Object.class, Byte.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("b2");
m.invoke(f, this, (byte) 111);
return Byte.toString(b2);
}
public String setChar() throws Exception {
Method m = Field.class.getMethod("setChar", Object.class, Character.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("c2");
m.invoke(f, this, 'b');
return Character.toString(c2);
}
public String setDouble() throws Exception {
Method m = Field.class.getMethod("setDouble", Object.class, Double.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("d2");
m.invoke(f, this, 6.28d);
return Double.toString(d2);
}
public String setFloat() throws Exception {
Method m = Field.class.getMethod("setFloat", Object.class, Float.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("f2");
m.invoke(f, this, 13.0f);
return Float.toString(this.f2);
}
public String setInt() throws Exception {
Method m = Field.class.getMethod("setInt", Object.class, Integer.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("i2");
m.invoke(f, this, 11122);
return Integer.toString(i2);
}
public String setLong() throws Exception {
Method m = Field.class.getMethod("setLong", Object.class, Long.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("j2");
m.invoke(f, this, 222L);
return Long.toString(j2);
}
public String setShort() throws Exception {
Method m = Field.class.getMethod("setShort", Object.class, Short.TYPE);
Field f = JLRFSetTheRest2.class.getDeclaredField("s2");
m.invoke(f, this, (short) 777);
return Short.toString(s2);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFSetTheRest2().run());
}
}

View File

@@ -0,0 +1,87 @@
package iri;
import java.lang.reflect.Field;
/**
* This variant is using set() for primitive fields but passing in wrapper values.
*
* @author Andy Clement
* @since 1.0.4
*/
public class JLRFSetTheRestVariant extends FormattingHelper {
public boolean z;
public byte b;
public char c;
public double d;
public float f;
public int i;
public long j;
public short s;
public String run() throws Exception {
StringBuilder s = new StringBuilder();
s.append(setBoolean()).append(" ");
s.append(setByte()).append(" ");
s.append(setChar()).append(" ");
s.append(setDouble()).append(" ");
s.append(setFloat()).append(" ");
s.append(setInt()).append(" ");
s.append(setLong()).append(" ");
s.append(setShort()).append(" ");
return s.toString().trim();
}
public String setBoolean() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("z");
f.set(this, Boolean.TRUE);
return Boolean.toString(z);
}
public String setByte() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("b");
f.set(this, new Byte("123"));
return Byte.toString(b);
}
public String setChar() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("c");
f.set(this, Character.valueOf('a'));
return Character.toString(c);
}
public String setDouble() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("d");
f.set(this, Double.valueOf(3.14d));
return Double.toString(d);
}
public String setFloat() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("f");
f.set(this, Float.valueOf(6.5f));
return Float.toString(this.f);
}
public String setInt() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("i");
f.set(this, Integer.valueOf(32767));
return Integer.toString(i);
}
public String setLong() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("j");
f.set(this, Long.valueOf(555L));
return Long.toString(j);
}
public String setShort() throws Exception {
Field f = JLRFSetTheRestVariant.class.getDeclaredField("s");
f.set(this, Short.valueOf((short) 333));
return Short.toString(s);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRFSetTheRestVariant().run());
}
}

View File

@@ -0,0 +1,27 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotation extends FormattingHelper {
@AnnoT
public void string() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getAnnotation", Class.class);
Method mm = JLRMGetAnnotation.class.getDeclaredMethod("string");
Annotation a = (Annotation) m.invoke(mm, AnnoT.class);
Annotation b = (Annotation) m.invoke(mm, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotation().run());
}
}

View File

@@ -0,0 +1,32 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotation2 extends FormattingHelper {
@AnnoT
public void string() {
}
@Deprecated
public void newmethod() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getAnnotation", Class.class);
Method mm = JLRMGetAnnotation2.class.getDeclaredMethod("newmethod");
Annotation a = (Annotation) m.invoke(mm, AnnoT.class);
Annotation b = (Annotation) m.invoke(mm, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotation2().run());
}
}

View File

@@ -0,0 +1,28 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotationViaAccessibleObject extends FormattingHelper {
@AnnoT
public void string() {
}
public String run() throws Exception {
Method m = AccessibleObject.class.getMethod("getAnnotation", Class.class);
Method mm = JLRMGetAnnotationViaAccessibleObject.class.getDeclaredMethod("string");
Annotation a = (Annotation) m.invoke(mm, AnnoT.class);
Annotation b = (Annotation) m.invoke(mm, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotationViaAccessibleObject().run());
}
}

View File

@@ -0,0 +1,33 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotationViaAccessibleObject2 extends FormattingHelper {
@AnnoT
public void string() {
}
@Deprecated
public void newmethod() {
}
public String run() throws Exception {
Method m = AccessibleObject.class.getMethod("getAnnotation", Class.class);
Method mm = JLRMGetAnnotationViaAccessibleObject2.class.getDeclaredMethod("newmethod");
Annotation a = (Annotation) m.invoke(mm, AnnoT.class);
Annotation b = (Annotation) m.invoke(mm, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotationViaAccessibleObject2().run());
}
}

View File

@@ -0,0 +1,28 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotationViaAnnotatedElement extends FormattingHelper {
@AnnoT
public void string() {
}
public String run() throws Exception {
Method m = AnnotatedElement.class.getMethod("getAnnotation", Class.class);
Method mm = JLRMGetAnnotationViaAnnotatedElement.class.getDeclaredMethod("string");
Annotation a = (Annotation) m.invoke(mm, AnnoT.class);
Annotation b = (Annotation) m.invoke(mm, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotationViaAnnotatedElement().run());
}
}

View File

@@ -0,0 +1,33 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotationViaAnnotatedElement2 extends FormattingHelper {
@AnnoT
public void string() {
}
@Deprecated
public void newmethod() {
}
public String run() throws Exception {
Method m = AnnotatedElement.class.getMethod("getAnnotation", Class.class);
Method mm = JLRMGetAnnotationViaAnnotatedElement2.class.getDeclaredMethod("newmethod");
Annotation a = (Annotation) m.invoke(mm, AnnoT.class);
Annotation b = (Annotation) m.invoke(mm, Deprecated.class);
return a + " " + b;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotationViaAnnotatedElement2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotations extends FormattingHelper {
@AnnoT
public void string() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getAnnotations");
Method mm = JLRMGetAnnotations.class.getDeclaredMethod("string");
Annotation[] o = (Annotation[]) m.invoke(mm);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotations().run());
}
}

View File

@@ -0,0 +1,30 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetAnnotations2 extends FormattingHelper {
@AnnoT
public void string() {
}
@Deprecated
public void newmethod() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getAnnotations");
Method mm = JLRMGetAnnotations2.class.getDeclaredMethod("newmethod");
Annotation[] o = (Annotation[]) m.invoke(mm);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetAnnotations2().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetDecAnnotations extends FormattingHelper {
@AnnoT
public void string() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getDeclaredAnnotations");
Method mm = JLRMGetDecAnnotations.class.getDeclaredMethod("string");
Annotation[] o = (Annotation[]) m.invoke(mm);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetDecAnnotations().run());
}
}

View File

@@ -0,0 +1,30 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMGetDecAnnotations2 extends FormattingHelper {
@AnnoT
public void string() {
}
@Deprecated
public void newmethod() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getDeclaredAnnotations");
Method mm = JLRMGetDecAnnotations2.class.getDeclaredMethod("newmethod");
Annotation[] o = (Annotation[]) m.invoke(mm);
return format(o);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetDecAnnotations2().run());
}
}

View File

@@ -0,0 +1,31 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
import reflection.AnnoT2;
public class JLRMGetParameterAnnotations extends FormattingHelper {
public void string(@AnnoT String s, int i, @AnnoT2 int j) {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getParameterAnnotations");
Method mm = JLRMGetParameterAnnotations.class.getDeclaredMethod("string", String.class, Integer.TYPE, Integer.TYPE);
Annotation[][] arrayofannos = (Annotation[][]) m.invoke(mm);
StringBuilder s = new StringBuilder();
for (Annotation[] annos : arrayofannos) {
s.append("[");
s.append(format(annos));
s.append("]");
}
return s.toString().trim();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetParameterAnnotations().run());
}
}

View File

@@ -0,0 +1,34 @@
package iri;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import reflection.AnnoT;
import reflection.AnnoT2;
public class JLRMGetParameterAnnotations2 extends FormattingHelper {
public void string(@AnnoT String s, int i, @AnnoT2 int j) {
}
public void newmethod(@AnnoT2 String s, @AnnoT int i, int j) {
}
public String run() throws Exception {
Method m = Method.class.getMethod("getParameterAnnotations");
Method mm = JLRMGetParameterAnnotations2.class.getDeclaredMethod("newmethod", String.class, Integer.TYPE, Integer.TYPE);
Annotation[][] arrayofannos = (Annotation[][]) m.invoke(mm);
StringBuilder s = new StringBuilder();
for (Annotation[] annos : arrayofannos) {
s.append("[");
s.append(format(annos));
s.append("]");
}
return s.toString().trim();
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMGetParameterAnnotations2().run());
}
}

View File

@@ -0,0 +1,22 @@
package iri;
import java.lang.reflect.Method;
public class JLRMInvoke extends FormattingHelper {
public String runner() {
return "ran";
}
public String run() throws Exception {
Method m = Method.class.getMethod("invoke", Object.class, Object[].class);
Method mm = JLRMInvoke.class.getDeclaredMethod("runner");
String s = (String) m.invoke(mm, this, (Object[]) null);
return s;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMInvoke().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.reflect.Method;
public class JLRMInvoke2 extends FormattingHelper {
public String runner() {
return "ran";
}
public String newmethod() {
return "alsoran";
}
public String run() throws Exception {
Method m = Method.class.getMethod("invoke", Object.class, Object[].class);
Method mm = JLRMInvoke2.class.getDeclaredMethod("newmethod");
String s = (String) m.invoke(mm, this, (Object[]) null);
return s;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMInvoke2().run());
}
}

View File

@@ -0,0 +1,26 @@
package iri;
import java.lang.reflect.Method;
public class JLRMInvoke3 extends FormattingHelper {
public String runner() {
return "ran";
}
public String newmethod2(String s, int i) {
return s + Integer.toString(i);
}
public String run() throws Exception {
Method m = Method.class.getMethod("invoke", Object.class, Object[].class);
Method mm = JLRMInvoke3.class.getDeclaredMethod("newmethod2", String.class, Integer.TYPE);
String s = (String) m.invoke(mm, this, new Object[] { "abc", 3 });
return s;
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMInvoke3().run());
}
}

View File

@@ -0,0 +1,25 @@
package iri;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMIsAnnotationPresent extends FormattingHelper {
@Deprecated
public void string() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("isAnnotationPresent", Class.class);
Method mm = JLRMIsAnnotationPresent.class.getDeclaredMethod("string");
boolean b = (Boolean) m.invoke(mm, Deprecated.class);
boolean c = (Boolean) m.invoke(mm, AnnoT.class);
return Boolean.toString(b) + Boolean.toString(c);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMIsAnnotationPresent().run());
}
}

View File

@@ -0,0 +1,29 @@
package iri;
import java.lang.reflect.Method;
import reflection.AnnoT;
public class JLRMIsAnnotationPresent2 extends FormattingHelper {
@Deprecated
public void string() {
}
@AnnoT
public void newmethod() {
}
public String run() throws Exception {
Method m = Method.class.getMethod("isAnnotationPresent", Class.class);
Method mm = JLRMIsAnnotationPresent2.class.getDeclaredMethod("newmethod");
boolean b = (Boolean) m.invoke(mm, Deprecated.class);
boolean c = (Boolean) m.invoke(mm, AnnoT.class);
return Boolean.toString(b) + Boolean.toString(c);
}
public static void main(String[] argv) throws Exception {
System.out.println(new JLRMIsAnnotationPresent2().run());
}
}