Skip to content

Commit 84c912f

Browse files
dfa1claude
andcommitted
refactor: rename FbsInlineStruct -> FbsMemorySegment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 88d3f21 commit 84c912f

7 files changed

Lines changed: 13 additions & 10 deletions

File tree

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ Regenerate after editing `.fbs`/`.proto` (both generators are in-house, no exter
7777
Both schema languages are compiled in-process to MemorySegment-native Java, with no
7878
`flatc`/`protoc` and no `com.google.flatbuffers`/`protobuf-java` runtime (ADR 0017):
7979
- **`.fbs``fbs-gen`** (`io.github.dfa1.vortex.fbsgen`): generates readers extending
80-
`FbsTable` (vtable-based) or `FbsInlineStruct` (fixed-offset inline) and builders over
80+
`FbsTable` (vtable-based) or `FbsMemorySegment` (fixed-offset inline) and builders over
8181
`FbsBuilder`, all in the same generated package `io.github.dfa1.vortex.core.fbs`. The
82-
runtime base classes `FbsTable`/`FbsInlineStruct` are package-private (only generated
82+
runtime base classes `FbsTable`/`FbsMemorySegment` are package-private (only generated
8383
readers extend them); `FbsBuilder` is public because the writer module assembles FlatBuffers
8484
with it. Schema names with a trailing `_` (e.g. `Struct_`) have the underscore stripped in
8585
the generated Java class name (`FbsStruct`) — the upstream uses `_` to avoid C++ conflicts,

core/src/main/java/io/github/dfa1/vortex/core/fbs/FbsBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/// Reader and builder for the `Buffer` FlatBuffers struct (inline, 8 bytes).
99
@Generated("io.github.dfa1.vortex.fbsgen.CodeGen")
10-
public final class FbsBuffer extends FbsInlineStruct {
10+
public final class FbsBuffer extends FbsMemorySegment {
1111

1212
/// Positions this reader at a struct.
1313
/// @param seg the buffer

core/src/main/java/io/github/dfa1/vortex/core/fbs/FbsInlineStruct.java renamed to core/src/main/java/io/github/dfa1/vortex/core/fbs/FbsMemorySegment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/// directly at `position + fieldOffset`.
1818
///
1919
/// Package-private: only the generated struct accessors in this package extend it.
20-
class FbsInlineStruct {
20+
class FbsMemorySegment {
2121

2222
/// The backing buffer.
2323
protected MemorySegment seg;
@@ -26,7 +26,7 @@ class FbsInlineStruct {
2626
protected long pos;
2727

2828
/// Creates an unpositioned cursor; call [#init(MemorySegment, long)] before use.
29-
protected FbsInlineStruct() {
29+
protected FbsMemorySegment() {
3030
}
3131

3232
/// Positions this cursor at a struct.

core/src/main/java/io/github/dfa1/vortex/core/fbs/FbsSegmentSpec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/// Reader and builder for the `SegmentSpec` FlatBuffers struct (inline, 16 bytes).
99
@Generated("io.github.dfa1.vortex.fbsgen.CodeGen")
10-
public final class FbsSegmentSpec extends FbsInlineStruct {
10+
public final class FbsSegmentSpec extends FbsMemorySegment {
1111

1212
/// Positions this reader at a struct.
1313
/// @param seg the buffer

fbs-gen/src/main/java/io/github/dfa1/vortex/fbsgen/CodeGen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/// One `.java` file per declaration:
1212
/// - each `table` becomes a `final class extends FbsTable` with read accessors plus
1313
/// `createX`/`startX`/`addX`/`endX`/`finishXBuffer` builders;
14-
/// - each `struct` becomes a `final class extends FbsInlineStruct` with inline-offset accessors
14+
/// - each `struct` becomes a `final class extends FbsMemorySegment` with inline-offset accessors
1515
/// and an inline `createX` builder;
1616
/// - each `enum` becomes a constants holder over its underlying integer type;
1717
/// - each `union` becomes a discriminator-constants holder (NONE = 0, members from 1).
@@ -295,7 +295,7 @@ private String emitStruct(Ast.StructDecl struct) {
295295
sb.append("/// Reader and builder for the `").append(struct.name()).append("` FlatBuffers struct (inline, ")
296296
.append(layout.size()).append(" bytes).\n");
297297
sb.append(GENERATED_ANNOTATION);
298-
sb.append("public final class ").append(name).append(" extends FbsInlineStruct {\n\n");
298+
sb.append("public final class ").append(name).append(" extends FbsMemorySegment {\n\n");
299299
sb.append("""
300300
/// Positions this reader at a struct.
301301
/// @param seg the buffer
@@ -723,7 +723,7 @@ private static VectorElem scalarVectorElem(Ast.Scalar scalar) {
723723
///
724724
/// @param javaType accessor return type
725725
/// @param readPrefix expression prefix (e.g. a widening cast), or empty
726-
/// @param readMethod FbsTable/FbsInlineStruct reader method name
726+
/// @param readMethod FbsTable/FbsMemorySegment reader method name
727727
/// @param readSuffix expression suffix (e.g. an unsigned mask or `!= 0`), or empty
728728
/// @param zero default/absent value literal
729729
private record ScalarIo(String javaType, String readPrefix, String readMethod, String readSuffix, String zero) {

fbs-gen/src/test/java/io/github/dfa1/vortex/fbsgen/CodeGenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void emitsInlineOffsetsForStruct() throws IOException {
7171
String src = generateOne("FbsBuffer.java");
7272

7373
// Then
74-
assertThat(src).contains("extends FbsInlineStruct");
74+
assertThat(src).contains("extends FbsMemorySegment");
7575
assertThat(src).contains("8 bytes");
7676
assertThat(src).contains("public int padding() {\n return readShort(0) & 0xFFFF;");
7777
assertThat(src).contains("public int alignmentExponent() {\n return readByte(2) & 0xFF;");

integration/src/test/java/io/github/dfa1/vortex/integration/RaincloudConformanceIntegrationTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,14 @@ private static void reportUntriaged(Path vortex, Path parquet) {
110110
try {
111111
assertMatchesParquetOracle(vortex, parquet);
112112
} catch (TestAbortedException e) {
113+
System.out.println("TRIAGE " + vortex + " => ABORTED " + e.getMessage());
113114
throw e; // oracle limitation, not a conformance outcome
114115
} catch (AssertionError | Exception e) {
116+
System.out.println("TRIAGE " + vortex + " => FAILS " + e.getMessage());
115117
throw new TestAbortedException(
116118
"untriaged slug fails — classify as gap:<issue> in expected-status.csv: " + e);
117119
}
120+
System.out.println("TRIAGE " + vortex + " => OK");
118121
throw new TestAbortedException("untriaged slug passes — flip its matrix entry to ok");
119122
}
120123

0 commit comments

Comments
 (0)