File tree Expand file tree Collapse file tree 7 files changed +39
-238
lines changed
Samples/SwiftKitSampleApp/src/test/java/com/example/swift
JavaKitConfigurationShared
SwiftKitCore/src/main/java/org/swift/swiftkit/core Expand file tree Collapse file tree 7 files changed +39
-238
lines changed Original file line number Diff line number Diff line change @@ -23,15 +23,15 @@ public class UnsignedNumbersTest {
2323 void take_uint32 () {
2424 try (var arena = AllocatingSwiftArena .ofConfined ()) {
2525 var c = MySwiftClass .init (1 , 2 , arena );
26- c .takeUnsignedInt (UnsignedInteger . valueOf ( 128 ) );
26+ c .takeUnsignedInt (128 );
2727 }
2828 }
2929
3030 @ Test
3131 void take_uint64 () {
3232 try (var arena = AllocatingSwiftArena .ofConfined ()) {
3333 var c = MySwiftClass .init (1 , 2 , arena );
34- c .takeUnsignedLong (UnsignedLong .MAX_VALUE );
34+ c .takeUnsignedLong (Long .MAX_VALUE );
3535 }
3636 }
3737}
Original file line number Diff line number Diff line change @@ -321,8 +321,8 @@ extension FFMSwift2JavaGenerator {
321321 methodName: String
322322 ) throws -> TranslatedParameter {
323323
324- // If we need to handle unsigned integers "safely" do so here
325- if config. unsignedNumbersMode . needsConversion {
324+ // If we need to handle unsigned integers do so here
325+ if config. effectiveUnsignedNumbersMode . needsConversion {
326326 if let unsignedWrapperType = JavaType . unsignedWrapper ( for: swiftType) /* and we're in safe wrapper mode */ {
327327 return TranslatedParameter (
328328 javaParameters: [
@@ -583,15 +583,15 @@ extension FFMSwift2JavaGenerator {
583583 ) throws -> TranslatedResult {
584584 let swiftType = swiftResult. type
585585
586- // If we need to handle unsigned integers "safely" do so here
587- if config. unsignedNumbersMode . needsConversion {
586+ // If we need to handle unsigned integers do so here
587+ if config. effectiveUnsignedNumbersMode . needsConversion {
588588 if let unsignedWrapperType = JavaType . unsignedWrapper ( for: swiftType) /* and we're in safe wrapper mode */ {
589589 return TranslatedResult (
590590 javaResultType: unsignedWrapperType,
591591 outParameters: [ ] ,
592592 conversion: unsignedResultConversion (
593593 swiftType, to: unsignedWrapperType,
594- mode: self . config. unsignedNumbersMode )
594+ mode: self . config. effectiveUnsignedNumbersMode )
595595 )
596596 }
597597 }
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ public struct Configuration: Codable {
4242
4343 public var writeEmptyFiles : Bool ? // FIXME: default it to false, but that plays not nice with Codable
4444
45- public var unsignedNumbersMode : JExtractUnsignedIntegerMode = . default
45+ public var unsignedNumbersMode : JExtractUnsignedIntegerMode ?
46+ public var effectiveUnsignedNumbersMode : JExtractUnsignedIntegerMode {
47+ unsignedNumbersMode ?? . default
48+ }
4649
4750 // ==== java 2 swift ---------------------------------------------------------
4851
File renamed without changes.
Original file line number Diff line number Diff line change 1- package org .swift .swiftkit .core .annotations ;
1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2024 Apple Inc. and the Swift.org project authors
6+ // Licensed under Apache License v2.0
7+ //
8+ // See LICENSE.txt for license information
9+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10+ //
11+ // SPDX-License-Identifier: Apache-2.0
12+ //
13+ //===----------------------------------------------------------------------===//
214
15+ package org .swift .swiftkit .core .annotations ;
316
417import java .lang .annotation .Documented ;
518import java .lang .annotation .Retention ;
Original file line number Diff line number Diff line change 1- package org .swift .swiftkit .core .annotations ;
1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2024 Apple Inc. and the Swift.org project authors
6+ // Licensed under Apache License v2.0
7+ //
8+ // See LICENSE.txt for license information
9+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10+ //
11+ // SPDX-License-Identifier: Apache-2.0
12+ //
13+ //===----------------------------------------------------------------------===//
214
15+ package org .swift .swiftkit .core .annotations ;
316
417import static java .lang .annotation .ElementType .TYPE_USE ;
518import static java .lang .annotation .RetentionPolicy .RUNTIME ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments