Skip to content

Commit

Permalink
Enables explicit API mode
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed May 12, 2022
1 parent a56988f commit 44f0c5f
Show file tree
Hide file tree
Showing 15 changed files with 221 additions and 217 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
}
}

kotlin {
explicitApi = 'strict'
}

dependencies {
api 'com.amazon.ion:ion-java:[1.4.0,)'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
Expand Down
136 changes: 68 additions & 68 deletions src/com/amazon/ionelement/api/AnyElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -147,210 +147,210 @@ import java.math.BigInteger
*
* @see [IonElement]
*/
interface AnyElement : IonElement {
public interface AnyElement : IonElement {

/** See [AnyElement]. */
fun asBoolean(): BoolElement
public fun asBoolean(): BoolElement

/** See [AnyElement]. */
fun asBooleanOrNull(): BoolElement?
public fun asBooleanOrNull(): BoolElement?

/** See [AnyElement]. */
fun asInt(): IntElement
public fun asInt(): IntElement

/** See [AnyElement]. */
fun asIntOrNull(): IntElement?
public fun asIntOrNull(): IntElement?

/** See [AnyElement]. */
fun asDecimal(): DecimalElement
public fun asDecimal(): DecimalElement

/** See [AnyElement]. */
fun asDecimalOrNull(): DecimalElement?
public fun asDecimalOrNull(): DecimalElement?

/** See [AnyElement]. */
fun asFloat(): FloatElement
public fun asFloat(): FloatElement

/** See [AnyElement]. */
fun asFloatOrNull(): FloatElement?
public fun asFloatOrNull(): FloatElement?

/** See [AnyElement]. */
fun asText(): TextElement
public fun asText(): TextElement

/** See [AnyElement]. */
fun asTextOrNull(): TextElement?
public fun asTextOrNull(): TextElement?

/** See [AnyElement]. */
fun asString(): StringElement
public fun asString(): StringElement

/** See [AnyElement]. */
fun asStringOrNull(): StringElement?
public fun asStringOrNull(): StringElement?

/** See [AnyElement]. */
fun asSymbol(): SymbolElement
public fun asSymbol(): SymbolElement

/** See [AnyElement]. */
fun asSymbolOrNull(): SymbolElement?
public fun asSymbolOrNull(): SymbolElement?

/** See [AnyElement]. */
fun asTimestamp(): TimestampElement
public fun asTimestamp(): TimestampElement

/** See [AnyElement]. */
fun asTimestampOrNull(): TimestampElement?
public fun asTimestampOrNull(): TimestampElement?

/** See [AnyElement]. */
fun asLob(): LobElement
public fun asLob(): LobElement

/** See [AnyElement]. */
fun asLobOrNull(): LobElement?
public fun asLobOrNull(): LobElement?

/** See [AnyElement]. */
fun asBlob(): BlobElement
public fun asBlob(): BlobElement

/** See [AnyElement]. */
fun asBlobOrNull(): BlobElement?
public fun asBlobOrNull(): BlobElement?

/** See [AnyElement]. */
fun asClob(): ClobElement
public fun asClob(): ClobElement

/** See [AnyElement]. */
fun asClobOrNull(): ClobElement?
public fun asClobOrNull(): ClobElement?

/** See [AnyElement]. */
fun asContainer(): ContainerElement
public fun asContainer(): ContainerElement

/** See [AnyElement]. */
fun asContainerOrNull(): ContainerElement?
public fun asContainerOrNull(): ContainerElement?

/** See [AnyElement]. */
fun asSeq(): SeqElement
public fun asSeq(): SeqElement

/** See [AnyElement]. */
fun asSeqOrNull(): SeqElement?
public fun asSeqOrNull(): SeqElement?

/** See [AnyElement]. */
fun asList(): ListElement
public fun asList(): ListElement

/** See [AnyElement]. */
fun asListOrNull(): ListElement?
public fun asListOrNull(): ListElement?

/** See [AnyElement]. */
fun asSexp(): SexpElement
public fun asSexp(): SexpElement

/** See [AnyElement]. */
fun asSexpOrNull(): SexpElement?
public fun asSexpOrNull(): SexpElement?

/** See [AnyElement]. */
fun asStruct(): StructElement
public fun asStruct(): StructElement

/** See [AnyElement]. */
fun asStructOrNull(): StructElement?
public fun asStructOrNull(): StructElement?

/**
* If this is an Ion integer, returns its [IntElementSize] otherwise, throws [IonElementConstraintException].
*/
val integerSize: IntElementSize
public val integerSize: IntElementSize

/** See [AnyElement]. */
val booleanValue: Boolean
public val booleanValue: Boolean

/** See [AnyElement]. */
val booleanValueOrNull: Boolean?
public val booleanValueOrNull: Boolean?

/** See [AnyElement]. */
val longValue: Long
public val longValue: Long

/** See [AnyElement]. */
val longValueOrNull: Long?
public val longValueOrNull: Long?

/** See [AnyElement]. */
val bigIntegerValue: BigInteger
public val bigIntegerValue: BigInteger

/** See [AnyElement]. */
val bigIntegerValueOrNull: BigInteger?
public val bigIntegerValueOrNull: BigInteger?

/** See [AnyElement]. */
val textValue: String
public val textValue: String

/** See [AnyElement]. */
val textValueOrNull: String?
public val textValueOrNull: String?

/** See [AnyElement]. */
val stringValue: String
public val stringValue: String

/** See [AnyElement]. */
val stringValueOrNull: String?
public val stringValueOrNull: String?

/** See [AnyElement]. */
val symbolValue: String
public val symbolValue: String

/** See [AnyElement]. */
val symbolValueOrNull: String?
public val symbolValueOrNull: String?

/** See [AnyElement]. */
val decimalValue: Decimal
public val decimalValue: Decimal

/** See [AnyElement]. */
val decimalValueOrNull: Decimal?
public val decimalValueOrNull: Decimal?

/** See [AnyElement]. */
val doubleValue: Double
public val doubleValue: Double

/** See [AnyElement]. */
val doubleValueOrNull: Double?
public val doubleValueOrNull: Double?

/** See [AnyElement]. */
val timestampValue: Timestamp
public val timestampValue: Timestamp

/** See [AnyElement]. */
val timestampValueOrNull: Timestamp?
public val timestampValueOrNull: Timestamp?

/** See [AnyElement]. */
val bytesValue: ByteArrayView
public val bytesValue: ByteArrayView

/** See [AnyElement]. */
val bytesValueOrNull: ByteArrayView?
public val bytesValueOrNull: ByteArrayView?

/** See [AnyElement]. */
val blobValue: ByteArrayView
public val blobValue: ByteArrayView

/** See [AnyElement]. */
val blobValueOrNull: ByteArrayView?
public val blobValueOrNull: ByteArrayView?

/** See [AnyElement]. */
val clobValue: ByteArrayView
public val clobValue: ByteArrayView

/** See [AnyElement]. */
val clobValueOrNull: ByteArrayView?
public val clobValueOrNull: ByteArrayView?

/** See [AnyElement]. */
val containerValues: Collection<AnyElement>
public val containerValues: Collection<AnyElement>

/** See [AnyElement]. */
val containerValuesOrNull: Collection<AnyElement>?
public val containerValuesOrNull: Collection<AnyElement>?

/** See [AnyElement]. */
val seqValues: List<AnyElement>
public val seqValues: List<AnyElement>

/** See [AnyElement]. */
val seqValuesOrNull: List<AnyElement>?
public val seqValuesOrNull: List<AnyElement>?

/** See [AnyElement]. */
val listValues: List<AnyElement>
public val listValues: List<AnyElement>

/** See [AnyElement]. */
val listValuesOrNull: List<AnyElement>?
public val listValuesOrNull: List<AnyElement>?

/** See [AnyElement]. */
val sexpValues: List<AnyElement>
public val sexpValues: List<AnyElement>

/** See [AnyElement]. */
val sexpValuesOrNull: List<AnyElement>?
public val sexpValuesOrNull: List<AnyElement>?

/** See [AnyElement]. */
val structFields: Collection<StructField>
public val structFields: Collection<StructField>

/** See [AnyElement]. */
val structFieldsOrNull: Collection<StructField>?
public val structFieldsOrNull: Collection<StructField>?

override fun copy(annotations: List<String>, metas: MetaContainer): AnyElement
override fun withAnnotations(vararg additionalAnnotations: String): AnyElement
Expand Down
8 changes: 4 additions & 4 deletions src/com/amazon/ionelement/api/ByteArrayView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package com.amazon.ionelement.api

/** An immutable wrapper over a [byte[]]. */
interface ByteArrayView : Iterable<Byte> {
fun size(): Int
operator fun get(index: Int): Byte
public interface ByteArrayView : Iterable<Byte> {
public fun size(): Int
public operator fun get(index: Int): Byte

fun copyOfBytes(): ByteArray
public fun copyOfBytes(): ByteArray
}

14 changes: 7 additions & 7 deletions src/com/amazon/ionelement/api/ElementType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ import com.amazon.ionelement.api.ElementType.SYMBOL
* has no notion of datagrams. It also exposes [isText], [isContainer] and [isLob] as properties instead of as static
* functions.
*/
enum class ElementType(
public enum class ElementType(
/** True if the current [ElementType] is [STRING] or [SYMBOL]. */
val isText: Boolean,
public val isText: Boolean,

/**
* True if the current [ElementType] is [LIST] or [SEXP] or [STRUCT].
*
* Ordering of the child elements cannot be guaranteed for [STRUCT] elements.
*/
val isContainer: Boolean,
public val isContainer: Boolean,

/**
* True if the current [ElementType] is [LIST] or [SEXP].
*
* Ordering of the child elements is guaranteed.
*/
val isSeq: Boolean,
public val isSeq: Boolean,

/** True if the current [ElementType] is [CLOB] or [BLOB]. */
val isLob: Boolean
public val isLob: Boolean
) {
// Other scalar types
NULL(false, false, false, false),
Expand All @@ -60,7 +60,7 @@ enum class ElementType(
STRUCT(false, true, false, false);

/** Converts this [ElementType] to [IonType]. */
fun toIonType() = when(this) {
public fun toIonType(): IonType = when(this) {
NULL -> IonType.NULL
BOOL -> IonType.BOOL
INT -> IonType.INT
Expand All @@ -83,7 +83,7 @@ enum class ElementType(
* @throws [IllegalStateException] if the receiver is [IonType.DATAGRAM] because [AnyElement] has no notion of
* datagrams.
*/
fun IonType.toElementType() = when(this) {
public fun IonType.toElementType(): ElementType = when(this) {
IonType.NULL -> ElementType.NULL
IonType.BOOL -> ElementType.BOOL
IonType.INT -> ElementType.INT
Expand Down
Loading

0 comments on commit 44f0c5f

Please sign in to comment.