diff options
27 files changed, 306 insertions, 275 deletions
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java index c06eb7eb1..bfb1b4681 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java @@ -93,12 +93,12 @@ class Candidates { m_session = session; m_candidateSelectorsUnmodifiable = new AtomicBoolean(false); - m_dependentMap = new OpenHashMapSet<>(); + m_dependentMap = new OpenHashMapSet<Capability, Requirement>(); m_candidateMap = new OpenHashMapList(); - m_allWrappedHosts = new HashMap<>(); - m_populateResultCache = new OpenHashMap<>(); - m_subtitutableMap = new OpenHashMap<>(); - m_delta = new OpenHashMapSet<>(3); + m_allWrappedHosts = new HashMap<Resource, WrappedResource>(); + m_populateResultCache = new OpenHashMap<Resource, PopulateResult>(); + m_subtitutableMap = new OpenHashMap<Capability, Requirement>(); + m_delta = new OpenHashMapSet<Requirement, Capability>(3); } public int getNbResources() @@ -108,7 +108,7 @@ class Candidates public Map<Resource, Resource> getRootHosts() { - Map<Resource, Resource> hosts = new LinkedHashMap<>(); + Map<Resource, Resource> hosts = new LinkedHashMap<Resource, Resource>(); for (Resource res : m_session.getMandatoryResources()) { addHost(res, hosts); @@ -160,8 +160,8 @@ class Candidates public void populate(Collection<Resource> resources) { ResolveContext rc = m_session.getContext(); - Set<Resource> toRemove = new HashSet<>(); - LinkedList<Resource> toPopulate = new LinkedList<>(resources); + Set<Resource> toRemove = new HashSet<Resource>(); + LinkedList<Resource> toPopulate = new LinkedList<Resource>(resources); while (!toPopulate.isEmpty()) { Resource resource = toPopulate.getFirst(); @@ -170,8 +170,8 @@ class Candidates if (result == null) { result = new PopulateResult(); - result.candidates = new OpenHashMap<>(); - result.remaining = new ArrayList<>(resource.getRequirements(null)); + result.candidates = new OpenHashMap<Requirement, List<Capability>>(); + result.remaining = new ArrayList<Requirement>(resource.getRequirements(null)); m_populateResultCache.put(resource, result); } if (result.success || result.error != null) @@ -206,7 +206,7 @@ class Candidates continue; } List<Capability> candidates = rc.findProviders(requirement); - LinkedList<Resource> newToPopulate = new LinkedList<>(); + LinkedList<Resource> newToPopulate = new LinkedList<Resource>(); ResolutionError thrown = processCandidates(newToPopulate, requirement, candidates); if (candidates.isEmpty() && !Util.isOptional(requirement)) { @@ -270,7 +270,7 @@ class Candidates OpenHashMap<String, List<Capability>> exportNames = new OpenHashMap<String, List<Capability>>() { @Override protected List<Capability> compute(String s) { - return new ArrayList<>(1); + return new ArrayList<Capability>(1); } }; for (Capability packageExport : resource.getCapabilities(null)) @@ -322,7 +322,7 @@ class Candidates ResolutionError checkSubstitutes() { - OpenHashMap<Capability, Integer> substituteStatuses = new OpenHashMap<>(m_subtitutableMap.size()); + OpenHashMap<Capability, Integer> substituteStatuses = new OpenHashMap<Capability, Integer>(m_subtitutableMap.size()); for (Capability substitutable : m_subtitutableMap.keySet()) { // initialize with unprocessed @@ -451,7 +451,7 @@ class Candidates // Process the candidates, removing any candidates that // cannot resolve. // TODO: verify the two following statements - LinkedList<Resource> toPopulate = new LinkedList<>(); + LinkedList<Resource> toPopulate = new LinkedList<Resource>(); ResolutionError rethrow = processCandidates(toPopulate, m_session.getDynamicRequirement(), m_session.getDynamicCandidates()); // Add the dynamic imports candidates. @@ -509,7 +509,7 @@ class Candidates { if (fragmentCands == null) { - fragmentCands = new HashSet<>(); + fragmentCands = new HashSet<Capability>(); } fragmentCands.add(candCap); } @@ -729,7 +729,7 @@ class Candidates // this is a special case where we need to completely replace the CandidateSelector // this method should never be called from normal Candidates permutations CandidateSelector candidates = m_candidateMap.get(req); - List<Capability> remaining = new ArrayList<>(candidates.getRemainingCandidates()); + List<Capability> remaining = new ArrayList<Capability>(candidates.getRemainingCandidates()); remaining.removeAll(caps); candidates = new CandidateSelector(remaining, m_candidateSelectorsUnmodifiable); m_candidateMap.put(req, candidates); @@ -776,15 +776,15 @@ class Candidates // requirements as well as replacing fragment capabilities // with host's attached fragment capabilities. // Steps 1 and 2 - List<WrappedResource> hostResources = new ArrayList<>(); - List<Resource> unselectedFragments = new ArrayList<>(); + List<WrappedResource> hostResources = new ArrayList<WrappedResource>(); + List<Resource> unselectedFragments = new ArrayList<Resource>(); for (Entry<Capability, Map<String, Map<Version, List<Requirement>>>> hostEntry : hostFragments.entrySet()) { // Step 1 Capability hostCap = hostEntry.getKey(); Map<String, Map<Version, List<Requirement>>> fragments = hostEntry.getValue(); - List<Resource> selectedFragments = new ArrayList<>(); + List<Resource> selectedFragments = new ArrayList<Resource>(); for (Entry<String, Map<Version, List<Requirement>>> fragEntry : fragments.entrySet()) { @@ -876,7 +876,7 @@ class Candidates CopyOnWriteSet<Requirement> dependents = m_dependentMap.get(origCap); if (dependents != null) { - dependents = new CopyOnWriteSet<>(dependents); + dependents = new CopyOnWriteSet<Requirement>(dependents); m_dependentMap.put(c, dependents); for (Requirement r : dependents) { @@ -972,7 +972,7 @@ class Candidates private Map<Capability, Map<String, Map<Version, List<Requirement>>>> getHostFragments() { Map<Capability, Map<String, Map<Version, List<Requirement>>>> hostFragments = - new HashMap<>(); + new HashMap<Capability, Map<String, Map<Version, List<Requirement>>>>(); for (Entry<Requirement, CandidateSelector> entry : m_candidateMap.fast()) { Requirement req = entry.getKey(); @@ -988,20 +988,20 @@ class Candidates Map<String, Map<Version, List<Requirement>>> fragments = hostFragments.get(cap); if (fragments == null) { - fragments = new HashMap<>(); + fragments = new HashMap<String, Map<Version, List<Requirement>>>(); hostFragments.put(cap, fragments); } Map<Version, List<Requirement>> fragmentVersions = fragments.get(resSymName); if (fragmentVersions == null) { fragmentVersions = - new TreeMap<>(Collections.reverseOrder()); + new TreeMap<Version, List<Requirement>>(Collections.reverseOrder()); fragments.put(resSymName, fragmentVersions); } List<Requirement> actual = fragmentVersions.get(resVersion); if (actual == null) { - actual = new ArrayList<>(); + actual = new ArrayList<Requirement>(); if (resVersion == null) resVersion = new Version(0, 0, 0); fragmentVersions.put(resVersion, actual); @@ -1030,7 +1030,7 @@ class Candidates result.success = false; result.error = ex; // Remove from dependents. - Set<Resource> unresolvedResources = new HashSet<>(); + Set<Resource> unresolvedResources = new HashSet<Resource>(); remove(resource, unresolvedResources); // Remove dependents that failed as a result of removing revision. while (!unresolvedResources.isEmpty()) @@ -1150,7 +1150,7 @@ class Candidates public void dump(ResolveContext rc) { // Create set of all revisions from requirements. - Set<Resource> resources = new CopyOnWriteSet<>(); + Set<Resource> resources = new CopyOnWriteSet<Resource>(); for (Entry<Requirement, CandidateSelector> entry : m_candidateMap.entrySet()) { diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java index d2c02bf79..6c9b278db 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java @@ -18,50 +18,19 @@ */ package org.apache.felix.resolver; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.security.*; +import java.util.*; import java.util.Map.Entry; -import java.util.Queue; -import java.util.Set; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; +import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; + import org.apache.felix.resolver.reason.ReasonException; import org.apache.felix.resolver.util.ArrayMap; import org.apache.felix.resolver.util.CandidateSelector; import org.apache.felix.resolver.util.OpenHashMap; -import org.osgi.framework.namespace.BundleNamespace; -import org.osgi.framework.namespace.ExecutionEnvironmentNamespace; -import org.osgi.framework.namespace.HostNamespace; -import org.osgi.framework.namespace.IdentityNamespace; -import org.osgi.framework.namespace.PackageNamespace; -import org.osgi.resource.Capability; -import org.osgi.resource.Namespace; -import org.osgi.resource.Requirement; -import org.osgi.resource.Resource; -import org.osgi.resource.Wire; -import org.osgi.resource.Wiring; -import org.osgi.service.resolver.HostedCapability; -import org.osgi.service.resolver.ResolutionException; -import org.osgi.service.resolver.ResolveContext; -import org.osgi.service.resolver.Resolver; +import org.osgi.framework.namespace.*; +import org.osgi.resource.*; +import org.osgi.service.resolver.*; public class ResolverImpl implements Resolver { @@ -95,19 +64,19 @@ public class ResolverImpl implements Resolver private final List<Capability> m_dynamicCandidates; // keeps track of valid related resources that we have seen. // a null value or TRUE indicate it is valid - private Map<Resource, Boolean> m_validRelatedResources = new HashMap<>(0); + private Map<Resource, Boolean> m_validRelatedResources = new HashMap<Resource, Boolean>(0); // keeps track of related resources for each resource - private Map<Resource, Collection<Resource>> m_relatedResources = new HashMap<>(0); + private Map<Resource, Collection<Resource>> m_relatedResources = new HashMap<Resource, Collection<Resource>>(0); // Holds candidate permutations based on permutating "uses" chains. // These permutations are given higher priority. - private final List<Candidates> m_usesPermutations = new LinkedList<>(); + private final List<Candidates> m_usesPermutations = new LinkedList<Candidates>(); private int m_usesIndex = 0; // Holds candidate permutations based on permutating requirement candidates. // These permutations represent backtracking on previous decisions. - private final List<Candidates> m_importPermutations = new LinkedList<>(); + private final List<Candidates> m_importPermutations = new LinkedList<Candidates>(); private int m_importIndex = 0; // Holds candidate permutations based on substituted packages - private final List<Candidates> m_substPermutations = new LinkedList<>(); + private final List<Candidates> m_substPermutations = new LinkedList<Candidates>(); private int m_substituteIndex = 0; // Holds candidate permutations based on removing candidates that satisfy // multiple cardinality requirements. @@ -115,11 +84,11 @@ public class ResolverImpl implements Resolver // removed the offending capabilities private Candidates m_multipleCardCandidates = null; // The delta is used to detect that we have already processed this particular permutation - private final Set<Object> m_processedDeltas = new HashSet<>(); + private final Set<Object> m_processedDeltas = new HashSet<Object>(); private final Executor m_executor; - private final Set<Requirement> m_mutated = new HashSet<>(); - private final Set<Requirement> m_sub_mutated = new HashSet<>(); - private final ConcurrentMap<String, List<String>> m_usesCache = new ConcurrentHashMap<>(); + private final Set<Requirement> m_mutated = new HashSet<Requirement>(); + private final Set<Requirement> m_sub_mutated = new HashSet<Requirement>(); + private final ConcurrentMap<String, List<String>> m_usesCache = new ConcurrentHashMap<String, List<String>>(); private ResolutionError m_currentError; volatile private CancellationException m_isCancelled = null; @@ -145,8 +114,8 @@ public class ResolverImpl implements Resolver m_optionalResources = Collections.emptyList(); } else { // Do not call resolve context yet, onCancel must be called first - m_mandatoryResources = new ArrayList<>(); - m_optionalResources = new ArrayList<>(); + m_mandatoryResources = new ArrayList<Resource>(); + m_optionalResources = new ArrayList<Resource>(); } } @@ -356,7 +325,7 @@ public class ResolverImpl implements Resolver public Collection<Resource> getRelatedResources(Resource resource) { Collection<Resource> related = m_relatedResources.get(resource); - return related == null ? Collections.emptyList() : related; + return related == null ? Collections.<Resource> emptyList() : related; } public void setRelatedResources(Resource resource, Collection<Resource> related) { @@ -409,7 +378,13 @@ public class ResolverImpl implements Resolver final ExecutorService executor = System.getSecurityManager() != null ? AccessController.doPrivileged( - (PrivilegedAction<ExecutorService>) () -> Executors.newFixedThreadPool(m_parallelism), m_acc) + new PrivilegedAction<ExecutorService>() + { + public ExecutorService run() + { + return Executors.newFixedThreadPool(m_parallelism); + } + }, m_acc) : Executors.newFixedThreadPool(m_parallelism); try @@ -420,9 +395,11 @@ public class ResolverImpl implements Resolver { if (System.getSecurityManager() != null) { - AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - executor.shutdownNow(); - return null; + AccessController.doPrivileged(new PrivilegedAction<Void>(){ + public Void run() { + executor.shutdownNow(); + return null; + } }, m_acc); } else @@ -444,7 +421,7 @@ public class ResolverImpl implements Resolver } private Map<Resource, List<Wire>> doResolve(ResolveSession session) throws ResolutionException { - Map<Resource, List<Wire>> wireMap = new HashMap<>(); + Map<Resource, List<Wire>> wireMap = new HashMap<Resource, List<Wire>>(); boolean retry; do { @@ -456,7 +433,7 @@ public class ResolverImpl implements Resolver throw session.getCurrentError().toException(); } - Map<Resource, ResolutionError> faultyResources = new HashMap<>(); + Map<Resource, ResolutionError> faultyResources = new HashMap<Resource, ResolutionError>(); Candidates allCandidates = findValidCandidates(session, faultyResources); session.checkForCancel(); @@ -540,7 +517,7 @@ public class ResolverImpl implements Resolver return; } } else { - List<Resource> toPopulate = new ArrayList<>(); + List<Resource> toPopulate = new ArrayList<Resource>(); // Populate mandatory resources; since these are mandatory // resources, failure throws a resolve exception. @@ -591,7 +568,7 @@ public class ResolverImpl implements Resolver //allCandidates.dump(); - Map<Resource, ResolutionError> currentFaultyResources = new HashMap<>(); + Map<Resource, ResolutionError> currentFaultyResources = new HashMap<Resource, ResolutionError>(); session.setCurrentError( checkConsistency( @@ -638,7 +615,7 @@ public class ResolverImpl implements Resolver ResolutionError error = null; // Check package consistency Map<Resource, Object> resultCache = - new OpenHashMap<>(resourcePkgMap.size()); + new OpenHashMap<Resource, Object>(resourcePkgMap.size()); for (Entry<Resource, Resource> entry : allhosts.entrySet()) { rethrow = checkPackageSpaceConsistency( @@ -701,7 +678,7 @@ public class ResolverImpl implements Resolver { // Create a list for requirement and proposed candidate // capability or actual capability if resource is resolved or not. - List<WireCandidate> wireCandidates = new ArrayList<>(256); + List<WireCandidate> wireCandidates = new ArrayList<WireCandidate>(256); Wiring wiring = session.getContext().getWirings().get(resource); if (wiring != null) { @@ -823,8 +800,8 @@ public class ResolverImpl implements Resolver resourcePkgs, wire.requirement, wire.capability, - new HashSet<>(), - new HashSet<>()); + new HashSet<Capability>(), + new HashSet<Resource>()); } return resourcePkgs; @@ -848,7 +825,7 @@ public class ResolverImpl implements Resolver // we need to calculate its uses constraints again to make sure the new // import is consistent with the existing package space. Wiring wiring = session.getContext().getWirings().get(resource); - Set<Capability> usesCycleMap = new HashSet<>(); + Set<Capability> usesCycleMap = new HashSet<Capability>(); int size = wireCandidates.size(); boolean isDynamicImporting = size > 0 @@ -1117,13 +1094,13 @@ public class ResolverImpl implements Resolver } ArrayMap<Set<Capability>, UsedBlames> usedPkgBlames = currentPkgs.m_usedPkgs.getOrCompute(usedPkgName); - List<Blame> newBlames = new ArrayList<>(); + List<Blame> newBlames = new ArrayList<Blame>(); for (Blame blame : candSourceBlames) { List<Requirement> newBlameReqs; if (blame.m_reqs != null) { - newBlameReqs = new ArrayList<>(blameReqs.size() + 1); + newBlameReqs = new ArrayList<Requirement>(blameReqs.size() + 1); newBlameReqs.addAll(blameReqs); // Only add the last requirement in blame chain because // that is the requirement wired to the blamed capability @@ -1153,9 +1130,9 @@ public class ResolverImpl implements Resolver final EnhancedExecutor executor = new EnhancedExecutor(session.getExecutor()); // Parallel compute wire candidates - final Map<Resource, List<WireCandidate>> allWireCandidates = new ConcurrentHashMap<>(); + final Map<Resource, List<WireCandidate>> allWireCandidates = new ConcurrentHashMap<Resource, List<WireCandidate>>(); { - final ConcurrentMap<Resource, Runnable> tasks = new ConcurrentHashMap<>(allCandidates.getNbResources()); + final ConcurrentMap<Resource, Runnable> tasks = new ConcurrentHashMap<Resource, Runnable>(allCandidates.getNbResources()); class Computer implements Runnable { final Resource resource; @@ -1189,20 +1166,32 @@ public class ResolverImpl implements Resolver } // Parallel get all exported packages - final OpenHashMap<Resource, Packages> allPackages = new OpenHashMap<>(allCandidates.getNbResources()); + final OpenHashMap<Resource, Packages> allPackages = new OpenHashMap<Resource, Packages>(allCandidates.getNbResources()); for (final Resource resource : allWireCandidates.keySet()) { final Packages packages = new Packages(resource); allPackages.put(resource, packages); - executor.execute(() -> calculateExportedPackages(session, allCandidates, resource, - packages.m_exportedPkgs, packages.m_substitePkgs)); + executor.execute(new Runnable() + { + public void run() + { + calculateExportedPackages(session, allCandidates, resource, + packages.m_exportedPkgs, packages.m_substitePkgs); + } + }); } executor.await(); // Parallel compute package lists for (final Resource resource : allWireCandidates.keySet()) { - executor.execute(() -> getPackages(session, allCandidates, allWireCandidates, allPackages, resource, allPackages.get(resource))); + executor.execute(new Runnable() + { + public void run() + { + getPackages(session, allCandidates, allWireCandidates, allPackages, resource, allPackages.get(resource)); + } + }); } executor.await(); @@ -1227,7 +1216,13 @@ public class ResolverImpl implements Resolver final Packages packages = entry.getValue(); if (packages.m_sources.isEmpty()) { - executor.execute(() -> getPackageSourcesInternal(session, allPackages, resource, packages)); + executor.execute(new Runnable() + { + public void run() + { + getPackageSourcesInternal(session, allPackages, resource, packages); + } + }); } } executor.await(); @@ -1235,7 +1230,13 @@ public class ResolverImpl implements Resolver // Parallel compute uses for (final Resource resource : allWireCandidates.keySet()) { - executor.execute(() -> computeUses(session, allWireCandidates, allPackages, resource)); + executor.execute(new Runnable() + { + public void run() + { + computeUses(session, allWireCandidates, allPackages, resource); + } + }); } executor.await(); @@ -1250,7 +1251,7 @@ public class ResolverImpl implements Resolver nb++; } } - List<String> uses = new ArrayList<>(nb); + List<String> uses = new ArrayList<String>(nb); int start = 0; while (true) { while (start < l) { @@ -1288,7 +1289,7 @@ public class ResolverImpl implements Resolver } else { - usedCaps = new HashSet<>(); + usedCaps = new HashSet<Capability>(); for (Blame blame : blames) { usedCaps.addAll(getPackageSources(blame.m_cap, resourcePkgMap)); @@ -1382,8 +1383,8 @@ public class ResolverImpl implements Resolver // When several reqs are permuted at the same time this reduces the number of solutions tried. // See the method Candidates::canRemoveCandidate for a case where substitutions must be checked // because of this code that may permute multiple reqs in on candidates permutation. - AtomicReference<Candidates> permRef1 = new AtomicReference<>(); - AtomicReference<Candidates> permRef2 = new AtomicReference<>(); + AtomicReference<Candidates> permRef1 = new AtomicReference<Candidates>(); + AtomicReference<Candidates> permRef2 = new AtomicReference<Candidates>(); Set<Requirement> mutated = null; // Check if there are any uses conflicts with exported packages. @@ -1402,7 +1403,7 @@ public class ResolverImpl implements Resolver { mutated = (mutated != null) ? mutated - : new HashSet<>(); + : new HashSet<Requirement>(); rethrow = permuteUsedBlames(session, rethrow, allCandidates, resource, pkgName, null, usedBlames, permRef1, permRef2, mutated); } @@ -1436,7 +1437,7 @@ public class ResolverImpl implements Resolver } else { - allImportRequirePkgs = new OpenHashMap<>(pkgs.m_requiredPkgs.size() + pkgs.m_importedPkgs.size()); + allImportRequirePkgs = new OpenHashMap<String, List<Blame>>(pkgs.m_requiredPkgs.size() + pkgs.m_importedPkgs.size()); allImportRequirePkgs.putAll(pkgs.m_requiredPkgs); allImportRequirePkgs.putAll(pkgs.m_importedPkgs); } @@ -1457,7 +1458,7 @@ public class ResolverImpl implements Resolver { mutated = (mutated != null) ? mutated - : new HashSet<>();// Split packages, need to think how to get a good message for split packages (sigh) + : new HashSet<Requirement>();// Split packages, need to think how to get a good message for split packages (sigh) // For now we just use the first requirement that brings in the package that conflicts Blame requirementBlame = requirementBlames.get(0); rethrow = permuteUsedBlames(session, rethrow, allCandidates, resource, pkgName, requirementBlame, usedBlames, permRef1, permRef2, mutated); @@ -1733,7 +1734,7 @@ public class ResolverImpl implements Resolver case 1: return isCompatible(currentBlames.get(0), candSources, resourcePkgMap); default: - Set<Capability> currentSources = new HashSet<>(currentBlames.size()); + Set<Capability> currentSources = new HashSet<Capability>(currentBlames.size()); for (Blame currentBlame : currentBlames) { Set<Capability> blameSources = getPackageSources(currentBlame.m_cap, resourcePkgMap); @@ -1750,19 +1751,19 @@ public class ResolverImpl implements Resolver Resource resource = cap.getResource(); if(resource == null) { - return new HashSet<>(); + return new HashSet<Capability>(); } OpenHashMap<Capability, Set<Capability>> sources = resourcePkgMap.get(resource).m_sources; if(sources == null) { - return new HashSet<>(); + return new HashSet<Capability>(); } Set<Capability> packageSources = sources.get(cap); if(packageSources == null) { - return new HashSet<>(); + return new HashSet<Capability>(); } return packageSources; @@ -1779,7 +1780,7 @@ public class ResolverImpl implements Resolver @SuppressWarnings("serial") OpenHashMap<String, Set<Capability>> pkgs = new OpenHashMap<String, Set<Capability>>(caps.size()) { public Set<Capability> compute(String pkgName) { - return new HashSet<>(); + return new HashSet<Capability>(); } }; Map<Capability, Set<Capability>> sources = packages.m_sources; @@ -1810,7 +1811,7 @@ public class ResolverImpl implements Resolver } else { - sources.put(sourceCap, Collections.emptySet()); + sources.put(sourceCap, Collections.<Capability>emptySet()); } } } @@ -1876,11 +1877,11 @@ public class ResolverImpl implements Resolver if (!session.getContext().getWirings().containsKey(unwrappedResource) && !wireMap.containsKey(unwrappedResource)) { - wireMap.put(unwrappedResource, Collections.emptyList()); + wireMap.put(unwrappedResource, Collections.<Wire>emptyList()); - List<Wire> packageWires = new ArrayList<>(); - List<Wire> bundleWires = new ArrayList<>(); - List<Wire> capabilityWires = new ArrayList<>(); + List<Wire> packageWires = new ArrayList<Wire>(); + List<Wire> bundleWires = new ArrayList<Wire>(); + List<Wire> capabilityWires = new ArrayList<Wire>(); for (Requirement req : resource.getRequirements(null)) { @@ -1951,7 +1952,8 @@ public class ResolverImpl implements Resolver // creating duplicate non-payload wires if the fragment // is attached to more than one host. List<Wire> fragmentWires = wireMap.get(fragment); - fragmentWires = (fragmentWires == null) ? new ArrayList<>() : fragmentWires; + fragmentWires = (fragmentWires == null) + ? new ArrayList<Wire>() : fragmentWires; // Loop through all of the fragment's requirements and create // any necessary wires for non-payload requirements. @@ -2034,9 +2036,9 @@ public class ResolverImpl implements Resolver ResolveSession session, Map<Resource, List<Wire>> wireMap, Candidates allCandidates) { - wireMap.put(session.getDynamicHost(), Collections.emptyList()); + wireMap.put(session.getDynamicHost(), Collections.<Wire>emptyList()); - List<Wire> packageWires = new ArrayList<>(); + List<Wire> packageWires = new ArrayList<Wire>(); // Get the candidates for the current dynamic requirement. // Record the dynamic candidate. @@ -2126,16 +2128,16 @@ public class ResolverImpl implements Resolver int nbCaps = resource.getCapabilities(null).size(); int nbReqs = resource.getRequirements(null).size(); - m_exportedPkgs = new OpenHashMap<>(nbCaps); - m_substitePkgs = new OpenHashMap<>(nbCaps); + m_exportedPkgs = new OpenHashMap<String, Blame>(nbCaps); + m_substitePkgs = new OpenHashMap<String, Blame>(nbCaps); m_importedPkgs = new OpenHashMap<String, List<Blame>>(nbReqs) { public List<Blame> compute(String s) { - return new ArrayList<>(); + return new ArrayList<Blame>(); } }; m_requiredPkgs = new OpenHashMap<String, List<Blame>>(nbReqs) { public List<Blame> compute(String s) { - return new ArrayList<>(); + return new ArrayList<Blame>(); } }; m_usedPkgs = new OpenHashMap<String, ArrayMap<Set<Capability>, UsedBlames>>(128) { @@ -2149,7 +2151,7 @@ public class ResolverImpl implements Resolver }; } }; - m_sources = new OpenHashMap<>(nbCaps); + m_sources = new OpenHashMap<Capability, Set<Capability>>(nbCaps); } } @@ -2198,7 +2200,7 @@ public class ResolverImpl implements Resolver private static class UsedBlames { public final Set<Capability> m_caps; - public final List<Blame> m_blames = new ArrayList<>(); + public final List<Blame> m_blames = new ArrayList<ResolverImpl.Blame>(); private Map<Requirement, Set<Capability>> m_rootCauses; public UsedBlames(Set<Capability> caps) @@ -2228,12 +2230,12 @@ public class ResolverImpl implements Resolver // capability pulled in is a conflict. if (m_rootCauses == null) { - m_rootCauses = new HashMap<>(); + m_rootCauses = new HashMap<Requirement, Set<Capability>>(); } Set<Capability> rootCauses = m_rootCauses.get(req); if (rootCauses == null) { - rootCauses = new HashSet<>(); + rootCauses = new HashSet<Capability>(); m_rootCauses.put(req, rootCauses); } rootCauses.add(matchingRootCause); @@ -2248,7 +2250,7 @@ public class ResolverImpl implements Resolver return Collections.emptySet(); } Set<Capability> result = m_rootCauses.get(req); - return result == null ? Collections.emptySet() : result; + return result == null ? Collections.<Capability>emptySet() : result; } @Override @@ -2469,8 +2471,8 @@ public class ResolverImpl implements Resolver private static class EnhancedExecutor { private final Executor executor; - private final Queue<Future<Void>> awaiting = new ConcurrentLinkedQueue<>(); - private final AtomicReference<Throwable> throwable = new AtomicReference<>(); + private final Queue<Future<Void>> awaiting = new ConcurrentLinkedQueue<Future<Void>>(); + private final AtomicReference<Throwable> throwable = new AtomicReference<Throwable>(); public EnhancedExecutor(Executor executor) { @@ -2479,14 +2481,18 @@ public class ResolverImpl implements Resolver public void execute(final Runnable runnable) { - FutureTask<Void> task = new FutureTask<>(() -> { - try - { - runnable.run(); - } - catch (Throwable t) + FutureTask<Void> task = new FutureTask<Void>(new Runnable() + { + public void run() { - throwable.compareAndSet(null, t); + try + { + runnable.run(); + } + catch (Throwable t) + { + throwable.compareAndSet(null, t); + } } }, (Void) null); // must have a happens-first to add the task to awaiting diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java index 647855600..973cd5b72 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java @@ -99,7 +99,7 @@ public class Util public static List<Requirement> getDynamicRequirements(List<Requirement> reqs) { - List<Requirement> result = new ArrayList<>(); + List<Requirement> result = new ArrayList<Requirement>(); if (reqs != null) { for (Requirement req : reqs) diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java index 8fab2a3b3..f17969e30 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2012, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ public class WrappedCapability implements HostedCapability // This is done to work around issues with wrapper resources equality tests. // Note this is depends on the implementation details of the ResolveContext to actually // check the osgi.content capability. - Map<String, Object> augmentedDirs = new HashMap<>(m_cap.getAttributes()); + Map<String, Object> augmentedDirs = new HashMap<String, Object>(m_cap.getAttributes()); Object wrapperUrl = augmentedDirs.get("url"); wrapperUrl = "wrapper:" + wrapperUrl; augmentedDirs.put("url", wrapperUrl); diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java index 6b0b31fdb..c51f74ee2 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java @@ -38,7 +38,7 @@ class WrappedResource implements Resource m_fragments = fragments; // Wrap host capabilities. - List<Capability> caps = new ArrayList<>(); + List<Capability> caps = new ArrayList<Capability>(); for (Capability cap : m_host.getCapabilities(null)) { caps.add(new WrappedCapability(this, cap)); @@ -58,7 +58,7 @@ class WrappedResource implements Resource m_cachedCapabilities = Collections.unmodifiableList(caps); // Wrap host requirements. - List<Requirement> reqs = new ArrayList<>(); + List<Requirement> reqs = new ArrayList<Requirement>(); for (Requirement req : m_host.getRequirements(null)) { reqs.add(new WrappedRequirement(this, req)); @@ -98,7 +98,7 @@ class WrappedResource implements Resource public List<Capability> getCapabilities(String namespace) { if (namespace != null) { - List<Capability> filtered = new ArrayList<>(); + List<Capability> filtered = new ArrayList<Capability>(); for (Capability capability : m_cachedCapabilities) { if (namespace.equals(capability.getNamespace())) { filtered.add(capability); @@ -112,7 +112,7 @@ class WrappedResource implements Resource public List<Requirement> getRequirements(String namespace) { if (namespace != null) { - List<Requirement> filtered = new ArrayList<>(); + List<Requirement> filtered = new ArrayList<Requirement>(); for (Requirement requirement : m_cachedRequirements) { if (namespace.equals(requirement.getNamespace())) { filtered.add(requirement); diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java index 16a921723..c61a194c9 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java @@ -132,7 +132,7 @@ public class ArrayMap<K, V> extends AbstractMap<K, V> { @Override public Iterator<Entry<K, V>> iterator() { return new Iterator<Entry<K, V>>() { - FastEntry<K, V> entry = new FastEntry<>(); + FastEntry<K, V> entry = new FastEntry<K, V>(); int index = 0; public boolean hasNext() { diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java index bce3386a3..de8a5f502 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java @@ -32,7 +32,7 @@ public class CandidateSelector { public CandidateSelector(List<Capability> candidates, AtomicBoolean isUnmodifiable) { this.isUnmodifiable = isUnmodifiable; - this.unmodifiable = new ArrayList<>(candidates); + this.unmodifiable = new ArrayList<Capability>(candidates); } protected CandidateSelector(CandidateSelector candidateSelector) { diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMap.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMap.java index f781de315..b27198c4d 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMap.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMap.java @@ -631,7 +631,11 @@ public class OpenHashMap<K, V> implements Serializable, Cloneable, SortedMap<K, public Iterable<Map.Entry<K, V>> fast() { if (fast == null) { - fast = FastEntryIterator::new; + fast = new Iterable<Entry<K, V>>() { + public Iterator<Entry<K, V>> iterator() { + return new FastEntryIterator(); + } + }; } return fast; diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java index 6d8f7d63a..2cdf70635 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java @@ -35,7 +35,7 @@ public class OpenHashMapSet<K, V> extends OpenHashMap<K, CopyOnWriteSet<V>> { Object[] values = copy.value; for (int i = values.length; i-- > 0;) { if (values[i] != null) { - values[i] = new CopyOnWriteSet<>((CopyOnWriteSet<V>) values[i]); + values[i] = new CopyOnWriteSet<V>((CopyOnWriteSet<V>) values[i]); } } return copy; @@ -43,7 +43,7 @@ public class OpenHashMapSet<K, V> extends OpenHashMap<K, CopyOnWriteSet<V>> { @Override protected CopyOnWriteSet<V> compute(K key) { - return new CopyOnWriteSet<>(); + return new CopyOnWriteSet<V>(); } } diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java index 74f81c79f..a91ba30ee 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java @@ -49,7 +49,7 @@ public class ShadowList extends CandidateSelector private ShadowList(List<Capability> unmodifiable, List<Capability> original, AtomicBoolean isUnmodifiable) { super(unmodifiable, isUnmodifiable); - m_original = new ArrayList<>(original); + m_original = new ArrayList<Capability>(original); } public ShadowList copy() { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java index 95caf5a3c..ffcb6416b 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2012, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2012, 2020). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,8 @@ public abstract class DTO { */ @Override public String toString() { - return appendValue(new StringBuilder(), new IdentityHashMap<>(), "#", this).toString(); + return appendValue(new StringBuilder(), + new IdentityHashMap<Object,String>(), "#", this).toString(); } /** diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java index fd002d828..a2bc7aac5 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -437,21 +437,24 @@ public final class AdaptPermission extends BasicPermission { if (result != null) { return result; } - final Map<String, Object> map = new HashMap<>(5); + final Map<String, Object> map = new HashMap<String, Object>(5); map.put("adaptClass", getName()); if (bundle != null) { - AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - map.put("id", Long.valueOf(bundle.getBundleId())); - map.put("location", bundle.getLocation()); - String name = bundle.getSymbolicName(); - if (name != null) { - map.put("name", name); - } - SignerProperty signer = new SignerProperty(bundle); - if (signer.isBundleSigned()) { - map.put("signer", signer); + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + map.put("id", Long.valueOf(bundle.getBundleId())); + map.put("location", bundle.getLocation()); + String name = bundle.getSymbolicName(); + if (name != null) { + map.put("name", name); + } + SignerProperty signer = new SignerProperty(bundle); + if (signer.isBundleSigned()) { + map.put("signer", signer); + } + return null; } - return null; }); } return properties = map; @@ -488,7 +491,7 @@ final class AdaptPermissionCollection extends PermissionCollection { * Create an empty AdaptPermissions object. */ public AdaptPermissionCollection() { - permissions = new HashMap<>(); + permissions = new HashMap<String, AdaptPermission>(); all_allowed = false; } @@ -594,7 +597,7 @@ final class AdaptPermissionCollection extends PermissionCollection { */ @Override public synchronized Enumeration<Permission> elements() { - List<Permission> all = new ArrayList<>(permissions.values()); + List<Permission> all = new ArrayList<Permission>(permissions.values()); return Collections.enumeration(all); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java index e12085d70..7906054ba 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -220,7 +220,7 @@ public final class AdminPermission extends BasicPermission { * ThreadLocal used to determine if we have recursively called * getProperties. */ - private static final ThreadLocal<Bundle> recurse = new ThreadLocal<>(); + private static final ThreadLocal<Bundle> recurse = new ThreadLocal<Bundle>(); /** * Creates a new {@code AdminPermission} object that matches all bundles and @@ -839,19 +839,22 @@ public final class AdminPermission extends BasicPermission { } recurse.set(bundle); try { - final Map<String, Object> map = new HashMap<>(4); - AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - map.put("id", Long.valueOf(bundle.getBundleId())); - map.put("location", bundle.getLocation()); - String name = bundle.getSymbolicName(); - if (name != null) { - map.put("name", name); - } - SignerProperty signer = new SignerProperty(bundle); - if (signer.isBundleSigned()) { - map.put("signer", signer); + final Map<String, Object> map = new HashMap<String, Object>(4); + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + map.put("id", Long.valueOf(bundle.getBundleId())); + map.put("location", bundle.getLocation()); + String name = bundle.getSymbolicName(); + if (name != null) { + map.put("name", name); + } + SignerProperty signer = new SignerProperty(bundle); + if (signer.isBundleSigned()) { + map.put("signer", signer); + } + return null; } - return null; }); return properties = map; } finally { @@ -885,7 +888,7 @@ final class AdminPermissionCollection extends PermissionCollection { * */ public AdminPermissionCollection() { - permissions = new HashMap<>(); + permissions = new HashMap<String, AdminPermission>(); } /** @@ -988,7 +991,7 @@ final class AdminPermissionCollection extends PermissionCollection { */ @Override public synchronized Enumeration<Permission> elements() { - List<Permission> all = new ArrayList<>(permissions.values()); + List<Permission> all = new ArrayList<Permission>(permissions.values()); return Collections.enumeration(all); } @@ -996,7 +999,7 @@ final class AdminPermissionCollection extends PermissionCollection { private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)}; private synchronized void writeObject(ObjectOutputStream out) throws IOException { - Hashtable<String, AdminPermission> hashtable = new Hashtable<>(permissions); + Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(permissions); ObjectOutputStream.PutField pfields = out.putFields(); pfields.put("permissions", hashtable); pfields.put("all_allowed", all_allowed); @@ -1007,7 +1010,7 @@ final class AdminPermissionCollection extends PermissionCollection { ObjectInputStream.GetField gfields = in.readFields(); @SuppressWarnings("unchecked") Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields.get("permissions", null); - permissions = new HashMap<>(hashtable); + permissions = new HashMap<String, AdminPermission>(hashtable); all_allowed = gfields.get("all_allowed", false); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java index a0bdb5bb6..7a45b1cb5 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2019). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -453,7 +453,7 @@ final class BundlePermissionCollection extends PermissionCollection { * */ public BundlePermissionCollection() { - permissions = new HashMap<>(); + permissions = new HashMap<String, BundlePermission>(); all_allowed = false; } @@ -568,7 +568,7 @@ final class BundlePermissionCollection extends PermissionCollection { */ @Override public synchronized Enumeration<Permission> elements() { - List<Permission> all = new ArrayList<>(permissions.values()); + List<Permission> all = new ArrayList<Permission>(permissions.values()); return Collections.enumeration(all); } @@ -576,7 +576,7 @@ final class BundlePermissionCollection extends PermissionCollection { private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)}; private synchronized void writeObject(ObjectOutputStream out) throws IOException { - Hashtable<String, BundlePermission> hashtable = new Hashtable<>(permissions); + Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(permissions); ObjectOutputStream.PutField pfields = out.putFields(); pfields.put("permissions", hashtable); pfields.put("all_allowed", all_allowed); @@ -587,7 +587,7 @@ final class BundlePermissionCollection extends PermissionCollection { ObjectInputStream.GetField gfields = in.readFields(); @SuppressWarnings("unchecked") Hashtable<String, BundlePermission> hashtable = (Hashtable<String, BundlePermission>) gfields.get("permissions", null); - permissions = new HashMap<>(hashtable); + permissions = new HashMap<String, BundlePermission>(hashtable); all_allowed = gfields.get("all_allowed", false); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java index facdb2896..c7bae50ca 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -184,7 +184,7 @@ public final class CapabilityPermission extends BasicPermission { if (providingBundle == null) { throw new IllegalArgumentException("bundle must not be null"); } - this.attributes = new HashMap<>(attributes); + this.attributes = new HashMap<String, Object>(attributes); this.bundle = providingBundle; if ((action_mask & ACTION_ALL) != ACTION_REQUIRE) { throw new IllegalArgumentException("invalid action string"); @@ -499,23 +499,26 @@ public final class CapabilityPermission extends BasicPermission { if (result != null) { return result; } - final Map<String, Object> props = new HashMap<>(5); + final Map<String, Object> props = new HashMap<String, Object>(5); props.put("capability.namespace", getName()); if (bundle == null) { return properties = props; } - AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - props.put("id", Long.valueOf(bundle.getBundleId())); - props.put("location", bundle.getLocation()); - String name = bundle.getSymbolicName(); - if (name != null) { - props.put("name", name); - } - SignerProperty signer = new SignerProperty(bundle); - if (signer.isBundleSigned()) { - props.put("signer", signer); + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + props.put("id", Long.valueOf(bundle.getBundleId())); + props.put("location", bundle.getLocation()); + String name = bundle.getSymbolicName(); + if (name != null) { + props.put("name", name); + } + SignerProperty signer = new SignerProperty(bundle); + if (signer.isBundleSigned()) { + props.put("signer", signer); + } + return null; } - return null; }); return properties = new Properties(props, attributes); } @@ -552,7 +555,7 @@ public final class CapabilityPermission extends BasicPermission { if (entries != null) { return entries; } - Set<Map.Entry<String, Object>> all = new HashSet<>(attributes.size() + properties.size()); + Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(attributes.size() + properties.size()); all.addAll(attributes.entrySet()); all.addAll(properties.entrySet()); return entries = Collections.unmodifiableSet(all); @@ -598,7 +601,7 @@ final class CapabilityPermissionCollection extends PermissionCollection { * Creates an empty CapabilityPermissionCollection object. */ public CapabilityPermissionCollection() { - permissions = new HashMap<>(); + permissions = new HashMap<String, CapabilityPermission>(); all_allowed = false; } @@ -633,7 +636,7 @@ final class CapabilityPermissionCollection extends PermissionCollection { if (f != null) { pc = filterPermissions; if (pc == null) { - filterPermissions = pc = new HashMap<>(); + filterPermissions = pc = new HashMap<String, CapabilityPermission>(); } } else { pc = permissions; @@ -749,7 +752,7 @@ final class CapabilityPermissionCollection extends PermissionCollection { */ @Override public synchronized Enumeration<Permission> elements() { - List<Permission> all = new ArrayList<>(permissions.values()); + List<Permission> all = new ArrayList<Permission>(permissions.values()); Map<String, CapabilityPermission> pc = filterPermissions; if (pc != null) { all.addAll(pc.values()); diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java index 76402ec3b..587b532f9 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2020). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -373,7 +373,7 @@ public class FrameworkUtil { if (pattern == null) { throw new IllegalArgumentException("The pattern must not be null."); } - List<Object> parsed = new ArrayList<>(); + List<Object> parsed = new ArrayList<Object>(); final int length = pattern.length(); char c = ';'; // start with semi-colon to detect empty pattern for (int startIndex = skipSpaces(pattern, 0); startIndex < length;) { @@ -415,7 +415,7 @@ public class FrameworkUtil { if (dn.equals(STAR_WILDCARD) || dn.equals(MINUS_WILDCARD)) { continue; } - List<Object> rdns = new ArrayList<>(); + List<Object> rdns = new ArrayList<Object>(); if (dn.charAt(0) == '*') { int index = skipSpaces(dn, 1); if (dn.charAt(index) != ',') { @@ -437,13 +437,13 @@ public class FrameworkUtil { if (chain == null) { throw new IllegalArgumentException("DN chain must not be null."); } - List<Object> result = new ArrayList<>(chain.size()); + List<Object> result = new ArrayList<Object>(chain.size()); // Now we parse is a list of strings, lets make List of rdn out // of them for (String dn : chain) { dn = new X500Principal(dn).getName(X500Principal.CANONICAL); // Now dn is a nice CANONICAL DN - List<Object> rdns = new ArrayList<>(); + List<Object> rdns = new ArrayList<Object>(); parseDN(dn, rdns); result.add(rdns); } @@ -475,7 +475,7 @@ public class FrameworkUtil { private static void parseDN(String dn, List<Object> rdn) { int startIndex = 0; char c = '\0'; - List<String> nameValues = new ArrayList<>(); + List<String> nameValues = new ArrayList<String>(); while (startIndex < dn.length()) { int endIndex; for (endIndex = startIndex; endIndex < dn.length(); endIndex++) { @@ -494,7 +494,7 @@ public class FrameworkUtil { if (c != '+') { rdn.add(nameValues); if (endIndex != dn.length()) { - nameValues = new ArrayList<>(); + nameValues = new ArrayList<String>(); } else { nameValues = null; } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java index 0d6c37025..cc8cd627f 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -538,21 +538,24 @@ public final class PackagePermission extends BasicPermission { if (result != null) { return result; } - final Map<String, Object> map = new HashMap<>(5); + final Map<String, Object> map = new HashMap<String, Object>(5); map.put("package.name", getName()); if (bundle != null) { - AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - map.put("id", Long.valueOf(bundle.getBundleId())); - map.put("location", bundle.getLocation()); - String name = bundle.getSymbolicName(); - if (name != null) { - map.put("name", name); - } - SignerProperty signer = new SignerProperty(bundle); - if (signer.isBundleSigned()) { - map.put("signer", signer); + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + map.put("id", Long.valueOf(bundle.getBundleId())); + map.put("location", bundle.getLocation()); + String name = bundle.getSymbolicName(); + if (name != null) { + map.put("name", name); + } + SignerProperty signer = new SignerProperty(bundle); + if (signer.isBundleSigned()) { + map.put("signer", signer); + } + return null; } - return null; }); } return properties = map; @@ -596,7 +599,7 @@ final class PackagePermissionCollection extends PermissionCollection { * Create an empty PackagePermissions object. */ public PackagePermissionCollection() { - permissions = new HashMap<>(); + permissions = new HashMap<String, PackagePermission>(); all_allowed = false; } @@ -632,7 +635,7 @@ final class PackagePermissionCollection extends PermissionCollection { if (f != null) { pc = filterPermissions; if (pc == null) { - filterPermissions = pc = new HashMap<>(); + filterPermissions = pc = new HashMap<String, PackagePermission>(); } } else { pc = permissions; @@ -748,7 +751,7 @@ final class PackagePermissionCollection extends PermissionCollection { */ @Override public synchronized Enumeration<Permission> elements() { - List<Permission> all = new ArrayList<>(permissions.values()); + List<Permission> all = new ArrayList<Permission>(permissions.values()); Map<String, PackagePermission> pc = filterPermissions; if (pc != null) { all.addAll(pc.values()); @@ -761,7 +764,7 @@ final class PackagePermissionCollection extends PermissionCollection { new ObjectStreamField("filterPermissions", HashMap.class) }; private synchronized void writeObject(ObjectOutputStream out) throws IOException { - Hashtable<String, PackagePermission> hashtable = new Hashtable<>(permissions); + Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(permissions); ObjectOutputStream.PutField pfields = out.putFields(); pfields.put("permissions", hashtable); pfields.put("all_allowed", all_allowed); @@ -773,7 +776,7 @@ final class PackagePermissionCollection extends PermissionCollection { ObjectInputStream.GetField gfields = in.readFields(); @SuppressWarnings("unchecked") Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields.get("permissions", null); - permissions = new HashMap<>(hashtable); + permissions = new HashMap<String, PackagePermission>(hashtable); all_allowed = gfields.get("all_allowed", false); @SuppressWarnings("unchecked") HashMap<String, PackagePermission> fp = (HashMap<String, PackagePermission>) gfields.get("filterPermissions", null); diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java index 5bb32bfe1..a6b52521c 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -552,25 +552,28 @@ public final class ServicePermission extends BasicPermission { return result; } if (service == null) { - result = new HashMap<>(1); + result = new HashMap<String, Object>(1); result.put(Constants.OBJECTCLASS, new String[] {getName()}); return properties = result; } - final Map<String, Object> props = new HashMap<>(4); + final Map<String, Object> props = new HashMap<String, Object>(4); final Bundle bundle = service.getBundle(); if (bundle != null) { - AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - props.put("id", Long.valueOf(bundle.getBundleId())); - props.put("location", bundle.getLocation()); - String name = bundle.getSymbolicName(); - if (name != null) { - props.put("name", name); - } - SignerProperty signer = new SignerProperty(bundle); - if (signer.isBundleSigned()) { - props.put("signer", signer); + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + props.put("id", Long.valueOf(bundle.getBundleId())); + props.put("location", bundle.getLocation()); + String name = bundle.getSymbolicName(); + if (name != null) { + props.put("name", name); + } + SignerProperty signer = new SignerProperty(bundle); + if (signer.isBundleSigned()) { + props.put("signer", signer); + } + return null; } - return null; }); } return properties = new Properties(props, service); @@ -608,7 +611,7 @@ public final class ServicePermission extends BasicPermission { if (entries != null) { return entries; } - Set<Map.Entry<String, Object>> all = new HashSet<>(properties.entrySet()); + Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(properties.entrySet()); add: for (String key : service.getPropertyKeys()) { for (String k : properties.keySet()) { if (key.equalsIgnoreCase(k)) { @@ -712,7 +715,7 @@ final class ServicePermissionCollection extends PermissionCollection { * Creates an empty ServicePermissions object. */ public ServicePermissionCollection() { - permissions = new HashMap<>(); + permissions = new HashMap<String, ServicePermission>(); all_allowed = false; } @@ -747,7 +750,7 @@ final class ServicePermissionCollection extends PermissionCollection { if (f != null) { pc = filterPermissions; if (pc == null) { - filterPermissions = pc = new HashMap<>(); + filterPermissions = pc = new HashMap<String, ServicePermission>(); } } else { pc = permissions; @@ -889,7 +892,7 @@ final class ServicePermissionCollection extends PermissionCollection { */ @Override public synchronized Enumeration<Permission> elements() { - List<Permission> all = new ArrayList<>(permissions.values()); + List<Permission> all = new ArrayList<Permission>(permissions.values()); Map<String, ServicePermission> pc = filterPermissions; if (pc != null) { all.addAll(pc.values()); @@ -902,7 +905,7 @@ final class ServicePermissionCollection extends PermissionCollection { new ObjectStreamField("filterPermissions", HashMap.class) }; private synchronized void writeObject(ObjectOutputStream out) throws IOException { - Hashtable<String, ServicePermission> hashtable = new Hashtable<>(permissions); + Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(permissions); ObjectOutputStream.PutField pfields = out.putFields(); pfields.put("permissions", hashtable); pfields.put("all_allowed", all_allowed); @@ -914,7 +917,7 @@ final class ServicePermissionCollection extends PermissionCollection { ObjectInputStream.GetField gfields = in.readFields(); @SuppressWarnings("unchecked") Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields.get("permissions", null); - permissions = new HashMap<>(hashtable); + permissions = new HashMap<String, ServicePermission>(hashtable); all_allowed = gfields.get("all_allowed", false); @SuppressWarnings("unchecked") HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields.get("filterPermissions", null); diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java index 792b91d4e..53dec4a36 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2009, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ final class SignerProperty { String matchPattern = bundle != null ? other.pattern : pattern; Map<X509Certificate, List<X509Certificate>> signers = matchBundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED); for (List<X509Certificate> signerCerts : signers.values()) { - List<String> dnChain = new ArrayList<>(signerCerts.size()); + List<String> dnChain = new ArrayList<String>(signerCerts.size()); for (X509Certificate signerCert : signerCerts) { dnChain.add(signerCert.getSubjectDN().getName()); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java index f46779f10..8a79c1452 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,12 @@ public class BundleLocationCondition { String[] args = info.getArgs(); if (args.length != 1 && args.length != 2) throw new IllegalArgumentException("Illegal number of args: " + args.length); - String bundleLocation = AccessController.doPrivileged((PrivilegedAction<String>) () -> bundle.getLocation()); + String bundleLocation = AccessController.doPrivileged(new PrivilegedAction<String>() { + @Override + public String run() { + return bundle.getLocation(); + } + }); Filter filter = null; try { filter = FrameworkUtil.createFilter("(location=" + escapeLocation(args[0]) + ")"); @@ -74,7 +79,7 @@ public class BundleLocationCondition { // this should never happen, but just in case throw new RuntimeException("Invalid filter: " + e.getFilter(), e); } - Dictionary<String, String> matchProps = new Hashtable<>(2); + Dictionary<String, String> matchProps = new Hashtable<String, String>(2); matchProps.put("location", bundleLocation); boolean negate = (args.length == 2) ? "!".equals(args[1]) : false; return (negate ^ filter.match(matchProps)) ? Condition.TRUE : Condition.FALSE; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java index 2941be76a..9bb17ecb4 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ public class BundleSignerCondition { Map<X509Certificate, List<X509Certificate>> signers = bundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED); boolean match = false; for (List<X509Certificate> signerCerts : signers.values()) { - List<String> dnChain = new ArrayList<>(signerCerts.size()); + List<String> dnChain = new ArrayList<String>(signerCerts.size()); for (X509Certificate signer : signerCerts) { dnChain.add(signer.getSubjectDN().getName()); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java index fa529a8c3..f96821be9 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -123,7 +123,7 @@ public class ConditionInfo { } /* type may be followed by args which are quoted and encoded */ - List<String> argsList = new ArrayList<>(); + List<String> argsList = new ArrayList<String>(); while (encoded[pos] == '"') { pos++; begin = pos; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java index d9df44a6a..2bcc0ac8e 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public class ResolutionException extends Exception { if ((unresolvedRequirements == null) || unresolvedRequirements.isEmpty()) { this.unresolvedRequirements = null; } else { - this.unresolvedRequirements = Collections.unmodifiableCollection(new ArrayList<>(unresolvedRequirements)); + this.unresolvedRequirements = Collections.unmodifiableCollection(new ArrayList<Requirement>(unresolvedRequirements)); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java index db9de5a1f..5a3d32eb9 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -289,7 +289,7 @@ public abstract class ResolveContext { */ public List<Wire> getSubstitutionWires(Wiring wiring) { // Keep track of the declared capability package names - Set<String> exportNames = new HashSet<>(); + Set<String> exportNames = new HashSet<String>(); // Add packages declared as provided by the wiring host for (Capability cap : wiring.getResource().getCapabilities(null)) { @@ -316,7 +316,7 @@ public abstract class ResolveContext { // collect the package wires that substitute one of the declared // export package names - List<Wire> substitutionWires = new ArrayList<>(); + List<Wire> substitutionWires = new ArrayList<Wire>(); for (Wire wire : wiring.getRequiredResourceWires(null)) { if (PackageNamespace.PACKAGE_NAMESPACE .equals(wire.getCapability().getNamespace())) { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java index 0773bc037..5988d7939 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2007, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2007, 2013). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,10 +103,10 @@ abstract class AbstractTracked<S, T, R> { * AbstractTracked constructor. */ AbstractTracked() { - tracked = new HashMap<>(); + tracked = new HashMap<S, T>(); trackingCount = 0; - adding = new ArrayList<>(6); - initial = new LinkedList<>(); + adding = new ArrayList<S>(6); + initial = new LinkedList<S>(); closed = false; } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java index 1b52ad25a..ac16c218a 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2007, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2007, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -383,7 +383,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> { * @since 1.5 */ public Map<Bundle, T> getTracked() { - Map<Bundle, T> map = new HashMap<>(); + Map<Bundle, T> map = new HashMap<Bundle, T>(); final Tracked t = tracked(); if (t == null) { /* if BundleTracker is not open */ return map; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java index fcf430ca1..3c9016c43 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -782,7 +782,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { * @since 1.5 */ public SortedMap<ServiceReference<S>, T> getTracked() { - SortedMap<ServiceReference<S>, T> map = new TreeMap<>(Collections.reverseOrder()); + SortedMap<ServiceReference<S>, T> map = new TreeMap<ServiceReference<S>, T>(Collections.reverseOrder()); final Tracked t = tracked(); if (t == null) { /* if ServiceTracker is not open */ return map; |