-
Notifications
You must be signed in to change notification settings - Fork 273
[SEC-180] Add ability to overlay classes with new definitions of existing methods #1816
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
smowton
merged 3 commits into
diffblue:develop
from
NathanJPhillips:feature/overlay-methods
Mar 27, 2018
Merged
Changes from all commits
Commits
Show all changes
3 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
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
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,14 @@ | ||
public class Test | ||
{ | ||
public int x; | ||
|
||
public static void main(String[] args) | ||
{ | ||
assert(false); | ||
} | ||
|
||
public static void notOverlain() | ||
{ | ||
assert(true); | ||
} | ||
} |
Binary file added
BIN
+185 Bytes
regression/cbmc-java/overlay-class/annotations/com/diffblue/OverlayClassImplementation.class
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
regression/cbmc-java/overlay-class/annotations/com/diffblue/OverlayClassImplementation.java
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,4 @@ | ||
package com.diffblue; | ||
|
||
public @interface OverlayClassImplementation { | ||
} |
Binary file added
BIN
+187 Bytes
...ession/cbmc-java/overlay-class/annotations/com/diffblue/OverlayMethodImplementation.class
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
regression/cbmc-java/overlay-class/annotations/com/diffblue/OverlayMethodImplementation.java
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,4 @@ | ||
package com.diffblue; | ||
|
||
public @interface OverlayMethodImplementation { | ||
} |
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
regression/cbmc-java/overlay-class/correct-overlay/Test.java
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,14 @@ | ||
import com.diffblue.OverlayClassImplementation; | ||
import com.diffblue.OverlayMethodImplementation; | ||
|
||
@OverlayClassImplementation | ||
public class Test | ||
{ | ||
public int x; | ||
|
||
@OverlayMethodImplementation | ||
public static void main(String[] args) | ||
{ | ||
assert(true); | ||
} | ||
} |
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,17 @@ | ||
CORE | ||
Test.class | ||
--classpath `./format_classpath.sh . annotations correct-overlay` --verbosity 10 | ||
^Getting class `Test' from file \.[\\/]Test\.class$ | ||
^Getting class `Test' from file correct-overlay[\\/]Test\.class$ | ||
^Adding symbol from overlay class: field 'x'$ | ||
^Adding symbol from overlay class: method 'java::Test\.<init>:\(\)V'$ | ||
^Field definition for java::Test\.x already loaded from overlay class$ | ||
^Adding symbol from overlay class: method 'java::Test\.main:\(\[Ljava/lang/String;\)V'$ | ||
^Method java::Test\.<init>:\(\)V exists in an overlay class without being marked as an overlay and also exists in the underlying class | ||
^Adding symbol: method 'java::Test\.notOverlain:\(\)V'$ | ||
^VERIFICATION SUCCESSFUL$ | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^Skipping class Test marked with OverlayClassImplementation but found before original definition$ | ||
^Skipping duplicate definition of class Test not marked with OverlayClassImplementation$ |
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,17 @@ | ||
CORE | ||
Test.class | ||
--classpath `./format_classpath.sh . annotations . correct-overlay` --verbosity 10 | ||
^Getting class `Test' from file \.[\\/]Test\.class$ | ||
^Getting class `Test' from file correct-overlay[\\/]Test\.class$ | ||
^Skipping duplicate definition of class Test not marked with OverlayClassImplementation$ | ||
^Adding symbol from overlay class: field 'x'$ | ||
^Adding symbol from overlay class: method 'java::Test\.<init>:\(\)V'$ | ||
^Field definition for java::Test\.x already loaded from overlay class$ | ||
^Adding symbol from overlay class: method 'java::Test\.main:\(\[Ljava/lang/String;\)V'$ | ||
^Method java::Test\.<init>:\(\)V exists in an overlay class without being marked as an overlay and also exists in the underlying class | ||
^Adding symbol: method 'java::Test\.notOverlain:\(\)V'$ | ||
^VERIFICATION SUCCESSFUL$ | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^Skipping class Test marked with OverlayClassImplementation but found before original definition$ |
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,12 @@ | ||
#!/bin/bash | ||
|
||
unameOut="$(uname -s)" | ||
case "${unameOut}" in | ||
CYGWIN*) separator=";";; | ||
MINGW*) separator=";";; | ||
MSYS*) separator=";";; | ||
Windows*) separator=";";; | ||
*) separator=":" | ||
esac | ||
|
||
echo -n `IFS=$separator; echo "$*"` |
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,16 @@ | ||
CORE | ||
Test.class | ||
--classpath `./format_classpath.sh annotations correct-overlay .` --verbosity 10 | ||
^Getting class `Test' from file correct-overlay[\\/]Test\.class$ | ||
^Getting class `Test' from file \.[\\/]Test\.class$ | ||
^Skipping class Test marked with OverlayClassImplementation but found before original definition$ | ||
^Adding symbol: field 'x'$ | ||
^Adding symbol: method 'java::Test\.main:\(\[Ljava/lang/String;\)V'$ | ||
^Adding symbol: method 'java::Test\.notOverlain:\(\)V'$ | ||
^VERIFICATION FAILED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^Skipping duplicate definition of class Test not marked with OverlayClassImplementation$ | ||
^Adding symbol from overlay class | ||
exists in an overlay class without being marked as an overlay and also exists in the underlying class |
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
regression/cbmc-java/overlay-class/unmarked-overlay/Test.java
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,11 @@ | ||
import com.diffblue.OverlayClassImplementation; | ||
import com.diffblue.OverlayMethodImplementation; | ||
|
||
public class Test | ||
{ | ||
@OverlayMethodImplementation | ||
public static void main(String[] args) | ||
{ | ||
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. To make this test more robust I'd probably put an |
||
assert(false); | ||
} | ||
} |
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,16 @@ | ||
CORE | ||
Test.class | ||
--classpath `./format_classpath.sh . annotations unmarked-overlay` --verbosity 10 | ||
^Getting class `Test' from file \.[\\/]Test\.class$ | ||
^Getting class `Test' from file unmarked-overlay[\\/]Test\.class$ | ||
^Skipping duplicate definition of class Test not marked with OverlayClassImplementation$ | ||
^Adding symbol: field 'x'$ | ||
^Adding symbol: method 'java::Test\.main:\(\[Ljava/lang/String;\)V'$ | ||
^Adding symbol: method 'java::Test\.notOverlain:\(\)V'$ | ||
^VERIFICATION FAILED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^Skipping class Test marked with OverlayClassImplementation but found before original definition$ | ||
^Adding symbol from overlay class | ||
exists in an overlay class without being marked as an overlay and also exists in the underlying class |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might consider pulling this into a separate repo so you don't have to keep providing implementations of these OverlayMethod/Class attributes.