Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run CI builds for all branches #663

Merged
merged 1 commit into from
Dec 7, 2023
Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master ]


jobs:
test:
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/amazon/ion/_private/SuppressFBWarnings.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package com.amazon.ion._private

/**
* SpotBugs looks for an annotation called `SuppressFBWarnings` regardless of the package it is in.
* This will allow us to disable some SpotBugs rules when we want e.g. to allow switch case fallthrough.
*
* We are implementing our own annotation so that we don't have to declare any dependency on another package just for this.
*/
annotation class SuppressFBWarnings(
/**
* The set of FindBugs/SpotBugs warnings that are to be suppressed in the annotated element.
* The value can be a bug category, kind, or pattern.
* For examples of some bug types, see https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html
*/
vararg val value: String = []
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.amazon.ion.IonException;
import com.amazon.ion.IonType;
import com.amazon.ion.Timestamp;
import com.amazon.ion._private.SuppressFBWarnings;
import com.amazon.ion.impl.bin.IntList;
import com.amazon.ion.impl.bin.utf8.Utf8StringDecoder;
import com.amazon.ion.impl.bin.utf8.Utf8StringDecoderPool;
Expand Down Expand Up @@ -694,6 +695,7 @@ private BigDecimal readTimestampFraction_1_1() {
* Reads an Ion 1.1 long form timestamp.
* @return the value.
*/
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
private Timestamp readTimestampLongForm_1_1() {
int year;
int month = 1;
Expand Down Expand Up @@ -761,6 +763,7 @@ private Timestamp readTimestampLongForm_1_1() {
* Reads an Ion 1.1 timestamp in either the long or short form.
* @return the value.
*/
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
private Timestamp readTimestamp_1_1() {
if (valueTid.variableLength) {
return readTimestampLongForm_1_1();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/amazon/ion/impl/IonTypeID.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ private IonTypeID(byte id, int minorVersion) {
case TIMESTAMP_NANOS_PRECISION_WITH_OFFSET:
length = 9;
break;
default:
// Unreachable
}
} else {
length = lowerNibble;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/amazon/ion/impl/_Private_IonConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.amazon.ion.impl;

import com.amazon.ion.IonException;
import com.amazon.ion._private.SuppressFBWarnings;

/**
* NOT FOR APPLICATION USE!
Expand Down Expand Up @@ -100,6 +101,7 @@ public static final boolean isSurrogate(int c) {
/**
* The byte sequence indicating use of Ion 1.0 binary format.
*/
@SuppressFBWarnings("MS_MUTABLE_ARRAY")
public static final byte[] BINARY_VERSION_MARKER_1_0 = { (byte) 0xE0,
(byte) 0x01,
(byte) 0x00,
Expand All @@ -108,6 +110,7 @@ public static final boolean isSurrogate(int c) {
/**
* The byte sequence indicating use of Ion 1.1 binary format.
*/
@SuppressFBWarnings("MS_MUTABLE_ARRAY")
public static final byte[] BINARY_VERSION_MARKER_1_1 = { (byte) 0xE0,
(byte) 0x01,
(byte) 0x01,
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/amazon/ion/impl/bin/Ion_1_1_Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package com.amazon.ion.impl.bin;

import com.amazon.ion.Timestamp;
import com.amazon.ion._private.SuppressFBWarnings;

/**
* Contains constants (other than OpCodes) which are generally applicable to both reading and writing binary Ion 1.1
Expand Down Expand Up @@ -63,7 +64,7 @@ private Ion_1_1_Constants() {}
public static final int L_TIMESTAMP_OFFSET_BIAS = 1440; // 24 hours * 60 min/hour

//////// Lookup tables ////////

@SuppressFBWarnings("MS_MUTABLE_ARRAY")
public static final Timestamp.Precision[] S_TIMESTAMP_PRECISION_FOR_TYPE_ID_OFFSET = new Timestamp.Precision[] {
Timestamp.Precision.YEAR, // 0x70
Timestamp.Precision.MONTH, // 0x71
Expand All @@ -80,6 +81,7 @@ private Ion_1_1_Constants() {}
Timestamp.Precision.SECOND, // 0x7C (nanosecond offset)
};

@SuppressFBWarnings("MS_MUTABLE_ARRAY")
public static final Timestamp.Precision[] L_TIMESTAMP_PRECISION_FOR_LENGTH = new Timestamp.Precision[] {
null, // Length 0: illegal
null, // Length 1: illegal
Expand Down
Loading