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

View File

@@ -0,0 +1,75 @@
package reflection.constructors;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
/**
* Test class with constructors, for the purpose of testing constructor invocation.
* <p>
* Constructors in this class have some behavior (which is changed in a reloaded class), so that we can see when they are
* being called.
*
* @author kdvolder
*/
public class ClassForNewInstance {
private boolean b;
private String s;
private int i;
private double d;
public ClassForNewInstance() {
System.out.println("no args");
}
ClassForNewInstance(String x) {
this.s = x;
System.out.println("string "+x);
}
protected ClassForNewInstance(int x) {
this.i = x;
System.out.println("int "+x);
}
@SuppressWarnings("unused")
private ClassForNewInstance(boolean x) {
this.b = x;
System.out.println("bool "+x);
}
//Becomes public
@SuppressWarnings("unused")
private ClassForNewInstance(int x, String y) {
this.i = x; this.s = y;
System.out.println("int String "+x+" "+y);
}
//Becomes private
public ClassForNewInstance(double x) {
this.d = x;
System.out.println("double "+x);
}
// Will be deleted
public ClassForNewInstance(char c, char d) {
s = c+","+d;
}
@Override
public String toString() {
// The value of toString is used by the test to check expected result... so
return "001{ "+b+", "+s+","+i+","+d+"}";
}
/// We also use this class itself as an "invoker" for testing, so that we have some cases where it *is* allowed
// to call private methods etc. without setAccessible!
public static Object callNewInstance(Constructor<?> thiz, Object[] a0)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
return thiz.newInstance(a0);
}
}

View File

@@ -0,0 +1,79 @@
package reflection.constructors;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
/**
* Test class with constructors, for the purpose of testing constructor invocation.
* <p>
* Constructors in this class have some behavior (which is changed in a reloaded class), so that we can see when they are
* being called.
*
* @author kdvolder
*/
public class ClassForNewInstance002 {
private boolean b;
private String s;
private int i;
private double d;
public ClassForNewInstance002() {
System.out.println("002 no args");
}
ClassForNewInstance002(String x) {
this.s = "002"+x;
System.out.println("002 string "+x);
}
protected ClassForNewInstance002(int x) {
this.i = x+200;
System.out.println("002 int "+x);
}
@SuppressWarnings("unused")
private ClassForNewInstance002(boolean x) {
this.b = !x;
System.out.println("002 bool "+x);
}
//Becomes public
public ClassForNewInstance002(int x, String y) {
this.i = 20+x; this.s = "222"+y;
System.out.println("002 int String "+x+" "+y);
}
//Becomes private
@SuppressWarnings("unused")
private ClassForNewInstance002(double x) {
System.out.println("002 double "+x);
}
//New public one
public ClassForNewInstance002(float x) {
System.out.println("002 float "+x);
}
//New private one
@SuppressWarnings("unused")
private ClassForNewInstance002(char x) {
System.out.println("002 char "+x);
}
@Override
public String toString() {
// The value of toString is used by the test to check expected result... so
return "002{ "+b+", "+s+","+i+","+d+"}";
}
/// We also use this class itself as an "invoker" for testing, so that we have some cases where it *is* allowed
// to call private methods etc. without setAccessible!
public static Object callNewInstance(Constructor<?> thiz, Object[] a0)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
return thiz.newInstance(a0);
}
}

View File

@@ -0,0 +1,19 @@
package reflection.constructors;
/**
* This version (003) is only used for testing "Class.newInstance" so we only need a default constructor
*/
public class ClassForNewInstance003 {
private ClassForNewInstance003() {
System.out.println("003 no args");
}
@Override
public String toString() {
// The value of toString is used by the test to check expected result... so
return "003";
}
}

View File

@@ -0,0 +1,20 @@
package reflection.constructors;
/**
* This version (004) is only used for testing "Class.newInstance". Testing case where there is
* no default constructor
*/
public class ClassForNewInstance004 {
public ClassForNewInstance004(String noDefaultConstructor) {
System.out.println("004 blah");
}
@Override
public String toString() {
// The value of toString is used by the test to check expected result... so
return "004";
}
}

View File

@@ -0,0 +1,43 @@
package reflection.constructors;
import reflection.AnnoT;
import reflection.AnnoT2;
import reflection.AnnoT3;
/**
* For testing constructor reloading and methods related to fetching annotation data from
* constructors.
*
* @author kdvolder
*/
public class ClassWithAnnotatedConstructors {
// We want our reloaded version to have
// - additional constructors (with annotations)
// - constructors with changed annotations
//The annotation will be removed
@SuppressWarnings("unused")
private @AnnoT ClassWithAnnotatedConstructors() {}
//The attribute value will be changed
public @AnnoT3("first") ClassWithAnnotatedConstructors(int x) {}
//Annotations will be added
protected ClassWithAnnotatedConstructors(double x) {}
//Annotations will be changed (some added some removed)
protected @AnnoT @AnnoT3("haa") ClassWithAnnotatedConstructors(boolean x) {}
//Annotations are not changed at all
public @AnnoT @AnnoT2 @AnnoT3("haa") ClassWithAnnotatedConstructors(char x) {}
// Annotations in the parameters will change
public ClassWithAnnotatedConstructors(@AnnoT2 String x, @AnnoT3("bah") double y, @AnnoT boolean z) {}
// Annotations in the parameters will be removed
public ClassWithAnnotatedConstructors(@AnnoT2 double x, @AnnoT3("boohoo") double y, @AnnoT boolean z) {}
// Annotations in the parameters will be added
public ClassWithAnnotatedConstructors(char x, double y, boolean z) {}
}

View File

@@ -0,0 +1,56 @@
package reflection.constructors;
import reflection.AnnoT;
import reflection.AnnoT2;
import reflection.AnnoT3;
/**
* For testing constructor reloading and methods related to fetching annotation data from
* constructors.
*
* @author kdvolder
*/
public class ClassWithAnnotatedConstructors002 {
// We want our reloaded version to have
// - additional constructors (with annotations)
// - constructors with changed annotations
//The annotation will be removed
@SuppressWarnings("unused")
private /* @AnnoT */ ClassWithAnnotatedConstructors002() {}
//The attribute value will be changed
public @AnnoT3(/*"first"*/ "second") ClassWithAnnotatedConstructors002(int x) {}
//Annotations will be added
protected @AnnoT @AnnoT3("haa002") ClassWithAnnotatedConstructors002(double x) {}
//Annotations will be changed (some added some removed)
protected /*@AnnoT*/ @AnnoT3("haa") /*+*/ @AnnoT2 ClassWithAnnotatedConstructors002(boolean x) {}
//Annotations are not changed at all
public @AnnoT @AnnoT2 @AnnoT3("haa") ClassWithAnnotatedConstructors002(char x) {}
// Annotations in the parameters will change
public ClassWithAnnotatedConstructors002(@AnnoT3("002") String x, @AnnoT2 double y, boolean z) {}
// Annotations in the parameters will be removed
public ClassWithAnnotatedConstructors002(double x, double y, boolean z) {}
// Annotations in the parameters will be added
public ClassWithAnnotatedConstructors002(@AnnoT char x, @AnnoT2 String y, @AnnoT2 @AnnoT3("bongo") @AnnoT boolean z) {}
///////////////////////////////////////////
// Some new constructors with and without annotations
public @AnnoT @AnnoT2 @AnnoT3("haa") ClassWithAnnotatedConstructors002(String x) {}
public ClassWithAnnotatedConstructors002(Float x) {}
public @AnnoT2 ClassWithAnnotatedConstructors002(float x) {}
public ClassWithAnnotatedConstructors002(float x, @AnnoT2 String y, @AnnoT2 @AnnoT3("bongo") @AnnoT boolean z) {}
}

View File

@@ -0,0 +1,50 @@
package reflection.constructors;
import javax.crypto.IllegalBlockSizeException;
/**
* A class with some constructors, for testing methods like Class.getConstructor, Class.getConstructors etc.
* <p>
* We need a few variations in this class, some different parameter lists and different visibility modifiers on
* these constructors.
*
* @author kdvolder
*/
public class ClassWithConstructors {
//////////////////////////////////////////////////
// Constructors that will not be changed (one with each kind of scope)
private ClassWithConstructors() {
}
protected ClassWithConstructors(int x) {
this();
}
public ClassWithConstructors(boolean z) {
}
ClassWithConstructors(double z) {
}
/////////////////////////////////////////////////////////////////////////
// Some constructors that change in different ways in the reloaded class
// modifier will change
public ClassWithConstructors(int i, String s) {
}
// will be deleted
public ClassWithConstructors(boolean i, String s) {
}
// will get exceptions
public ClassWithConstructors(String i, String s) {
}
// will remove exceptions
public ClassWithConstructors(double i, String s) throws IllegalBlockSizeException {
}
}

View File

@@ -0,0 +1,66 @@
package reflection.constructors;
import java.io.IOException;
/**
* A class with some constructors, for testing methods like Class.getConstructor, Class.getConstructors etc.
* <p>
* We need a few variations in this class, some different parameter lists and different visibility modifiers on
* these constructors.
*
* @author kdvolder
*/
public class ClassWithConstructors002 {
//////////////////////////////////////////////////
// Constructors that will not be changed (one with each kind of scope)
private ClassWithConstructors002() {
}
protected ClassWithConstructors002(int x) {
this();
}
public ClassWithConstructors002(boolean z) {
}
ClassWithConstructors002(double z) {
}
/////////////////////////////////////////////////////////////////////////
// Some constructors that change in different ways in the reloaded class
// modifier will change
@SuppressWarnings("unused")
private ClassWithConstructors002(int i, String s) {
}
// will be deleted
// public ClassWithConstructors002(boolean i, String s) {
// }
// will get exceptions
public ClassWithConstructors002(String i, String s) throws IOException, InterruptedException {
}
// will remove exceptions
public ClassWithConstructors002(double i, String s) {
}
///////////////////////////////////////////////////////////////////////////
// Some constructors are added
@SuppressWarnings("unused")
private ClassWithConstructors002(double x, ClassWithConstructors002 copy) {
}
public ClassWithConstructors002(long x, ClassWithConstructors002 copy) {
}
protected ClassWithConstructors002(short x, ClassWithConstructors002 copy) {
}
ClassWithConstructors002(char x, ClassWithConstructors002 copy) {
}
}