Browse Source

Merge pull request #5 from greboid/jsr305

Add JSR305
pull/6/head
Chris Smith 9 years ago
parent
commit
a36e3d3ce8
2 changed files with 7 additions and 3 deletions
  1. 2
    0
      build.gradle
  2. 5
    3
      src/com/dmdirc/util/StringUtils.java

+ 2
- 0
build.gradle View File

27
 repositories.mavenCentral()
27
 repositories.mavenCentral()
28
 
28
 
29
 dependencies {
29
 dependencies {
30
+    compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
31
+
30
     testCompile group: 'junit', name: 'junit', version: '4.11'
32
     testCompile group: 'junit', name: 'junit', version: '4.11'
31
     testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
33
     testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
32
     testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'
34
     testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'

+ 5
- 3
src/com/dmdirc/util/StringUtils.java View File

22
 
22
 
23
 package com.dmdirc.util;
23
 package com.dmdirc.util;
24
 
24
 
25
+import javax.annotation.Nonnull;
26
+
25
 /**
27
 /**
26
  * Utilities for dealing with strings.
28
  * Utilities for dealing with strings.
27
  */
29
  */
41
      * the index of the first character beyond the end of the word. If the specified index is not
43
      * the index of the first character beyond the end of the word. If the specified index is not
42
      * contained within a word (i.e., is whitespace) then 0,0 is returned.
44
      * contained within a word (i.e., is whitespace) then 0,0 is returned.
43
      */
45
      */
44
-    public static int[] indiciesOfWord(final CharSequence text, final int index) {
46
+    public static int[] indiciesOfWord(@Nonnull final CharSequence text, final int index) {
45
         final int start = indexOfStartOfWord(text, index);
47
         final int start = indexOfStartOfWord(text, index);
46
         final int end = indexOfEndOfWord(text, index);
48
         final int end = indexOfEndOfWord(text, index);
47
 
49
 
61
      *
63
      *
62
      * @return Start index of the word surrounding the index
64
      * @return Start index of the word surrounding the index
63
      */
65
      */
64
-    public static int indexOfStartOfWord(final CharSequence text, final int index) {
66
+    public static int indexOfStartOfWord(@Nonnull final CharSequence text, final int index) {
65
         int start = index;
67
         int start = index;
66
 
68
 
67
         // Traverse backwards
69
         // Traverse backwards
83
      *
85
      *
84
      * @return End index of the word surrounding the index
86
      * @return End index of the word surrounding the index
85
      */
87
      */
86
-    public static int indexOfEndOfWord(final CharSequence text, final int index) {
88
+    public static int indexOfEndOfWord(@Nonnull final CharSequence text, final int index) {
87
         int end = index;
89
         int end = index;
88
 
90
 
89
         // And forwards
91
         // And forwards

Loading…
Cancel
Save