Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: address IntelliJ QAPlug plugin findings #5149

Merged
merged 35 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
aa6ca30
qa: make final fields static
jdrueckert Oct 22, 2023
1a53322
qa: remove unnecessary local before return
jdrueckert Oct 22, 2023
db4f626
qa: avoid instanceof checks in catch clause
jdrueckert Oct 22, 2023
e3d80fb
qa: method/constructor should not throw java.lang.Exception
jdrueckert Oct 22, 2023
f22c1fa
qa: instanceof check covers null check
jdrueckert Oct 22, 2023
9d7204b
qa: avoid toString on String objects
jdrueckert Oct 22, 2023
993b370
qa: remove overrides that only call their super
jdrueckert Oct 22, 2023
315ef35
qa: remove unused private methods
jdrueckert Oct 22, 2023
3c5d507
qa: if statement nesting not necessary
jdrueckert Oct 22, 2023
df3539a
qa: remove unused local variable
jdrueckert Oct 22, 2023
b0ec929
qa: close resources after use
jdrueckert Oct 22, 2023
06c5fcf
qa: use equals() to compare object references
jdrueckert Oct 22, 2023
3428369
Merge branch 'develop' into chore/qaplug-findings
jdrueckert Oct 27, 2023
a3f8fbc
fix: reintroduce override, needed to elevate access modifier
jdrueckert Oct 27, 2023
760a174
fix: exception type in override
jdrueckert Oct 27, 2023
f067ba2
chore: replace invalid javadoc character with unicode representation
jdrueckert Oct 27, 2023
077d488
javadoc: fix broken references
jdrueckert Oct 28, 2023
6a816ed
javadoc: fix disallowed self-closing and empty elements
jdrueckert Oct 28, 2023
a27bd8e
javadoc: fix invalid uses of @param and @return
jdrueckert Oct 28, 2023
c93ad63
javadoc: fix bad use of symbols
jdrueckert Oct 28, 2023
ad27ad0
javadoc: fix disallowed list item tag without surrounding list
jdrueckert Oct 28, 2023
cce1a8b
javadoc: fix erroneous tags
jdrueckert Oct 28, 2023
45e6571
javadoc: fix more references
jdrueckert Oct 28, 2023
35c2bc3
javadoc: fix emphasize tags
jdrueckert Oct 28, 2023
60a41a5
chore: fix missing javadoc errors
jdrueckert Oct 28, 2023
3d13e1f
javadoc: fix @see
jdrueckert Oct 29, 2023
848947e
checkstyle: remove illegal throws
jdrueckert Oct 30, 2023
f585450
checkstyle: remove unused imports
jdrueckert Oct 30, 2023
01e8edd
refactor: replace explicit close with try-with-resources
jdrueckert Oct 30, 2023
b841271
revert: removal of unused param from AbstractFamily constructor
jdrueckert Oct 30, 2023
2aad50f
revert: close zip Filesystem
jdrueckert Oct 30, 2023
49725fa
revert: removing required zip.close
jdrueckert Oct 30, 2023
bf26781
Merge branch 'develop' into chore/qaplug-findings
jdrueckert Oct 31, 2023
971c853
Merge branch 'develop' into chore/qaplug-findings
jdrueckert Nov 6, 2023
08bd7ea
Merge branch 'develop' into chore/qaplug-findings
jdrueckert Nov 11, 2023
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 @@ -37,10 +37,10 @@

/**
* Behavior tree system
* <p/>
* <p>
* Each entity with BehaviorComponent is kept under control by this system. For each such entity a behavior tree is
* loaded and an interpreter is started.
* <p/>
* <p>
* Modifications made to a behavior tree will reflect to all entities using this tree.
*/
@RegisterSystem(RegisterMode.AUTHORITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@

/**
* Behavior tree system
* <p/>
* <p>
* Each entity with BehaviorComponent is kept under control by this system. For each such entity a behavior tree
* is loaded and an interpreter is started.
* <p/>
* <p>
* Modifications made to a behavior tree will reflect to all entities using this tree.
*/
@RegisterSystem(RegisterMode.AUTHORITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* The action that is used by an action or decorator node. Every action node of a behavior tree has its own action
* instance. There is only one action instance for all actors, that run a behavior tree - so all state information
* needs to be stored at the actor.
* <p/>
* <p>
* Action instances are shown in the property panel of the behavior editor.
*/
@API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@

/**
* JSON deserializer to create trees using json:
* <p/>
* <p>
* { sequence:[action1, {action2:{ foo:bar, duration:7}}] }
* <p/>
* <p>
* Actions and Decorators need to be registered before parsing.
*/
public class BehaviorTreeBuilder implements JsonDeserializer<BehaviorNode>, JsonSerializer<BehaviorNode> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

/**
* This is only attached to the <b>alive character</b> entities. <br/>
* Used to differentiate between alive and dead character entities.<br/><br/>
* This is only attached to the <b>alive character</b> entities.<br>
* Used to differentiate between alive and dead character entities.<br><br>
*
* This needs to be necessarily attached to all character entities that require CharacterMovementComponent
* for movement systems to work.<br/>
* for movement systems to work.<br>
* Can be used to differently handle situations for character entities that can remain in a dead state
* or respawn after a while.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**
* This component is attached to all character entities. It governs movement and stores associated paramenters, and can
* be used instead of a CapsuleShapeComponent by the physics system to define the collision shape. <br/> The {@link
* be used instead of a CapsuleShapeComponent by the physics system to define the collision shape. <br> The {@link
* AliveCharacterComponent} should necessarily be attached to the character entity for the movement systems to work.
*/
public final class CharacterMovementComponent implements Component<CharacterMovementComponent> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

/**
* This is only attached to the player entities. <br/>
* This is only attached to the player entities. <br>
* Used to differentiate between player characters and other character entities.
*/
public class PlayerCharacterComponent extends EmptyComponent<PlayerCharacterComponent> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/**
* This event gets sent when the {@link LocalPlayer} object is ready to be used.
* <br/>
* <br>
* The object can be injected using {@link org.terasology.engine.registry.In}.
* This event corresponds with its isValid() method returning true for the first time.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.terasology.gestalt.entitysystem.event.Event;

/**
* This event gets sent when the player respawns.<br/>
* The player entity is preserved along with its components during respawn.<br/>
* This event gets sent when the player respawns.<br>
* The player entity is preserved along with its components during respawn.<br>
* This event should be received and handled by systems that need to reset
* some components attached to the player entity.
*/
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/java/org/terasology/engine/math/Side.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static List<Side> horizontalSides() {

/**
* This provides a static List of all Sides defined in the enumeration. The result contains the same values as
* calling {@code Side#values} but this does not create a new copy on every call. <br/>
* calling {@code Side#values} but this does not create a new copy on every call.<br>
*
* @return All available sides
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Stores the current RecordAndReplayStatus. This class is extremely important since the status is the flag that
* activates Record and Replay.
* <p>
* <br>
* <h2>Record Workflow</h2> When the user clicks on the "Record" button on the extras menu, the {@link #status}
* is set to PREPARING_RECORD. When a game is selected to be loaded from the "Record Screen" and the game is completely
* loaded, the {@link #status} will be set to RECORDING by the {@link org.terasology.engine.core.modes.loadProcesses.InitialiseRecordAndReplay}
Expand All @@ -22,7 +22,7 @@
* and then every recorded data that was not stored yet will be serialized
* and stored once {@link org.terasology.engine.persistence.internal.SaveTransaction}'s
* saveRecordingData() method is called right after the game is saved. Once this is done, the {@link #status} is set to NOT_ACTIVATED.
* <p>
* <br>
* <h2>Replay Workflow</h2> When the user clicks on the "Replay" button on the extras menu, the {@link #status}
* is set to PREPEARING_REPLAY. During the load process of a Replay, the {@link org.terasology.engine.core.modes.loadProcesses.InitialiseWorld}
* class gets the game path from the "recordings" folder instead of the "saves" one,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* This implementation works closely with a number of support objects, in particular:
* <p>
* TODO: update this section to include new, relevant objects - a RenderableWorld instance, providing acceleration
* structures caching blocks requiring different rendering treatments<br/>
* structures caching blocks requiring different rendering treatments<br>
*/
public final class WorldRendererImpl implements WorldRenderer {
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* <p>
* When you create a TaskMaster, it is important to shut it down after you're finished with it, generally in the
* shutdown method of a ComponentSystem. A basic usage example follows:
* <p>
* <br>
* <pre>
* {@literal
* TaskMaster<MyBaseTask> taskMaster = TaskMaster.createFIFOTaskMaster("MyTaskMaster", 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ public abstract class AbstractBlockFamily implements BlockFamily {
private BlockUri uri;
private Set<String> categories = Sets.newHashSet();

protected AbstractBlockFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
setBlockUri(new BlockUri(definition.getUrn()));
setCategory(definition.getCategories());
}

protected AbstractBlockFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
protected AbstractBlockFamily(BlockFamilyDefinition definition) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change unrelated to the commit message - is that on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes and no - I saw that blockBuilder isn't used and wanted to change something about it but then I thought I'd ask soundwave about the intent of the changes first - still waiting to hear back... wanted to put the change in a separate PR, but seems they snuck their way in here unfortunately...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

setBlockUri(new BlockUri(definition.getUrn()));
setCategory(definition.getCategories());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public class AttachedToSurfaceFamily extends AbstractBlockFamily {
private Map<Side, Block> blocks = Maps.newEnumMap(Side.class);
private Block archetype;

public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition, shape, blockBuilder);
public AttachedToSurfaceFamily(BlockFamilyDefinition definition) {
super(definition);
throw new UnsupportedOperationException("Freeform blocks not supported");
}

public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition, blockBuilder);
super(definition);

Map<Side, Block> blockMap = Maps.newEnumMap(Side.class);
if (definition.getData().hasSection("top")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CeilingSupportingHorizontalFamily(BlockFamilyDefinition definition, Block
}

public CeilingSupportingHorizontalFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition, blockBuilder);
super(definition);

BlockUri uri = new BlockUri(definition.getUrn());
populateBlockMaps(blockBuilder, null, definition, uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class FreeformFamily extends AbstractBlockFamily implements SideDefinedBl
private Block archetypeBlock;

public FreeformFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition, shape, blockBuilder);
super(definition);
BlockUri uri;
if (CUBE_SHAPE_URN.equals(shape.getUrn())) {
uri = new BlockUri(definition.getUrn());
Expand All @@ -54,8 +54,8 @@ public FreeformFamily(BlockFamilyDefinition definition, BlockShape shape, BlockB
setBlockUri(uri);
}

public FreeformFamily(BlockFamilyDefinition blockFamilyDefinition, BlockBuilderHelper blockBuilderHelper) {
super(blockFamilyDefinition, blockBuilderHelper);
public FreeformFamily(BlockFamilyDefinition blockFamilyDefinition) {
super(blockFamilyDefinition);
throw new UnsupportedOperationException("Shape expected");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class HorizontalFamily extends AbstractBlockFamily implements SideDefined
private Map<Side, Block> blocks = Maps.newEnumMap(Side.class);

public HorizontalFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition, shape, blockBuilder);
super(definition);
BlockUri uri;
if (CUBE_SHAPE_URN.equals(shape.getUrn())) {
uri = new BlockUri(definition.getUrn());
Expand All @@ -48,7 +48,7 @@ public HorizontalFamily(BlockFamilyDefinition definition, BlockShape shape, Bloc
}

public HorizontalFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition, blockBuilder);
super(definition);
BlockUri uri = new BlockUri(definition.getUrn());
for (Rotation rot : Rotation.horizontalRotations()) {
Side side = rot.rotate(Side.FRONT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,13 @@ public abstract class MultiConnectFamily extends AbstractBlockFamily implements

protected TByteObjectMap<Block> blocks = new TByteObjectHashMap<>();

/**
* Constructor for a block with a specified shape
*
* @param definition Family definition
* @param shape The shape of the block
* @param blockBuilder The builder to make the blocks for the family
*/
public MultiConnectFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition, shape, blockBuilder);
}

/**
* Constructor for a regular block
*
* @param definition Family definition
* @param blockBuilder The builder to make the blocks for the family
*/
public MultiConnectFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition, blockBuilder);
public MultiConnectFamily(BlockFamilyDefinition definition) {
super(definition);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SymmetricFamily extends AbstractBlockFamily {
private Block block;

public SymmetricFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition, shape, blockBuilder);
super(definition);
BlockUri uri;
if (CUBE_SHAPE_URN.equals(shape.getUrn())) {
uri = new BlockUri(definition.getUrn());
Expand All @@ -33,7 +33,7 @@ public SymmetricFamily(BlockFamilyDefinition definition, BlockShape shape, Block
}

public SymmetricFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition, blockBuilder);
super(definition);
block = blockBuilder.constructSimpleBlock(definition, new BlockUri(definition.getUrn()), this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Provides chunks. Chunks placed in this JVM. Also generated Chunks if needed.
* <p>
* Loading/Unload chunks dependent on {@link RelevanceSystem}
* <p/>
* <p>
* Produces events:
* <p>
* {@link OnChunkGenerated} when chunk was generated {@link WorldGenerator}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* Provides chunks received from remote source.
* <p>
* Loading/Unload chunks dependent on {@link org.terasology.engine.network.Server}
* <p/>
* <p>
* Produce events:
* <p>
* {@link OnChunkLoaded} when chunk received from server and processed.
Expand Down