Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
* @author Jonas Konrad
*/
@ConfigurationProperties(GracefulShutdownConfiguration.PREFIX)
@Requires(property = GracefulShutdownConfiguration.ENABLED, value = StringUtils.TRUE, defaultValue = StringUtils.FALSE)
@Requires(property = GracefulShutdownConfiguration.MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED, value = StringUtils.TRUE, defaultValue = StringUtils.FALSE)
public final class GracefulShutdownConfiguration implements Toggleable {
public static final String PREFIX = "micronaut.lifecycle.graceful-shutdown";
public static final String ENABLED = PREFIX + ".enabled";
public static final String MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED = PREFIX + ".enabled";
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming the public constant GracefulShutdownConfiguration.ENABLED to MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED is also a breaking change for downstream code that references this constant (common in @Requires(property=...) usage). Consider retaining ENABLED as an @Deprecated alias to the new constant to avoid breaking consumers, while using the new constant internally.

Suggested change
public static final String MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED = PREFIX + ".enabled";
public static final String MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED = PREFIX + ".enabled";
/**
* @deprecated Use {@link #MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED} instead.
*/
@Deprecated
public static final String ENABLED = MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED;

Copilot uses AI. Check for mistakes.

private boolean enabled;
private Duration gracePeriod = Duration.ofSeconds(15);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
@Singleton
@Requires(bean = GracefulShutdownManager.class)
@Requires(property = GracefulShutdownConfiguration.ENABLED, value = StringUtils.TRUE, defaultValue = StringUtils.FALSE)
@Requires(property = GracefulShutdownConfiguration.MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED, value = StringUtils.TRUE, defaultValue = StringUtils.FALSE)
@Experimental
public final class GracefulShutdownListener implements ApplicationEventListener<ShutdownEvent>, Ordered {
private static final Logger LOG = LoggerFactory.getLogger(GracefulShutdownListener.class);
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/io/micronaut/core/bind/ArgumentBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ interface BindingResult<T> {
/**
* An empty but satisfied result.
*/
BindingResult EMPTY = Optional::empty;
BindingResult BINDING_RESULT_EMPTY = Optional::empty;
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming BindingResult.EMPTY and BindingResult.UNSATISFIED to new identifiers is a source/binary breaking change for any external code referencing those public constants. To preserve compatibility (and still satisfy Sonar), keep the old constant names as @Deprecated aliases that delegate to the new constants (e.g., EMPTY = BINDING_RESULT_EMPTY and UNSATISFIED = BINDING_RESULT_UNSATISFIED), while encouraging internal usage of the new names.

Copilot uses AI. Check for mistakes.

/**
* An empty but unsatisfied result.
*/
BindingResult UNSATISFIED = new BindingResult() {
BindingResult BINDING_RESULT_UNSATISFIED = new BindingResult() {
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming BindingResult.EMPTY and BindingResult.UNSATISFIED to new identifiers is a source/binary breaking change for any external code referencing those public constants. To preserve compatibility (and still satisfy Sonar), keep the old constant names as @Deprecated aliases that delegate to the new constants (e.g., EMPTY = BINDING_RESULT_EMPTY and UNSATISFIED = BINDING_RESULT_UNSATISFIED), while encouraging internal usage of the new names.

Copilot uses AI. Check for mistakes.
@Override
public Optional getValue() {
return Optional.empty();
Expand Down Expand Up @@ -154,7 +154,7 @@ default <R> BindingResult<R> flatMap(Function<T, BindingResult<R>> transform) {
* @since 4.0.0
*/
static <R> BindingResult<R> empty() {
return BindingResult.EMPTY;
return BindingResult.BINDING_RESULT_EMPTY;
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming BindingResult.EMPTY and BindingResult.UNSATISFIED to new identifiers is a source/binary breaking change for any external code referencing those public constants. To preserve compatibility (and still satisfy Sonar), keep the old constant names as @Deprecated aliases that delegate to the new constants (e.g., EMPTY = BINDING_RESULT_EMPTY and UNSATISFIED = BINDING_RESULT_UNSATISFIED), while encouraging internal usage of the new names.

Copilot uses AI. Check for mistakes.
}

/**
Expand All @@ -163,7 +163,7 @@ static <R> BindingResult<R> empty() {
* @since 4.0.0
*/
static <R> BindingResult<R> unsatisfied() {
return UNSATISFIED;
return BINDING_RESULT_UNSATISFIED;
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming BindingResult.EMPTY and BindingResult.UNSATISFIED to new identifiers is a source/binary breaking change for any external code referencing those public constants. To preserve compatibility (and still satisfy Sonar), keep the old constant names as @Deprecated aliases that delegate to the new constants (e.g., EMPTY = BINDING_RESULT_EMPTY and UNSATISFIED = BINDING_RESULT_UNSATISFIED), while encouraging internal usage of the new names.

Copilot uses AI. Check for mistakes.
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ExecutableBinderSpec extends Specification {
ArgumentBinder argumentBinder = Mock(ArgumentBinder)

argumentBinder.bind(_, _) >> ({ args ->
return ArgumentBinder.BindingResult.UNSATISFIED
return ArgumentBinder.BindingResult.BINDING_RESULT_UNSATISFIED
} )

registry.findArgumentBinder(_) >> Optional.of( argumentBinder)
Expand Down Expand Up @@ -138,7 +138,7 @@ class ExecutableBinderSpec extends Specification {
ArgumentBinder argumentBinder = Mock(ArgumentBinder)

argumentBinder.bind(_, _) >> ({ args ->
return ArgumentBinder.BindingResult.UNSATISFIED
return ArgumentBinder.BindingResult.BINDING_RESULT_UNSATISFIED
} )

registry.findArgumentBinder(_) >> Optional.of( argumentBinder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ default BindingResult<T> bind(ArgumentConversionContext<T> context, HttpRequest<
if (source instanceof NettyHttpRequest<?> nettyHttpRequest) {
return bindForNettyRequest(context, nettyHttpRequest);
}
return BindingResult.EMPTY;
return BindingResult.BINDING_RESULT_EMPTY;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ public BindingResult<BasicAuth> bind(ArgumentConversionContext<BasicAuth> contex
return () -> Optional.of(new BasicAuth(values[0], values[1]));
}
}
return BindingResult.EMPTY;
return BindingResult.BINDING_RESULT_EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public BindingResult<Locale> bind(ArgumentConversionContext<Locale> context, Htt
if (locale.isPresent()) {
return () -> locale;
} else {
return BindingResult.UNSATISFIED;
return BindingResult.BINDING_RESULT_UNSATISFIED;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public BindingResult<T> bind(ArgumentConversionContext<T> context, HttpRequest<?
pending.add(pendingRequestBindingResult);
allUnsatisfied = false;
} else {
if (result != BindingResult.UNSATISFIED) {
if (result != BindingResult.BINDING_RESULT_UNSATISFIED) {
errors.addAll(result.getConversionErrors());
allUnsatisfied = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public BindingResult<T> bind(ArgumentConversionContext<T> context, HttpRequest<?
}
} else {
//noinspection unchecked
return BindingResult.EMPTY;
return BindingResult.BINDING_RESULT_EMPTY;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class GracefulShutdownContextSpec extends Specification {
given:
def mgmtPort = SocketUtils.findAvailableTcpPort()
def ctx = ApplicationContext.run([
(GracefulShutdownConfiguration.ENABLED): true,
'micronaut.application.name': 'foo',
"spec.name": "GracefulShutdownContextSpec",
'endpoints.health.sensitive': false,
'endpoints.all.port': mgmtPort,
'micronaut.http.client.exception-on-error-status': false
(GracefulShutdownConfiguration.MICRONAUT_LIFECYCLE_GRACEFUL_SHUTDOWN_ENABLED): true,
'micronaut.application.name' : 'foo',
"spec.name" : "GracefulShutdownContextSpec",
'endpoints.health.sensitive' : false,
'endpoints.all.port' : mgmtPort,
'micronaut.http.client.exception-on-error-status' : false
])
def server = ctx.getBean(EmbeddedServer)
server.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ShoppingCartRequestArgumentBinder

Cookie cookie = source.cookies.get("shoppingCart")
if (!cookie) {
return BindingResult.EMPTY
return BindingResult.BINDING_RESULT_EMPTY
}

Optional<Map<String, Object>> cookieValue = objectSerializer.deserialize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ShoppingCartRequestArgumentBinder

Cookie cookie = source.cookies.get("shoppingCart")
if (!cookie) {
return BindingResult.EMPTY
return BindingResult.BINDING_RESULT_EMPTY
}

return () -> objectSerializer.deserialize( //<2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ShoppingCartRequestArgumentBinder(
.stringValue(ShoppingCart::class.java)
.orElse(context.argument.name)

val cookie = source.cookies.get("shoppingCart") ?: return BindingResult.EMPTY
val cookie = source.cookies.get("shoppingCart") ?: return BindingResult.BINDING_RESULT_EMPTY

val cookieValue: Optional<Map<String, Any>> = objectSerializer.deserialize(
cookie.value.toByteArray(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public BindingResult<Principal> bind(ArgumentConversionContext<Principal> contex
if (existing.isPresent()) {
return () -> existing;
} else {
return BindingResult.EMPTY;
return BindingResult.BINDING_RESULT_EMPTY;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public BindingResult<Object> bind(

Cookie cookie = source.getCookies().get("shoppingCart");
if (cookie == null) {
return BindingResult.EMPTY;
return BindingResult.BINDING_RESULT_EMPTY;
}

Optional<Map<String, Object>> cookieValue = objectSerializer.deserialize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public <T> Optional<ArgumentBinder<T, WebSocketState>> findArgumentBinder(Argume
ConvertibleValues<Object> uriVariables = source.getSession().getUriVariables();
if (uriVariables.contains(argument.getName())) {
Optional<T> val = uriVariables.get(argument.getName(), argument);
return val.isEmpty() ? ArgumentBinder.BindingResult.UNSATISFIED : () -> val;
return val.isEmpty() ? ArgumentBinder.BindingResult.BINDING_RESULT_UNSATISFIED : () -> val;
}
return (ArgumentBinder.BindingResult<T>) queryValueArgumentBinder.bind((ArgumentConversionContext<Object>) context, source.getOriginatingRequest());
});
Expand Down
Loading