Skip to content

Commit

Permalink
Perform clean code of bundles/org.eclipse.osgi
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipse-equinox-bot committed Jan 27, 2025
1 parent 3fdc70d commit 3779d22
Show file tree
Hide file tree
Showing 69 changed files with 474 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ final Map<ModuleRevision, ModuleWiring> getWiringsClone() {
try {
Map<ModuleRevision, ModuleWiring> clonedWirings = new HashMap<>(wirings);
clonedWirings.replaceAll(new BiFunction<ModuleRevision, ModuleWiring, ModuleWiring>() {
@Override
public ModuleWiring apply(ModuleRevision r, ModuleWiring w) {
return new ModuleWiring(r, w.getCapabilities(), w.getRequirements(), w.getProvidedWires(),
w.getRequiredWires(), w.getSubstitutedNames());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,12 @@ public void logUsesConstraintViolation(Resource resource, ResolutionError error)
}
}

@Override
public void logRequirement(String message, Requirement requirement) {
debug(String.format(message, ModuleContainer.toString(requirement)));
}

@Override
public void logCapability(String message, Capability requirement) {
debug(String.format(message, ModuleContainer.toString(requirement)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public final class ModuleRevision implements BundleRevision {

private NamespaceList<ModuleCapability> createCapabilities(NamespaceList.Builder<GenericInfo> capabilityInfos) {
return capabilityInfos.transformIntoCopy(new Function<GenericInfo, ModuleCapability>() {
@Override
public ModuleCapability apply(GenericInfo i) {
Map<String, String> directives = i.mutable ? copyUnmodifiableMap(i.directives) : i.directives;
Map<String, Object> attributes = i.mutable ? copyUnmodifiableMap(i.attributes) : i.attributes;
Expand All @@ -82,6 +83,7 @@ private <K, V> Map<K, V> copyUnmodifiableMap(Map<K, V> map) {

private NamespaceList<ModuleRequirement> createRequirements(NamespaceList.Builder<GenericInfo> infos) {
return infos.transformIntoCopy(new Function<GenericInfo, ModuleRequirement>() {
@Override
public ModuleRequirement apply(GenericInfo i) {
return new ModuleRequirement(i.namespace, i.directives, i.attributes, ModuleRevision.this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public final class ModuleRevisionBuilder {
*/
public static class GenericInfo {
final static Function<GenericInfo, String> GETNAMESPACE = new Function<GenericInfo, String>() {
@Override
public String apply(GenericInfo info) {
return info.getNamespace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class EquinoxModuleDataNamespace extends Namespace {
*
* @deprecated use {@link #LAZYSTART_HEADER}
*/
@Deprecated
public static final String AUTOSTART_HEADER = "Eclipse-AutoStart"; //$NON-NLS-1$

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public int read() throws IOException {
throw new IOException();
}

@Override
public File getContent() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@
public class NamespaceList<E> {

public final static Function<ModuleWire, String> WIRE = new Function<ModuleWire, String>() {
@Override
public String apply(ModuleWire wire) {
return wire.getCapability().getNamespace();
}
};
public final static Function<ModuleCapability, String> CAPABILITY = new Function<ModuleCapability, String>() {
@Override
public String apply(ModuleCapability capability) {
return capability.getNamespace();
}
};
public final static Function<ModuleRequirement, String> REQUIREMENT = new Function<ModuleRequirement, String>() {
@Override
public String apply(ModuleRequirement requirement) {
return requirement.getNamespace();
}
Expand Down Expand Up @@ -188,6 +191,7 @@ public boolean hasNext() {
return inner.hasNext();
}

@Override
public E next() {
if (!hasNext()) {
throw new NoSuchElementException();
Expand Down Expand Up @@ -333,6 +337,7 @@ private boolean addAll(Map<String, List<E>> perNamespaceElements) {

private List<E> getNamespaceList(String namespace) {
return namespaceElements.computeIfAbsent(namespace, new Function<String, List<E>>() {
@Override
public List<E> apply(String n) {
return new ArrayList<>();
}
Expand Down Expand Up @@ -402,6 +407,7 @@ public void addAllFilteredAfterLastMatch(NamespaceList<E> list, Predicate<? supe
targetList.add(toAdd);
} else {
addAfterLastMatch(toAdd, targetList, new Predicate<E>() {
@Override
public boolean test(E e) {
return insertionMatcher.test(toAdd, e);
}
Expand Down Expand Up @@ -448,6 +454,7 @@ public boolean remove(Object o) {

private void removeNamespaceElement(String namespace, E element) {
namespaceElements.computeIfPresent(namespace, new BiFunction<String, List<E>, List<E>>() {
@Override
public List<E> apply(String n, List<E> es) {
if (es.remove(element)) {
Builder.this.size--;
Expand Down Expand Up @@ -482,6 +489,7 @@ public void removeNamespaceIf(Predicate<String> filter) {
prepareModification();

namespaceElements.entrySet().removeIf(new Predicate<Map.Entry<String, List<E>>>() {
@Override
public boolean test(Map.Entry<String, List<E>> e) {
if (filter.test(e.getKey())) {
Builder.this.size -= e.getValue().size();
Expand All @@ -498,6 +506,7 @@ public boolean removeIf(Predicate<? super E> filter) {

int s = size;
namespaceElements.values().removeIf(new Predicate<List<E>>() {
@Override
public boolean test(List<E> es) {
return removeElementsIf(es, filter) == null;
}
Expand All @@ -516,6 +525,7 @@ public void removeElementsOfNamespaceIf(String namespace, Predicate<? super E> f
prepareModification();

namespaceElements.computeIfPresent(namespace, new BiFunction<String, List<E>, List<E>>() {
@Override
public List<E> apply(String n, List<E> es) {
return removeElementsIf(es, filter);
}
Expand Down Expand Up @@ -555,6 +565,7 @@ public NamespaceList<E> build() {

int[] start = new int[] { 0 };
namespaceElements.replaceAll(new BiFunction<String, List<E>, List<E>>() {
@Override
public List<E> apply(String n, List<E> es) {
int from = start[0];
int to = start[0] += es.size();
Expand All @@ -571,6 +582,7 @@ private void prepareModification() {
// namespace-lists for subsequent modification
namespaceElements = new LinkedHashMap<>(namespaceElements);
namespaceElements.replaceAll(new BiFunction<String, List<E>, List<E>>() {
@Override
public List<E> apply(String n, List<E> es) {
return new ArrayList<>(es);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ private static void addRequirers(Set<Bundle> importing, ModuleWiring wiring, Str
/**
* @deprecated
*/
@Deprecated
@Override
public String getSpecificationVersion() {
return getVersion().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public DefineClassResult(Class<?> clazz, boolean defined) {

private static final class ClassNameLock {
static final Function<String, ClassNameLock> SUPPLIER = new Function<String, ClassNameLock>() {
@Override
public ClassNameLock apply(String className) {
return new ClassNameLock(className);
}
Expand Down Expand Up @@ -199,6 +200,7 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
}

// preparing for Java 9
@Override
protected Class<?> findClass(String moduleName, String name) {
try {
return findLocalClass(name);
Expand Down Expand Up @@ -240,6 +242,7 @@ public URL getResource(String name) {
}

// preparing for Java 9
@Override
protected URL findResource(String moduleName, String name) {
return findLocalResource(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public boolean isReadOnly() {
/**
* @deprecated
*/
@Deprecated
@Override
public boolean setURL(URL value, boolean lock) throws IllegalStateException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ void delete(SecurityRow securityRow, boolean firstTry) {
/**
* @deprecated
*/
@Deprecated
@Override
public ConditionalPermissionInfo addConditionalPermissionInfo(ConditionInfo[] conds, PermissionInfo[] perms) {
return setConditionalPermissionInfo(null, conds, perms, true);
Expand Down Expand Up @@ -287,6 +288,7 @@ public AccessControlContext getAccessControlContext(String[] signers) {
/**
* @deprecated
*/
@Deprecated
@Override
public ConditionalPermissionInfo getConditionalPermissionInfo(String name) {
synchronized (lock) {
Expand All @@ -297,6 +299,7 @@ public ConditionalPermissionInfo getConditionalPermissionInfo(String name) {
/**
* @deprecated
*/
@Deprecated
@Override
public Enumeration<ConditionalPermissionInfo> getConditionalPermissionInfos() {
// could implement our own Enumeration, but we don't care about performance
Expand All @@ -312,6 +315,7 @@ public Enumeration<ConditionalPermissionInfo> getConditionalPermissionInfos() {
/**
* @deprecated
*/
@Deprecated
@Override
public ConditionalPermissionInfo setConditionalPermissionInfo(String name, ConditionInfo[] conds,
PermissionInfo[] perms) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ PermissionInfo[] internalGetPermissionInfos() {
/**
* @deprecated
*/
@Deprecated
@Override
public void delete() {
securityAdmin.delete(this, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public PermissionInfo[] getPermissionInfos() {
/**
* @deprecated
*/
@Deprecated
@Override
public void delete() {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ private boolean isSignatureFile(String entry) {
return false;
}

@Override
public int read() throws IOException {
if (nextEntryInput != null) {
int result = nextEntryInput.read();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public URLStreamHandlerSetter(URLStreamHandlerProxy handler) {
* int, String, String)
* @deprecated
*/
@Deprecated
@Override
public void setURL(URL url, String protocol, String host, int port, String file, String ref) {
handlerProxy.setURL(url, protocol, host, port, file, ref);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public interface BundleDelta extends Comparable<BundleDelta> {
* @see BundleDelta#getType
* @deprecated this type is no longer valid
*/
@Deprecated
public static final int LINKAGE_CHANGED = 0x20;

/**
Expand All @@ -80,6 +81,7 @@ public interface BundleDelta extends Comparable<BundleDelta> {
* @see BundleDelta#getType
* @deprecated this type is no longer valid
*/
@Deprecated
public static final int OPTIONAL_LINKAGE_CHANGED = 0x40;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public interface ExportPackageDescription extends BaseDescription {
* @deprecated all export package descriptions are roots. The Reexport-Package
* header never became API.
*/
@Deprecated
public boolean isRoot();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public interface GenericDescription extends BaseDescription {
*
* @deprecated matching should only be done against a capability's attributes.
*/
@Deprecated
@Override
public String getName();

Expand All @@ -63,6 +64,7 @@ public interface GenericDescription extends BaseDescription {
*
* @deprecated matching should only be done against a capability's attributes.
*/
@Deprecated
@Override
public Version getVersion();
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public interface PlatformAdmin {
* @return a system resolver
* @deprecated in favour of {@link #createResolver()}.
*/
@Deprecated
public Resolver getResolver();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public interface State {
* @deprecated use
* {@link #resolveBundle(BundleDescription, boolean, BundleDescription[], ExportPackageDescription[], ExportPackageDescription[], GenericDescription[], BundleDescription[], ExportPackageDescription[], GenericDescription[], Map)}
*/
@Deprecated
public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts,
ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports);
Expand Down Expand Up @@ -240,6 +241,7 @@ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescri
* @deprecated use
* {@link #resolveBundle(BundleDescription, boolean, BundleDescription[], ExportPackageDescription[], ExportPackageDescription[], GenericDescription[], BundleDescription[], ExportPackageDescription[], GenericDescription[], Map)}
*/
@Deprecated
public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts,
ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports,
BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports);
Expand Down Expand Up @@ -438,6 +440,7 @@ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescri
* @deprecated The exact form of this has never been defined. There is no
* alternative method available.
*/
@Deprecated
public void setOverrides(Object value);

/**
Expand Down
Loading

0 comments on commit 3779d22

Please sign in to comment.