Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
import org.gradle.internal.impldep.com.google.common.base.Preconditions;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Objects;

/**
* This task just extracts a file from the resources
Expand All @@ -29,8 +29,8 @@ public abstract class ExtractCodeStyleFileTask extends DefaultTask {

@TaskAction
public void store() throws IOException {
Files.copy(Objects.requireNonNull(
ExtractCodeStyleFileTask.class.getClassLoader().getResourceAsStream(getInput().get())),
Files.copy(Preconditions.checkNotNull(
ExtractCodeStyleFileTask.class.getClassLoader().getResourceAsStream(getInput().get())),
getDestination().get().getAsFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.gradle.api.UnknownTaskException;
import org.gradle.api.file.RegularFile;
import org.gradle.api.provider.Provider;
import org.gradle.internal.impldep.com.google.api.client.util.Preconditions;

import javax.annotation.Nonnull;
import java.io.File;
Expand Down Expand Up @@ -108,7 +109,7 @@ public void apply(@Nonnull Project project) {
try (
InputStream url = getClass().getClassLoader()
.getResourceAsStream("se-codestyle/.editorconfig")) {
Files.copy(Objects.requireNonNull(url), editorConfig.toPath(),
Files.copy(Preconditions.checkNotNull(url), editorConfig.toPath(),
StandardCopyOption.REPLACE_EXISTING);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.gradle.queue;

import com.google.common.base.Preconditions;
import com.google.gson.Gson;
import de.monticore.gradle.internal.io.PrefixStream;
import de.monticore.gradle.internal.io.PrintStreamThreadProxy;
Expand Down Expand Up @@ -76,10 +77,10 @@ protected void init(ServiceRegistry serviceRegistry) {
logger.warn("Possibly overriding the CachedQueueService instance");
INSTANCE = this;
}
this.serviceRegistry = Objects.requireNonNull(serviceRegistry);
this.serviceRegistry = Preconditions.checkNotNull(serviceRegistry);
this.providerSelf = (Provider<CachedQueueService>) serviceRegistry.get(BuildServiceRegistry.class).getRegistrations().getByName(NAME).getService();
Objects.requireNonNull(serviceRegistry.get(ActionExecutionSpecFactory.class), "ActionExecutionSpecFactory");
Objects.requireNonNull(serviceRegistry.get(IsolatableFactory.class), "isolatableFactory");
Preconditions.checkNotNull(serviceRegistry.get(ActionExecutionSpecFactory.class), "ActionExecutionSpecFactory");
Preconditions.checkNotNull(serviceRegistry.get(IsolatableFactory.class), "isolatableFactory");

serviceRegistry.get(BuildEventListenerRegistryInternal.class)
.onOperationCompletion(this.providerSelf);
Expand Down Expand Up @@ -635,7 +636,7 @@ public void markForErasure() {


/**
* Construc
* Constructor for a new WorkQueue
*
* @param workerExecutor the worker executor to use
* @param extraClasspathElement the classpath elements to use
Expand All @@ -644,7 +645,7 @@ public void markForErasure() {
public WorkQueue newWorkQueue(WorkerExecutor workerExecutor, FileCollection extraClasspathElement) {
return new CachedIsolatedWorkQueue(workerExecutor.noIsolation(),
serviceRegistry.get(InstantiatorFactory.class),
Objects.requireNonNull(serviceRegistry, "serviceRegistry"),
Preconditions.checkNotNull(serviceRegistry, "serviceRegistry"),
this.providerSelf,
extraClasspathElement);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* (c) https://github.com/MontiCore/monticore */
package de.se_rwth.commons.groovy;

import com.google.common.base.Preconditions;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -45,7 +47,7 @@ public DelegatingClassLoader(ClassLoader delegate) {

@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
return Objects.requireNonNull(delegate.get()).loadClass(name);
return Preconditions.checkNotNull(delegate.get()).loadClass(name);
}

@Override
Expand All @@ -65,23 +67,23 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE

@Override
public URL getResource(String name) {
return Objects.requireNonNull(delegate.get()).getResource(name);
return Preconditions.checkNotNull(delegate.get()).getResource(name);
}

@Override
public Enumeration<URL> getResources(String name) throws IOException {
return Objects.requireNonNull(delegate.get()).getResources(name);
return Preconditions.checkNotNull(delegate.get()).getResources(name);
}

// Enable with language level 9
// @Override
// public Stream<URL> resources(String name) {
// return Objects.requireNonNull(delegate.get()).resources(name);
// return Preconditions.checkNotNull(delegate.get()).resources(name);
// }

@Override
public InputStream getResourceAsStream(String name) {
return Objects.requireNonNull(delegate.get()).getResourceAsStream(name);
return Preconditions.checkNotNull(delegate.get()).getResourceAsStream(name);
}

@Override
Expand Down
Loading