refactor: comments/annotations for Java
Removes duplicate code to generate comments/annotations.
When generating comments, newlines are appended only if necessary, which
removes unnecessary newlines in the output.
Bug: none
Test: aidl_unittests
Change-Id: I1df1302300e07045bab4d02b0f61b21b1152b5ae
diff --git a/aidl_language.h b/aidl_language.h
index 54b6fc0..991bbe6 100644
--- a/aidl_language.h
+++ b/aidl_language.h
@@ -1050,7 +1050,7 @@
void DispatchVisit(AidlVisitor& v) const override { v.Visit(*this); }
};
-class AidlEnumerator : public AidlNode {
+class AidlEnumerator : public AidlNode, public AidlCommentable {
public:
AidlEnumerator(const AidlLocation& location, const std::string& name, AidlConstantValue* value,
const std::string& comments);
@@ -1064,7 +1064,6 @@
const std::string& GetName() const { return name_; }
AidlConstantValue* GetValue() const { return value_.get(); }
- const std::string& GetComments() const { return comments_; }
bool CheckValid(const AidlTypeSpecifier& enum_backing_type) const;
string ValueString(const AidlTypeSpecifier& backing_type,
@@ -1081,7 +1080,6 @@
private:
const std::string name_;
unique_ptr<AidlConstantValue> value_;
- const std::string comments_;
const bool value_user_specified_;
};