Skip to content

Commit e0ca2d6

Browse files
authored
Fix #557: add direct use of module-info.java (#558)
1 parent c7f91fb commit e0ca2d6

File tree

30 files changed

+1081
-142
lines changed

30 files changed

+1081
-142
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
java_version: ['17', '21']
26+
java_version: ['17', '21', '23']
2727
include:
2828
- java_version: '17'
2929
release_build: 'R'

avro/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ abstractions.
8686
</execution>
8787
</executions>
8888
</plugin>
89-
<!-- 19-Mar-2019, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
90-
will have to use `moduleInfoFile` as anything else requires JDK 9+
91-
-->
92-
<plugin>
93-
<groupId>org.moditect</groupId>
94-
<artifactId>moditect-maven-plugin</artifactId>
95-
</plugin>
9689
</plugins>
9790
</build>
9891
</project>

avro/src/moditect/module-info.java renamed to avro/src/main/java/module-info.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
module tools.jackson.dataformat.avro {
1+
// Avro Main artifact Module descriptor
2+
module tools.jackson.dataformat.avro
3+
{
24
requires transitive com.fasterxml.jackson.annotation;
35
requires tools.jackson.core;
46
requires tools.jackson.databind;
57

6-
// silly avro Apache impl, its deps:
7-
requires static avro;
8-
requires static jackson.core.asl;
9-
requires static jackson.mapper.asl;
8+
requires org.apache.avro;
109

1110
exports tools.jackson.dataformat.avro;
1211
exports tools.jackson.dataformat.avro.annotation;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Avro unit test Module descriptor
2+
module tools.jackson.dataformat.avro
3+
{
4+
// Since we are not split from Main artifact, will not
5+
// need to depend on Main artifact -- but need its dependencies
6+
7+
requires tools.jackson.core;
8+
requires tools.jackson.databind;
9+
10+
requires org.apache.avro;
11+
12+
// Additional test lib/framework dependencies
13+
requires org.assertj.core;
14+
requires org.junit.jupiter.api;
15+
requires org.junit.jupiter.params;
16+
17+
// Further, need to open up some packages for JUnit et al
18+
19+
opens tools.jackson.dataformat.avro;
20+
opens tools.jackson.dataformat.avro.annotation;
21+
opens tools.jackson.dataformat.avro.dos;
22+
opens tools.jackson.dataformat.avro.fuzz;
23+
opens tools.jackson.dataformat.avro.gen;
24+
opens tools.jackson.dataformat.avro.interop;
25+
opens tools.jackson.dataformat.avro.interop.annotations;
26+
opens tools.jackson.dataformat.avro.interop.arrays;
27+
opens tools.jackson.dataformat.avro.interop.maps;
28+
opens tools.jackson.dataformat.avro.interop.records;
29+
opens tools.jackson.dataformat.avro.jsr310;
30+
opens tools.jackson.dataformat.avro.schema;
31+
opens tools.jackson.dataformat.avro.schemaev;
32+
opens tools.jackson.dataformat.avro.testsupport;
33+
opens tools.jackson.dataformat.avro.testutil.failure;
34+
opens tools.jackson.dataformat.avro.tofix;
35+
}

avro/src/test/java/tools/jackson/dataformat/avro/BigDecimal_schemaCreationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void testSchemaCreation_withLogicalTypesDisabled_onBigDecimalWithAvroDeci
4242
// because logical types are disabled by default.
4343
final Schema actualSchema = gen.getGeneratedSchema().getAvroSchema();
4444

45-
System.out.println(BigDecimalWithAvroDecimalAnnotationWrapper.class.getSimpleName() + " schema:" + actualSchema.toString(true));
45+
//System.out.println(BigDecimalWithAvroDecimalAnnotationWrapper.class.getSimpleName() + " schema:" + actualSchema.toString(true));
4646

4747
// THEN
4848
assertThat(actualSchema.getField("bigDecimalValue")).isNotNull();
@@ -64,7 +64,7 @@ public void testSchemaCreation_withLogicalTypesEnabled_onBigDecimalWithAvroDecim
6464
MAPPER.acceptJsonFormatVisitor(BigDecimalWithAvroDecimalAnnotationWrapper.class, gen);
6565
final Schema actualSchema = gen.getGeneratedSchema().getAvroSchema();
6666

67-
System.out.println(BigDecimalWithAvroDecimalAnnotationWrapper.class.getSimpleName() + " schema:" + actualSchema.toString(true));
67+
//System.out.println(BigDecimalWithAvroDecimalAnnotationWrapper.class.getSimpleName() + " schema:" + actualSchema.toString(true));
6868

6969
// THEN
7070
assertThat(actualSchema.getField("bigDecimalValue")).isNotNull();
@@ -97,7 +97,7 @@ public void testSchemaCreation_withLogicalTypesEnabled_onBigDecimalWithAvroDecim
9797
MAPPER.acceptJsonFormatVisitor(BigDecimalWithAvroDecimalAnnotationToFixedWrapper.class, gen);
9898
final Schema actualSchema = gen.getGeneratedSchema().getAvroSchema();
9999

100-
System.out.println(BigDecimalWithAvroDecimalAnnotationToFixedWrapper.class.getSimpleName() + " schema:" + actualSchema.toString(true));
100+
//System.out.println(BigDecimalWithAvroDecimalAnnotationToFixedWrapper.class.getSimpleName() + " schema:" + actualSchema.toString(true));
101101

102102
// THEN
103103
assertThat(actualSchema.getField("bigDecimalValue")).isNotNull();

cbor/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ encoded data using Jackson abstractions (streaming API, data binding, tree model
6464
</execution>
6565
</executions>
6666
</plugin>
67-
<!-- 19-Mar-2019, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
68-
will have to use `moduleInfoFile` as anything else requires JDK 9+
69-
-->
70-
<plugin>
71-
<groupId>org.moditect</groupId>
72-
<artifactId>moditect-maven-plugin</artifactId>
73-
</plugin>
7467
</plugins>
7568
</build>
7669
</project>

cbor/src/moditect/module-info.java renamed to cbor/src/main/java/module-info.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
module tools.jackson.dataformat.cbor {
1+
// CBOR Main artifact Module descriptor
2+
module tools.jackson.dataformat.cbor
3+
{
24
requires tools.jackson.core;
35
requires tools.jackson.databind;
46

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// CBOR unit test Module descriptor
2+
module tools.jackson.dataformat.cbor
3+
{
4+
// Since we are not split from Main artifact, will not
5+
// need to depend on Main artifact -- but need its dependencies
6+
7+
requires tools.jackson.core;
8+
requires tools.jackson.databind;
9+
10+
// Additional test lib/framework dependencies
11+
requires org.junit.jupiter.api;
12+
requires org.junit.jupiter.params;
13+
14+
// Further, need to open up some packages for JUnit et al
15+
opens tools.jackson.dataformat.cbor;
16+
opens tools.jackson.dataformat.cbor.constraints;
17+
opens tools.jackson.dataformat.cbor.dos;
18+
opens tools.jackson.dataformat.cbor.filter;
19+
opens tools.jackson.dataformat.cbor.fuzz;
20+
opens tools.jackson.dataformat.cbor.gen;
21+
opens tools.jackson.dataformat.cbor.gen.dos;
22+
opens tools.jackson.dataformat.cbor.mapper;
23+
opens tools.jackson.dataformat.cbor.parse;
24+
opens tools.jackson.dataformat.cbor.seq;
25+
opens tools.jackson.dataformat.cbor.testutil;
26+
opens tools.jackson.dataformat.cbor.testutil.failure;
27+
}

cbor/src/test/java/tools/jackson/dataformat/cbor/parse/SymbolTableTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,27 @@ public void testSimpleDefault() throws Exception
3636
assertTrue(syms.isCanonicalizing()); // added in 2.13
3737

3838
assertEquals(0, syms.size());
39-
assertEquals(0, _findParent(syms).size());
39+
//assertEquals(0, _findParent(syms).size());
4040

4141
assertToken(JsonToken.START_OBJECT, p.nextToken());
4242
assertToken(JsonToken.PROPERTY_NAME, p.nextToken());
4343
assertEquals("a", p.currentName());
4444
assertEquals(1, syms.size());
4545
// not yet synced to parent
46-
assertEquals(0, _findParent(syms).size());
46+
//assertEquals(0, _findParent(syms).size());
4747

4848
while (p.nextToken() != null) { ; }
4949
assertEquals(2, syms.size());
5050
// but after closing, should sync
51-
assertEquals(2, _findParent(syms).size());
51+
//assertEquals(2, _findParent(syms).size());
5252
}
5353

5454
// by default, should canonicalize etc:
5555
try (JsonParser p = vanillaMapper.createParser(doc)) {
5656
ByteQuadsCanonicalizer syms = _findSymbols(p);
5757
assertEquals(2, syms.size());
5858
// also check that parent (root) has it all?
59-
assertEquals(2, _findParent(syms).size());
59+
//assertEquals(2, _findParent(syms).size());
6060

6161
// but no additions second time around
6262
while (p.nextToken() != null) { ; }
@@ -118,7 +118,7 @@ public void testSimpleNoCanonicalize() throws Exception
118118
assertFalse(syms.isCanonicalizing()); // added in 2.13
119119
assertEquals(-1, syms.size());
120120
// also, should not have parent:
121-
assertNull(_findParent(syms));
121+
//assertNull(_findParent(syms));
122122

123123
assertToken(JsonToken.START_OBJECT, p.nextToken());
124124
assertToken(JsonToken.PROPERTY_NAME, p.nextToken());
@@ -227,10 +227,13 @@ private ByteQuadsCanonicalizer _findSymbols(JsonParser p) throws Exception
227227
return (ByteQuadsCanonicalizer) f.get(p);
228228
}
229229

230+
// Cannot access under JPMS, alas
231+
/*
230232
private ByteQuadsCanonicalizer _findParent(ByteQuadsCanonicalizer sym) throws Exception
231233
{
232234
Field f = ByteQuadsCanonicalizer.class.getDeclaredField("_parent");
233235
f.setAccessible(true);
234236
return (ByteQuadsCanonicalizer) f.get(sym);
235237
}
238+
*/
236239
}

ion/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@ tree model)
7878
</execution>
7979
</executions>
8080
</plugin>
81-
<!-- 19-Mar-2019, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
82-
will have to use `moduleInfoFile` as anything else requires JDK 9+
83-
-->
84-
<plugin>
85-
<groupId>org.moditect</groupId>
86-
<artifactId>moditect-maven-plugin</artifactId>
87-
</plugin>
8881
</plugins>
8982
</build>
9083
</project>

0 commit comments

Comments
 (0)