Skip to content
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
3 changes: 2 additions & 1 deletion cli/src/main/java/montithings/steps/UnpackResources.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// (c) https://github.com/MontiCore/monticore
package montithings.steps;

import com.google.common.base.Verify;
import montithings.CLIState;
import montithings.CLIStep;
import montithings.MTCLI;
Expand Down Expand Up @@ -54,7 +55,7 @@ public void unpackResources(String srcName, File targetDirectory, String targetN
* @param target copy destination directory
*/
public void copyFromJar(String source, final Path target) throws URISyntaxException, IOException {
URI resource = Objects.requireNonNull(MTCLI.class.getResource("")).toURI();
URI resource = Verify.verifyNotNull(MTCLI.class.getResource("")).toURI();
FileSystem fileSystem;
try {
fileSystem = FileSystems.newFileSystem(resource, Collections.<String, String>emptyMap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.swing.text.DocumentFilter;

import static montithings.generator.helper.TypesHelper.java2cppTypeString;

/**
Expand Down Expand Up @@ -1094,7 +1092,7 @@ public static ASTInitBehavior getInitBehavior(ComponentTypeSymbol component,

public static String getInitBehaviorName(ComponentTypeSymbol component, ASTBehavior behavior) {
return getPortSpecificInitBehaviorName(component,
Objects.requireNonNull(getInitBehavior(component, behavior)));
Preconditions.checkNotNull(getInitBehavior(component, behavior)));
}

public static List<ASTInitBehavior> getInitBehaviorsWithoutBehaviors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package montithings.generator.helper;

import arcbasis._symboltable.ComponentTypeSymbol;
import com.google.common.base.Verify;
import de.se_rwth.commons.Names;
import de.se_rwth.commons.logging.Log;
import montithings._symboltable.IMontiThingsScope;
Expand Down Expand Up @@ -218,7 +219,7 @@ public static Set<String> getFilesWithEnding(File hwcPath, Set<String> fileEndin
if (recursive) {
pathStream = Files.walk(hwcPath.toPath());
} else {
pathStream = Arrays.stream(Objects.requireNonNull(hwcPath.listFiles())).map(File::toPath);
pathStream = Arrays.stream(Verify.verifyNotNull(hwcPath.listFiles())).map(File::toPath);
}

files = pathStream
Expand Down Expand Up @@ -251,7 +252,7 @@ public static Set<String> getFilesWithPrefix(File hwcPath, Set<String> filePrefi
if (recursive) {
pathStream = Files.walk(hwcPath.toPath());
} else {
pathStream = Arrays.stream(Objects.requireNonNull(hwcPath.listFiles())).map(File::toPath);
pathStream = Arrays.stream(Verify.verifyNotNull(hwcPath.listFiles())).map(File::toPath);
}

files = pathStream
Expand Down Expand Up @@ -299,7 +300,7 @@ public static File[] getSubPackagesPath(String modelPath) {
File[] subDirs = new File(modelPath).listFiles(File::isDirectory);

// Iterate over subdirectories of the model folder and add the paths of the subdirs to array
for (File subDir : Objects.requireNonNull(subDirs)) {
for (File subDir : Verify.verifyNotNull(subDirs)) {
subPackagesPaths.add(new File(subDir.getAbsolutePath()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package montithings.generator.steps.generate;

import arcbasis._symboltable.PortSymbol;
import com.google.common.base.Verify;
import de.se_rwth.commons.logging.Log;
import montithings.generator.config.SplittingMode;
import montithings.generator.config.TargetPlatform;
Expand Down Expand Up @@ -43,7 +44,7 @@ public void action(GeneratorToolState state) {

List<String> executableSensorActuatorPorts = new ArrayList<>();

for (File pckg : Objects.requireNonNull(packages)) {
for (File pckg : Verify.verifyNotNull(packages)) {
Set<String> sensorActuatorPorts = getFilesWithEnding(pckg, getFileEndings(), false);
for (String port : sensorActuatorPorts) {
if (!templatePortBelongsToComponent(port, state)) {
Expand All @@ -56,7 +57,7 @@ public void action(GeneratorToolState state) {
}
}

for (File pckg : Objects.requireNonNull(packages)) {
for (File pckg : Verify.verifyNotNull(packages)) {
Set<String> sensorActuatorPorts = getFilesWithPrefix(pckg, Collections.singleton("&"), false);
for (String port : sensorActuatorPorts) {
Log.debug("Processing handwritten port '" + port + "'", TOOL_NAME);
Expand Down