khmarbaise opened a new issue, #11581:
URL: https://github.com/apache/maven/issues/11581

   ### Affected version
   
   4.0.0-rc5
   
   ### Bug description
   
   Using Maven 4.0.0-rc5
   ```
   $> mvn --version
   Apache Maven 4.0.0-rc-5 (fb3ecaef88106acb40467a450248dfdbd75f3b35)
   Maven home: /Users/khm/tools/maven
   Java version: 26-ea, vendor: Oracle Corporation, runtime: 
/Users/khm/.sdkman/candidates/java/26.ea.28-open
   Default locale: en_DE, platform encoding: UTF-8
   OS name: "mac os x", version: "14.6.1", arch: "aarch64", family: "mac"
   ```
   Using JDK 26-Build 28 
   
   Starting a project just with a simple: 
   ```
   $> mvn clean
   [INFO] 
   [INFO] 1 problem was encountered while building the effective settings (use 
-e to see details)
   [INFO] 
   [INFO] Scanning for projects...
   WARNING: Final field modelId in class org.apache.maven.api.model.InputSource 
has been mutated reflectively by class 
org.apache.maven.impl.model.DefaultModelBuilder$ModelBuilderSessionState in 
unnamed module @7dcf94f8 
(file:/Users/khm/tools/maven/lib/maven-impl-4.0.0-rc-5.jar)
   WARNING: Use --enable-final-field-mutation=ALL-UNNAMED to avoid a warning
   WARNING: Mutating final fields will be blocked in a future release unless 
final field mutation is enabled
   [INFO] Inspecting build with total of 1 modules
   [INFO] Installing Central Publishing features
   [INFO] 
   [INFO] -----------------------------------< 
com.soebes.so.example.reflection:deep-reflection 
>-----------------------------------
   [INFO] Building Deep Reflection 1.0-SNAPSHOT
   [INFO]   from pom.xml
   [INFO] ---------------------------------------------------------[ jar 
]----------------------------------------------------------
   [INFO] 
   [INFO] --- clean:3.5.0:clean (default-clean) @ deep-reflection ---
   [INFO] Deleting /Users/khm/ws-git-soebes/examples/deep-reflection/target
   [INFO] 
--------------------------------------------------------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] 
--------------------------------------------------------------------------------------------------------------------------
   [INFO] Total time:  0.415 s
   [INFO] Finished at: 2025-12-21T10:34:41+01:00
   [INFO] 
--------------------------------------------------------------------------------------------------------------------------
   ````
   The WARNING is the result of [JEP 500](https://openjdk.org/jeps/500) which 
produces those things.
   
   The culprit code 
(https://github.com/apache/maven/blob/maven-4.0.x/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java#L1505):
   ```java
                   InputLocation loc = model.getLocation("");
                   InputSource v4src = loc != null ? loc.getSource() : null;
                   if (v4src != null) {
                       try {
                           Field field = 
InputSource.class.getDeclaredField("modelId");
                           field.setAccessible(true);
                           field.set(v4src, ModelProblemUtils.toId(model));
                       } catch (Throwable t) {
                           // TODO: use a lazy source ?
                           throw new IllegalStateException("Unable to set 
modelId on InputSource", t);
                       }
                   }
   ```
   It's using `setAccessible` on a class which itself is defined as `final` and 
also has not `set` Methods...
   


-- 
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