You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2021/09/26 08:59:00 UTC
[ant] branch master updated: Simplify single assignment and avoid
redundant if conditions.
This is an automated email from the ASF dual-hosted git repository.
bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new 0ad2609 Simplify single assignment and avoid redundant if conditions.
new 48c6dc5 Merge pull request #155 from arturobernalg/feature/redundant_if
0ad2609 is described below
commit 0ad2609358b127bbeba03c4d8c0e89ad3443dda8
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Tue Aug 31 21:03:12 2021 +0200
Simplify single assignment and avoid redundant if conditions.
---
src/main/org/apache/tools/ant/taskdefs/Tar.java | 5 +----
src/main/org/apache/tools/ant/taskdefs/XmlProperty.java | 7 ++-----
src/main/org/apache/tools/ant/types/Permissions.java | 5 +----
3 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java
index 76446fd..9d1cdf4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Tar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java
@@ -635,10 +635,7 @@ public class Tar extends MatchingTask {
* @since Ant 1.7
*/
protected boolean check(final File basedir, final String[] files) {
- boolean upToDate = true;
- if (!archiveIsUpToDate(files, basedir)) {
- upToDate = false;
- }
+ boolean upToDate = archiveIsUpToDate(files, basedir);
for (String file : files) {
if (tarFile.equals(new File(basedir, file))) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
index 4a86ca0..4e07c3a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
+++ b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
@@ -404,17 +404,14 @@ public class XmlProperty extends Task {
}
String nodeText = null;
boolean emptyNode = false;
- boolean semanticEmptyOverride = false;
- if (node.getNodeType() == Node.ELEMENT_NODE
+ boolean semanticEmptyOverride = node.getNodeType() == Node.ELEMENT_NODE
&& semanticAttributes
&& node.hasAttributes()
&& (node.getAttributes().getNamedItem(VALUE) != null
|| node.getAttributes().getNamedItem(LOCATION) != null
|| node.getAttributes().getNamedItem(REF_ID) != null
|| node.getAttributes().getNamedItem(PATH) != null || node.getAttributes()
- .getNamedItem(PATHID) != null)) {
- semanticEmptyOverride = true;
- }
+ .getNamedItem(PATHID) != null);
if (node.getNodeType() == Node.TEXT_NODE) {
// For the text node, add a property.
nodeText = getAttributeValue(node);
diff --git a/src/main/org/apache/tools/ant/types/Permissions.java b/src/main/org/apache/tools/ant/types/Permissions.java
index 1d94388..b61d9f6 100644
--- a/src/main/org/apache/tools/ant/types/Permissions.java
+++ b/src/main/org/apache/tools/ant/types/Permissions.java
@@ -207,10 +207,7 @@ public class Permissions {
public void checkPermission(final java.security.Permission perm) {
if (active) {
if (delegateToOldSM && !perm.getName().equals("exitVM")) {
- boolean permOK = false;
- if (granted.implies(perm)) {
- permOK = true;
- }
+ boolean permOK = granted.implies(perm);
checkRevoked(perm);
/*
if the permission was not explicitly granted or revoked