Skip to content

Commit

Permalink
Merge branch '4.7.x' into 4.8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Dec 17, 2024
2 parents 28842ed + f6eb101 commit 86d40ac
Show file tree
Hide file tree
Showing 23 changed files with 338 additions and 554 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private void processBuilderDefinition(ClassElement element, VisitorContext conte
throw new ElementPostponedToNextRoundException(element);
}
String creatorMethod = lombokBuilder.stringValue("buildMethodName").orElse("build");
String[] writePrefixes = lombokBuilder.stringValue("setterPrefix").map(sp -> new String[] { sp }).orElse(new String[]{""});
String[] writePrefixes = lombokBuilder.stringValue("setterPrefix").map(sp -> new String[]{sp}).orElse(new String[]{""});
processBuilderDefinition(
element,
context,
Expand Down Expand Up @@ -420,18 +420,13 @@ private void processElement(boolean metadata,
List<PropertyElement> beanProperties = ce.getBeanProperties(propertyElementQuery).stream()
.filter(p -> !p.isExcluded())
.toList();
// unfortunately sometimes we don't see the Lombok transformations
// so assume if the class is annotated with Lombok builder we cannot
// access the constructor.
if (!ce.hasDeclaredAnnotation(ANN_LOMBOK_BUILDER)) {
Optional<MethodElement> constructorElement = ce.getPrimaryConstructor();
constructorElement.ifPresent(constructorEl -> {
if (ArrayUtils.isNotEmpty(constructorEl.getParameters())) {
writer.visitConstructor(constructorEl);
}
});
ce.getDefaultConstructor().ifPresent(writer::visitDefaultConstructor);
}
Optional<MethodElement> constructorElement = ce.getPrimaryConstructor();
constructorElement.ifPresent(constructorEl -> {
if (ArrayUtils.isNotEmpty(constructorEl.getParameters())) {
writer.visitConstructor(constructorEl);
}
});
ce.getDefaultConstructor().ifPresent(writer::visitDefaultConstructor);

for (PropertyElement beanProperty : beanProperties) {
if (beanProperty.isExcluded()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
}
Class<?> beanType = beanInfo.getBeanType();
List<AnnotationValue<Annotation>> values = beanInfo.getAnnotationMetadata().getAnnotationValuesByName("io.micronaut.context.annotation.Requires");
if (values.isEmpty()) {
AnnotationValue<Annotation> requirements = beanInfo.getAnnotationMetadata().getAnnotation("io.micronaut.context.annotation.Requirements");
if (requirements != null) {
values = requirements.getAnnotations("value");
}
}
if (!values.isEmpty()) {
for (AnnotationValue<Annotation> value : values) {
String[] classNames = EMPTY_STRING_ARRAY;
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ projectGroupId=io.micronaut
projectDesc=Core components supporting the Micronaut Framework
title=Micronaut Core
githubSlug=micronaut-projects/micronaut-core
docsRepository=micronaut-projects/micronaut-docs
docsRepository=micronaut-projects/micronaut-docs
testsdir=inject-groovy/src/test/groovy/io/micronaut/docs
testssession=session/src/test/groovy/io/micronaut/session/docs
testskafka=configurations/kafka/src/test/groovy/io/micronaut/configuration/kafka/docs
Expand Down
3 changes: 3 additions & 0 deletions http-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies {
api(libs.managed.netty.handler.proxy)

compileOnly(libs.managed.netty.incubator.codec.http3)
testImplementation(libs.managed.netty.incubator.codec.http3)

testAnnotationProcessor(platform(libs.test.boms.micronaut.validation))
testAnnotationProcessor(libs.micronaut.validation.processor) {
Expand All @@ -46,6 +47,8 @@ dependencies {
testImplementation(libs.wiremock)
testImplementation(libs.logback.classic)
testImplementation(libs.bcpkix)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.awaitility)
testImplementation(libs.managed.reactor.test)

testRuntimeOnly(libs.managed.netty.tcnative.boringssl.static) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ final void emitPoolHandle(PendingRequest sink, PoolHandle ph) {
}

@Override
public boolean dispatch(PendingRequest sink) {
public final boolean dispatch(PendingRequest sink) {
if (!tryEarmarkForRequest()) {
return false;
}
Expand Down Expand Up @@ -1615,7 +1615,7 @@ void fireReadTimeout(ChannelHandlerContext ctx) {
}

@Override
void dispatch0(PendingRequest sink) {
final void dispatch0(PendingRequest sink) {
if (!channel.isActive() || windDownConnection) {
// make sure the request isn't dispatched to this connection again
windDownConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,7 @@ private <E extends HttpClientException> E decorate(DefaultHttpClient ctx, E exc)
/**
* Used as a holder for the current SSE event.
*/
private static class CurrentEvent {
private static final class CurrentEvent {
byte[] data;
String id;
String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private void transitionToState(ChannelHandlerContext ctx, ReaderState<?> fromSta
if (state != fromState) {
throw new IllegalStateException("Wrong source state");
}
fromState.leave(ctx);
state = nextState;
}

Expand All @@ -110,6 +111,9 @@ void channelReadComplete(ChannelHandlerContext ctx) {
void channelInactive(ChannelHandlerContext ctx) {
exceptionCaught(ctx, new ResponseClosedException("Connection closed before response was received"));
}

void leave(ChannelHandlerContext ctx) {
}
}

/**
Expand Down Expand Up @@ -226,6 +230,7 @@ private final class UnbufferedContent extends ReaderState<HttpContent> implement
private final ResponseListener listener;
private final ChannelHandlerContext streamingContext;
private final StreamingNettyByteBody.SharedBuffer streaming;
private final boolean wasAutoRead;
private long demand;

UnbufferedContent(ResponseListener listener, ChannelHandlerContext ctx, HttpResponse response) {
Expand All @@ -235,6 +240,13 @@ private final class UnbufferedContent extends ReaderState<HttpContent> implement
streaming.setExpectedLengthFrom(response.headers());
}
streamingContext = ctx;
wasAutoRead = ctx.channel().config().isAutoRead();
ctx.channel().config().setAutoRead(false);
}

@Override
void leave(ChannelHandlerContext ctx) {
ctx.channel().config().setAutoRead(wasAutoRead);
}

void add(ByteBuf buf) {
Expand Down Expand Up @@ -278,14 +290,7 @@ public void start() {
}

private void start0() {
if (state != this) {
return;
}

demand++;
if (demand == 1) {
streamingContext.read();
}
onBytesConsumed0(1);
}

@Override
Expand All @@ -306,7 +311,7 @@ private void onBytesConsumed0(long bytesConsumed) {
long newDemand = oldDemand + bytesConsumed;
if (newDemand < oldDemand) {
// overflow
newDemand = oldDemand;
newDemand = Long.MAX_VALUE;
}
this.demand = newDemand;
if (oldDemand <= 0 && newDemand > 0) {
Expand Down

This file was deleted.

Loading

0 comments on commit 86d40ac

Please sign in to comment.