Skip to content

Commit

Permalink
Java update from 21.0.4 to 21.0.5 including different depenndencies (#…
Browse files Browse the repository at this point in the history
…7221)

* Upgraded Java from 21.0.4 to 21.0.4
Upgraded CheckStyle from 10.18.1 to 10.20.1
Upgraded pmd from 7.6.0 to 7.7.0
Corrected pmd error in ClassLevelTableModel.java

* Changed few Java files to meet pmd recommendations.
Updated ruleset.xml, renamed deprecated rules.

* Correct the targetPlatform in build.gradle from windows-x64 to win-x64.

Signed-off-by: Vest <[email protected]>

* Corrected the "targetPlaform" naming back from "win" to "windows".
Removed two semicolons.

Signed-off-by: Vest <[email protected]>

* Removed redundant spaces

Signed-off-by: Vest <[email protected]>

---------

Signed-off-by: Vest <[email protected]>
  • Loading branch information
Vest authored Nov 16, 2024
1 parent 8d731e8 commit d30055b
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 30 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ext {
releaseDir = layout.projectDirectory.dir("build/release")

// JavaFX version
javaFXVersion = "21.0.4"
javaFXVersion = "21.0.5"
}

application {
Expand Down Expand Up @@ -372,7 +372,7 @@ runtime {
? "mac"
: (Os.isFamily(Os.FAMILY_UNIX)
? "linux"
: (Os.isFamily(Os.FAMILY_WINDOWS) ? "win" : "unknown")))
: (Os.isFamily(Os.FAMILY_WINDOWS) ? "windows" : "unknown")))
def targetPlatform = ["x86_64" : "x64",
"amd64" : "x64",
"aarch64" : "aarch64"]
Expand Down Expand Up @@ -552,7 +552,7 @@ tasks.register("downloadJRE") {
? layout.projectDirectory.dir("jre/${os}/jre_${arch}/Contents/Home/release").asFile
: layout.projectDirectory.dir("jre/${os}/jre_${arch}/release").asFile)
def outputDir = layout.projectDirectory.dir("jre/${os}/jre_${arch}")
def shouldDownloadJDK = true;
def shouldDownloadJDK = true

try {
if (jreRelease.exists()) {
Expand Down Expand Up @@ -701,7 +701,7 @@ tasks.register("downloadJavaFXLocal", Download) {

def supportedArch = ["x86_64" : "-x64",
"amd64" : "-x64",
"aarch64": "-aarch64"];
"aarch64": "-aarch64"]

def hostArchitecture = System.getProperty("os.arch")
def archAppend = supportedArch[hostArchitecture]
Expand Down
4 changes: 2 additions & 2 deletions code/gradle/reporting.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ checkstyle {
configFile = new File('code/standards/checkstyle.xml')
configProperties = [samedir: "${rootDir}/code/standards"]
showViolations = true
toolVersion = '10.18.1'
toolVersion = '10.20.1'
sourceSets = []
}

Expand All @@ -19,7 +19,7 @@ pmd {
ruleSetFiles = files('code/standards/ruleset.xml')
consoleOutput = true
sourceSets = []
toolVersion = "7.6.0"
toolVersion = "7.7.0"
incrementalAnalysis = true
}

Expand Down
14 changes: 7 additions & 7 deletions code/src/java/pcgen/base/test/InequalityTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Expand All @@ -18,7 +18,7 @@

/**
* An InequalityTester is a method of checking two objects for equality.
*
* <p>
* This is done with a system other than .equals() since there may be exceptions
* to true equality that we need to handle
*/
Expand All @@ -27,15 +27,15 @@ public interface InequalityTester
{
/**
* Tests the equality between two objects using this InequalityTester
*
*
* @param o1
* The first object to be tested for equality
* @param o2
* The second object to be tested for equality
* @param location
* The location of the objects, to assist with debugging
* The location of the objects to assist with debugging
* @return A String indicating how the items are not equal; null if equal
*/
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public String testEquality(Object o1, Object o2, String location);
@SuppressWarnings("PMD.UnitTestShouldUseTestAnnotation")
String testEquality(Object o1, Object o2, String location);
}
17 changes: 13 additions & 4 deletions code/src/java/pcgen/gui2/converter/UnstretchingGridLayout.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright (c) 2009 Tom Parker <[email protected]>
*
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Expand All @@ -22,9 +22,13 @@
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Insets;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class UnstretchingGridLayout extends GridLayout
{
private transient Lock instanceLock = new ReentrantLock();

public UnstretchingGridLayout(int arg0, int arg1)
{
super(arg0, arg1);
Expand All @@ -33,8 +37,10 @@ public UnstretchingGridLayout(int arg0, int arg1)
@Override
public void layoutContainer(Container parent)
{
synchronized (parent.getTreeLock())
try
{
instanceLock.lock();

int componentCount = parent.getComponentCount();
if (componentCount == 0)
{
Expand Down Expand Up @@ -106,6 +112,9 @@ public void layoutContainer(Container parent)
}
yLoc += rowHeight[row] + yGutter;
}
} finally
{
instanceLock.unlock();
}
}
}
34 changes: 25 additions & 9 deletions code/src/java/pcgen/gui2/filter/FilterBar.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
* Copyright 2010 Connor Petty <[email protected]>
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
package pcgen.gui2.filter;

Expand All @@ -30,6 +30,8 @@
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import javax.swing.JButton;
import javax.swing.JPanel;
Expand Down Expand Up @@ -211,6 +213,7 @@ public boolean isOpen()
*/
private static class FilterLayout extends FlowLayout
{
private transient Lock instanceLock = new ReentrantLock();

public FilterLayout()
{
Expand All @@ -220,8 +223,10 @@ public FilterLayout()
@Override
public void layoutContainer(Container target)
{
synchronized (target.getTreeLock())
try
{
instanceLock.lock();

Insets insets = target.getInsets();
int maxwidth = target.getWidth() - (insets.left + insets.right + getHgap() * 2);
int nmembers = target.getComponentCount();
Expand Down Expand Up @@ -272,6 +277,9 @@ public void layoutContainer(Container target)
}
layoutComponents(target, insets.left + getHgap(), y, maxwidth, rowh, xChildren, yChildren, start,
nmembers, ltr);
} finally
{
instanceLock.unlock();
}
}

Expand Down Expand Up @@ -300,8 +308,10 @@ private void layoutComponents(Container target, int xOffset, int yOffset, int ma
@Override
public Dimension preferredLayoutSize(Container target)
{
synchronized (target.getTreeLock())
try
{
instanceLock.lock();

Dimension dim = new Dimension(0, 0);
int nmembers = target.getComponentCount();

Expand Down Expand Up @@ -340,14 +350,19 @@ public Dimension preferredLayoutSize(Container target)
dim.width += insets.left + insets.right + getHgap() * 2;
dim.height += insets.top + insets.bottom + getVgap() * 2;
return dim;
} finally
{
instanceLock.unlock();
}
}

@Override
public Dimension minimumLayoutSize(Container target)
{
synchronized (target.getTreeLock())
try
{
instanceLock.lock();

Dimension dim = new Dimension(0, 0);
int nmembers = target.getComponentCount();

Expand Down Expand Up @@ -384,9 +399,10 @@ public Dimension minimumLayoutSize(Container target)
dim.width += insets.left + insets.right + getHgap() * 2;
dim.height += insets.top + insets.bottom + getVgap() * 2;
return dim;
} finally
{
instanceLock.unlock();
}
}

}

}
8 changes: 4 additions & 4 deletions code/standards/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!--
- Code quality rule set for use with the PCGen Java code.
- See https://pmd.github.io/latest/pmd_rules_java.html
- for descriptions of the rules applied.
- for descriptions of the rules applied.
-->
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="PCGen Code Rules"
Expand All @@ -28,15 +28,15 @@
<exclude name="MethodReturnsInternalArray"/>
<!-- One to fix later as there are loads of these reported -->
<exclude name="ReplaceVectorWithList" />
<exclude name="SwitchStmtsShouldHaveDefault"/>
<exclude name="NonExhaustiveSwitch"/>
<exclude name="SystemPrintln"/>
<exclude name="UnusedAssignment"/>
<exclude name="UnusedFormalParameter"/>
<exclude name="UnusedPrivateField"/>
<exclude name="UnusedPrivateMethod"/>
<!-- it's a tradeoff: it creates a warning to use it, which then has to be addressed -->
<exclude name="UseVarargs"/>
<exclude name="JUnitAssertionsShouldIncludeMessage"/>
<exclude name="UnitTestAssertionsShouldIncludeMessage"/>
<!-- no networking code, but has false positives -->
<exclude name="AvoidUsingHardCodedIP"/>
<exclude name="SimplifiableTestAssertion"/>
Expand Down Expand Up @@ -194,7 +194,7 @@
<exclude name="InsufficientStringBufferDeclaration"/>
<exclude name="RedundantFieldInitializer"/>
<exclude name="StringToString"/>
<exclude name="TooFewBranchesForASwitchStatement"/>
<exclude name="TooFewBranchesForSwitch"/>
<exclude name="UseIndexOfChar"/>
<exclude name="UseStringBufferForStringAppends"/>
<exclude name="UselessStringValueOf"/>
Expand Down

0 comments on commit d30055b

Please sign in to comment.