From 6cd7f3b729b652bc182298a15e0950fe8c9e7678 Mon Sep 17 00:00:00 2001 From: Jun Luo <4catcode@gmail.com> Date: Wed, 15 May 2024 19:27:38 +0800 Subject: [PATCH] Java: show the XDR source code in the javadoc (#196) --- lib/xdrgen/generators/java.rb | 26 ++++--- .../block_comments.x/AccountFlags.java | 17 ++-- .../const.x/TestArray.java | 11 +-- .../const.x/TestArray2.java | 11 +-- .../generator_spec_java/enum.x/Color.java | 19 ++--- .../generator_spec_java/enum.x/Color2.java | 19 ++--- .../enum.x/MessageType.java | 55 ++++++------- .../generator_spec_java/nesting.x/Foo.java | 11 +-- .../nesting.x/MyUnion.java | 58 +++++++++----- .../nesting.x/UnionKey.java | 19 ++--- .../generator_spec_java/optional.x/Arr.java | 11 +-- .../optional.x/HasOptions.java | 21 ++--- .../generator_spec_java/struct.x/Int64.java | 11 +-- .../struct.x/MyStruct.java | 25 +++--- .../generator_spec_java/test.x/Color.java | 19 ++--- .../generator_spec_java/test.x/HasStuff.java | 17 ++-- .../generator_spec_java/test.x/Hash.java | 11 +-- .../generator_spec_java/test.x/Hashes1.java | 11 +-- .../generator_spec_java/test.x/Hashes2.java | 11 +-- .../generator_spec_java/test.x/Hashes3.java | 11 +-- .../generator_spec_java/test.x/Int1.java | 11 +-- .../generator_spec_java/test.x/Int2.java | 11 +-- .../generator_spec_java/test.x/Int3.java | 11 +-- .../generator_spec_java/test.x/Int4.java | 11 +-- .../test.x/LotsOfMyStructs.java | 17 ++-- .../generator_spec_java/test.x/MyStruct.java | 29 +++---- .../generator_spec_java/test.x/Nester.java | 77 +++++++++++++------ .../generator_spec_java/test.x/OptHash1.java | 11 +-- .../generator_spec_java/test.x/OptHash2.java | 11 +-- .../generator_spec_java/test.x/Str.java | 11 +-- .../generator_spec_java/test.x/Str2.java | 11 +-- .../generator_spec_java/test.x/Uint512.java | 11 +-- .../generator_spec_java/test.x/Uint513.java | 11 +-- .../generator_spec_java/test.x/Uint514.java | 11 +-- .../generator_spec_java/union.x/Error.java | 11 +-- .../generator_spec_java/union.x/IntUnion.java | 25 +++--- .../union.x/IntUnion2.java | 11 +-- .../generator_spec_java/union.x/Multi.java | 11 +-- .../generator_spec_java/union.x/MyUnion.java | 27 +++---- .../generator_spec_java/union.x/UnionKey.java | 17 ++-- 40 files changed, 414 insertions(+), 326 deletions(-) diff --git a/lib/xdrgen/generators/java.rb b/lib/xdrgen/generators/java.rb index f8621674d..e1562cf32 100644 --- a/lib/xdrgen/generators/java.rb +++ b/lib/xdrgen/generators/java.rb @@ -138,6 +138,7 @@ def render_definition(defn, constants_container) def render_nested_definitions(defn, out, post_name="implements XdrElement") return unless defn.respond_to? :nested_definitions defn.nested_definitions.each{|ndefn| + render_source_comment out, ndefn case ndefn when AST::Definitions::Struct ; name = name ndefn @@ -699,17 +700,12 @@ def render_top_matter(out) def render_source_comment(out, defn) return if defn.is_a?(AST::Definitions::Namespace) - out.puts <<-EOS.strip_heredoc - // === xdr source ============================================================ - - EOS - - out.puts "// " + defn.text_value.split("\n").join("\n// ") - - out.puts <<-EOS.strip_heredoc - - // =========================================================================== - EOS + out.puts "/**" + out.puts " * #{name defn}'s original definition in the XDR file is:" + out.puts " *
"
+        out.puts " * " + escape_html(defn.text_value).split("\n").join("\n * ")
+        out.puts " * 
" + out.puts " */" end def render_base64(return_type, out) @@ -961,6 +957,14 @@ def name(named) def name_string(name) name.camelize end + + def escape_html(value) + value.to_s + .gsub('&', '&') + .gsub('<', '<') + .gsub('>', '>') + .gsub('*', '*') # to avoid encountering`*/` + end end end end diff --git a/spec/output/generator_spec_java/block_comments.x/AccountFlags.java b/spec/output/generator_spec_java/block_comments.x/AccountFlags.java index 2b4fee010..5da6b929d 100644 --- a/spec/output/generator_spec_java/block_comments.x/AccountFlags.java +++ b/spec/output/generator_spec_java/block_comments.x/AccountFlags.java @@ -10,14 +10,15 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -// === xdr source ============================================================ - -// enum AccountFlags -// { // masks for each flag -// AUTH_REQUIRED_FLAG = 0x1 -// }; - -// =========================================================================== +/** + * AccountFlags's original definition in the XDR file is: + *
+ * enum AccountFlags
+ * { // masks for each flag
+ *     AUTH_REQUIRED_FLAG = 0x1
+ * };
+ * 
+ */ public enum AccountFlags implements XdrElement { AUTH_REQUIRED_FLAG(1), ; diff --git a/spec/output/generator_spec_java/const.x/TestArray.java b/spec/output/generator_spec_java/const.x/TestArray.java index 684dcacaf..d7cd318e8 100644 --- a/spec/output/generator_spec_java/const.x/TestArray.java +++ b/spec/output/generator_spec_java/const.x/TestArray.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef int TestArray[FOO]; - -// =========================================================================== +/** + * TestArray's original definition in the XDR file is: + *
+ * typedef int TestArray[FOO];
+ * 
+ */ public class TestArray implements XdrElement { private Integer[] TestArray; diff --git a/spec/output/generator_spec_java/const.x/TestArray2.java b/spec/output/generator_spec_java/const.x/TestArray2.java index 887d18210..ba2fe8cfc 100644 --- a/spec/output/generator_spec_java/const.x/TestArray2.java +++ b/spec/output/generator_spec_java/const.x/TestArray2.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef int TestArray2; - -// =========================================================================== +/** + * TestArray2's original definition in the XDR file is: + *
+ * typedef int TestArray2<FOO>;
+ * 
+ */ public class TestArray2 implements XdrElement { private Integer[] TestArray2; diff --git a/spec/output/generator_spec_java/enum.x/Color.java b/spec/output/generator_spec_java/enum.x/Color.java index 9e9c6e66c..546993fa8 100644 --- a/spec/output/generator_spec_java/enum.x/Color.java +++ b/spec/output/generator_spec_java/enum.x/Color.java @@ -10,15 +10,16 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -// === xdr source ============================================================ - -// enum Color { -// RED=0, -// GREEN=1, -// BLUE=2 -// }; - -// =========================================================================== +/** + * Color's original definition in the XDR file is: + *
+ * enum Color {
+ *     RED=0,  
+ *     GREEN=1,  
+ *     BLUE=2  
+ * };
+ * 
+ */ public enum Color implements XdrElement { RED(0), GREEN(1), diff --git a/spec/output/generator_spec_java/enum.x/Color2.java b/spec/output/generator_spec_java/enum.x/Color2.java index 8232789a9..9662817a0 100644 --- a/spec/output/generator_spec_java/enum.x/Color2.java +++ b/spec/output/generator_spec_java/enum.x/Color2.java @@ -10,15 +10,16 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -// === xdr source ============================================================ - -// enum Color2 { -// RED2=RED, -// GREEN2=1, -// BLUE2=2 -// }; - -// =========================================================================== +/** + * Color2's original definition in the XDR file is: + *
+ * enum Color2 {
+ *     RED2=RED,  
+ *     GREEN2=1,  
+ *     BLUE2=2  
+ * };
+ * 
+ */ public enum Color2 implements XdrElement { RED2(0), GREEN2(1), diff --git a/spec/output/generator_spec_java/enum.x/MessageType.java b/spec/output/generator_spec_java/enum.x/MessageType.java index 53dbf9ddf..f2be344cc 100644 --- a/spec/output/generator_spec_java/enum.x/MessageType.java +++ b/spec/output/generator_spec_java/enum.x/MessageType.java @@ -10,33 +10,34 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -// === xdr source ============================================================ - -// enum MessageType -// { -// ERROR_MSG, -// HELLO, -// DONT_HAVE, -// -// GET_PEERS, // gets a list of peers this guy knows about -// PEERS, -// -// GET_TX_SET, // gets a particular txset by hash -// TX_SET, -// -// GET_VALIDATIONS, // gets validations for a given ledger hash -// VALIDATIONS, -// -// TRANSACTION, //pass on a tx you have heard about -// JSON_TRANSACTION, -// -// // FBA -// GET_FBA_QUORUMSET, -// FBA_QUORUMSET, -// FBA_MESSAGE -// }; - -// =========================================================================== +/** + * MessageType's original definition in the XDR file is: + *
+ * enum MessageType
+ * {
+ *     ERROR_MSG,    
+ *     HELLO,
+ *     DONT_HAVE,
+ * 
+ *     GET_PEERS,   // gets a list of peers this guy knows about        
+ *     PEERS,
+ * 
+ *     GET_TX_SET,  // gets a particular txset by hash        
+ *     TX_SET,    
+ * 
+ *     GET_VALIDATIONS, // gets validations for a given ledger hash        
+ *     VALIDATIONS,    
+ * 
+ *     TRANSACTION, //pass on a tx you have heard about        
+ *     JSON_TRANSACTION,
+ * 
+ *     // FBA        
+ *     GET_FBA_QUORUMSET,        
+ *     FBA_QUORUMSET,    
+ *     FBA_MESSAGE
+ * };
+ * 
+ */ public enum MessageType implements XdrElement { ERROR_MSG(0), HELLO(1), diff --git a/spec/output/generator_spec_java/nesting.x/Foo.java b/spec/output/generator_spec_java/nesting.x/Foo.java index 134c2ba45..7c53c1371 100644 --- a/spec/output/generator_spec_java/nesting.x/Foo.java +++ b/spec/output/generator_spec_java/nesting.x/Foo.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef int Foo; - -// =========================================================================== +/** + * Foo's original definition in the XDR file is: + *
+ * typedef int Foo;
+ * 
+ */ public class Foo implements XdrElement { private Integer Foo; diff --git a/spec/output/generator_spec_java/nesting.x/MyUnion.java b/spec/output/generator_spec_java/nesting.x/MyUnion.java index de9dacfea..ab29d0fbd 100644 --- a/spec/output/generator_spec_java/nesting.x/MyUnion.java +++ b/spec/output/generator_spec_java/nesting.x/MyUnion.java @@ -11,26 +11,27 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// union MyUnion switch (UnionKey type) -// { -// case ONE: -// struct { -// int someInt; -// } one; -// -// case TWO: -// struct { -// int someInt; -// Foo foo; -// } two; -// -// case OFFER: -// void; -// }; - -// =========================================================================== +/** + * MyUnion's original definition in the XDR file is: + *
+ * union MyUnion switch (UnionKey type)
+ * {
+ *     case ONE:
+ *         struct {
+ *             int someInt;
+ *         } one;
+ * 
+ *     case TWO:
+ *         struct {
+ *             int someInt;
+ *             Foo foo;
+ *         } two;
+ * 
+ *     case OFFER:
+ *         void;
+ * };
+ * 
+ */ public class MyUnion implements XdrElement { public MyUnion () {} UnionKey type; @@ -155,6 +156,14 @@ public static MyUnion fromXdrByteArray(byte[] xdr) throws IOException { return decode(xdrDataInputStream); } + /** + * MyUnionOne's original definition in the XDR file is: + *
+   * struct {
+   *             int someInt;
+   *         }
+   * 
+ */ public static class MyUnionOne implements XdrElement { public MyUnionOne () {} private Integer someInt; @@ -228,6 +237,15 @@ public MyUnionOne build() { } } + /** + * MyUnionTwo's original definition in the XDR file is: + *
+   * struct {
+   *             int someInt;
+   *             Foo foo;
+   *         }
+   * 
+ */ public static class MyUnionTwo implements XdrElement { public MyUnionTwo () {} private Integer someInt; diff --git a/spec/output/generator_spec_java/nesting.x/UnionKey.java b/spec/output/generator_spec_java/nesting.x/UnionKey.java index e917d2033..fb3136582 100644 --- a/spec/output/generator_spec_java/nesting.x/UnionKey.java +++ b/spec/output/generator_spec_java/nesting.x/UnionKey.java @@ -10,15 +10,16 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -// === xdr source ============================================================ - -// enum UnionKey { -// ONE = 1, -// TWO = 2, -// OFFER = 3 -// }; - -// =========================================================================== +/** + * UnionKey's original definition in the XDR file is: + *
+ * enum UnionKey {
+ *   ONE = 1,
+ *   TWO = 2,
+ *   OFFER = 3
+ * };
+ * 
+ */ public enum UnionKey implements XdrElement { ONE(1), TWO(2), diff --git a/spec/output/generator_spec_java/optional.x/Arr.java b/spec/output/generator_spec_java/optional.x/Arr.java index 25857682e..860b59f87 100644 --- a/spec/output/generator_spec_java/optional.x/Arr.java +++ b/spec/output/generator_spec_java/optional.x/Arr.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef int Arr[2]; - -// =========================================================================== +/** + * Arr's original definition in the XDR file is: + *
+ * typedef int Arr[2];
+ * 
+ */ public class Arr implements XdrElement { private Integer[] Arr; diff --git a/spec/output/generator_spec_java/optional.x/HasOptions.java b/spec/output/generator_spec_java/optional.x/HasOptions.java index a4fd3924b..4c07e944c 100644 --- a/spec/output/generator_spec_java/optional.x/HasOptions.java +++ b/spec/output/generator_spec_java/optional.x/HasOptions.java @@ -11,16 +11,17 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// struct HasOptions -// { -// int* firstOption; -// int *secondOption; -// Arr *thirdOption; -// }; - -// =========================================================================== +/** + * HasOptions's original definition in the XDR file is: + *
+ * struct HasOptions
+ * {
+ *   int* firstOption;
+ *   int *secondOption;
+ *   Arr *thirdOption;
+ * };
+ * 
+ */ public class HasOptions implements XdrElement { public HasOptions () {} private Integer firstOption; diff --git a/spec/output/generator_spec_java/struct.x/Int64.java b/spec/output/generator_spec_java/struct.x/Int64.java index 5e297453e..d5029d25d 100644 --- a/spec/output/generator_spec_java/struct.x/Int64.java +++ b/spec/output/generator_spec_java/struct.x/Int64.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef hyper int64; - -// =========================================================================== +/** + * Int64's original definition in the XDR file is: + *
+ * typedef hyper int64;
+ * 
+ */ public class Int64 implements XdrElement { private Long int64; diff --git a/spec/output/generator_spec_java/struct.x/MyStruct.java b/spec/output/generator_spec_java/struct.x/MyStruct.java index 28d7819e6..6396b1fe9 100644 --- a/spec/output/generator_spec_java/struct.x/MyStruct.java +++ b/spec/output/generator_spec_java/struct.x/MyStruct.java @@ -12,18 +12,19 @@ import java.util.Objects; import java.util.Arrays; -// === xdr source ============================================================ - -// struct MyStruct -// { -// int someInt; -// int64 aBigInt; -// opaque someOpaque[10]; -// string someString<>; -// string maxString<100>; -// }; - -// =========================================================================== +/** + * MyStruct's original definition in the XDR file is: + *
+ * struct MyStruct
+ * {
+ *     int    someInt;
+ *     int64  aBigInt;
+ *     opaque someOpaque[10];
+ *     string someString<>;
+ *     string maxString<100>;
+ * };
+ * 
+ */ public class MyStruct implements XdrElement { public MyStruct () {} private Integer someInt; diff --git a/spec/output/generator_spec_java/test.x/Color.java b/spec/output/generator_spec_java/test.x/Color.java index 263a4562d..8b64c3648 100644 --- a/spec/output/generator_spec_java/test.x/Color.java +++ b/spec/output/generator_spec_java/test.x/Color.java @@ -10,15 +10,16 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -// === xdr source ============================================================ - -// enum Color { -// RED, -// BLUE = 5, -// GREEN -// }; - -// =========================================================================== +/** + * Color's original definition in the XDR file is: + *
+ * enum Color {
+ *   RED,
+ *   BLUE = 5,
+ *   GREEN
+ * };
+ * 
+ */ public enum Color implements XdrElement { RED(0), BLUE(5), diff --git a/spec/output/generator_spec_java/test.x/HasStuff.java b/spec/output/generator_spec_java/test.x/HasStuff.java index c7f47d1e2..3015f1726 100644 --- a/spec/output/generator_spec_java/test.x/HasStuff.java +++ b/spec/output/generator_spec_java/test.x/HasStuff.java @@ -11,14 +11,15 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// struct HasStuff -// { -// LotsOfMyStructs data; -// }; - -// =========================================================================== +/** + * HasStuff's original definition in the XDR file is: + *
+ * struct HasStuff
+ * {
+ *   LotsOfMyStructs data;
+ * };
+ * 
+ */ public class HasStuff implements XdrElement { public HasStuff () {} private LotsOfMyStructs data; diff --git a/spec/output/generator_spec_java/test.x/Hash.java b/spec/output/generator_spec_java/test.x/Hash.java index e3ce29bf0..e5cd4e551 100644 --- a/spec/output/generator_spec_java/test.x/Hash.java +++ b/spec/output/generator_spec_java/test.x/Hash.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef opaque Hash[32]; - -// =========================================================================== +/** + * Hash's original definition in the XDR file is: + *
+ * typedef opaque Hash[32];
+ * 
+ */ public class Hash implements XdrElement { private byte[] Hash; diff --git a/spec/output/generator_spec_java/test.x/Hashes1.java b/spec/output/generator_spec_java/test.x/Hashes1.java index b5c6a8cdb..f69adbcba 100644 --- a/spec/output/generator_spec_java/test.x/Hashes1.java +++ b/spec/output/generator_spec_java/test.x/Hashes1.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef Hash Hashes1[12]; - -// =========================================================================== +/** + * Hashes1's original definition in the XDR file is: + *
+ * typedef Hash Hashes1[12];
+ * 
+ */ public class Hashes1 implements XdrElement { private Hash[] Hashes1; diff --git a/spec/output/generator_spec_java/test.x/Hashes2.java b/spec/output/generator_spec_java/test.x/Hashes2.java index 0af1a9e15..11ff7b448 100644 --- a/spec/output/generator_spec_java/test.x/Hashes2.java +++ b/spec/output/generator_spec_java/test.x/Hashes2.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef Hash Hashes2<12>; - -// =========================================================================== +/** + * Hashes2's original definition in the XDR file is: + *
+ * typedef Hash Hashes2<12>;
+ * 
+ */ public class Hashes2 implements XdrElement { private Hash[] Hashes2; diff --git a/spec/output/generator_spec_java/test.x/Hashes3.java b/spec/output/generator_spec_java/test.x/Hashes3.java index 5f428897d..09fd6afce 100644 --- a/spec/output/generator_spec_java/test.x/Hashes3.java +++ b/spec/output/generator_spec_java/test.x/Hashes3.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef Hash Hashes3<>; - -// =========================================================================== +/** + * Hashes3's original definition in the XDR file is: + *
+ * typedef Hash Hashes3<>;
+ * 
+ */ public class Hashes3 implements XdrElement { private Hash[] Hashes3; diff --git a/spec/output/generator_spec_java/test.x/Int1.java b/spec/output/generator_spec_java/test.x/Int1.java index 079ddf12f..ca647afa9 100644 --- a/spec/output/generator_spec_java/test.x/Int1.java +++ b/spec/output/generator_spec_java/test.x/Int1.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef int int1; - -// =========================================================================== +/** + * Int1's original definition in the XDR file is: + *
+ * typedef int             int1;
+ * 
+ */ public class Int1 implements XdrElement { private Integer int1; diff --git a/spec/output/generator_spec_java/test.x/Int2.java b/spec/output/generator_spec_java/test.x/Int2.java index 3f9bc5926..f7cf4e5b5 100644 --- a/spec/output/generator_spec_java/test.x/Int2.java +++ b/spec/output/generator_spec_java/test.x/Int2.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef hyper int2; - -// =========================================================================== +/** + * Int2's original definition in the XDR file is: + *
+ * typedef hyper           int2;
+ * 
+ */ public class Int2 implements XdrElement { private Long int2; diff --git a/spec/output/generator_spec_java/test.x/Int3.java b/spec/output/generator_spec_java/test.x/Int3.java index 3a21ac493..ac255140c 100644 --- a/spec/output/generator_spec_java/test.x/Int3.java +++ b/spec/output/generator_spec_java/test.x/Int3.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef unsigned int int3; - -// =========================================================================== +/** + * Int3's original definition in the XDR file is: + *
+ * typedef unsigned int    int3;
+ * 
+ */ public class Int3 implements XdrElement { private XdrUnsignedInteger int3; diff --git a/spec/output/generator_spec_java/test.x/Int4.java b/spec/output/generator_spec_java/test.x/Int4.java index 1f50aa110..a3df9c1c9 100644 --- a/spec/output/generator_spec_java/test.x/Int4.java +++ b/spec/output/generator_spec_java/test.x/Int4.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef unsigned hyper int4; - -// =========================================================================== +/** + * Int4's original definition in the XDR file is: + *
+ * typedef unsigned hyper  int4;
+ * 
+ */ public class Int4 implements XdrElement { private XdrUnsignedHyperInteger int4; diff --git a/spec/output/generator_spec_java/test.x/LotsOfMyStructs.java b/spec/output/generator_spec_java/test.x/LotsOfMyStructs.java index 84ef5f7ab..71ac2c54c 100644 --- a/spec/output/generator_spec_java/test.x/LotsOfMyStructs.java +++ b/spec/output/generator_spec_java/test.x/LotsOfMyStructs.java @@ -11,14 +11,15 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// struct LotsOfMyStructs -// { -// MyStruct members<>; -// }; - -// =========================================================================== +/** + * LotsOfMyStructs's original definition in the XDR file is: + *
+ * struct LotsOfMyStructs
+ * {
+ *     MyStruct members<>;
+ * };
+ * 
+ */ public class LotsOfMyStructs implements XdrElement { public LotsOfMyStructs () {} private MyStruct[] members; diff --git a/spec/output/generator_spec_java/test.x/MyStruct.java b/spec/output/generator_spec_java/test.x/MyStruct.java index 3cdc263a1..09015e925 100644 --- a/spec/output/generator_spec_java/test.x/MyStruct.java +++ b/spec/output/generator_spec_java/test.x/MyStruct.java @@ -11,20 +11,21 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// struct MyStruct -// { -// uint512 field1; -// optHash1 field2; -// int1 field3; -// unsigned int field4; -// float field5; -// double field6; -// bool field7; -// }; - -// =========================================================================== +/** + * MyStruct's original definition in the XDR file is: + *
+ * struct MyStruct
+ * {
+ *     uint512 field1;
+ *     optHash1 field2;
+ *     int1 field3;
+ *     unsigned int field4;
+ *     float field5;
+ *     double field6;
+ *     bool field7;
+ * };
+ * 
+ */ public class MyStruct implements XdrElement { public MyStruct () {} private Uint512 field1; diff --git a/spec/output/generator_spec_java/test.x/Nester.java b/spec/output/generator_spec_java/test.x/Nester.java index 787e690af..6867dbf2e 100644 --- a/spec/output/generator_spec_java/test.x/Nester.java +++ b/spec/output/generator_spec_java/test.x/Nester.java @@ -11,30 +11,31 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// struct Nester -// { -// enum { -// BLAH_1, -// BLAH_2 -// } nestedEnum; -// -// struct { -// int blah; -// } nestedStruct; -// -// union switch (Color color) { -// case RED: -// void; -// default: -// int blah2; -// } nestedUnion; -// -// -// }; - -// =========================================================================== +/** + * Nester's original definition in the XDR file is: + *
+ * struct Nester
+ * {
+ *   enum {
+ *     BLAH_1,
+ *     BLAH_2
+ *   } nestedEnum;
+ * 
+ *   struct {
+ *     int blah;
+ *   } nestedStruct;
+ * 
+ *   union switch (Color color) {
+ *     case RED:
+ *       void;
+ *     default:
+ *       int blah2;
+ *   } nestedUnion;
+ * 
+ * 
+ * };
+ * 
+ */ public class Nester implements XdrElement { public Nester () {} private NesterNestedEnum nestedEnum; @@ -139,6 +140,15 @@ public Nester build() { } } + /** + * NesterNestedEnum's original definition in the XDR file is: + *
+   * enum {
+   *     BLAH_1,
+   *     BLAH_2
+   *   }
+   * 
+ */ public static enum NesterNestedEnum implements XdrElement { BLAH_1(0), BLAH_2(1), @@ -195,6 +205,14 @@ public static NestedEnum fromXdrByteArray(byte[] xdr) throws IOException { } } + /** + * NesterNestedStruct's original definition in the XDR file is: + *
+   * struct {
+   *     int blah;
+   *   }
+   * 
+ */ public static class NesterNestedStruct implements XdrElement { public NesterNestedStruct () {} private Integer blah; @@ -268,6 +286,17 @@ public NesterNestedStruct build() { } } + /** + * NesterNestedUnion's original definition in the XDR file is: + *
+   * union switch (Color color) {
+   *     case RED:
+   *       void;
+   *     default:
+   *       int blah2;
+   *   }
+   * 
+ */ public static class NesterNestedUnion implements XdrElement { public NesterNestedUnion () {} Color color; diff --git a/spec/output/generator_spec_java/test.x/OptHash1.java b/spec/output/generator_spec_java/test.x/OptHash1.java index 0a64e8058..fd8cb2bf8 100644 --- a/spec/output/generator_spec_java/test.x/OptHash1.java +++ b/spec/output/generator_spec_java/test.x/OptHash1.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef Hash *optHash1; - -// =========================================================================== +/** + * OptHash1's original definition in the XDR file is: + *
+ * typedef Hash *optHash1;
+ * 
+ */ public class OptHash1 implements XdrElement { private Hash optHash1; diff --git a/spec/output/generator_spec_java/test.x/OptHash2.java b/spec/output/generator_spec_java/test.x/OptHash2.java index bb087923c..0cacea821 100644 --- a/spec/output/generator_spec_java/test.x/OptHash2.java +++ b/spec/output/generator_spec_java/test.x/OptHash2.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef Hash* optHash2; - -// =========================================================================== +/** + * OptHash2's original definition in the XDR file is: + *
+ * typedef Hash* optHash2;
+ * 
+ */ public class OptHash2 implements XdrElement { private Hash optHash2; diff --git a/spec/output/generator_spec_java/test.x/Str.java b/spec/output/generator_spec_java/test.x/Str.java index e222e4106..b0ab22de2 100644 --- a/spec/output/generator_spec_java/test.x/Str.java +++ b/spec/output/generator_spec_java/test.x/Str.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef string str<64>; - -// =========================================================================== +/** + * Str's original definition in the XDR file is: + *
+ * typedef string str<64>;
+ * 
+ */ public class Str implements XdrElement { private XdrString str; diff --git a/spec/output/generator_spec_java/test.x/Str2.java b/spec/output/generator_spec_java/test.x/Str2.java index 4b6cdd709..7e820409f 100644 --- a/spec/output/generator_spec_java/test.x/Str2.java +++ b/spec/output/generator_spec_java/test.x/Str2.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef string str2<>; - -// =========================================================================== +/** + * Str2's original definition in the XDR file is: + *
+ * typedef string str2<>;
+ * 
+ */ public class Str2 implements XdrElement { private XdrString str2; diff --git a/spec/output/generator_spec_java/test.x/Uint512.java b/spec/output/generator_spec_java/test.x/Uint512.java index a091d1ec8..f8819f2ab 100644 --- a/spec/output/generator_spec_java/test.x/Uint512.java +++ b/spec/output/generator_spec_java/test.x/Uint512.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef opaque uint512[64]; - -// =========================================================================== +/** + * Uint512's original definition in the XDR file is: + *
+ * typedef opaque uint512[64];
+ * 
+ */ public class Uint512 implements XdrElement { private byte[] uint512; diff --git a/spec/output/generator_spec_java/test.x/Uint513.java b/spec/output/generator_spec_java/test.x/Uint513.java index 06bb768af..6c2df51b7 100644 --- a/spec/output/generator_spec_java/test.x/Uint513.java +++ b/spec/output/generator_spec_java/test.x/Uint513.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef opaque uint513<64>; - -// =========================================================================== +/** + * Uint513's original definition in the XDR file is: + *
+ * typedef opaque uint513<64>;
+ * 
+ */ public class Uint513 implements XdrElement { private byte[] uint513; diff --git a/spec/output/generator_spec_java/test.x/Uint514.java b/spec/output/generator_spec_java/test.x/Uint514.java index 719b430fb..e1ad5a6fe 100644 --- a/spec/output/generator_spec_java/test.x/Uint514.java +++ b/spec/output/generator_spec_java/test.x/Uint514.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Arrays; -// === xdr source ============================================================ - -// typedef opaque uint514<>; - -// =========================================================================== +/** + * Uint514's original definition in the XDR file is: + *
+ * typedef opaque uint514<>;
+ * 
+ */ public class Uint514 implements XdrElement { private byte[] uint514; diff --git a/spec/output/generator_spec_java/union.x/Error.java b/spec/output/generator_spec_java/union.x/Error.java index c5b1bc493..1fe8a9d43 100644 --- a/spec/output/generator_spec_java/union.x/Error.java +++ b/spec/output/generator_spec_java/union.x/Error.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef int Error; - -// =========================================================================== +/** + * Error's original definition in the XDR file is: + *
+ * typedef int Error;
+ * 
+ */ public class Error implements XdrElement { private Integer Error; diff --git a/spec/output/generator_spec_java/union.x/IntUnion.java b/spec/output/generator_spec_java/union.x/IntUnion.java index 71c82c7d0..0b3a6081f 100644 --- a/spec/output/generator_spec_java/union.x/IntUnion.java +++ b/spec/output/generator_spec_java/union.x/IntUnion.java @@ -12,18 +12,19 @@ import java.util.Objects; import java.util.Arrays; -// === xdr source ============================================================ - -// union IntUnion switch (int type) -// { -// case 0: -// Error error; -// case 1: -// Multi things<>; -// -// }; - -// =========================================================================== +/** + * IntUnion's original definition in the XDR file is: + *
+ * union IntUnion switch (int type)
+ * {
+ *     case 0:
+ *         Error error;
+ *     case 1:
+ *         Multi things<>;
+ * 
+ * };
+ * 
+ */ public class IntUnion implements XdrElement { public IntUnion () {} Integer type; diff --git a/spec/output/generator_spec_java/union.x/IntUnion2.java b/spec/output/generator_spec_java/union.x/IntUnion2.java index 19c95ed8c..45ddec6d7 100644 --- a/spec/output/generator_spec_java/union.x/IntUnion2.java +++ b/spec/output/generator_spec_java/union.x/IntUnion2.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef IntUnion IntUnion2; - -// =========================================================================== +/** + * IntUnion2's original definition in the XDR file is: + *
+ * typedef IntUnion IntUnion2;
+ * 
+ */ public class IntUnion2 implements XdrElement { private IntUnion IntUnion2; diff --git a/spec/output/generator_spec_java/union.x/Multi.java b/spec/output/generator_spec_java/union.x/Multi.java index c3ac21f08..281454e04 100644 --- a/spec/output/generator_spec_java/union.x/Multi.java +++ b/spec/output/generator_spec_java/union.x/Multi.java @@ -11,11 +11,12 @@ import java.io.ByteArrayOutputStream; import java.util.Objects; -// === xdr source ============================================================ - -// typedef int Multi; - -// =========================================================================== +/** + * Multi's original definition in the XDR file is: + *
+ * typedef int Multi;
+ * 
+ */ public class Multi implements XdrElement { private Integer Multi; diff --git a/spec/output/generator_spec_java/union.x/MyUnion.java b/spec/output/generator_spec_java/union.x/MyUnion.java index 3a5bea607..90cdebe61 100644 --- a/spec/output/generator_spec_java/union.x/MyUnion.java +++ b/spec/output/generator_spec_java/union.x/MyUnion.java @@ -12,19 +12,20 @@ import java.util.Objects; import java.util.Arrays; -// === xdr source ============================================================ - -// union MyUnion switch (UnionKey type) -// { -// case ERROR: -// Error error; -// case MULTI: -// Multi things<>; -// -// -// }; - -// =========================================================================== +/** + * MyUnion's original definition in the XDR file is: + *
+ * union MyUnion switch (UnionKey type)
+ * {
+ *     case ERROR:
+ *         Error error;
+ *     case MULTI:
+ *         Multi things<>;
+ * 
+ * 
+ * };
+ * 
+ */ public class MyUnion implements XdrElement { public MyUnion () {} UnionKey type; diff --git a/spec/output/generator_spec_java/union.x/UnionKey.java b/spec/output/generator_spec_java/union.x/UnionKey.java index 07ffbc088..0ca6d26fa 100644 --- a/spec/output/generator_spec_java/union.x/UnionKey.java +++ b/spec/output/generator_spec_java/union.x/UnionKey.java @@ -10,14 +10,15 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -// === xdr source ============================================================ - -// enum UnionKey { -// ERROR, -// MULTI -// }; - -// =========================================================================== +/** + * UnionKey's original definition in the XDR file is: + *
+ * enum UnionKey {
+ *   ERROR,
+ *   MULTI
+ * };
+ * 
+ */ public enum UnionKey implements XdrElement { ERROR(0), MULTI(1),