Minor code optimization: remove unnecessary null assignments.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@656327 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Capability.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Capability.java
index fc964ee..765da51 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Capability.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Capability.java
@@ -27,16 +27,16 @@
public class Capability implements ICapability
{
- private String m_namespace = null;
- private R4Directive[] m_directives = null;
- private R4Attribute[] m_attributes = null;
- private Map m_attrMap = null;
+ private String m_namespace;
+ private R4Directive[] m_directives;
+ private R4Attribute[] m_attributes;
+ private Map m_attrMap;
private String[] m_uses = new String[0];
- private String[][] m_includeFilter = null;
- private String[][] m_excludeFilter = null;
+ private String[][] m_includeFilter;
+ private String[][] m_excludeFilter;
// Cached properties for performance reasons.
- private String m_pkgName = null;
+ private String m_pkgName;
private Version m_pkgVersion = Version.emptyVersion;
public Capability(String namespace, R4Directive[] dirs, R4Attribute[] attrs)
@@ -431,7 +431,7 @@
loop: for (int i = 0; i < len; i++)
{
- String piece = (String) pieces[i];
+ String piece = pieces[i];
int index = 0;
if (i == len - 1)
{
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
index bc39416..f9946e7 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
@@ -21,23 +21,23 @@
import java.util.*;
import org.apache.felix.framework.Logger;
-import org.apache.felix.framework.cache.BundleRevision;
-import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.VersionRange;
import org.apache.felix.moduleloader.ICapability;
import org.apache.felix.moduleloader.IRequirement;
import org.osgi.framework.*;
public class ManifestParser
{
- private Logger m_logger = null;
- private Map m_configMap = null;
- private Map m_headerMap = null;
- private String m_bundleSymbolicName = null;
- private Version m_bundleVersion = null;
- private ICapability[] m_capabilities = null;
- private IRequirement[] m_requirements = null;
- private IRequirement[] m_dynamicRequirements = null;
- private R4LibraryClause[] m_libraryHeaders = null;
+ private Logger m_logger;
+ private Map m_configMap;
+ private Map m_headerMap;
+ private String m_bundleSymbolicName;
+ private Version m_bundleVersion;
+ private ICapability[] m_capabilities;
+ private IRequirement[] m_requirements;
+ private IRequirement[] m_dynamicRequirements;
+ private R4LibraryClause[] m_libraryHeaders;
private boolean m_libraryHeadersOptional = false;
public ManifestParser(Logger logger, Map configMap, Map headerMap)
@@ -313,7 +313,7 @@
clause.getLibraryEntries()[i],
clause.getOSNames(), clause.getProcessors(), clause.getOSVersions(),
clause.getLanguages(), clause.getSelectionFilter());
- }
+ }
}
if (current < libraries.length)
{
@@ -731,14 +731,14 @@
newAttrs);
}
}
-
- if (parseExtensionBundleHeader((String)
+
+ if (parseExtensionBundleHeader((String)
m_headerMap.get(Constants.FRAGMENT_HOST)) != null)
{
checkExtensionBundle();
}
}
-
+
private void checkExtensionBundle() throws BundleException
{
if (m_headerMap.containsKey(Constants.IMPORT_PACKAGE) ||
@@ -826,7 +826,7 @@
R4Attribute[] newAttrs = new R4Attribute[attrs.length + 1];
newAttrs[0] = new R4Attribute(
ICapability.PACKAGE_PROPERTY,
- (String) clauses[clauseIdx][CLAUSE_PATHS_INDEX][pathIdx], false);
+ clauses[clauseIdx][CLAUSE_PATHS_INDEX][pathIdx], false);
System.arraycopy(attrs, 0, newAttrs, 1, attrs.length);
// Create package capability and add to capability list.
@@ -919,7 +919,7 @@
R4Attribute[] newAttrs = new R4Attribute[attrs.length + 1];
newAttrs[0] = new R4Attribute(
ICapability.PACKAGE_PROPERTY,
- (String) clauses[clauseIdx][CLAUSE_PATHS_INDEX][pathIdx], false);
+ clauses[clauseIdx][CLAUSE_PATHS_INDEX][pathIdx], false);
System.arraycopy(attrs, 0, newAttrs, 1, attrs.length);
// Create package requirement and add to requirement list.
@@ -974,7 +974,7 @@
R4Attribute[] newAttrs = new R4Attribute[attrs.length + 1];
newAttrs[0] = new R4Attribute(
Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE,
- (String) clauses[clauseIdx][CLAUSE_PATHS_INDEX][pathIdx], false);
+ clauses[clauseIdx][CLAUSE_PATHS_INDEX][pathIdx], false);
System.arraycopy(attrs, 0, newAttrs, 1, attrs.length);
// Create package requirement and add to requirement list.
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java
index 7bb5a2c..ec5b751 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -20,10 +20,10 @@
public class R4Attribute
{
- private String m_name = "";
- private Object m_value = null;
- private boolean m_isMandatory = false;
-
+ private final String m_name;
+ private final Object m_value;
+ private final boolean m_isMandatory;
+
public R4Attribute(String name, Object value, boolean isMandatory)
{
m_name = name;
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java
index 3dfaa48..cf83899 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -20,9 +20,9 @@
public class R4Directive
{
- private String m_name = "";
- private String m_value = "";
-
+ private final String m_name;
+ private final String m_value;
+
public R4Directive(String name, String value)
{
m_name = name;
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
index 64aae73..b89e30c 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
@@ -22,12 +22,12 @@
public class R4Library
{
- private String m_libraryFile = null;
- private String[] m_osnames = null;
- private String[] m_processors = null;
- private String[] m_osversions = null;
- private String[] m_languages = null;
- private String m_selectionFilter = null;
+ private String m_libraryFile;
+ private String[] m_osnames;
+ private String[] m_processors;
+ private String[] m_osversions;
+ private String[] m_languages;
+ private String m_selectionFilter;
public R4Library(
String libraryFile, String[] osnames, String[] processors, String[] osversions,
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
index 91923db..0053541 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -22,17 +22,18 @@
import org.apache.felix.framework.FilterImpl;
import org.apache.felix.framework.Logger;
-import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.VersionRange;
import org.osgi.framework.*;
public class R4LibraryClause
{
- private String[] m_libraryEntries = null;
- private String[] m_osnames = null;
- private String[] m_processors = null;
- private String[] m_osversions = null;
- private String[] m_languages = null;
- private String m_selectionFilter = null;
+ private final String[] m_libraryEntries;
+ private final String[] m_osnames;
+ private final String[] m_processors;
+ private final String[] m_osversions;
+ private final String[] m_languages;
+ private final String m_selectionFilter;
public R4LibraryClause(String[] libraryEntries, String[] osnames,
String[] processors, String[] osversions, String[] languages,
@@ -134,7 +135,7 @@
private boolean checkOSNames(String currentOSName, String[] osnames)
{
- boolean win32 = currentOSName.startsWith("win") &&
+ boolean win32 = currentOSName.startsWith("win") &&
(currentOSName.equals("windows95") ||
currentOSName.equals("windows98") ||
currentOSName.equals("windowsnt") ||
@@ -145,7 +146,7 @@
for (int i = 0; (osnames != null) && (i < osnames.length); i++)
{
- if (osnames[i].equals(currentOSName) ||
+ if (osnames[i].equals(currentOSName) ||
("win32".equals(osnames[i]) && win32))
{
return true;
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Requirement.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Requirement.java
index 10444a5..7215118 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Requirement.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/Requirement.java
@@ -27,14 +27,14 @@
public class Requirement implements IRequirement
{
- private String m_namespace = null;
- private R4Directive[] m_directives = null;
- private R4Attribute[] m_attributes = null;
+ private final String m_namespace;
+ private R4Directive[] m_directives;
+ private R4Attribute[] m_attributes;
private boolean m_isOptional = false;
- private String m_pkgName = null;
- private VersionRange m_pkgVersionRange = null;
- private Filter m_filter = null;
+ private String m_pkgName;
+ private VersionRange m_pkgVersionRange;
+ private Filter m_filter;
public Requirement(String namespace, String filterStr) throws InvalidSyntaxException
{