summaryrefslogtreecommitdiff
path: root/tools/aapt2/java
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2018-10-01 23:37:31 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-10-01 23:37:31 +0000
commit20ecc6397b33b39700e2de4dae14be5398bbc007 (patch)
treeabdd972f8bc78c2378864f6b28b5ece4006685b4 /tools/aapt2/java
parent417b7b14bb0f3f3e5e0ad2e46848230e944a7ae9 (diff)
parent9ba5cb4796a66b387af1f9350134f742f490aa7f (diff)
Merge "Do not use StringPiece in ExtractJavaIdentifier"
Diffstat (limited to 'tools/aapt2/java')
-rw-r--r--tools/aapt2/java/ManifestClassGenerator.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/aapt2/java/ManifestClassGenerator.cpp b/tools/aapt2/java/ManifestClassGenerator.cpp
index be67c9c8c03c..10e504ec0752 100644
--- a/tools/aapt2/java/ManifestClassGenerator.cpp
+++ b/tools/aapt2/java/ManifestClassGenerator.cpp
@@ -26,21 +26,20 @@
#include "util/Maybe.h"
#include "xml/XmlDom.h"
-using ::android::StringPiece;
using ::aapt::text::IsJavaIdentifier;
namespace aapt {
-static Maybe<StringPiece> ExtractJavaIdentifier(IDiagnostics* diag, const Source& source,
+static Maybe<std::string> ExtractJavaIdentifier(IDiagnostics* diag, const Source& source,
const std::string& value) {
- StringPiece result = value;
+ std::string result = value;
size_t pos = value.rfind('.');
if (pos != std::string::npos) {
result = result.substr(pos + 1);
}
// Normalize only the java identifier, leave the original value unchanged.
- if (result.contains("-")) {
+ if (result.find("-") != std::string::npos) {
result = JavaClassGenerator::TransformToFieldName(result);
}
@@ -64,7 +63,7 @@ static bool WriteSymbol(const Source& source, IDiagnostics* diag, xml::Element*
return false;
}
- Maybe<StringPiece> result =
+ Maybe<std::string> result =
ExtractJavaIdentifier(diag, source.WithLine(el->line_number), attr->value);
if (!result) {
return false;