Skip to content

Commit c849d73

Browse files
authored
[MSHADE-359] update guava (#42)
* update guava * remove a couple of usages of Guava * remove a couple of usages of Joiner
1 parent 7966a5a commit c849d73

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,13 @@
185185
<dependency>
186186
<groupId>com.google.guava</groupId>
187187
<artifactId>guava</artifactId>
188-
<version>19.0</version>
188+
<version>28.2-android</version>
189+
</dependency>
190+
191+
<dependency>
192+
<groupId>org.apache.commons</groupId>
193+
<artifactId>commons-lang3</artifactId>
194+
<version>3.7</version>
189195
</dependency>
190196

191197
<dependency>

src/main/java/org/apache/maven/plugins/shade/DefaultShader.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import java.util.regex.Pattern;
4545
import java.util.zip.ZipException;
4646

47+
import org.apache.commons.lang3.StringUtils;
4748
import org.apache.maven.plugin.MojoExecutionException;
4849
import org.apache.maven.plugins.shade.filter.Filter;
4950
import org.apache.maven.plugins.shade.relocation.Relocator;
@@ -58,8 +59,6 @@
5859
import org.objectweb.asm.commons.ClassRemapper;
5960
import org.objectweb.asm.commons.Remapper;
6061

61-
62-
import com.google.common.base.Joiner;
6362
import com.google.common.collect.HashMultimap;
6463
import com.google.common.collect.Multimap;
6564

@@ -351,8 +350,8 @@ private void logSummaryOfDuplicates( Multimap<Collection<File>, String> overlapp
351350
all.addAll( resources );
352351

353352
getLogger().warn(
354-
Joiner.on( ", " ).join( jarzS ) + " define " + all.size()
355-
+ " overlapping " + Joiner.on( " and " ).join( overlaps ) + ": " );
353+
StringUtils.join( jarzS, ", " ) + " define " + all.size()
354+
+ " overlapping " + StringUtils.join( overlaps, " and " ) + ": " );
356355
//CHECKSTYLE_ON: LineLength
357356

358357
Collections.sort( all );

src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
import org.apache.commons.io.IOUtils;
3838
import org.apache.maven.plugins.shade.relocation.Relocator;
3939

40-
import com.google.common.io.LineReader;
41-
4240
/**
4341
* Resources transformer that relocates classes in META-INF/services and appends entries in META-INF/services resources
4442
* into a single resource. For example, if there are several META-INF/services/org.apache.maven.project.ProjectBuilder
@@ -77,7 +75,7 @@ public void processResource( String resource, InputStream is, final List<Relocat
7775

7876
final String content = IOUtils.toString( is );
7977
StringReader reader = new StringReader( content );
80-
LineReader lineReader = new LineReader( reader );
78+
BufferedReader lineReader = new BufferedReader( reader );
8179
String line;
8280
while ( ( line = lineReader.readLine() ) != null )
8381
{

src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.io.FileOutputStream;
2929
import java.io.InputStream;
3030
import java.nio.charset.StandardCharsets;
31+
import java.util.ArrayList;
3132
import java.util.Arrays;
3233
import java.util.List;
3334
import java.util.jar.JarEntry;
@@ -39,18 +40,18 @@
3940
import org.apache.maven.plugins.shade.relocation.SimpleRelocator;
4041
import org.junit.Test;
4142

42-
import com.google.common.collect.Lists;
43-
4443
/**
4544
* Test for handling META-INF/service/...
4645
*/
4746
public class ServiceResourceTransformerTest {
47+
48+
private List<Relocator> relocators = new ArrayList<Relocator>();
4849

4950
@Test
5051
public void relocatedClasses() throws Exception {
5152
SimpleRelocator relocator =
5253
new SimpleRelocator( "org.foo", "borg.foo", null, Arrays.asList( "org.foo.exclude.*" ) );
53-
List<Relocator> relocators = Lists.<Relocator>newArrayList( relocator );
54+
relocators.add( relocator );
5455

5556
String content = "org.foo.Service\norg.foo.exclude.OtherService\n";
5657
byte[] contentBytes = content.getBytes( StandardCharsets.UTF_8 );
@@ -95,8 +96,8 @@ public void relocatedClasses() throws Exception {
9596
public void concatanationAppliedMultipleTimes() throws Exception {
9697
SimpleRelocator relocator =
9798
new SimpleRelocator( "org.eclipse", "org.eclipse1234", null, null );
98-
List<Relocator> relocators = Lists.<Relocator>newArrayList( relocator );
99-
99+
relocators.add( relocator );
100+
100101
String content = "org.eclipse.osgi.launch.EquinoxFactory\n";
101102
byte[] contentBytes = content.getBytes( "UTF-8" );
102103
InputStream contentStream = new ByteArrayInputStream( contentBytes );
@@ -138,8 +139,8 @@ public void concatanationAppliedMultipleTimes() throws Exception {
138139
@Test
139140
public void concatenation() throws Exception {
140141
SimpleRelocator relocator = new SimpleRelocator("org.foo", "borg.foo", null, null);
141-
List<Relocator> relocators = Lists.<Relocator>newArrayList( relocator );
142-
142+
relocators.add( relocator );
143+
143144
String content = "org.foo.Service\n";
144145
byte[] contentBytes = content.getBytes( StandardCharsets.UTF_8 );
145146
InputStream contentStream = new ByteArrayInputStream( contentBytes );

0 commit comments

Comments
 (0)