Skip to content

Commit

Permalink
Run CI for all pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed Dec 7, 2023
1 parent 79c8e5c commit 3352e63
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
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
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.impl._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
3 changes: 3 additions & 0 deletions src/main/java/com/amazon/ion/impl/IonTypeID.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.amazon.ion.impl;

import com.amazon.ion.IonType;
import com.amazon.ion.impl._private.SuppressFBWarnings;

import static com.amazon.ion.impl.bin.OpCodes.*;

Expand Down Expand Up @@ -352,6 +353,8 @@ private IonTypeID(byte id, int minorVersion) {
case TIMESTAMP_NANOS_PRECISION_WITH_OFFSET:
length = 9;
break;
default:
throw new IllegalStateException("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.impl._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
13 changes: 13 additions & 0 deletions src/main/java/com/amazon/ion/impl/_private/SuppressFBWarnings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.amazon.ion.impl._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.
*/
public @interface SuppressFBWarnings {
/**
* The set of FindBugs warnings that are to be suppressed in
* annotated element. The value can be a bug category, kind or pattern.
*/
String[] value() default {};
}
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.impl._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

0 comments on commit 3352e63

Please sign in to comment.