Skip to content

Commit

Permalink
Merge pull request #175 from rhwood/no-jsr305
Browse files Browse the repository at this point in the history
Do not rely on JSR 305 annotations.
  • Loading branch information
pabender authored Sep 3, 2020
2 parents 1e759e0 + c924baf commit 4d7094b
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ classes
target
doc

# ant requirements
!/lib/*.jar

# bash autocompletion artifacts
/.ant-targets-build.xml
/nbproject/private/
8 changes: 3 additions & 5 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@
<pathelement location="lib/byte-buddy-1.5.0.jar" /> <!-- only needed for tests compile and run -->
<pathelement location="lib/byte-buddy-agent-1.5.0.jar" /> <!-- only needed for tests compile and run -->
<pathelement location="lib/objenesis-2.4.jar" /> <!-- only needed for tests compile and run -->
<pathelement location="lib/jdom-2.0.5.jar" />
<pathelement location="lib/jdom.jar" />
<pathelement location="lib/jdom2-2.0.6.jar" />
<pathelement location="lib/jlfgr-1_0.jar" />
<pathelement location="lib/annotations.jar" /> <!-- only needed for compile -->
<pathelement location="lib/jcip-annotations-1.0.jar" /> <!-- only needed for compile -->
<pathelement location="lib/jsr305.jar" /> <!-- only needed for compile -->
<pathelement location="lib/spotbugs-annotations-3.1.2.jar" /> <!-- only needed for compile -->
<pathelement location="/System/Library/Java" /> <!-- MacOS X -->
<pathelement location="lib/spotbugs-annotations-4.1.2.jar" /> <!-- only needed for compile -->
<pathelement location="${target}/" /> <!-- last to check for name collisions -->
</path>

Expand Down
8 changes: 1 addition & 7 deletions lib/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ Contents:

Specific components:

jdom.jar
version 1.1
jdom-2.0.5.jar
jdom-2.0.6.jar
Used for testing only, not in main jar
from <jdom.org>

Expand All @@ -17,10 +15,6 @@ junit.jar
Used for testing only, not at runtime
from <junit.org>

annotations.jar, jsr305.jar:
From Findbugs 1.3.9 from http://findbugs.sourceforge.net
Only needed at compile/build time, not runtime

xercesImpl.jar:
Needed to build and run tests
version Xerces-J 2.9.1
Expand Down
Binary file removed lib/annotations.jar
Binary file not shown.
Binary file added lib/jcip-annotations-1.0.jar
Binary file not shown.
Binary file removed lib/jdom-2.0.5.jar
Binary file not shown.
Binary file added lib/jdom2-2.0.6.jar
Binary file not shown.
Binary file not shown.
9 changes: 2 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>3.1.2</version>
<version>4.1.2</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -88,11 +88,6 @@
<artifactId>xercesImpl</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>net.java.linoleum</groupId>
<artifactId>jlfgr</artifactId>
Expand Down Expand Up @@ -184,7 +179,7 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.2</version>
<version>4.0.4</version>
<!-- configured to fail on High priority bugs during test phase -->
<configuration>
<effort>Max</effort>
Expand Down
3 changes: 1 addition & 2 deletions src/org/openlcb/MimicNodeStore.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.openlcb;

import edu.umd.cs.findbugs.annotations.Nullable;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Collection;
Expand All @@ -11,8 +12,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.annotation.Nullable;

/**
* Store containing mimic proxies for nodes on external connections
* <p>
Expand Down
3 changes: 1 addition & 2 deletions src/org/openlcb/can/OpenLcbCanFrame.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.openlcb.can;

import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.openlcb.*;
import org.openlcb.implementations.DatagramUtils;

import javax.annotation.Nullable;

/**
* Carry and work with a CAN frame in OpenLCB format.
*
Expand Down
5 changes: 2 additions & 3 deletions src/org/openlcb/cdi/cmd/RestoreConfig.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package org.openlcb.cdi.cmd;

import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import org.openlcb.EventID;
import org.openlcb.NodeID;
import org.openlcb.can.impl.OlcbConnection;
import org.openlcb.cdi.impl.ConfigRepresentation;

/**
* Created by bracz on 4/9/16.
*/
Expand All @@ -25,7 +24,7 @@ public static interface ConfigCallback {
void onError(String error);
}

public static void parseConfigFromFile(@Nonnull String filePath, @Nonnull ConfigCallback callback) {
public static void parseConfigFromFile(@NonNull String filePath, @NonNull ConfigCallback callback) {
BufferedReader inFile = null;
try {
inFile = Files.newBufferedReader(Paths.get(filePath), Charset.forName("UTF-8"));
Expand Down
2 changes: 1 addition & 1 deletion src/org/openlcb/cdi/impl/ConfigRepresentation.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.openlcb.cdi.impl;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Reader;
Expand All @@ -13,7 +14,6 @@
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import org.openlcb.DefaultPropertyListenerSupport;
import org.openlcb.EventID;
import org.openlcb.NodeID;
Expand Down
2 changes: 1 addition & 1 deletion src/org/openlcb/cdi/impl/RangeCacheUtil.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.openlcb.cdi.impl;

import edu.umd.cs.findbugs.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;

/**
* Helper class to get a sequence of ranges and merges them into larger chunks to read from the
Expand Down
18 changes: 9 additions & 9 deletions src/org/openlcb/cdi/swing/CdiPanel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.openlcb.cdi.swing;

import edu.umd.cs.findbugs.annotations.NonNull;
import org.openlcb.EventID;
import org.openlcb.cdi.CdiRep;
import org.openlcb.cdi.cmd.BackupConfig;
Expand Down Expand Up @@ -49,7 +50,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.annotation.Nonnull;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
Expand Down Expand Up @@ -1299,11 +1299,11 @@ boolean isDirty() {
protected abstract void writeDisplayTextToNode();

// Take the latest entry (or "") from the Cdi entry and write it to the text box.
protected abstract void updateDisplayText(@Nonnull String value);
protected abstract void updateDisplayText(@NonNull String value);

// returns the currently displayed value ("" if none).
protected abstract
@Nonnull
@NonNull
String getDisplayText();
}

Expand Down Expand Up @@ -1453,11 +1453,11 @@ protected void writeDisplayTextToNode() {
}

@Override
protected void updateDisplayText(@Nonnull String value) {
protected void updateDisplayText(@NonNull String value) {
textField.setText(value);
}

@Nonnull
@NonNull
@Override
protected String getDisplayText() {
String s = textField.getText();
Expand Down Expand Up @@ -1557,12 +1557,12 @@ protected void writeDisplayTextToNode() {
}

@Override
protected void updateDisplayText(@Nonnull String value) {
protected void updateDisplayText(@NonNull String value) {
if (textField != null) textField.setText(value);
if (box != null) box.setSelectedItem(value);
}

@Nonnull
@NonNull
@Override
protected String getDisplayText() {
String s = (box == null) ? (String) textField.getText()
Expand Down Expand Up @@ -1607,11 +1607,11 @@ protected void writeDisplayTextToNode() {
}

@Override
protected void updateDisplayText(@Nonnull String value) {
protected void updateDisplayText(@NonNull String value) {
textField.setText(value);
}

@Nonnull
@NonNull
@Override
protected String getDisplayText() {
String s = textField.getText();
Expand Down
9 changes: 4 additions & 5 deletions src/org/openlcb/implementations/EventTable.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.openlcb.implementations;

import edu.umd.cs.findbugs.annotations.NonNull;
import org.openlcb.DefaultPropertyListenerSupport;
import org.openlcb.EventID;

Expand All @@ -8,9 +9,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;

import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import net.jcip.annotations.ThreadSafe;

/**
* EventTable keeps an in-memory representation of all currently known event IDs on the bus. It
Expand Down Expand Up @@ -38,7 +37,7 @@ public class EventTable {
* @return the descriptor structure matching the given Event ID.
*/
public
@Nonnull
@NonNull
EventInfo getEventInfo(EventID event) {
synchronized (entries) {
long key = event.toLong();
Expand Down Expand Up @@ -83,7 +82,7 @@ class SearchEntryHelper implements Comparable<SearchEntryHelper> {
}

@Override
public int compareTo(@Nonnull SearchEntryHelper o) {
public int compareTo(@NonNull SearchEntryHelper o) {
int scc = Float.compare(score,o.score);
if (scc != 0) return scc;
return -entry.description.compareTo(o.entry.description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.openlcb.implementations.throttle;

import edu.umd.cs.findbugs.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import org.openlcb.Connection;
import org.openlcb.Message;
import org.openlcb.MessageDecoder;
Expand Down
2 changes: 1 addition & 1 deletion src/org/openlcb/messages/TractionControlReplyMessage.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.openlcb.messages;

import edu.umd.cs.findbugs.annotations.Nullable;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import net.jcip.annotations.Immutable;
import net.jcip.annotations.ThreadSafe;
import org.openlcb.AddressedPayloadMessage;
Expand Down

0 comments on commit 4d7094b

Please sign in to comment.