Bug#1033952: unblock: osgi-core/8.0.0-2

Jochen Sprickerhof jspricke at debian.org
Tue Apr 4 22:01:49 BST 2023


Package: release.debian.org
Severity: normal
User: release.debian.org at packages.debian.org
Usertags: unblock
X-Debbugs-Cc: osgi-core at packages.debian.org
Control: affects -1 + src:osgi-core

Please unblock package osgi-core

[ Reason ]
The LoggerFactory and LogEntry interface definitions where added to
osgi-core in version 8.0.0 duplication those in osgi-compendium.
osgi-compendium carries a Debian patch to adopt the APIs to be backward
compatible that was missing from osgi-core resulting in src:bnd FTBFS
(#1026606). 8.0.0-2 copies this patch so both packages provide the same
API.

[ Impact ]
src:bnd can not be build without this patch.

[ Tests ]
I did a test rebuild of src:bnd to make sure it compiles again:
https://tests.reproducible-builds.org/debian/rb-pkg/bnd.html

[ Risks ]
Given that the patch is already in osgi-compendium since 2020 and it
only provides default implementations for the added API methods I don't
see a risk.

Alternative solutions I looked into:

- Adopting src:bnd to implement the new API. I tried this but the diff
  was rather large with no added value. Also I assume there are other
  packages depending on the old API.

- removing LoggerFactory and LogEntry from osgi-core again which would
  result in a diff to the upstream source and probably other packages
  failing.

[ Checklist ]
  [X] all changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in testing

unblock osgi-core/8.0.0-2
-------------- next part --------------
diff --git a/debian/changelog b/debian/changelog
index 0f8c8cf..ee0ef4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+osgi-core (8.0.0-2) unstable; urgency=medium
+
+  * Team upload.
+  * Preserve backward compatibility in logging interface.
+    Turned the new interface methods into default methods to preserve the
+    backward compatibility. Taken from osgi-compendium. (Closes: #1026606)
+
+ -- Jochen Sprickerhof <jspricke at debian.org>  Mon, 03 Apr 2023 14:57:28 +0200
+
 osgi-core (8.0.0-1) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/patches/01-backward-compatibility.patch b/debian/patches/01-backward-compatibility.patch
new file mode 100644
index 0000000..a45e721
--- /dev/null
+++ b/debian/patches/01-backward-compatibility.patch
@@ -0,0 +1,95 @@
+Description: Preserves the source compatibility with older versions of the API
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/org/osgi/service/log/LoggerFactory.java
++++ b/org/osgi/service/log/LoggerFactory.java
+@@ -61,7 +61,7 @@
+ 	 *         parameter is equal to {@link Logger#ROOT_LOGGER_NAME}, then the
+ 	 *         root logger is returned.
+ 	 */
+-	Logger getLogger(String name);
++	default Logger getLogger(String name) { throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Return the {@link Logger} named with the specified class.
+@@ -70,7 +70,7 @@
+ 	 *            {@code null}.
+ 	 * @return The {@link Logger} named with the name of the specified class.
+ 	 */
+-	Logger getLogger(Class< ? > clazz);
++	default Logger getLogger(Class< ? > clazz) { throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Return the {@link Logger} of the specified type named with the specified
+@@ -88,7 +88,7 @@
+ 	 * @throws IllegalArgumentException If the specified type is not a supported
+ 	 *             Logger type.
+ 	 */
+-	<L extends Logger> L getLogger(String name, Class<L> loggerType);
++	default <L extends Logger> L getLogger(String name, Class<L> loggerType) { throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Return the {@link Logger} of the specified type named with the specified
+@@ -104,7 +104,7 @@
+ 	 * @throws IllegalArgumentException If the specified type is not a supported
+ 	 *             Logger type.
+ 	 */
+-	<L extends Logger> L getLogger(Class< ? > clazz, Class<L> loggerType);
++	default <L extends Logger> L getLogger(Class< ? > clazz, Class<L> loggerType) {throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Return the {@link Logger} of the specified type named with the specified
+@@ -130,6 +130,6 @@
+ 	 * @throws IllegalArgumentException If the specified type is not a supported
+ 	 *             Logger type or the specified Bundle is not a resolved bundle.
+ 	 */
+-	<L extends Logger> L getLogger(Bundle bundle, String name,
+-			Class<L> loggerType);
++	default <L extends Logger> L getLogger(Bundle bundle, String name,
++			Class<L> loggerType) { throw new UnsupportedOperationException(); }
+ }
+--- a/org/osgi/service/log/LogEntry.java
++++ b/org/osgi/service/log/LogEntry.java
+@@ -111,7 +111,7 @@
+ 	 * @return The level of this {@code LogEntry} object.
+ 	 * @since 1.4
+ 	 */
+-	LogLevel getLogLevel();
++	default LogLevel getLogLevel() { throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Returns the name of the {@link Logger} object used to create this
+@@ -121,7 +121,7 @@
+ 	 *         {@code LogEntry} object.
+ 	 * @since 1.4
+ 	 */
+-	String getLoggerName();
++	default String getLoggerName() { throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Returns the sequence number for this {@code LogEntry} object.
+@@ -133,7 +133,7 @@
+ 	 * @return The sequence number for this {@code LogEntry} object.
+ 	 * @since 1.4
+ 	 */
+-	long getSequence();
++	default long getSequence() { throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Returns a string representing the thread which created this
+@@ -146,7 +146,7 @@
+ 	 *         {@code LogEntry} object.
+ 	 * @since 1.4
+ 	 */
+-	String getThreadInfo();
++	default String getThreadInfo() { throw new UnsupportedOperationException(); }
+ 
+ 	/**
+ 	 * Returns the location information of the creation of this {@code LogEntry}
+@@ -156,5 +156,5 @@
+ 	 *         object.
+ 	 * @since 1.4
+ 	 */
+-	StackTraceElement getLocation();
++	default StackTraceElement getLocation() { throw new UnsupportedOperationException(); }
+ }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..4e58ea8
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+01-backward-compatibility.patch


More information about the pkg-java-maintainers mailing list