mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -25,12 +25,14 @@ public class FileComparisonFailure extends ComparisonFailure implements KnownExc
|
||||
private final String myFilePath;
|
||||
private final String myActualFilePath;
|
||||
|
||||
public FileComparisonFailure(String message, String expected, String actual, String filePath) {
|
||||
this(message, expected, actual, filePath, null);
|
||||
public FileComparisonFailure(String message, /*@NotNull */String expected, /*@NotNull */String actual, String expectedFilePath) {
|
||||
this(message, expected, actual, expectedFilePath, null);
|
||||
}
|
||||
|
||||
public FileComparisonFailure(String message, String expected, String actual, String expectedFilePath, String actualFilePath) {
|
||||
public FileComparisonFailure(String message, /*@NotNull */String expected, /*@NotNull */String actual, String expectedFilePath, String actualFilePath) {
|
||||
super(message, expected, actual);
|
||||
if (expected == null) throw new NullPointerException("'expected' must not be null");
|
||||
if (actual == null) throw new NullPointerException("'actual' must not be null");
|
||||
myExpected = expected;
|
||||
myActual = actual;
|
||||
myFilePath = expectedFilePath;
|
||||
@@ -60,7 +62,7 @@ public class FileComparisonFailure extends ComparisonFailure implements KnownExc
|
||||
private static class MyPacketFactory extends ComparisonDetailsExtractor {
|
||||
private final String myFilePath;
|
||||
|
||||
public MyPacketFactory(ComparisonFailure assertion, String expected, String actual, String filePath) {
|
||||
MyPacketFactory(ComparisonFailure assertion, String expected, String actual, String filePath) {
|
||||
super(assertion, expected, actual);
|
||||
myFilePath = filePath;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class EditorPaintingTest extends AbstractEditorTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void fail(String message, File expectedResultsFile, BufferedImage actualImage) throws IOException {
|
||||
private void fail(@NotNull String message, @NotNull File expectedResultsFile, BufferedImage actualImage) throws IOException {
|
||||
File savedImage = FileUtil.createTempFile(getName(), ".png", false);
|
||||
addTmpFileToKeep(savedImage);
|
||||
ImageIO.write(actualImage, "png", savedImage);
|
||||
|
||||
@@ -251,7 +251,8 @@ public class EditorTestUtil {
|
||||
*
|
||||
* @see #extractCaretAndSelectionMarkers(Document, boolean)
|
||||
*/
|
||||
public static CaretAndSelectionState extractCaretAndSelectionMarkers(Document document) {
|
||||
@NotNull
|
||||
public static CaretAndSelectionState extractCaretAndSelectionMarkers(@NotNull Document document) {
|
||||
return extractCaretAndSelectionMarkers(document, true);
|
||||
}
|
||||
|
||||
@@ -261,7 +262,8 @@ public class EditorTestUtil {
|
||||
*
|
||||
* @param processBlockSelection if <code>true</code>, <block> and </block> tags describing a block selection state will also be extracted.
|
||||
*/
|
||||
public static CaretAndSelectionState extractCaretAndSelectionMarkers(final Document document, final boolean processBlockSelection) {
|
||||
@NotNull
|
||||
public static CaretAndSelectionState extractCaretAndSelectionMarkers(@NotNull Document document, final boolean processBlockSelection) {
|
||||
return new WriteCommandAction<CaretAndSelectionState>(null) {
|
||||
@Override
|
||||
public void run(@NotNull Result<CaretAndSelectionState> actionResult) {
|
||||
@@ -271,9 +273,8 @@ public class EditorTestUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CaretAndSelectionState extractCaretAndSelectionMarkersImpl(Document document, boolean processBlockSelection) {
|
||||
public static CaretAndSelectionState extractCaretAndSelectionMarkersImpl(@NotNull Document document, boolean processBlockSelection) {
|
||||
List<CaretInfo> carets = ContainerUtil.newArrayList();
|
||||
TextRange blockSelection = null;
|
||||
String fileText = document.getText();
|
||||
|
||||
RangeMarker blockSelectionStartMarker = null;
|
||||
@@ -354,6 +355,7 @@ public class EditorTestUtil {
|
||||
if (carets.isEmpty()) {
|
||||
carets.add(new CaretInfo(null, null));
|
||||
}
|
||||
TextRange blockSelection = null;
|
||||
if (blockSelectionStartMarker != null) {
|
||||
blockSelection = new TextRange(blockSelectionStartMarker.getStartOffset(), blockSelectionEndMarker.getStartOffset());
|
||||
}
|
||||
|
||||
+1
@@ -1891,6 +1891,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
|
||||
private static class SelectionAndCaretMarkupLoader {
|
||||
private final String filePath;
|
||||
@NotNull
|
||||
private final String newFileText;
|
||||
private final EditorTestUtil.CaretAndSelectionState caretState;
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public class StreamUtil {
|
||||
private static final Logger LOG = Logger.getInstance(StreamUtil.class);
|
||||
|
||||
private StreamUtil() {
|
||||
}
|
||||
|
||||
@@ -34,9 +36,8 @@ public class StreamUtil {
|
||||
* @param inputStream source stream
|
||||
* @param outputStream destination stream
|
||||
* @return bytes copied
|
||||
* @throws IOException
|
||||
*/
|
||||
public static int copyStreamContent(InputStream inputStream, OutputStream outputStream) throws IOException {
|
||||
public static int copyStreamContent(@NotNull InputStream inputStream, @NotNull OutputStream outputStream) throws IOException {
|
||||
final byte[] buffer = new byte[10 * 1024];
|
||||
int count;
|
||||
int total = 0;
|
||||
@@ -47,7 +48,8 @@ public class StreamUtil {
|
||||
return total;
|
||||
}
|
||||
|
||||
public static byte[] loadFromStream(InputStream inputStream) throws IOException {
|
||||
@NotNull
|
||||
public static byte[] loadFromStream(@NotNull InputStream inputStream) throws IOException {
|
||||
final UnsyncByteArrayOutputStream outputStream = new UnsyncByteArrayOutputStream();
|
||||
try {
|
||||
copyStreamContent(inputStream, outputStream);
|
||||
@@ -61,31 +63,37 @@ public class StreamUtil {
|
||||
/**
|
||||
* @deprecated depends on the default encoding, use StreamUtil#readText(java.io.InputStream, String) instead
|
||||
*/
|
||||
public static String readText(InputStream inputStream) throws IOException {
|
||||
@NotNull
|
||||
public static String readText(@NotNull InputStream inputStream) throws IOException {
|
||||
final byte[] data = loadFromStream(inputStream);
|
||||
return new String(data);
|
||||
}
|
||||
|
||||
public static String readText(InputStream inputStream, @NotNull String encoding) throws IOException {
|
||||
@NotNull
|
||||
public static String readText(@NotNull InputStream inputStream, @NotNull String encoding) throws IOException {
|
||||
final byte[] data = loadFromStream(inputStream);
|
||||
return new String(data, encoding);
|
||||
}
|
||||
public static String readText(InputStream inputStream, @NotNull Charset encoding) throws IOException {
|
||||
@NotNull
|
||||
public static String readText(@NotNull InputStream inputStream, @NotNull Charset encoding) throws IOException {
|
||||
final byte[] data = loadFromStream(inputStream);
|
||||
return new String(data, encoding);
|
||||
}
|
||||
|
||||
public static String convertSeparators(String s) {
|
||||
@NotNull
|
||||
public static String convertSeparators(@NotNull String s) {
|
||||
return StringFactory.createShared(convertSeparators(s.toCharArray()));
|
||||
}
|
||||
|
||||
public static char[] readTextAndConvertSeparators(Reader reader) throws IOException {
|
||||
@NotNull
|
||||
public static char[] readTextAndConvertSeparators(@NotNull Reader reader) throws IOException {
|
||||
char[] buffer = readText(reader);
|
||||
|
||||
return convertSeparators(buffer);
|
||||
}
|
||||
|
||||
private static char[] convertSeparators(char[] buffer) {
|
||||
@NotNull
|
||||
private static char[] convertSeparators(@NotNull char[] buffer) {
|
||||
int dst = 0;
|
||||
char prev = ' ';
|
||||
for (char c : buffer) {
|
||||
@@ -113,11 +121,13 @@ public class StreamUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String readTextFrom(Reader reader) throws IOException {
|
||||
@NotNull
|
||||
public static String readTextFrom(@NotNull Reader reader) throws IOException {
|
||||
return StringFactory.createShared(readText(reader));
|
||||
}
|
||||
|
||||
private static char[] readText(Reader reader) throws IOException {
|
||||
@NotNull
|
||||
private static char[] readText(@NotNull Reader reader) throws IOException {
|
||||
CharArrayWriter writer = new CharArrayWriter();
|
||||
|
||||
char[] buffer = new char[2048];
|
||||
@@ -140,7 +150,4 @@ public class StreamUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(StreamUtil.class);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user