-
Notifications
You must be signed in to change notification settings - Fork 273
[TG-2453] catch unsupported generics exception #1838
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
mgudemann
merged 3 commits into
diffblue:develop
from
mgudemann:bugfix/catch_unsupported_generics_exception
Feb 19, 2018
Merged
Changes from all commits
Commits
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
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
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 added
BIN
+442 Bytes
unit/java_bytecode/java_bytecode_parse_generics/GenericBounds.class
Binary file not shown.
Binary file added
BIN
+338 Bytes
unit/java_bytecode/java_bytecode_parse_generics/GenericBoundsLower.class
Binary file not shown.
Binary file added
BIN
+338 Bytes
unit/java_bytecode/java_bytecode_parse_generics/GenericBoundsUpper.class
Binary file not shown.
Binary file added
BIN
+631 Bytes
unit/java_bytecode/java_bytecode_parse_generics/GenericInterface.class
Binary file not shown.
64 changes: 64 additions & 0 deletions
64
unit/java_bytecode/java_bytecode_parse_generics/parse_generic_superclasses.cpp
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,64 @@ | ||
/*******************************************************************\ | ||
|
||
Module: Unit tests for parsing classes with generic superclasses or interfaces | ||
with unsupported signatures, falling back to using the raw type | ||
descriptors | ||
|
||
Author: DiffBlue Limited. All rights reserved. | ||
|
||
\*******************************************************************/ | ||
|
||
#include <testing-utils/catch.hpp> | ||
#include <testing-utils/load_java_class.h> | ||
#include <testing-utils/require_type.h> | ||
|
||
SCENARIO( | ||
"parse generic superclass signature", | ||
"[core][java_byte code[java_bytecode_parse_generics]]") | ||
{ | ||
const symbol_tablet &new_symbol_table = load_java_class( | ||
"GenericBounds", "./java_bytecode/java_bytecode_parse_generics"); | ||
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. This file appears to be new but is missing from the PR |
||
|
||
const std::string base_generic = "java::Generic"; | ||
const irep_idt base_generic_interface = "java::InterfaceGeneric"; | ||
|
||
const std::string load_class("java::GenericBounds"); | ||
THEN( | ||
"these fields have a non-generic base class / interface as their real " | ||
"generic signature is unsupported at the moment") | ||
{ | ||
// once bounds in generic signatures are supported, this test must be | ||
// changed to check for the correct generic types, TODO(mgudemann), | ||
// cf. TG-1286, TG-675 | ||
{ | ||
const symbolt &upper_symbol = | ||
new_symbol_table.lookup_ref("java::GenericBoundsUpper"); | ||
const java_class_typet &upper_type = | ||
to_java_class_type(upper_symbol.type); | ||
REQUIRE(upper_type.bases().size() == 1); | ||
const symbol_typet base_type = require_type::require_symbol( | ||
upper_type.bases().at(0).type(), base_generic); | ||
REQUIRE_FALSE(is_java_generic_symbol_type(base_type)); | ||
} | ||
{ | ||
const symbolt &lower_symbol = | ||
new_symbol_table.lookup_ref("java::GenericBoundsLower"); | ||
const java_class_typet &lower_type = | ||
to_java_class_type(lower_symbol.type); | ||
REQUIRE(lower_type.bases().size() == 1); | ||
const symbol_typet base_type = require_type::require_symbol( | ||
lower_type.bases().at(0).type(), base_generic); | ||
REQUIRE_FALSE(is_java_generic_symbol_type(base_type)); | ||
} | ||
{ | ||
const symbolt &interface_symbol = | ||
new_symbol_table.lookup_ref("java::GenericInterface"); | ||
const java_class_typet &interface_type = | ||
to_java_class_type(interface_symbol.type); | ||
REQUIRE(interface_type.bases().size() == 2); | ||
const symbol_typet base_type = require_type::require_symbol( | ||
interface_type.bases().at(1).type(), base_generic_interface); | ||
REQUIRE_FALSE(is_java_generic_symbol_type(base_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.
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.
This file needs adding to the
unit/Makefile