From bbad65d1ff8706f0d50f29d788f404dba3fc8154 Mon Sep 17 00:00:00 2001 From: J2ObjC Team Date: Mon, 1 Jun 2026 11:10:08 -0700 Subject: [PATCH] Return the autoreleased exception from the static helper, don't throw from the static helper since we're throwing at the error site. PiperOrigin-RevId: 924807821 --- jre_emul/Classes/java/lang/AbstractStringBuilder.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jre_emul/Classes/java/lang/AbstractStringBuilder.m b/jre_emul/Classes/java/lang/AbstractStringBuilder.m index 6bda39e4c0..493a351ac3 100644 --- a/jre_emul/Classes/java/lang/AbstractStringBuilder.m +++ b/jre_emul/Classes/java/lang/AbstractStringBuilder.m @@ -57,7 +57,7 @@ static inline void NewBuffer(JreStringBuilder *sb, jint size) { static JavaLangStringIndexOutOfBoundsException *IndexAndLength(JreStringBuilder *sb, jint index) { id exc = [[JavaLangStringIndexOutOfBoundsException alloc] initWithNSString: [NSString stringWithFormat:@"this.length=%d; index=%d", sb->count_, index]]; - @throw AUTORELEASE(exc); + return AUTORELEASE(exc); } static JavaLangStringIndexOutOfBoundsException *StartEndAndLength( @@ -65,7 +65,7 @@ static inline void NewBuffer(JreStringBuilder *sb, jint size) { id exc = [[JavaLangStringIndexOutOfBoundsException alloc] initWithNSString: [NSString stringWithFormat:@"this.length=%d; start=%d; length=%d", sb->count_, start, end - start]]; - @throw AUTORELEASE(exc); + return AUTORELEASE(exc); } @implementation JavaLangAbstractStringBuilder