mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Add @javax.annotation.Generated to generated flatbuffer Java types (#4986)
* Add @javax.annotation.Generated to generated flatbuffer Java types. * Updating test goldens.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
99fe1dc80f
commit
233976c821
@@ -56,6 +56,7 @@ struct LanguageParameters {
|
||||
std::string optional_suffix;
|
||||
std::string includes;
|
||||
std::string class_annotation;
|
||||
std::string generated_type_annotation;
|
||||
CommentConfig comment_config;
|
||||
};
|
||||
|
||||
@@ -87,7 +88,8 @@ const LanguageParameters &GetLangParams(IDLOptions::Language lang) {
|
||||
"",
|
||||
"import java.nio.*;\nimport java.lang.*;\nimport "
|
||||
"java.util.*;\nimport com.google.flatbuffers.*;\n",
|
||||
"\n@SuppressWarnings(\"unused\")\n",
|
||||
"\n@SuppressWarnings(\"unused\")",
|
||||
"\n@javax.annotation.Generated(value=\"flatc\")\n",
|
||||
{
|
||||
"/**",
|
||||
" *",
|
||||
@@ -120,6 +122,7 @@ const LanguageParameters &GetLangParams(IDLOptions::Language lang) {
|
||||
"?",
|
||||
"using global::System;\nusing global::FlatBuffers;\n\n",
|
||||
"",
|
||||
"",
|
||||
{
|
||||
nullptr,
|
||||
"///",
|
||||
@@ -218,6 +221,7 @@ class GeneralGenerator : public BaseGenerator {
|
||||
}
|
||||
code += lang_.class_annotation;
|
||||
}
|
||||
code += lang_.generated_type_annotation;
|
||||
code += classcode;
|
||||
if (!namespace_name.empty()) code += lang_.namespace_end;
|
||||
auto filename = NamespaceDir(ns) + defname + lang_.file_extension;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Ability extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
|
||||
public Ability __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Any {
|
||||
private Any() { }
|
||||
public static final byte NONE = 0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Color {
|
||||
private Color() { }
|
||||
public static final byte Red = 1;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
/**
|
||||
* an example documentation comment: monster object
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Referrable extends Table {
|
||||
public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); }
|
||||
public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Stat extends Table {
|
||||
public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
|
||||
public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Test extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
|
||||
public Test __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
final class TestSimpleTableWithEnum extends Table {
|
||||
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
|
||||
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class TypeAliases extends Table {
|
||||
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb) { return getRootAsTypeAliases(_bb, new TypeAliases()); }
|
||||
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Vec3 extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
|
||||
public Vec3 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class Monster extends Table {
|
||||
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
|
||||
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class InParentNamespace extends Table {
|
||||
public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb) { return getRootAsInParentNamespace(_bb, new InParentNamespace()); }
|
||||
public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
Binary file not shown.
@@ -2,6 +2,8 @@
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class EnumInNestedNS {
|
||||
private EnumInNestedNS() { }
|
||||
public static final byte A = 0;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class StructInNestedNS extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
|
||||
public StructInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class TableInNestedNS extends Table {
|
||||
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb) { return getRootAsTableInNestedNS(_bb, new TableInNestedNS()); }
|
||||
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class SecondTableInA extends Table {
|
||||
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb) { return getRootAsSecondTableInA(_bb, new SecondTableInA()); }
|
||||
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class TableInFirstNS extends Table {
|
||||
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb) { return getRootAsTableInFirstNS(_bb, new TableInFirstNS()); }
|
||||
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@javax.annotation.Generated(value="flatc")
|
||||
public final class TableInC extends Table {
|
||||
public static TableInC getRootAsTableInC(ByteBuffer _bb) { return getRootAsTableInC(_bb, new TableInC()); }
|
||||
public static TableInC getRootAsTableInC(ByteBuffer _bb, TableInC obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
|
||||
Reference in New Issue
Block a user