Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 17 and jigsaw modules #25

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions DependencyUpdateSearch_Rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<!-- Ignore Alpha's, Beta's, release candidates and milestones -->
<ignoreVersion type="regex">(?i).*Alpha(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*a(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*Beta(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*-B(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*RC(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*CR(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*M(?:-?\d+)?</ignoreVersion>
</ignoreVersions>
<rules>
</rules>
</ruleset>
68 changes: 55 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -52,38 +52,38 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.5</version>
<version>2.13.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
<version>2.13.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.3</version>
<version>2.9.1</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.20</version>
<version>1.35</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.20</version>
<version>1.35</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
<version>3.12.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -125,16 +125,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.10.1</version>
<configuration>
<release>16</release>
<release>17</release>
<source>17</source>
<target>17</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -147,7 +149,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<version>3.4.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -177,7 +179,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -199,7 +201,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<version>2.20</version> <!-- note: 2.20.1 to 2.22.2 crash during tests -->
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<parallel>methods</parallel>
Expand All @@ -215,6 +217,46 @@
</includes>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.11.0</version>
<configuration>
<rulesUri>file:///${project.basedir}/DependencyUpdateSearch_Rules.xml</rulesUri>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.3.2,)</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down
38 changes: 38 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
open module com.jsoniter {

exports com.jsoniter;

exports com.jsoniter.fuzzy;

exports com.jsoniter.static_codegen;

exports com.jsoniter.extra;

exports com.jsoniter.output;

exports com.jsoniter.annotation;

exports com.jsoniter.spi;

exports com.jsoniter.any;


/** static, because marked as optional in pom.xml*/
requires static javassist;

/** static, because marked as optional in pom.xml*/
requires static com.fasterxml.jackson.core;

/** static, because marked as optional in pom.xml*/
requires static com.fasterxml.jackson.annotation;

/** static, because marked as optional in pom.xml*/
requires static com.fasterxml.jackson.databind;

/** static, because marked as optional in pom.xml*/
requires static com.google.gson;

/** static, because only used in testing */
requires static java.desktop;

}
18 changes: 7 additions & 11 deletions src/test/java/com/jsoniter/output/TestNested.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package com.jsoniter.output;

import java.io.*;
import java.util.*;

import com.jsoniter.annotation.JsonProperty;
import com.jsoniter.spi.JsoniterSpi;
import com.jsoniter.spi.TypeLiteral;
import junit.framework.TestCase;
import com.jsoniter.spi.*;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;

public class TestNested extends TestCase {

Expand Down Expand Up @@ -45,7 +41,7 @@ public void test_collection_of_objects() throws IOException {
obj1.field1 = "1";
obj1.field2 = "2";
String output = JsonStream.serialize(new TypeLiteral<List<TestObject1>>() {
}, new ArrayList() {{
}, new ArrayList<>() {{
add(obj1);
}});
assertTrue(output.contains("field1"));
Expand Down Expand Up @@ -92,7 +88,7 @@ public void test_map_of_objects() throws IOException {
obj1.field1 = "1";
obj1.field2 = "2";
stream.writeVal(new TypeLiteral<Map<String, TestObject1>>() {
}, new HashMap() {{
}, new HashMap<>() {{
put("hello", obj1);
}});
stream.close();
Expand Down