This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new e4602eca94 Restore the legacy ValueMetaBase constructor for binary
compatibility (#9538)
e4602eca94 is described below
commit e4602eca94bec2a89788b90252ec2c0903402449
Author: Romain Manni-Bucau <[email protected]>
AuthorDate: Tue Nov 17 10:35:38 2026 +0100
Restore the legacy ValueMetaBase constructor for binary compatibility
(#9538)
---
.../apache/hop/core/row/value/ValueMetaBase.java | 12 ++++-
.../core/row/ValueMetaBaseCompatibilityTest.java | 56 ++++++++++++++++++++++
2 files changed, 67 insertions(+), 1 deletion(-)
diff --git
a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java
b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java
index a954fcf350..d6d1a58de4 100644
--- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java
+++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java
@@ -292,7 +292,17 @@ public class ValueMetaBase implements IValueMeta {
this(name, IValueMeta.TYPE_NONE, -1, -1);
}
- protected ValueMetaBase(String name, int type) {
+ /**
+ * Creates value metadata for components compiled against the legacy public
constructor.
+ *
+ * @param name the field name
+ * @param type the value type
+ * @deprecated Retained for binary compatibility. Use {@link
+ * ValueMetaFactory#createValueMeta(String, int)} for type-specific
value metadata in new
+ * code.
+ */
+ @Deprecated(since = "2.21")
+ public ValueMetaBase(String name, int type) {
this(name, type, -1, -1);
}
diff --git
a/core/src/test/java/org/apache/hop/core/row/ValueMetaBaseCompatibilityTest.java
b/core/src/test/java/org/apache/hop/core/row/ValueMetaBaseCompatibilityTest.java
new file mode 100644
index 0000000000..2c752fd015
--- /dev/null
+++
b/core/src/test/java/org/apache/hop/core/row/ValueMetaBaseCompatibilityTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.core.row;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import org.apache.hop.core.row.value.ValueMetaBase;
+import org.apache.hop.junit.rules.RestoreHopEnvironmentExtension;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+@ExtendWith(RestoreHopEnvironmentExtension.class)
+class ValueMetaBaseCompatibilityTest {
+
+ @SuppressWarnings("deprecation")
+ @ParameterizedTest
+ @ValueSource(ints = {IValueMeta.TYPE_STRING, IValueMeta.TYPE_DATE,
IValueMeta.TYPE_INTEGER})
+ void legacyConstructorIsAccessibleOutsideItsPackage(final int type) {
+ // A direct call from another package guards the API used by already
compiled plugins.
+ final var valueMeta = new ValueMetaBase("legacyField", type);
+
+ assertEquals("legacyField", valueMeta.getName());
+ assertEquals(type, valueMeta.getType());
+ assertEquals(-1, valueMeta.getLength());
+ assertEquals(type == IValueMeta.TYPE_INTEGER ? 0 : -1,
valueMeta.getPrecision());
+ assertEquals(IValueMeta.STORAGE_TYPE_NORMAL, valueMeta.getStorageType());
+ }
+
+ @Test
+ void legacyConstructorIsDeprecatedWithoutScheduledRemoval() throws
NoSuchMethodException {
+ final var constructor = ValueMetaBase.class.getConstructor(String.class,
int.class);
+ final var deprecation = constructor.getAnnotation(Deprecated.class);
+
+ assertNotNull(deprecation);
+ assertFalse(deprecation.forRemoval());
+ }
+}