Skip to content

Commit

Permalink
Merge pull request gradle#9004 from gradle/revert-8991-lptr/core/use-…
Browse files Browse the repository at this point in the history
…guava-java-8

Revert "Use Java 8-compatible variant of Guava"
  • Loading branch information
lptr authored Apr 12, 2019
2 parents c3b1113 + 9d928bf commit 618b413
Show file tree
Hide file tree
Showing 26 changed files with 25 additions and 175 deletions.
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ libraries.fastutil = [coordinates: 'it.unimi.dsi:fastutil', version:
libraries.gcs = [coordinates: 'com.google.apis:google-api-services-storage', version: 'v1-rev136-1.25.0']
libraries.groovy = [coordinates: 'org.gradle.groovy:groovy-all', version: gradleGroovyVersion, because: 'emulating the Groovy 2.4-style groovy-all.jar, see https://github.com/gradle/gradle-groovy-all']
libraries.gson = [coordinates: 'com.google.code.gson:gson', version: '2.8.5']
libraries.guava = [coordinates: 'com.google.guava:guava', version: '26.0-jre']
libraries.guava = [coordinates: 'com.google.guava:guava', version: '26.0-android', because: 'android variant is compatible with JDK 7']
libraries.inject = [coordinates: 'javax.inject:javax.inject', version: '1']
libraries.ivy = [coordinates: 'org.apache.ivy:ivy', version: '2.3.0',
because: '2.4.0 contains a breaking change in DefaultModuleDescriptor.getExtraInfo(), cf. https://issues.apache.org/jira/browse/IVY-1457']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,9 @@ public static ScriptBlock detectScriptBlock(Statement statement, Predicate<? sup
@Nullable
public static ScriptBlock detectScriptBlock(Statement statement, final Collection<String> names) {
return detectScriptBlock(statement, new Predicate<ScriptBlock>() {
@Override
public boolean apply(ScriptBlock input) {
return names.contains(input.getName());
}

@Override
// Added for Java 6 source compatibility
public boolean test(ScriptBlock input) {
return apply(input);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ public abstract class Actions {
public boolean apply(@Nullable Action<?> input) {
return input != DO_NOTHING;
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable Action<?> input) {
return apply(input);
}
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.gradle.internal.work;

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.gradle.api.Action;
Expand Down Expand Up @@ -43,6 +44,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -202,12 +204,12 @@ public void run() {
}

private boolean containsProjectLocks(Iterable<? extends ResourceLock> locks) {
for (ResourceLock lock : locks) {
if (lock instanceof ProjectLock) {
return true;
return Iterables.any(locks, new Predicate<ResourceLock>() {
@Override
public boolean apply(@Nullable ResourceLock lock) {
return lock instanceof ProjectLock;
}
}
return false;
});
}

private Iterable<? extends ResourceLock> locksNotHeld(final Iterable<? extends ResourceLock> locks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,10 @@ class IncrementalInputsIntegrationTest extends AbstractIncrementalTasksIntegrati
"""

file("input").createDir()
def inputPath = file('input').absolutePath

expect:
fails("myTask")
failureHasCause("Multiple entries with same value: inputTwo=$inputPath and inputOne=$inputPath")
failureHasCause("Multiple entries with same key: ${file('input').absolutePath}=inputTwo and ${file('input').absolutePath}=inputOne")
}

def "two incremental file properties can point to the same file"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,9 @@ public boolean hasPlugin(Class<? extends Plugin> type) {
private Plugin doFindPlugin(String id) {
for (final PluginManagerInternal.PluginWithId pluginWithId : pluginManager.pluginsForId(id)) {
Plugin plugin = Iterables.tryFind(DefaultPluginContainer.this, new Predicate<Plugin>() {
@Override
public boolean apply(Plugin plugin) {
return pluginWithId.clazz.equals(plugin.getClass());
}

@Override
// Added for Java 6 source compatibility
public boolean test(Plugin input) {
return apply(input);
}
}).orNull();

if (plugin != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ public void visitContents(FileCollectionResolveContext context) {
public boolean apply(InputFilePropertySpec property) {
return property.isSkipWhenEmpty();
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable InputFilePropertySpec input) {
return apply(input);
}
});
this.outputFiles = new CompositeFileCollection() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,6 @@ private void removeShouldRunAfterSuccessorsIfTheyImposeACycle(final HashMultimap
public boolean apply(Node input) {
return visitingNodes.containsEntry(input, nodeWithVisitingSegment.visitingSegment);
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable Node input) {
return apply(input);
}
});
}

Expand Down Expand Up @@ -444,12 +438,6 @@ public Integer transform(final Node dependsOnTask) {
public boolean apply(NodeInVisitingSegment nodeInVisitingSegment) {
return nodeInVisitingSegment.node.equals(dependsOnTask);
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable NodeInVisitingSegment input) {
return apply(input);
}
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ public File apply(File input) {
public boolean apply(File input) {
return inCombinedRootsOrAncestorOfAnyRoot(input, roots, unfiltered);
}

@Override
// Added for Java 6 source compatibility
public boolean test(File input) {
return apply(input);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ public <D, R, T extends BuildOperationType<D, R>> List<TypedRecord<D, R>> all(fi
public boolean apply(Record input) {
return detailsType.isInstance(input.descriptor.getDetails());
}

@Override
// Added for Java 6 source compatibility
public boolean test(Record input) {
return apply(input);
}
})
.transform(new Function<Record, TypedRecord<D, R>>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.gradle.internal.graph.GraphRenderer;
import org.gradle.internal.logging.text.StyledTextOutput;

import javax.annotation.Nullable;
import java.util.Set;

import static org.gradle.internal.logging.text.StyledTextOutput.Style.Info;
Expand Down Expand Up @@ -128,11 +127,5 @@ public boolean apply(RenderableDependency node) {
}
return false;
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable RenderableDependency input) {
return apply(input);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ public static DependentComponentsRenderableDependency of(ComponentSpec component
public boolean apply(BinarySpec binarySpec) {
return binarySpec.isBuildable();
}

@Override
// Added for Java 6 source compatibility
public boolean test(BinarySpec input) {
return apply(input);
}
});
}
boolean testSuite = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
import java.util.Map;
import java.util.TreeMap;

import static org.gradle.internal.logging.text.StyledTextOutput.Style.Description;
import static org.gradle.internal.logging.text.StyledTextOutput.Style.Identifier;
import static org.gradle.internal.logging.text.StyledTextOutput.Style.Normal;
import static org.gradle.internal.logging.text.StyledTextOutput.Style.*;

public class ModelNodeRenderer extends ReportRenderer<ModelNode, TextReportBuilder> {

Expand Down Expand Up @@ -170,12 +168,6 @@ static Iterable<ModelRuleDescriptor> uniqueExecutedRulesExcludingCreator(final M
public boolean apply(ModelRuleDescriptor input) {
return !input.equals(model.getDescriptor());
}

@Override
// Added for Java 6 source compatibility
public boolean test(ModelRuleDescriptor input) {
return apply(input);
}
});
return ImmutableSet.copyOf(filtered);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DistributionIntegritySpec extends DistributionIntegrationSpec {
'commons-io-2.6.jar' : 'f877d304660ac2a142f3865badfc971dec7ed73c747c7f8d5d2f5139ca736513',
'commons-lang-2.6.jar' : '50f11b09f877c294d56f24463f47d28f929cf5044f648661c0f0cfbae9a2f49c',
'groovy-all-1.0-2.5.4.jar' : '704d3307616c57234871c4db3a355c3e81ea975db8dac8ee6c9264b91c74d2b7',
'guava-26.0-jre.jar' : 'a0e9cabad665bc20bcd2b01f108e5fc03f756e13aea80abaadb9f407033bea2c',
'guava-26.0-android.jar' : '1d044ebb866ef08b7d04e998b4260c9b52fab6e6d6b68d207859486bb3686cd5',
'jansi-1.17.1.jar' : 'b2234bfb0d8f245562d64ed9325df6b907093f4daa702c9082d4796db2a2d894',
'javax.inject-1.jar' : '91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
'jcl-over-slf4j-1.7.25.jar' : '5e938457e79efcbfb3ab64bc29c43ec6c3b95fffcda3c155f4a86cc320c11e14',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/
package org.gradle.api.internal.file;

import com.google.common.collect.AbstractIterator;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import groovy.lang.Closure;
import org.apache.commons.lang.StringUtils;
import org.gradle.api.file.FileCollection;
Expand All @@ -31,6 +32,7 @@
import org.gradle.util.CollectionUtils;
import org.gradle.util.GUtil;

import javax.annotation.Nullable;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -188,6 +190,12 @@ public FileCollection filter(Closure filterClosure) {

@Override
public FileCollection filter(final Spec<? super File> filterSpec) {
final Predicate<File> predicate = new Predicate<File>() {
@Override
public boolean apply(@Nullable File input) {
return filterSpec.isSatisfiedBy(input);
}
};
return new AbstractFileCollection() {
@Override
public String getDisplayName() {
Expand All @@ -206,24 +214,12 @@ public Set<File> getFiles() {

@Override
public boolean contains(File file) {
return AbstractFileCollection.this.contains(file) && filterSpec.isSatisfiedBy(file);
return AbstractFileCollection.this.contains(file) && predicate.apply(file);
}

@Override
public Iterator<File> iterator() {
final Iterator<File> delegate = AbstractFileCollection.this.iterator();
return new AbstractIterator<File>() {
@Override
protected File computeNext() {
while (delegate.hasNext()) {
File element = delegate.next();
if (filterSpec.isSatisfiedBy(element)) {
return element;
}
}
return endOfData();
}
};
return Iterators.filter(AbstractFileCollection.this.iterator(), predicate);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Lists;
import groovy.lang.Closure;
import org.gradle.api.internal.file.collections.DirectoryFileTree;
import org.gradle.api.tasks.AntBuilderAware;
import org.gradle.internal.metaobject.BeanDynamicObject;
import org.gradle.internal.metaobject.DynamicObject;
import org.gradle.api.internal.file.collections.DirectoryFileTree;
import org.gradle.api.tasks.AntBuilderAware;

import java.util.Collections;

Expand All @@ -46,12 +46,6 @@ public Object addToAntBuilder(final Object node, final String childNodeName) {
public boolean apply(DirectoryFileTree input) {
return input.getDir().exists();
}

@Override
// Added for Java 6 source compatibility
public boolean test(DirectoryFileTree input) {
return apply(input);
}
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.gradle.language.base.internal.compile.Compiler;
import org.gradle.util.VersionNumber;

import javax.annotation.Nullable;
import java.io.File;
import java.io.Serializable;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -164,12 +163,6 @@ public void compile(List<String> files, CompilationUnit cu) {
public boolean apply(File file) {
return hasExtension(file, ".java");
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable File input) {
return apply(input);
}
}));

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.gradle.language.base.internal.compile.Compiler;
import org.gradle.util.CollectionUtils;

import javax.annotation.Nullable;
import java.io.File;
import java.util.List;

Expand Down Expand Up @@ -72,12 +71,6 @@ public boolean apply(File element) {
}
return false;
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable File input) {
return apply(input);
}
});

spec.setSourceFiles(ImmutableSet.copyOf(filtered));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ private void resolveAndFilterSourceFiles(JavaCompileSpec spec) {
public boolean apply(@Nullable File input) {
return hasExtension(input, ".java");
}

@Override
// Added for Java 6 source compatibility
public boolean test(@Nullable File input) {
return apply(input);
}
});

spec.setSourceFiles(ImmutableSet.copyOf(javaOnly));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,9 @@ public ClassRelevancyFilter(String excludedClassName) {
this.excludedClassName = excludedClassName;
}

@Override
public boolean apply(String className) {
return !className.startsWith("java.")
&& !excludedClassName.equals(className)
&& !PRIMITIVES.contains(className);
}

@Override
// Added for Java 6 source compatibility
public boolean test(String input) {
return apply(input);
}
}
Loading

0 comments on commit 618b413

Please sign in to comment.