"maxHeapSize" not work in jvmArgs, but can work int test blcok, it is a bug or intentional ?

build.gradle

test {
    jvmArgs(
            "-XX:+PrintCommandLineFlags",
            "-XX:MaxHeapSize=8G"
    )
}

console:

---config jvmArgs[-XX:+PrintCommandLineFlags, -XX:MaxHeapSize=8G]

-XX:ConcGCThreads=2 -XX:G1ConcRefinementThreads=8 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=268435456 -XX:MarkStackSize=4194304 -**XX:MaxHeapSize=536870912 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC 

move MaxHeapSize to test block

test {
   jvmArgs(
           "-XX:+PrintCommandLineFlags",
   )
}
maxHeapSize = "8G"

then output

---config jvmArgs[-XX:+PrintCommandLineFlags]
-XX:ConcGCThreads=2 -XX:G1ConcRefinementThreads=8 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=268435456 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=8589934592 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC 

why it is not work when use “-XX:MaxHeapSize=8G” in jvmArgs? it is a bug or intentional ?