-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding the clone implementation, which currently doesn't check to see…
… if the object is actually clone-able but does work on Arrays at least (the object vs. array implementations are different). This makes all unit tests pass along with the JDK, except for HashTable Test since it requires more complete reflection (getDeclaredFields).
- Loading branch information
Drew Zagieboylo
committed
Aug 20, 2018
1 parent
146dc64
commit 09459b5
Showing
7 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ | |
.settings/ | ||
.cproject | ||
.project | ||
.classpath | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import java.test.AbstractTest; | ||
import java.test.Test; | ||
import java.test.SubTest; | ||
|
||
public class AnonymousSubClass { | ||
|
||
public static void main(String[] args) { | ||
AbstractTest at = new Test(); | ||
at.printMessage(); | ||
at = new SubTest(); | ||
at.printMessage(); | ||
SubTest st = new SubTest() { | ||
public void doNothing(){ System.out.print(""); }; | ||
}; | ||
st.printMessage(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class CastNull { | ||
|
||
static class InnerOne { | ||
|
||
} | ||
|
||
static interface InnerInterOne { | ||
public Object objectify(); | ||
} | ||
|
||
static class InnerTwo implements InnerInterOne { | ||
public Object objectify() { | ||
return this; | ||
} | ||
|
||
|
||
} | ||
|
||
static class InnerThree implements InnerInterOne { | ||
public Object objectify() { | ||
return null; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
|
||
InnerTwo t = null; | ||
System.out.println(t == null); | ||
t = new InnerTwo(); | ||
InnerInterOne in = (InnerInterOne)t.objectify(); | ||
System.out.println(in == null); | ||
in = (InnerInterOne) new InnerThree().objectify(); | ||
System.out.println(in == null); | ||
InnerOne ino = (InnerOne) new InnerThree().objectify(); | ||
System.out.println(ino == null); | ||
try { | ||
Object o = new InnerTwo(); | ||
InnerOne o1 = (InnerOne) new InnerTwo().objectify(); | ||
} catch (ClassCastException e) { | ||
System.out.println("caught exception"); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class ClassTest { | ||
|
||
public static void main(String[] args) throws Exception { | ||
// Class<?> clazz = Class.forName("java.lang.Object"); | ||
System.out.println(Object.class.getName()); | ||
} | ||
} |