rmannibucau opened a new issue, #9537:
URL: https://github.com/apache/hop/issues/9537

   #### Apache Hop version?
   
   2.20.0, using a locally installed runtime.
   The constructor is also protected in the current 2.21.0-SNAPSHOT source 
before the proposed fix.
   
   #### Java version?
   
   OpenJDK 21.0.12 (Temurin).
   
   #### Operating system
   
   Linux.
   
   #### What happened?
   
   Existing, already compiled plugins fail when they execute a direct call to 
the formerly public `ValueMetaBase(String, int)` constructor.
   This has been reproduced with unchanged third-party plugin JARs: a transform 
and an action compiled against an older Hop API.
   
   The failure is an execution-time `IllegalAccessError`, not a missing plugin 
or dependency-discovery error.
   The relevant part of the observed error is:
   
   ```text
   java.lang.IllegalAccessError: ... tried to access protected method
   'void org.apache.hop.core.row.value.ValueMetaBase.<init>(java.lang.String, 
int)'
   ```
   
   In the transform this happens while constructing the output row metadata.
   In the action this happens while constructing value metadata.
   
   #### Cause
   
   #6988 and #7387 changed the constructors from public to protected in commit 
`c25b86e13cd5795c78eba581e4f59094e4f806e4`.
   The motivation for using `ValueMetaFactory` and type-specific metadata 
remains valid.
   However, narrowing access to an existing public constructor also breaks 
binaries that already invoke it, even though its JVM descriptor still exists.
   
   For example, code outside `org.apache.hop.core.row.value` previously 
compiled with this call:
   
   ```java
   IValueMeta valueMeta = new ValueMetaBase(outputField, newType);
   ```
   
   The same bytecode cannot access the protected constructor on the newer host.
   Moving the unchanged plugin into its normal plugin directory or adding 
`--add-opens` does not repair this direct invocation.
   
   #### Reproduction
   
   1. Use an existing plugin, compiled against an older Hop core, that directly 
invokes `ValueMetaBase(String, int)` from outside its package and is not 
accessing it as a subclass constructor.
   2. Install the unchanged plugin in the normal transform/action plugin 
directory of a Hop runtime whose constructor is protected, without bundling an 
older Hop core.
   3. Execute a pipeline/workflow that reaches that metadata-construction path 
using `hop-run.sh`.
   4. Observe `IllegalAccessError` at the constructor call.
   
   This was reproduced through normal folder-based plugin loading on the local 
Hop 2.20 runtime, not only on a flat test classpath.
   As a small source-level regression check, a direct call from an unrelated 
package also fails compilation against the protected constructor.
   
   #### Expected behavior / proposed compatibility fix
   
   Restore **only** `ValueMetaBase(String, int)` as a deprecated public 
constructor, retaining its existing initialization and directing new code to 
`ValueMetaFactory.createValueMeta(String, int)`.
   Keep the other constructors protected.
   
   This would allow deployed binaries using the demonstrated signature to keep 
linking while giving maintainers a migration path that does not require all 
plugin releases to be coordinated with the host upgrade.
   It does not make base metadata equivalent to factory-created, type-specific 
metadata, and does not promise that every older plugin is compatible.
   
   #### Validation of the proposed direction
   
   On the local Hop 2.20 runtime, changing only this constructor's access flag 
to public, without modifying either plugin JAR, allowed the tested cases to 
execute successfully.
   A source implementation of the same change, with deprecation, was then built 
from a 2.21.0-SNAPSHOT branch and exercised in a private copy of an existing 
local 2.21 client assembly with that freshly built core.
   
   - Both components passed their tested execution paths with unchanged plugin 
JARs, including output, metadata, resource-lifecycle, and termination 
assertions.
   
   These are focused compatibility checks, not certification of all plugin 
functions, shutdown races, or complete release packaging.
   
   #### Issue Priority
   
   Priority: 2
   
   #### Issue Component
   
   Component: API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to