Skip to content

Commit

Permalink
minor: var for local variable instantiation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfirry committed Oct 18, 2024
1 parent 5b154c4 commit 00141a4
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void execute() throws MojoExecutionException {
String[] splitName = name.split("\\.", -1);
finalFolder = targetClassFolder.toPath();
finalSourceFolder = targetSourceFolder.toPath();
String packageName = createPackageName(splitName);
var packageName = createPackageName(splitName);

finalFolder = resolvePath(finalFolder, splitName);
finalSourceFolder = resolvePath(finalSourceFolder, splitName);
Expand All @@ -97,14 +97,14 @@ public void execute() throws MojoExecutionException {
e);
}

String machineName = splitName[splitName.length - 1] + "MachineFactory";
var machineName = splitName[splitName.length - 1] + "MachineFactory";
generateClass(finalSourceFolder, packageName, machineName);
writeCompiledClasses(result, finalFolder);
addProjectResources(targetClassFolder.getPath(), targetSourceFolder.getPath());
}

private void addProjectResources(String classFolder, String sourceFolder) {
Resource resource = new Resource();
var resource = new Resource();
resource.setDirectory(classFolder);
project.addResource(resource);
project.addCompileSourceRoot(sourceFolder);
Expand All @@ -113,8 +113,8 @@ private void addProjectResources(String classFolder, String sourceFolder) {
private void writeCompiledClasses(CompilerResult result, Path finalFolder)
throws MojoExecutionException {
for (Map.Entry<String, byte[]> entry : result.classBytes().entrySet()) {
String binaryName = entry.getKey().replace('.', '/') + ".class";
Path targetFile = finalFolder.resolve(binaryName);
var binaryName = entry.getKey().replace('.', '/') + ".class";
var targetFile = finalFolder.resolve(binaryName);
try {
Files.write(targetFile, entry.getValue());
} catch (IOException e) {
Expand Down

0 comments on commit 00141a4

Please sign in to comment.