You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "James Z.M. Gao (Jira)" <ji...@apache.org> on 2023/02/04 12:40:00 UTC

[jira] [Created] (MNG-7678) Settings (v3) and Settings.Builder() cannot unset a non-null field

James Z.M. Gao created MNG-7678:
-----------------------------------

             Summary: Settings (v3) and Settings.Builder() cannot unset a non-null field
                 Key: MNG-7678
                 URL: https://issues.apache.org/jira/browse/MNG-7678
             Project: Maven
          Issue Type: Bug
          Components: Core, Settings
    Affects Versions: 4.0.0-alpha-4
            Reporter: James Z.M. Gao


 

Testing code:
{noformat}
    final Settings s = new Settings();

    s.setLocalRepository("xxx");
    assertEquals("xxx", s.getLocalRepository()); // OK

    s.setLocalRepository("yyy");
    assertEquals("yyy", s.getLocalRepository()); // OK

    s.setLocalRepository(null);
    assertNull(s.getLocalRepository()); // FAIL{noformat}
 

It seems related to the the build() method of Model Builder with forceCopy = false :

 
{noformat}
${field.name} != null ? ${field.name} : ( base != null ? base.${field.name} : null )${sep}
{noformat}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)