-
Notifications
You must be signed in to change notification settings - Fork 274
Clone reference array #3992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Clone reference array #3992
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or 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,92 @@ | ||
public class ArrayClone { | ||
public static void cloneReferenceArray() { | ||
ArrayClone[] a = {new ArrayClone(), new ArrayClone() }; | ||
ArrayClone[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneObjectArray() { | ||
Object[] a = {new Object(), new Object() }; | ||
Object[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneByteArray() { | ||
byte[] a = {(byte) 1, (byte) 2}; | ||
byte[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneShortArray() { | ||
short[] a = {(short) 1, (short) 2}; | ||
short[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneIntArray() { | ||
int[] a = {1, 2}; | ||
int[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneLongArray() { | ||
long[] a = {1L, 2L }; | ||
long[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneFloatArray() { | ||
float[] a = {1.0f, 2.0f}; | ||
float[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneDoubleArray() { | ||
double[] a = {1.0, 2.0}; | ||
double[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
public static void cloneBooleanArray() { | ||
boolean[] a = {true, false}; | ||
boolean[] clone = a.clone(); | ||
|
||
assert(a.length == clone.length); | ||
assert(a[0] == clone[0]); | ||
assert(a[1] == clone[1]); | ||
assert(a != clone); | ||
} | ||
|
||
} |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneBooleanArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that the clone works on a boolean array |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneByteArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for byte arrays |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneDoubleArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for double arrays |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneFloatArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for float arrays |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneIntArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for int arrays |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneLongArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for long arrays |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneObjectArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for arrays of objects |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneReferenceArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for reference (non-object) arrays |
This file contains hidden or 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,9 @@ | ||
CORE | ||
ArrayClone.class | ||
--function ArrayClone.cloneShortArray | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
LAJW marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-- | ||
-- | ||
Verify that clone works correctly for short arrays |
This file contains hidden or 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 |
---|---|---|
|
@@ -138,7 +138,9 @@ void ci_lazy_methods_neededt::gather_field_types( | |
{ | ||
const typet &element_type = | ||
java_array_element_type(to_struct_tag_type(class_type)); | ||
if(element_type.id() == ID_pointer) | ||
if( | ||
element_type.id() == ID_pointer && | ||
element_type.subtype().id() != ID_empty) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏ What about |
||
{ | ||
// This is a reference array -- mark its element type available. | ||
add_all_needed_classes(to_pointer_type(element_type)); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.