-
Notifications
You must be signed in to change notification settings - Fork 273
[TG-1633] Fix for inner generic types have incorrect type identifier #1698
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
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
Binary file modified
BIN
+184 Bytes
(100%)
unit/java_bytecode/java_bytecode_parse_generics/GenericClassWithGenericInnerClasses.class
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/*******************************************************************\ | ||
|
||
Module: Unit tests for java_types | ||
|
||
Author: DiffBlue Limited. All rights reserved. | ||
|
||
\*******************************************************************/ | ||
|
||
#include <testing-utils/catch.hpp> | ||
#include <java_types.h> | ||
|
||
SCENARIO("erase_type_arguments", "[core][java_types]") | ||
{ | ||
THEN( | ||
"erase_type_arguments should leave strings with no type arguments " | ||
"unaltered.") | ||
{ | ||
const std::string testInput1 = "testString1"; | ||
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. Nit - no need for a variable, give it as an input to the function directly as in the rest of the file. |
||
REQUIRE(erase_type_arguments(testInput1) == testInput1); | ||
} | ||
|
||
THEN("erase_type_arguments should remove a simple type argument") | ||
{ | ||
REQUIRE( | ||
erase_type_arguments("testClassName<testTypeArgument>") == | ||
"testClassName"); | ||
} | ||
|
||
THEN( | ||
"erase_type_arguments should remove multiple type arguments in cases " | ||
"of nested classes") | ||
{ | ||
REQUIRE( | ||
erase_type_arguments( | ||
"outerClass<testTypeArgument1>$" | ||
"innerClass<testTypeArgument2>") == "outerClass$innerClass"); | ||
} | ||
|
||
THEN( | ||
"erase_type_arguments should remove type arguments which contain nested " | ||
"type arguments") | ||
{ | ||
REQUIRE( | ||
erase_type_arguments( | ||
"outerClass<testTypeArgument1<testTypeArgument2>>") == "outerClass"); | ||
} | ||
|
||
THEN( | ||
"erase_type_arguments should remove multiple type arguments which contain " | ||
"nested type arguments in cases of nested classes") | ||
{ | ||
REQUIRE( | ||
erase_type_arguments( | ||
"outerClass<testTypeArgument1<testTypeArgument2>>$" | ||
"innerClass<testTypeArgument3<testTypeArgument4>>") == | ||
"outerClass$innerClass"); | ||
} | ||
|
||
THEN( | ||
"erase_type_arguments should throw an error if a type argument is " | ||
"unterminated") | ||
{ | ||
REQUIRE_THROWS_AS( | ||
erase_type_arguments( | ||
"testClassName<testTypeArgument1<testTypeArgument2>"), | ||
unsupported_java_class_signature_exceptiont &); | ||
} | ||
} |
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 writing a unit test for this specific function.
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.
Good point, the function only takes a string as an input so this should be easy to do.