-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06f57ea
commit 9252e4a
Showing
6 changed files
with
161 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...src/test/resources/tech/picnic/errorprone/bugpatterns/DirectReturnTemplatesTestInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package tech.picnic.errorprone.bugpatterns; | ||
|
||
import static java.util.stream.Collectors.joining; | ||
|
||
import java.util.stream.Stream; | ||
|
||
final class DirectReturnTemplatesTest implements RefasterTemplateTestCase { | ||
boolean testDirectlyReturnBooleanVariable() { | ||
boolean var = true; | ||
return var; | ||
} | ||
|
||
byte testDirectlyReturnByteVariable() { | ||
byte var = Byte.MAX_VALUE; | ||
return var; | ||
} | ||
|
||
char testDirectlyReturnCharVariable() { | ||
char var = Character.MAX_VALUE; | ||
return var; | ||
} | ||
|
||
short testDirectlyReturnShortVariable() { | ||
short var = Short.MAX_VALUE; | ||
return var; | ||
} | ||
|
||
int testDirectlyReturnIntVariable() { | ||
int var = Integer.MAX_VALUE; | ||
return var; | ||
} | ||
|
||
long testDirectlyReturnLongVariable() { | ||
long var = Long.MAX_VALUE; | ||
return var; | ||
} | ||
|
||
float testDirectlyReturnFloatVariable() { | ||
float var = Float.MAX_VALUE; | ||
return var; | ||
} | ||
|
||
double testDirectlyReturnDoubleVariable() { | ||
double var = Double.MAX_VALUE; | ||
return var; | ||
} | ||
|
||
String testDirectlyReturnObjectVariable() { | ||
String var = "foo"; | ||
return var; | ||
} | ||
|
||
String testDirectlyReturnObjectVariableWithPrecedingStatement() { | ||
String unrelated = "foo"; | ||
String var = Stream.of("bar", "baz").collect(joining(" ")); | ||
return var; | ||
} | ||
|
||
String testDirectlyReturnObjectVariableWithInterveningStatement() { | ||
String var = "foo"; | ||
String unrelated = "bar"; | ||
return var; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...rc/test/resources/tech/picnic/errorprone/bugpatterns/DirectReturnTemplatesTestOutput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package tech.picnic.errorprone.bugpatterns; | ||
|
||
import static java.util.stream.Collectors.joining; | ||
|
||
import java.util.stream.Stream; | ||
|
||
final class DirectReturnTemplatesTest implements RefasterTemplateTestCase { | ||
boolean testDirectlyReturnBooleanVariable() { | ||
return true; | ||
} | ||
|
||
byte testDirectlyReturnByteVariable() { | ||
return Byte.MAX_VALUE; | ||
} | ||
|
||
char testDirectlyReturnCharVariable() { | ||
return Character.MAX_VALUE; | ||
} | ||
|
||
short testDirectlyReturnShortVariable() { | ||
return Short.MAX_VALUE; | ||
} | ||
|
||
int testDirectlyReturnIntVariable() { | ||
return Integer.MAX_VALUE; | ||
} | ||
|
||
long testDirectlyReturnLongVariable() { | ||
return Long.MAX_VALUE; | ||
} | ||
|
||
float testDirectlyReturnFloatVariable() { | ||
return Float.MAX_VALUE; | ||
} | ||
|
||
double testDirectlyReturnDoubleVariable() { | ||
return Double.MAX_VALUE; | ||
} | ||
|
||
String testDirectlyReturnObjectVariable() { | ||
return "foo"; | ||
} | ||
|
||
String testDirectlyReturnObjectVariableWithPrecedingStatement() { | ||
String unrelated = "foo"; | ||
return Stream.of("bar", "baz").collect(joining(" ")); | ||
} | ||
|
||
String testDirectlyReturnObjectVariableWithInterveningStatement() { | ||
String var = "foo"; | ||
String unrelated = "bar"; | ||
return var; | ||
} | ||
} |
69 changes: 0 additions & 69 deletions
69
...ntrib/src/test/resources/tech/picnic/errorprone/bugpatterns/MethodTemplatesTestInput.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.