Skip to content
Merged
Changes from 1 commit
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
16 changes: 11 additions & 5 deletions src/java_bytecode/generate_java_generic_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@
// qualifiers, or the type as it was passed otherwise.
static std::string pretty_print_java_type(const std::string &fqn_java_type)
{
const std::string java_lang("java::java.lang.");
const std::string package_name(java_class_to_package(fqn_java_type) + ".");
if(package_name == java_lang)
return fqn_java_type.substr(java_lang.length());
return fqn_java_type;
std::string result;
const std::string java_cbmc_string("java::");
// Remove the java internal cbmc identifier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This should probably be Remove the CBMC internal java identifier

if(fqn_java_type.substr(0, java_cbmc_string.length()) == java_cbmc_string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use util/prefix.h

result = fqn_java_type.substr(java_cbmc_string.length());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use has_prefix from util here

// If the remaining has the "java.lang." string as well, trim it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please precise similar to "If the class is in package java.lang strip package name due to default import"

const std::string java_lang_string("java.lang.");
const std::string package_name(java_class_to_package(result) + ".");
if(package_name == java_lang_string)
result = result.substr(java_lang_string.length());
return result;
}

generate_java_generic_typet::generate_java_generic_typet(
Expand Down