Skip to content

Make two helper functions available #1611

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/java_bytecode/java_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ std::string erase_type_arguments(const std::string &src)

/// Returns the full class name, skipping over the generics.
/// \param src: a type descriptor or signature
/// 1. Signature: Lcom/package/OuterClass<TT;>.Inner;
/// 1. Signature: Lcom/package/OuterClass<TT;>.Inner;
/// 2. Descriptor: Lcom.pacakge.OuterClass$Inner;
/// \return The full name of the class like com.package.OuterClass.Inner (for
/// both examples).
Expand Down
12 changes: 12 additions & 0 deletions src/java_bytecode/java_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,16 @@ to_java_specialized_generic_class_type(typet &type)
return static_cast<const java_specialized_generic_class_typet &>(type);
}

/// Take a signature string and remove everything in angle brackets allowing for
/// the type to be parsed normally, for example
/// `java.util.HashSet<java.lang.Integer>` will be turned into
/// `java.util.HashSet`
std::string erase_type_arguments(const std::string &src);
/// Returns the full class name, skipping over the generics. This turns any of
/// these:
/// 1. Signature: Lcom/package/OuterClass<TT;>.Inner;
/// 2. Descriptor: Lcom.pacakge.OuterClass$Inner;
/// into `com.package.OuterClass.Inner`
std::string gather_full_class_name(const std::string &src);

#endif // CPROVER_JAVA_BYTECODE_JAVA_TYPES_H