Commit d5475484 authored by Xianwen Chen's avatar Xianwen Chen

Revert "Implement comments support (#379)"

This reverts commit 0ee3da6c.
parent 0ee3da6c
...@@ -55,10 +55,6 @@ Djinni's input is an interface description file. Here's an example: ...@@ -55,10 +55,6 @@ Djinni's input is an interface description file. Here's an example:
store: set<string>; store: set<string>;
hash: map<string, i32>; hash: map<string, i32>;
// You can generate two types of comments
// - Code comments by using "// comment" in djinni files which will generate "// comment"
// - Code documentation by using "# comment" in djinni files which will generate "/** comment */"
// Both of those types support single and multi line comments
values: list<another_record>; values: list<another_record>;
# Comments can also be put here # Comments can also be put here
......
...@@ -9,7 +9,7 @@ sort_order = enum { ...@@ -9,7 +9,7 @@ sort_order = enum {
} }
sort_items = interface +c { sort_items = interface +c {
// For the iOS / Android demo # For the iOS / Android demo
sort(order: sort_order, items: item_list); sort(order: sort_order, items: item_list);
static create_with_listener(listener: textbox_listener): sort_items; static create_with_listener(listener: textbox_listener): sort_items;
......
...@@ -15,7 +15,7 @@ class SortItems { ...@@ -15,7 +15,7 @@ class SortItems {
public: public:
virtual ~SortItems() {} virtual ~SortItems() {}
// For the iOS / Android demo /** For the iOS / Android demo */
virtual void sort(sort_order order, const ItemList & items) = 0; virtual void sort(sort_order order, const ItemList & items) = 0;
static std::shared_ptr<SortItems> create_with_listener(const std::shared_ptr<TextboxListener> & listener); static std::shared_ptr<SortItems> create_with_listener(const std::shared_ptr<TextboxListener> & listener);
......
...@@ -8,7 +8,7 @@ import javax.annotation.CheckForNull; ...@@ -8,7 +8,7 @@ import javax.annotation.CheckForNull;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
/*package*/ interface SortItems { /*package*/ interface SortItems {
// For the iOS / Android demo /** For the iOS / Android demo */
public void sort(@Nonnull SortOrder order, @Nonnull ItemList items); public void sort(@Nonnull SortOrder order, @Nonnull ItemList items);
@CheckForNull @CheckForNull
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@interface TXSSortItems : NSObject @interface TXSSortItems : NSObject
// For the iOS / Android demo /** For the iOS / Android demo */
- (void)sort:(TXSSortOrder)order - (void)sort:(TXSSortOrder)order
items:(nonnull TXSItemList *)items; items:(nonnull TXSItemList *)items;
......
...@@ -35,13 +35,7 @@ class EnumValue(val ty: Ident, ident: Ident) extends Ident(ident.name, ident.fil ...@@ -35,13 +35,7 @@ class EnumValue(val ty: Ident, ident: Ident) extends Ident(ident.name, ident.fil
case class TypeParam(ident: Ident) case class TypeParam(ident: Ident)
case class Doc(comments: Seq[Comment]) case class Doc(lines: Seq[String])
abstract sealed class Comment {
val lines: Seq[String]
}
case class CodeComment(override val lines: Seq[String]) extends Comment
case class DocComment(override val lines: Seq[String]) extends Comment
sealed abstract class TypeDecl { sealed abstract class TypeDecl {
val ident: Ident val ident: Ident
......
...@@ -18,15 +18,12 @@ package djinni ...@@ -18,15 +18,12 @@ package djinni
import djinni.ast._ import djinni.ast._
import java.io._ import java.io._
import djinni.generatorTools._ import djinni.generatorTools._
import djinni.meta._ import djinni.meta._
import djinni.syntax.Error import djinni.syntax.Error
import djinni.writer.IndentWriter import djinni.writer.IndentWriter
import scala.language.implicitConversions import scala.language.implicitConversions
import scala.collection.mutable import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.util.matching.Regex import scala.util.matching.Regex
package object generatorTools { package object generatorTools {
...@@ -428,44 +425,22 @@ abstract class Generator(spec: Spec) ...@@ -428,44 +425,22 @@ abstract class Generator(spec: Spec)
def writeMethodDoc(w: IndentWriter, method: Interface.Method, ident: IdentConverter) { def writeMethodDoc(w: IndentWriter, method: Interface.Method, ident: IdentConverter) {
val paramReplacements = method.params.map(p => (s"\\b${Regex.quote(p.ident.name)}\\b", s"${ident(p.ident.name)}")) val paramReplacements = method.params.map(p => (s"\\b${Regex.quote(p.ident.name)}\\b", s"${ident(p.ident.name)}"))
val newDoc = Doc(method.doc.lines.map(l => {
val comments = ArrayBuffer[Comment]()
method.doc.comments.foreach({
case DocComment(lines) =>
val newDocComment = DocComment(lines.map(l => {
paramReplacements.foldLeft(l)((line, rep) => paramReplacements.foldLeft(l)((line, rep) =>
line.replaceAll(rep._1, rep._2)) line.replaceAll(rep._1, rep._2))
})) }))
comments += newDocComment
case CodeComment(lines) =>
comments += CodeComment(lines)
})
val newDoc = Doc(comments)
writeDoc(w, newDoc) writeDoc(w, newDoc)
} }
def writeDoc(w: IndentWriter, doc: Doc) { def writeDoc(w: IndentWriter, doc: Doc) {
doc.comments.foreach({ doc.lines.length match {
case DocComment(lines) =>
lines.length match {
case 0 => case 0 =>
case 1 => case 1 =>
w.wl(s"/**${lines.head} */") w.wl(s"/**${doc.lines.head} */")
case _ => case _ =>
w.wl("/**") w.wl("/**")
lines.foreach (l => w.wl(s" *$l")) doc.lines.foreach (l => w.wl(s" *$l"))
w.wl(" */") w.wl(" */")
} }
case CodeComment(lines) =>
lines.foreach (l => w.wl(s"//$l"))
})
} }
} }
...@@ -16,19 +16,16 @@ ...@@ -16,19 +16,16 @@
package djinni package djinni
import java.io.{File, FileInputStream, FileNotFoundException, InputStreamReader, Writer} import java.io.{File, FileNotFoundException, InputStreamReader, FileInputStream, Writer}
import djinni.ast.Interface.Method import djinni.ast.Interface.Method
import djinni.ast.Record.DerivingType.DerivingType import djinni.ast.Record.DerivingType.DerivingType
import djinni.syntax._ import djinni.syntax._
import djinni.ast._ import djinni.ast._
import java.util.{Map => JMap} import java.util.{Map => JMap}
import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.Yaml
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
import scala.collection.mutable import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.util.control.Breaks._ import scala.util.control.Breaks._
import scala.util.parsing.combinator.RegexParsers import scala.util.parsing.combinator.RegexParsers
import scala.util.parsing.input.{Position, Positional} import scala.util.parsing.input.{Position, Positional}
...@@ -208,57 +205,7 @@ private object IdlParser extends RegexParsers { ...@@ -208,57 +205,7 @@ private object IdlParser extends RegexParsers {
case (s, p) => Ident(s, fileStack.top, p) case (s, p) => Ident(s, fileStack.top, p)
} }
def doc: Parser[Doc] = rep(regex("""#[^\n\r]*""".r) | regex("""\/\/[^\n\r]*""".r)) ^^ { commentLines => def doc: Parser[Doc] = rep(regex("""#[^\n\r]*""".r) ^^ (_.substring(1))) ^^ Doc
val docCommentPrefix = "#"
val codeCommentPrefix = "//"
val comments = ArrayBuffer[Comment]()
commentLines.foreach( commentLine => {
if (commentLine.startsWith(docCommentPrefix)) { // DocComment
val commentText = commentLine.substring(docCommentPrefix.length)
if (comments.isEmpty) {
comments += DocComment(Seq(commentText))
} else {
comments.last match {
case DocComment(lines) =>
val newLines = lines :+ commentText
comments.remove(comments.length-1)
comments += DocComment(newLines)
case CodeComment(_) =>
comments += DocComment(Seq(commentText))
}
}
} else if (commentLine.startsWith(codeCommentPrefix)) { // CodeComment
val commentText = commentLine.substring(codeCommentPrefix.length)
if (comments.isEmpty) {
comments += CodeComment(Seq(commentText))
} else {
val commentText = commentLine.substring(codeCommentPrefix.length)
comments.last match {
case DocComment(_) =>
comments += CodeComment(Seq(commentText))
case CodeComment(lines) =>
val newLines = lines :+ commentText
comments.remove(comments.length-1)
comments += CodeComment(newLines)
}
}
}
})
Doc(comments)
}
def parens[T](inner: Parser[T]): Parser[T] = surround("(", ")", inner) def parens[T](inner: Parser[T]): Parser[T] = surround("(", ")", inner)
def typeList[T](inner: Parser[T]): Parser[Seq[T]] = surround("<", ">", rep1sepend(inner, ",")) | success(Seq.empty) def typeList[T](inner: Parser[T]): Parser[Seq[T]] = surround("<", ">", rep1sepend(inner, ",")) | success(Seq.empty)
......
// Record returned by a client # Record returned by a client
client_returned_record = record { client_returned_record = record {
record_id: i64; record_id: i64;
content: string; content: string;
misc: optional<string>; misc: optional<string>;
} }
// Client interface # Client interface
client_interface = interface +j +o { client_interface = interface +j +o {
// Testing code comments before documentation comments
# Returns record of given string # Returns record of given string
get_record(record_id: i64, utf8string: string, misc: optional<string>): client_returned_record; get_record(record_id: i64, utf8string: string, misc: optional<string>): client_returned_record;
identifier_check(data: binary, r: i32, jret: i64): f64; identifier_check(data: binary, r: i32, jret: i64): f64;
return_str(): string; return_str(): string;
# Testing documentation comments before code comments
// This method takes an interface
meth_taking_interface(i: client_interface): string; meth_taking_interface(i: client_interface): string;
meth_taking_optional_interface(i: optional<client_interface>): string; meth_taking_optional_interface(i: optional<client_interface>): string;
} }
...@@ -22,20 +19,7 @@ client_interface = interface +j +o { ...@@ -22,20 +19,7 @@ client_interface = interface +j +o {
reverse_client_interface = interface +c { reverse_client_interface = interface +c {
const return_str(): string; const return_str(): string;
// Testing code comments before documentation comments
// with multiple lines
// and another line
# Testing documentation comments after code comments
# with multiple lines
# and another line
meth_taking_interface(i: reverse_client_interface): string; meth_taking_interface(i: reverse_client_interface): string;
# Testing documentation comments before code comments
# with multiple lines
# and another line
// Testing code comments after documentation comments
// with multiple lines
// and another line
meth_taking_optional_interface(i: optional<reverse_client_interface>): string; meth_taking_optional_interface(i: optional<reverse_client_interface>): string;
static create(): reverse_client_interface; static create(): reverse_client_interface;
......
// enum for use in constants # enum for use in constants
constant_enum = enum { constant_enum = enum {
some_value; some_value;
some_other_value; some_other_value;
......
...@@ -8,14 +8,10 @@ constant_record = record { ...@@ -8,14 +8,10 @@ constant_record = record {
constants = record { constants = record {
# bool_constant has documentation. # bool_constant has documentation.
const bool_constant: bool = true; const bool_constant: bool = true;
// i8_constant has a comment
const i8_constant: i8 = 1; const i8_constant: i8 = 1;
const i16_constant: i16 = 2; const i16_constant: i16 = 2;
const i32_constant: i32 = 3; const i32_constant: i32 = 3;
const i64_constant: i64 = 4; const i64_constant: i64 = 4;
// f64_constant has a long comment.
// (Second line of multi-line comment.
// Indented third line of multi-line comment.)
const f32_constant: f32 = 5.0; const f32_constant: f32 = 5.0;
# f64_constant has long documentation. # f64_constant has long documentation.
# (Second line of multi-line documentation. # (Second line of multi-line documentation.
...@@ -43,7 +39,7 @@ constants = record { ...@@ -43,7 +39,7 @@ constants = record {
}; };
# No support for null optional constants # No support for null optional constants
// No support for optional constant records # No support for optional constant records
# No support for constant binary, list, set, map # No support for constant binary, list, set, map
const dummy: bool = false; const dummy: bool = false;
...@@ -83,9 +79,9 @@ constants_interface = interface +c { ...@@ -83,9 +79,9 @@ constants_interface = interface +c {
some_string = string_constant some_string = string_constant
}; };
// No support for null optional constants # No support for null optional constants
# No support for optional constant records # No support for optional constant records
// No support for constant binary, list, set, map # No support for constant binary, list, set, map
dummy(); dummy();
} }
...@@ -2,9 +2,6 @@ color = enum { ...@@ -2,9 +2,6 @@ color = enum {
red; red;
orange; orange;
yellow; yellow;
// "It is customary to list indigo as a color lying between blue and violet, but it has
// never seemed to me that indigo is worth the dignity of being considered a separate
// color. To my eyes it seems merely deep blue." --Isaac Asimov
green; green;
blue; blue;
# "It is customary to list indigo as a color lying between blue and violet, but it has # "It is customary to list indigo as a color lying between blue and violet, but it has
......
...@@ -3,7 +3,7 @@ first_listener = interface +o { ...@@ -3,7 +3,7 @@ first_listener = interface +o {
first(); first();
} }
// Used for ObjC multiple inheritance tests # Used for ObjC multiple inheritance tests
second_listener = interface +o { second_listener = interface +o {
second(); second();
} }
...@@ -25,7 +25,7 @@ return_one = interface +c { ...@@ -25,7 +25,7 @@ return_one = interface +c {
return_one(): i8; return_one(): i8;
} }
// Used for C++ multiple inheritance tests # Used for C++ multiple inheritance tests
return_two = interface +c { return_two = interface +c {
static get_instance(): return_two; static get_instance(): return_two;
return_two(): i8; return_two(): i8;
......
...@@ -8,8 +8,6 @@ extern_record_with_derivings = record ...@@ -8,8 +8,6 @@ extern_record_with_derivings = record
e: test_color; e: test_color;
} deriving(eq, ord) } deriving(eq, ord)
// This file tests YAML dumped by Djinni can be parsed back in
extern_interface_1 = interface +c extern_interface_1 = interface +c
{ {
foo(i: test_client_interface): test_client_returned_record; foo(i: test_client_interface): test_client_returned_record;
......
...@@ -13,12 +13,11 @@ namespace testsuite { ...@@ -13,12 +13,11 @@ namespace testsuite {
struct ClientReturnedRecord; struct ClientReturnedRecord;
// Client interface /** Client interface */
class ClientInterface { class ClientInterface {
public: public:
virtual ~ClientInterface() {} virtual ~ClientInterface() {}
// Testing code comments before documentation comments
/** Returns record of given string */ /** Returns record of given string */
virtual ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string, const std::experimental::optional<std::string> & misc) = 0; virtual ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string, const std::experimental::optional<std::string> & misc) = 0;
...@@ -26,8 +25,6 @@ public: ...@@ -26,8 +25,6 @@ public:
virtual std::string return_str() = 0; virtual std::string return_str() = 0;
/** Testing documentation comments before code comments */
// This method takes an interface
virtual std::string meth_taking_interface(const std::shared_ptr<ClientInterface> & i) = 0; virtual std::string meth_taking_interface(const std::shared_ptr<ClientInterface> & i) = 0;
virtual std::string meth_taking_optional_interface(const std::shared_ptr<ClientInterface> & i) = 0; virtual std::string meth_taking_optional_interface(const std::shared_ptr<ClientInterface> & i) = 0;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace testsuite { namespace testsuite {
// Record returned by a client /** Record returned by a client */
struct ClientReturnedRecord final { struct ClientReturnedRecord final {
int64_t record_id; int64_t record_id;
std::string content; std::string content;
......
...@@ -11,9 +11,6 @@ enum class color : int { ...@@ -11,9 +11,6 @@ enum class color : int {
RED, RED,
ORANGE, ORANGE,
YELLOW, YELLOW,
// "It is customary to list indigo as a color lying between blue and violet, but it has
// never seemed to me that indigo is worth the dignity of being considered a separate
// color. To my eyes it seems merely deep blue." --Isaac Asimov
GREEN, GREEN,
BLUE, BLUE,
/** /**
......
...@@ -17,7 +17,6 @@ struct Constants final { ...@@ -17,7 +17,6 @@ struct Constants final {
/** bool_constant has documentation. */ /** bool_constant has documentation. */
static constexpr bool BOOL_CONSTANT = true; static constexpr bool BOOL_CONSTANT = true;
// i8_constant has a comment
static constexpr int8_t I8_CONSTANT = 1; static constexpr int8_t I8_CONSTANT = 1;
static constexpr int16_t I16_CONSTANT = 2; static constexpr int16_t I16_CONSTANT = 2;
...@@ -26,9 +25,6 @@ struct Constants final { ...@@ -26,9 +25,6 @@ struct Constants final {
static constexpr int64_t I64_CONSTANT = 4; static constexpr int64_t I64_CONSTANT = 4;
// f64_constant has a long comment.
// (Second line of multi-line comment.
// Indented third line of multi-line comment.)
static constexpr float F32_CONSTANT = 5.0f; static constexpr float F32_CONSTANT = 5.0f;
/** /**
...@@ -64,9 +60,11 @@ struct Constants final { ...@@ -64,9 +60,11 @@ struct Constants final {
static ConstantRecord const OBJECT_CONSTANT; static ConstantRecord const OBJECT_CONSTANT;
/** No support for null optional constants */ /**
// No support for optional constant records * No support for null optional constants
/** No support for constant binary, list, set, map */ * No support for optional constant records
* No support for constant binary, list, set, map
*/
static constexpr bool DUMMY = false; static constexpr bool DUMMY = false;
}; };
......
...@@ -62,9 +62,11 @@ public: ...@@ -62,9 +62,11 @@ public:
static ConstantRecord const OBJECT_CONSTANT; static ConstantRecord const OBJECT_CONSTANT;
// No support for null optional constants /**
/** No support for optional constant records */ * No support for null optional constants
// No support for constant binary, list, set, map * No support for optional constant records
* No support for constant binary, list, set, map
*/
virtual void dummy() = 0; virtual void dummy() = 0;
}; };
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "client_returned_record.hpp" #include "client_returned_record.hpp"
#include <memory> #include <memory>
// This file tests YAML dumped by Djinni can be parsed back in
class ExternInterface1 { class ExternInterface1 {
public: public:
virtual ~ExternInterface1() {} virtual ~ExternInterface1() {}
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace testsuite { namespace testsuite {
// Used for C++ multiple inheritance tests /** Used for C++ multiple inheritance tests */
class ReturnTwo { class ReturnTwo {
public: public:
virtual ~ReturnTwo() {} virtual ~ReturnTwo() {}
......
...@@ -15,24 +15,8 @@ public: ...@@ -15,24 +15,8 @@ public:
virtual std::string return_str() const = 0; virtual std::string return_str() const = 0;
// Testing code comments before documentation comments
// with multiple lines
// and another line
/**
* Testing documentation comments after code comments
* with multiple lines
* and another line
*/
virtual std::string meth_taking_interface(const std::shared_ptr<ReverseClientInterface> & i) = 0; virtual std::string meth_taking_interface(const std::shared_ptr<ReverseClientInterface> & i) = 0;
/**
* Testing documentation comments before code comments
* with multiple lines
* and another line
*/
// Testing code comments after documentation comments
// with multiple lines
// and another line
virtual std::string meth_taking_optional_interface(const std::shared_ptr<ReverseClientInterface> & i) = 0; virtual std::string meth_taking_optional_interface(const std::shared_ptr<ReverseClientInterface> & i) = 0;
static std::shared_ptr<ReverseClientInterface> create(); static std::shared_ptr<ReverseClientInterface> create();
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
namespace testsuite { namespace testsuite {
// Used for ObjC multiple inheritance tests /** Used for ObjC multiple inheritance tests */
class SecondListener { class SecondListener {
public: public:
virtual ~SecondListener() {} virtual ~SecondListener() {}
......
...@@ -6,9 +6,8 @@ package com.dropbox.djinni.test; ...@@ -6,9 +6,8 @@ package com.dropbox.djinni.test;
import javax.annotation.CheckForNull; import javax.annotation.CheckForNull;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
// Client interface /** Client interface */
public interface ClientInterface { public interface ClientInterface {
// Testing code comments before documentation comments
/** Returns record of given string */ /** Returns record of given string */
@Nonnull @Nonnull
public ClientReturnedRecord getRecord(long recordId, @Nonnull String utf8string, @CheckForNull String misc); public ClientReturnedRecord getRecord(long recordId, @Nonnull String utf8string, @CheckForNull String misc);
...@@ -18,8 +17,6 @@ public interface ClientInterface { ...@@ -18,8 +17,6 @@ public interface ClientInterface {
@Nonnull @Nonnull
public String returnStr(); public String returnStr();
/** Testing documentation comments before code comments */
// This method takes an interface
@Nonnull @Nonnull
public String methTakingInterface(@CheckForNull ClientInterface i); public String methTakingInterface(@CheckForNull ClientInterface i);
......
...@@ -6,7 +6,7 @@ package com.dropbox.djinni.test; ...@@ -6,7 +6,7 @@ package com.dropbox.djinni.test;
import javax.annotation.CheckForNull; import javax.annotation.CheckForNull;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
// Record returned by a client /** Record returned by a client */
public class ClientReturnedRecord { public class ClientReturnedRecord {
......
...@@ -10,9 +10,6 @@ public enum Color { ...@@ -10,9 +10,6 @@ public enum Color {
RED, RED,
ORANGE, ORANGE,
YELLOW, YELLOW,
// "It is customary to list indigo as a color lying between blue and violet, but it has
// never seemed to me that indigo is worth the dignity of being considered a separate
// color. To my eyes it seems merely deep blue." --Isaac Asimov
GREEN, GREEN,
BLUE, BLUE,
/** /**
......
...@@ -6,7 +6,7 @@ package com.dropbox.djinni.test; ...@@ -6,7 +6,7 @@ package com.dropbox.djinni.test;
import javax.annotation.CheckForNull; import javax.annotation.CheckForNull;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
// enum for use in constants /** enum for use in constants */
public enum ConstantEnum { public enum ConstantEnum {
SOME_VALUE, SOME_VALUE,
SOME_OTHER_VALUE, SOME_OTHER_VALUE,
......
...@@ -12,7 +12,6 @@ public class Constants { ...@@ -12,7 +12,6 @@ public class Constants {
/** bool_constant has documentation. */ /** bool_constant has documentation. */
public static final boolean BOOL_CONSTANT = true; public static final boolean BOOL_CONSTANT = true;
// i8_constant has a comment
public static final byte I8_CONSTANT = 1; public static final byte I8_CONSTANT = 1;
public static final short I16_CONSTANT = 2; public static final short I16_CONSTANT = 2;
...@@ -21,9 +20,6 @@ public class Constants { ...@@ -21,9 +20,6 @@ public class Constants {
public static final long I64_CONSTANT = 4l; public static final long I64_CONSTANT = 4l;
// f64_constant has a long comment.
// (Second line of multi-line comment.
// Indented third line of multi-line comment.)
public static final float F32_CONSTANT = 5.0f; public static final float F32_CONSTANT = 5.0f;
/** /**
...@@ -71,9 +67,11 @@ public class Constants { ...@@ -71,9 +67,11 @@ public class Constants {
I32_CONSTANT /* mSomeInteger */ , I32_CONSTANT /* mSomeInteger */ ,
STRING_CONSTANT /* mSomeString */ ); STRING_CONSTANT /* mSomeString */ );
/** No support for null optional constants */ /**
// No support for optional constant records * No support for null optional constants
/** No support for constant binary, list, set, map */ * No support for optional constant records
* No support for constant binary, list, set, map
*/
public static final boolean DUMMY = false; public static final boolean DUMMY = false;
......
...@@ -67,9 +67,11 @@ public interface ConstantsInterface { ...@@ -67,9 +67,11 @@ public interface ConstantsInterface {
I32_CONSTANT /* mSomeInteger */ , I32_CONSTANT /* mSomeInteger */ ,
STRING_CONSTANT /* mSomeString */ ); STRING_CONSTANT /* mSomeString */ );
// No support for null optional constants /**
/** No support for optional constant records */ * No support for null optional constants
// No support for constant binary, list, set, map * No support for optional constant records
* No support for constant binary, list, set, map
*/
public void dummy(); public void dummy();
static final class CppProxy implements ConstantsInterface static final class CppProxy implements ConstantsInterface
......
...@@ -5,7 +5,6 @@ package com.dropbox.djinni.test; ...@@ -5,7 +5,6 @@ package com.dropbox.djinni.test;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
// This file tests YAML dumped by Djinni can be parsed back in
public interface ExternInterface1 { public interface ExternInterface1 {
public com.dropbox.djinni.test.ClientReturnedRecord foo(com.dropbox.djinni.test.ClientInterface i); public com.dropbox.djinni.test.ClientReturnedRecord foo(com.dropbox.djinni.test.ClientInterface i);
......
...@@ -7,7 +7,7 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -7,7 +7,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.CheckForNull; import javax.annotation.CheckForNull;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
// Used for C++ multiple inheritance tests /** Used for C++ multiple inheritance tests */
public interface ReturnTwo { public interface ReturnTwo {
public byte returnTwo(); public byte returnTwo();
......
...@@ -11,25 +11,9 @@ public interface ReverseClientInterface { ...@@ -11,25 +11,9 @@ public interface ReverseClientInterface {
@Nonnull @Nonnull
public String returnStr(); public String returnStr();
// Testing code comments before documentation comments
// with multiple lines
// and another line
/**
* Testing documentation comments after code comments
* with multiple lines
* and another line
*/
@Nonnull @Nonnull
public String methTakingInterface(@CheckForNull ReverseClientInterface i); public String methTakingInterface(@CheckForNull ReverseClientInterface i);
/**
* Testing documentation comments before code comments
* with multiple lines
* and another line
*/
// Testing code comments after documentation comments
// with multiple lines
// and another line
@Nonnull @Nonnull
public String methTakingOptionalInterface(@CheckForNull ReverseClientInterface i); public String methTakingOptionalInterface(@CheckForNull ReverseClientInterface i);
......
...@@ -6,7 +6,7 @@ package com.dropbox.djinni.test; ...@@ -6,7 +6,7 @@ package com.dropbox.djinni.test;
import javax.annotation.CheckForNull; import javax.annotation.CheckForNull;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
// Used for ObjC multiple inheritance tests /** Used for ObjC multiple inheritance tests */
public interface SecondListener { public interface SecondListener {
public void second(); public void second();
} }
...@@ -6,10 +6,9 @@ ...@@ -6,10 +6,9 @@
@protocol DBClientInterface; @protocol DBClientInterface;
// Client interface /** Client interface */
@protocol DBClientInterface @protocol DBClientInterface
// Testing code comments before documentation comments
/** Returns record of given string */ /** Returns record of given string */
- (nonnull DBClientReturnedRecord *)getRecord:(int64_t)recordId - (nonnull DBClientReturnedRecord *)getRecord:(int64_t)recordId
utf8string:(nonnull NSString *)utf8string utf8string:(nonnull NSString *)utf8string
...@@ -21,8 +20,6 @@ ...@@ -21,8 +20,6 @@
- (nonnull NSString *)returnStr; - (nonnull NSString *)returnStr;
/** Testing documentation comments before code comments */
// This method takes an interface
- (nonnull NSString *)methTakingInterface:(nullable id<DBClientInterface>)i; - (nonnull NSString *)methTakingInterface:(nullable id<DBClientInterface>)i;
- (nonnull NSString *)methTakingOptionalInterface:(nullable id<DBClientInterface>)i; - (nonnull NSString *)methTakingOptionalInterface:(nullable id<DBClientInterface>)i;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
// Record returned by a client /** Record returned by a client */
@interface DBClientReturnedRecord : NSObject @interface DBClientReturnedRecord : NSObject
- (nonnull instancetype)initWithRecordId:(int64_t)recordId - (nonnull instancetype)initWithRecordId:(int64_t)recordId
content:(nonnull NSString *)content content:(nonnull NSString *)content
......
...@@ -8,9 +8,6 @@ typedef NS_ENUM(NSInteger, DBColor) ...@@ -8,9 +8,6 @@ typedef NS_ENUM(NSInteger, DBColor)
DBColorRed, DBColorRed,
DBColorOrange, DBColorOrange,
DBColorYellow, DBColorYellow,
// "It is customary to list indigo as a color lying between blue and violet, but it has
// never seemed to me that indigo is worth the dignity of being considered a separate
// color. To my eyes it seems merely deep blue." --Isaac Asimov
DBColorGreen, DBColorGreen,
DBColorBlue, DBColorBlue,
/** /**
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
// enum for use in constants /** enum for use in constants */
typedef NS_ENUM(NSInteger, DBConstantEnum) typedef NS_ENUM(NSInteger, DBConstantEnum)
{ {
DBConstantEnumSomeValue, DBConstantEnumSomeValue,
......
...@@ -27,14 +27,10 @@ ...@@ -27,14 +27,10 @@
/** bool_constant has documentation. */ /** bool_constant has documentation. */
extern BOOL const DBConstantsBoolConstant; extern BOOL const DBConstantsBoolConstant;
// i8_constant has a comment
extern int8_t const DBConstantsI8Constant; extern int8_t const DBConstantsI8Constant;
extern int16_t const DBConstantsI16Constant; extern int16_t const DBConstantsI16Constant;
extern int32_t const DBConstantsI32Constant; extern int32_t const DBConstantsI32Constant;
extern int64_t const DBConstantsI64Constant; extern int64_t const DBConstantsI64Constant;
// f64_constant has a long comment.
// (Second line of multi-line comment.
// Indented third line of multi-line comment.)
extern float const DBConstantsF32Constant; extern float const DBConstantsF32Constant;
/** /**
* f64_constant has long documentation. * f64_constant has long documentation.
...@@ -44,7 +40,9 @@ extern float const DBConstantsF32Constant; ...@@ -44,7 +40,9 @@ extern float const DBConstantsF32Constant;
extern double const DBConstantsF64Constant; extern double const DBConstantsF64Constant;
extern NSString * __nonnull const DBConstantsStringConstant; extern NSString * __nonnull const DBConstantsStringConstant;
extern NSString * __nullable const DBConstantsOptStringConstant; extern NSString * __nullable const DBConstantsOptStringConstant;
/** No support for null optional constants */ /**
// No support for optional constant records * No support for null optional constants
/** No support for constant binary, list, set, map */ * No support for optional constant records
* No support for constant binary, list, set, map
*/
extern BOOL const DBConstantsDummy; extern BOOL const DBConstantsDummy;
...@@ -23,9 +23,11 @@ extern NSString * __nullable const DBConstantsInterfaceOptStringConstant; ...@@ -23,9 +23,11 @@ extern NSString * __nullable const DBConstantsInterfaceOptStringConstant;
/** Interface containing constants */ /** Interface containing constants */
@interface DBConstantsInterface : NSObject @interface DBConstantsInterface : NSObject
// No support for null optional constants /**
/** No support for optional constant records */ * No support for null optional constants
// No support for constant binary, list, set, map * No support for optional constant records
* No support for constant binary, list, set, map
*/
- (void)dummy; - (void)dummy;
+ (NSNumber * __nullable)optBoolConstant; + (NSNumber * __nullable)optBoolConstant;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
// This file tests YAML dumped by Djinni can be parsed back in
@interface DBExternInterface1 : NSObject @interface DBExternInterface1 : NSObject
- (nonnull DBClientReturnedRecord *)foo:(nullable id<DBClientInterface>)i; - (nonnull DBClientReturnedRecord *)foo:(nullable id<DBClientInterface>)i;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
@class DBReturnTwo; @class DBReturnTwo;
// Used for C++ multiple inheritance tests /** Used for C++ multiple inheritance tests */
@interface DBReturnTwo : NSObject @interface DBReturnTwo : NSObject
+ (nullable DBReturnTwo *)getInstance; + (nullable DBReturnTwo *)getInstance;
......
...@@ -9,24 +9,8 @@ ...@@ -9,24 +9,8 @@
- (nonnull NSString *)returnStr; - (nonnull NSString *)returnStr;
// Testing code comments before documentation comments
// with multiple lines
// and another line
/**
* Testing documentation comments after code comments
* with multiple lines
* and another line
*/
- (nonnull NSString *)methTakingInterface:(nullable DBReverseClientInterface *)i; - (nonnull NSString *)methTakingInterface:(nullable DBReverseClientInterface *)i;
/**
* Testing documentation comments before code comments
* with multiple lines
* and another line
*/
// Testing code comments after documentation comments
// with multiple lines
// and another line
- (nonnull NSString *)methTakingOptionalInterface:(nullable DBReverseClientInterface *)i; - (nonnull NSString *)methTakingOptionalInterface:(nullable DBReverseClientInterface *)i;
+ (nullable DBReverseClientInterface *)create; + (nullable DBReverseClientInterface *)create;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
// Used for ObjC multiple inheritance tests /** Used for ObjC multiple inheritance tests */
@protocol DBSecondListener @protocol DBSecondListener
- (void)second; - (void)second;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment