Repository navigation
Expand file tree
/
Copy pathpom.xml
More file actions
211 lines (199 loc) · 10.2 KB
/
Copy pathpom.xml
File metadata and controls
211 lines (199 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sofabuffers</groupId>
<!-- CORELIB_PLAN §6: the registry name is derived, not a fixed string - the
organization slug `sofa-buffers` and the word `corelib`, written in the
registry's own convention. Maven Central has no single package name, so the
coordinate is groupId org.sofabuffers (the slug as a reverse-DNS group, which
is what Maven admits) plus artifactId corelib. The normative half is the
namespace, and every symbol is under org.sofabuffers.sofab. -->
<artifactId>corelib</artifactId>
<!-- 0.14.0: source-breaking, and behaviour-changing in one place. Sofab.API_VERSION
is the WIRE contract and stays 1: the bytes are unchanged.
(a) IStream.feed unwraps a rejection a Visitor raised through the
UncheckedIOException carrier (Sofab.invalid / limitExceeded / argument) and
throws the SofabException it declares, for every code (#129). Generated code
rejects schema bounds and receiver caps from inside the visitor, so a caller
catching what feed's signature promised never caught them; LIMIT_EXCEEDED in
particular was documented as arriving wrapped. Callers that caught
UncheckedIOException around feed and read getCause() catch SofabException
instead. A visitor's own I/O failure (a cause that is not a SofabException)
still passes through as thrown, and inside a callback the carriers are
unchanged.
(b) A zero-length output buffer is legal. OStream's constructors, bufferSet(),
reset() and overScratch(0) no longer refuse it with ARGUMENT; only a null
array is refused. MESSAGE_SPEC §2 makes the all-default message the empty
byte string, so a message with no fields has MAX_SIZE == 0 and the generated
one-shot encode() must be able to ask for it (generator#738). A sink still
rejects an empty buffer through the MIN_OUTPUT_BUFFER check (§5.1).
Added, not breaking: OStream.writeString(id, text, maxlen) refuses a string
whose UTF-8 encoding is longer than the caller's bound with ARGUMENT before
any byte of the field is written (generator#656). The library holds no bound
of its own; the two-argument writeString is unchanged and stays unbounded.
(0.13.0: source-breaking, in three places.
(a) IStream.feed now RETURNS the decode outcome —
DecodeStatus.COMPLETE or INCOMPLETE for the bytes consumed so far — on both
overloads, and the separate IStream.status() accessor is gone. One fact had
two readers and they could disagree: 0.12.x carried exactly that drift, a
refusal thrown from feed while status() still answered COMPLETE for the same
message. A refusal keeps travelling on the error channel with its code on the
exception (INVALID_MSG, LIMIT_EXCEEDED, ARGUMENT), so DecodeStatus also loses
the LIMIT_EXCEEDED constant that existed only for status() to report it: §6.3
offers a fourth decode outcome OR a terminal failure on the error channel,
and this port takes the second. Callers that read status() read feed's return
instead; callers that branched on DecodeStatus.LIMIT_EXCEEDED catch
SofabException and switch on error().
(b) A Visitor.arrayBulk destination of a fillable type but shorter than the
announced count is refused with ARGUMENT, terminally, instead of falling back
to per-element delivery (§6.6.3; §6.3's table lists "a destination too short
for the value it was handed" under that code). The fallback was silent data
loss on a well-formed message: a visitor overriding arrayBulk alone — the
documented shape for an integer array — had every element delivered to
inherited no-ops, never saw arrayBulkEnd, and read COMPLETE off the feed that
dropped them. Declining is untouched: null, or any type the decoder cannot
fill, is not a destination at all and still falls back per-element.
(c) The Seq reservations (placeElem, reserveElem, reserveRow*) and
Seq.checkIndex compare a wrapper array's schema count themselves, and so
refuse the countless Bound.SCHEMA_BOUNDED with ARGUMENT rather than growing
the list uncompared. Pass Bound.schema(count) where the schema bounds the
array: id >= count is INVALID_MSG, a receiver cap stays LIMIT_EXCEEDED, and
exactly one of the two is ever handed in (§6.2.1). SCHEMA_BOUNDED remains for
the one case with no second number to compare — a string/blob whose maxlen
the caller already enforced at the length word, where PayloadAcc has nothing
to hold it to.
0.12.0: source-breaking. The three §6.2.1 receiver caps became arguments on
the calls generated code already makes — PayloadAcc.string/blob take the cap
on the announced length, Seq.reserveRow* the cap on the row index — so every
one of those call sites gained a parameter. The library still holds no limit
and defines no default for one; Sofab.SCHEMA_BOUNDED is what a caller passes
where the schema bounds the field instead.
0.11.0: behaviour-breaking, not source-breaking. OStream.overScratch now
hands a thread the same OStream instance at every call, re-armed, instead of
a new one over the shared buffer - so two overScratch streams held at once
on one thread are now one stream, where before they were two over one
buffer. Both were already documented as valid only until the same thread
asks again. Pre-1.0, the minor is where a breaking change lands.
Sofab.API_VERSION stayed 1 in both. 0.9.0 removed writeSequenceBegin in
favour of the writeSequenceBeginLazy / writeSequenceEnd /
writeSequenceEndKeep trio.) -->
<version>0.14.0</version>
<packaging>jar</packaging>
<name>SofaBuffers CoreLib (Java)</name>
<description>Dependency-free, allocation-light, streaming Java implementation of the SofaBuffers (Sofab) serialization format.</description>
<url>https://github.com/sofa-buffers/corelib-java</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
<junit.version>6.1.3</junit.version>
<gson.version>2.15.0</gson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Test-only: parse the shared assets/test_vectors.json conformance suite.
Gson preserves exact precision for unsigned u64 values via getAsBigInteger().
The runtime library stays dependency-free. -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>sofab</finalName>
<!-- Put the shared conformance vectors on the test classpath straight from
assets/ (single source of truth, copied verbatim from the documentation repo). -->
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>assets</directory>
<includes>
<include>test_vectors.json</include>
</includes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.16.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.6.1</version>
</plugin>
<!-- Code coverage: produces target/site/jacoco/jacoco.xml during `mvn verify`. -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.16</version>
<configuration>
<!-- Benchmark tools are runnable mains, not unit-tested library code. -->
<excludes>
<exclude>org/sofabuffers/sofab/bench/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- API documentation: `mvn javadoc:javadoc` -> target/reports/apidocs. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.12.0</version>
<configuration>
<source>${maven.compiler.release}</source>
<doctitle>SofaBuffers Java ${project.version}</doctitle>
<windowtitle>SofaBuffers Java ${project.version}</windowtitle>
<quiet>true</quiet>
<notimestamp>true</notimestamp>
<!-- Benchmark tools are runnable mains, not part of the public API. -->
<excludePackageNames>org.sofabuffers.sofab.bench</excludePackageNames>
</configuration>
</plugin>
<!--
Run the benchmark tools, e.g.:
mvn -q compile exec:java -Dexec.mainClass=org.sofabuffers.sofab.bench.Perf
mvn -q compile exec:java -Dexec.mainClass=org.sofabuffers.sofab.bench.Bench
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<classpathScope>compile</classpathScope>
</configuration>
</plugin>
</plugins>
</build>
</project>