diff --git a/pkg/config/builder.go b/pkg/config/builder.go index 3e81947..49d59f5 100644 --- a/pkg/config/builder.go +++ b/pkg/config/builder.go @@ -360,10 +360,11 @@ func getGCOptions(gcName string, jvmMajor int) []string { case "Shenandoah": return []string{"-XX:+UseShenandoahGC"} case "ZGC": - zgcOpts := []string{"-XX:+UseZGC"} + zgcOpts := make([]string, 0, 1) if jvmMajor < 17 { zgcOpts = append(zgcOpts, "-XX:+UnlockExperimentalVMOptions") } + zgcOpts = append(zgcOpts, "-XX:+UseZGC") return zgcOpts default: // User needs to define all the settings diff --git a/pkg/config/builder_test.go b/pkg/config/builder_test.go index 6b9a36f..663ac4b 100644 --- a/pkg/config/builder_test.go +++ b/pkg/config/builder_test.go @@ -486,7 +486,7 @@ func TestGCOptions(t *testing.T) { assert.Equal([]string{"-XX:+UseShenandoahGC"}, getGCOptions("Shenandoah", 11)) assert.Equal([]string{"-XX:+UseShenandoahGC"}, getGCOptions("Shenandoah", 17)) - assert.Equal([]string{"-XX:+UseZGC", "-XX:+UnlockExperimentalVMOptions"}, getGCOptions("ZGC", 11)) + assert.Equal([]string{"-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC"}, getGCOptions("ZGC", 11)) assert.Equal([]string{"-XX:+UseZGC"}, getGCOptions("ZGC", 17)) }