mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
Dependency upgrades
Upgrades: * Maven Enforcer Plugin to 3.0.0-M3 * Maven Surefire Plugin to 3.0.0-M5 * Maven Checkstyle Plugin to 3.1.1 * Maven Bundle Plugin to 5.1.1 * Jacoco Maven Plugin to 0.8.6 * Checkstyle to 8.36.1 * JUnit Jipiter to 5.7.0 * AssertJ to 3.17.2 * Guava to 29.0-jre Fix AssertJ breaking changes Use Java 8 or Apache Commons IO instead of Guava where possible Update GitHub Actions to use JDK 14 and JDK 15-ea
This commit is contained in:
parent
52ab22bbd8
commit
e17e744b20
2
.github/workflows/java-ea.yml
vendored
2
.github/workflows/java-ea.yml
vendored
@ -7,7 +7,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java: [15-ea]
|
||||
java: [16-ea]
|
||||
name: 'Linux JDK ${{ matrix.java }}'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java: [11, 13, 14]
|
||||
java: [11, 13, 15]
|
||||
name: 'Linux JDK ${{ matrix.java }}'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -22,17 +22,16 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<org.mapstruct.gem.version>1.0.0.Alpha2</org.mapstruct.gem.version>
|
||||
<!-- We can't go to 3.0.0-M2 as it has a regression. See https://issues.apache.org/jira/browse/MENFORCER-306 -->
|
||||
<org.apache.maven.plugins.enforcer.version>3.0.0-M1</org.apache.maven.plugins.enforcer.version>
|
||||
<org.apache.maven.plugins.surefire.version>3.0.0-M3</org.apache.maven.plugins.surefire.version>
|
||||
<org.apache.maven.plugins.enforcer.version>3.0.0-M3</org.apache.maven.plugins.enforcer.version>
|
||||
<org.apache.maven.plugins.surefire.version>3.0.0-M5</org.apache.maven.plugins.surefire.version>
|
||||
<org.apache.maven.plugins.javadoc.version>3.1.0</org.apache.maven.plugins.javadoc.version>
|
||||
<org.springframework.version>4.0.3.RELEASE</org.springframework.version>
|
||||
<org.eclipse.tycho.compiler-jdt.version>1.6.0</org.eclipse.tycho.compiler-jdt.version>
|
||||
<com.puppycrawl.tools.checkstyle.version>8.29</com.puppycrawl.tools.checkstyle.version>
|
||||
<org.junit.jupiter.version>5.6.0</org.junit.jupiter.version>
|
||||
<com.puppycrawl.tools.checkstyle.version>8.36.1</com.puppycrawl.tools.checkstyle.version>
|
||||
<org.junit.jupiter.version>5.7.0</org.junit.jupiter.version>
|
||||
<add.release.arguments />
|
||||
<forkCount>1</forkCount>
|
||||
<assertj.version>3.11.1</assertj.version>
|
||||
<assertj.version>3.17.2</assertj.version>
|
||||
<!-- automatically run annotation processors within the incremental compilation -->
|
||||
<!-- Needed for the hickory processor-->
|
||||
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
|
||||
@ -112,7 +111,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
<version>29.0-jre</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct.tools.gem</groupId>
|
||||
@ -307,7 +306,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<configLocation>build-config/checkstyle.xml</configLocation>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
@ -383,7 +382,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>5.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-manifest</id>
|
||||
@ -529,7 +528,7 @@
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.5</version>
|
||||
<version>0.8.6</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
||||
|
@ -14,7 +14,6 @@ import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.atIndex;
|
||||
|
||||
/**
|
||||
* @author Filip Hrisafov
|
||||
@ -34,9 +33,8 @@ public class Issue1338Test {
|
||||
source.setProperties( Arrays.asList( "first", "second" ) );
|
||||
Target target = Issue1338Mapper.INSTANCE.map( source );
|
||||
|
||||
assertThat( target )
|
||||
.extracting( "properties" )
|
||||
.contains( Arrays.asList( "first", "second" ), atIndex( 0 ) );
|
||||
assertThat( target.getProperties() )
|
||||
.containsExactly( "first", "second" );
|
||||
|
||||
Source mapped = Issue1338Mapper.INSTANCE.map( target );
|
||||
|
||||
|
@ -15,7 +15,7 @@ import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.atIndex;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.ITERABLE;
|
||||
|
||||
/**
|
||||
* @author Filip Hrisafov
|
||||
@ -33,14 +33,14 @@ public class Issue1359Test {
|
||||
public void shouldCompile() {
|
||||
|
||||
Target target = new Target();
|
||||
assertThat( target ).extracting( "properties" ).contains( null, atIndex( 0 ) );
|
||||
assertThat( target ).extracting( "properties" ).isNull();
|
||||
|
||||
Set<String> properties = new HashSet<>();
|
||||
properties.add( "first" );
|
||||
Source source = new Source( properties );
|
||||
Issue1359Mapper.INSTANCE.map( target, source );
|
||||
|
||||
assertThat( target ).extracting( "properties" ).contains( properties, atIndex( 0 ) );
|
||||
assertThat( target ).extracting( "properties", ITERABLE ).containsExactly( "first" );
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,6 @@ public class Issue895Test {
|
||||
assertThat( listOfByteArray.getBytes() ).containsExactly( new byte[] { 0, 1 }, new byte[] { 1, 2 } );
|
||||
|
||||
arrayOfByteArray = Mappers.getMapper( MultiArrayMapper.class ).convert( listOfByteArray );
|
||||
assertThat( arrayOfByteArray.getBytes() ).containsExactly( new byte[] { 0, 1 }, new byte[] { 1, 2 } );
|
||||
assertThat( arrayOfByteArray.getBytes() ).isDeepEqualTo( new byte[][] { { 0, 1 }, { 1, 2 } } );
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.mapstruct.ap.test.builder.nestedprop.expanding;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
public class FlattenedStock {
|
||||
private String article1;
|
||||
@ -16,8 +16,8 @@ public class FlattenedStock {
|
||||
}
|
||||
|
||||
public FlattenedStock(String article1, String article2, int count) {
|
||||
this.article1 = checkNotNull( article1 );
|
||||
this.article2 = checkNotNull( article2 );
|
||||
this.article1 = requireNonNull( article1 );
|
||||
this.article2 = requireNonNull( article2 );
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
@ -8,14 +8,12 @@ package org.mapstruct.ap.test.collection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public class Target {
|
||||
|
||||
//CHECKSTYLE:OFF
|
||||
@ -54,10 +52,11 @@ public class Target {
|
||||
private StringHolderToLongMap nonGenericMapStringtoLong;
|
||||
|
||||
public Target() {
|
||||
otherStringLongMap = Maps.newHashMap();
|
||||
otherStringLongMap = new HashMap<>();
|
||||
otherStringLongMap.put( "not-present-after-mapping", 42L );
|
||||
|
||||
otherStringList = Lists.newArrayList( "not-present-after-mapping" );
|
||||
otherStringList = new ArrayList<>();
|
||||
otherStringList.add( "not-present-after-mapping" );
|
||||
}
|
||||
|
||||
public List<String> getStringList() {
|
||||
|
@ -8,12 +8,10 @@ package org.mapstruct.ap.test.collection.iterabletononiterable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class StringListMapper {
|
||||
|
||||
public String stringListToString(List<String> strings) {
|
||||
return strings == null ? null : Joiner.on( "-" ).join( strings );
|
||||
return strings == null ? null : String.join( "-", strings );
|
||||
}
|
||||
|
||||
public List<String> stringToStringList(String string) {
|
||||
|
@ -15,6 +15,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.assertj.core.api.AbstractCharSequenceAssert;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.assertj.core.api.FileAssert;
|
||||
@ -23,9 +24,6 @@ import org.assertj.core.internal.Diff;
|
||||
import org.assertj.core.internal.Failures;
|
||||
import org.assertj.core.util.diff.Delta;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
/**
|
||||
* Allows to perform assertions on .java source files.
|
||||
*
|
||||
@ -58,7 +56,7 @@ public class JavaFileAssert extends FileAssert {
|
||||
isFile();
|
||||
|
||||
try {
|
||||
return Assertions.assertThat( Files.toString( actual, Charsets.UTF_8 ) );
|
||||
return Assertions.assertThat( FileUtils.readFileToString( actual, StandardCharsets.UTF_8 ) );
|
||||
}
|
||||
catch ( IOException e ) {
|
||||
failWithMessage( "Unable to read" + actual.toString() + ". Exception: " + e.getMessage() );
|
||||
|
@ -19,6 +19,7 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@ -26,6 +27,7 @@ import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
|
||||
import org.apache.commons.io.output.NullOutputStream;
|
||||
import org.junit.runners.model.FrameworkMethod;
|
||||
import org.junit.runners.model.Statement;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
@ -41,8 +43,6 @@ import org.mapstruct.ap.testutil.compilation.model.CompilationOutcomeDescriptor;
|
||||
import org.mapstruct.ap.testutil.compilation.model.DiagnosticDescriptor;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.puppycrawl.tools.checkstyle.Checker;
|
||||
import com.puppycrawl.tools.checkstyle.ConfigurationLoader;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultLogger;
|
||||
@ -217,7 +217,7 @@ abstract class CompilingStatement extends Statement {
|
||||
ByteArrayOutputStream errorStream = new ByteArrayOutputStream();
|
||||
checker.addListener(
|
||||
new DefaultLogger(
|
||||
ByteStreams.nullOutputStream(),
|
||||
NullOutputStream.NULL_OUTPUT_STREAM,
|
||||
AutomaticBean.OutputStreamOptions.CLOSE,
|
||||
errorStream,
|
||||
AutomaticBean.OutputStreamOptions.CLOSE
|
||||
@ -234,7 +234,7 @@ abstract class CompilingStatement extends Statement {
|
||||
}
|
||||
|
||||
private static List<File> findGeneratedFiles(File file) {
|
||||
final List<File> files = Lists.newLinkedList();
|
||||
final List<File> files = new LinkedList<>();
|
||||
|
||||
if ( file.canRead() ) {
|
||||
if ( file.isDirectory() ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user