Skip to content

Commit

Permalink
style: fix styling and checkstyle warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
skaldarnar committed Nov 27, 2023
1 parent 0343eb1 commit 11bb4a3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
27 changes: 16 additions & 11 deletions src/main/java/org/terasology/launcher/game/GameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,20 @@ public class GameService extends Service<Boolean> {

public GameService() {
setExecutor(Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder()
.setNameFormat("GameService-%d")
.setDaemon(true)
.setUncaughtExceptionHandler(this::exceptionHandler)
.build()
new ThreadFactoryBuilder()
.setNameFormat("GameService-%d")
.setDaemon(true)
.setUncaughtExceptionHandler(this::exceptionHandler)
.build()
));
}

/**
* Start a new game process with these settings.
*
* @param installation the directory under which we will find libs/Terasology.jar, also used as the process's
* working directory
* @param settings supplies other settings relevant to configuring a process
* working directory
* @param settings supplies other settings relevant to configuring a process
*/
@SuppressWarnings("checkstyle:HiddenField")
public void start(Installation installation, Settings settings) {
Expand Down Expand Up @@ -116,10 +117,10 @@ public void restart() {
* This class's configuration fields <em>must</em> be set before this is called.
*
* @throws com.google.common.base.VerifyException when fields are unset
* @throws RuntimeException when required files in the game directory are missing or inaccessible
* @throws RuntimeException when required files in the game directory are missing or inaccessible
*/
@Override
protected RunGameTask createTask() throws GameVersionNotSupportedException{
protected RunGameTask createTask() throws GameVersionNotSupportedException {
verifyNotNull(settings);

GameStarter starter;
Expand All @@ -135,13 +136,17 @@ protected RunGameTask createTask() throws GameVersionNotSupportedException{
return new RunGameTask(starter);
}

/** After a task completes, reset to ready for the next. */
/**
* After a task completes, reset to ready for the next.
*/
@Override
protected void succeeded() {
reset(); // Ready to go again!
}

/** Checks to see if the failure left any exceptions behind, then resets to ready. */
/**
* Checks to see if the failure left any exceptions behind, then resets to ready.
*/
@Override
protected void failed() {
// "Uncaught" exceptions from javafx's Task are actually caught and kept in a property,
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/terasology/launcher/game/GameStarter.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ final class GameStarter implements Callable<Process> {
* @param logLevel the minimum level of log events Terasology will include on its output stream to us
*/
GameStarter(Installation installation, Path gameDataDirectory, JavaHeapSize heapMin, JavaHeapSize heapMax,
List<String> javaParams, List<String> gameParams, Level logLevel) throws IOException, GameVersionNotSupportedException, UnsupportedPlatformException {
List<String> javaParams, List<String> gameParams, Level logLevel)
throws IOException, GameVersionNotSupportedException, UnsupportedPlatformException {
Semver engineVersion = installation.getEngineVersion();
var gamePath = installation.path;

Expand Down
8 changes: 3 additions & 5 deletions src/main/java/org/terasology/launcher/platform/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
*/
public final class Platform {

final private OS os;

Check failure on line 17 in src/main/java/org/terasology/launcher/platform/Platform.java

View check run for this annotation

Check Run Reporter / code-analysis

com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck

com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck: 'private' modifier out of order with the JLS suggestions.
final private Arch arch;

Check failure on line 18 in src/main/java/org/terasology/launcher/platform/Platform.java

View check run for this annotation

Check Run Reporter / code-analysis

com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck

com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck: 'private' modifier out of order with the JLS suggestions.

//TODO(skaldarnar): I'm not fully settled on how to model the Platform. I thought splitting this up into two enums
// for OS and Architecture would help with more type-safe construction of these values, simplify comparison to
// select the right JRE for a game, etc.
Expand All @@ -28,17 +31,12 @@ public final class Platform {
// MAC_AARCH64
// The biggest drawback of being super-strict here is that development on non-supported platforms becomes
// impossible where it was just "not ideal" before.


public static final Set<Platform> SUPPORTED_PLATFORMS = Sets.newHashSet(

Check warning on line 34 in src/main/java/org/terasology/launcher/platform/Platform.java

View check run for this annotation

Check Run Reporter / code-analysis

com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck

com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck: Static variable definition in wrong order.
new Platform(OS.WINDOWS, Arch.X64),
new Platform(OS.LINUX, Arch.X64),
new Platform(OS.MAC, Arch.X64)
);

final private OS os;
final private Arch arch;

public Platform(OS os, Arch arch) {
this.os = os;
this.arch = arch;
Expand Down

0 comments on commit 11bb4a3

Please sign in to comment.