Fix checkstyle warnings after migration to the new version

This commit is contained in:
Alexey Andreev 2021-03-18 11:51:20 +03:00
parent 43437fd9b2
commit 0cff9e104c
43 changed files with 100 additions and 120 deletions

View File

@ -1,6 +1,7 @@
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<property name="fileExtensions" value="java"/>
<module name="LineLength">
<property name="max" value="120"/>
</module>

View File

@ -47,11 +47,10 @@ public class ScalaHacks implements ClassHolderTransformer {
transformProperties(cls);
break;
default:
{
if (cls.getName().endsWith(SCALA_INTERNAL_CLASS_MARKER)) {
checkAndRemoveExportAnnotation(cls);
}
} break;
break;
}
}

View File

@ -16,7 +16,6 @@
package org.teavm.classlib.impl.unicode;
import java.util.Arrays;
import org.teavm.classlib.impl.Base46;
import org.teavm.classlib.impl.CharFlow;

View File

@ -21,7 +21,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import org.teavm.classlib.java.util.stream.TStream;
public final class TOptional<T> {

View File

@ -1410,15 +1410,15 @@ public final class LocalDateTime
if ((hours | minutes | seconds | nanos) == 0) {
return with(newDate, time);
}
long totDays = nanos / NANOS_PER_DAY + // max/24*60*60*1B
seconds / SECONDS_PER_DAY + // max/24*60*60
minutes / MINUTES_PER_DAY + // max/24*60
hours / HOURS_PER_DAY; // max/24
long totDays = nanos / NANOS_PER_DAY // max/24*60*60*1B
+ seconds / SECONDS_PER_DAY // max/24*60*60
+ minutes / MINUTES_PER_DAY // max/24*60
+ hours / HOURS_PER_DAY; // max/24
totDays *= sign; // total max*0.4237...
long totNanos = nanos % NANOS_PER_DAY + // max 86400000000000
(seconds % SECONDS_PER_DAY) * NANOS_PER_SECOND + // max 86400000000000
(minutes % MINUTES_PER_DAY) * NANOS_PER_MINUTE + // max 86400000000000
(hours % HOURS_PER_DAY) * NANOS_PER_HOUR; // max 86400000000000
long totNanos = nanos % NANOS_PER_DAY // max 86400000000000
+ (seconds % SECONDS_PER_DAY) * NANOS_PER_SECOND // max 86400000000000
+ (minutes % MINUTES_PER_DAY) * NANOS_PER_MINUTE // max 86400000000000
+ (hours % HOURS_PER_DAY) * NANOS_PER_HOUR; // max 86400000000000
long curNoD = time.toNanoOfDay(); // max 86400000000000
totNanos = totNanos * sign + curNoD; // total 432000000000000
totDays += Jdk8Methods.floorDiv(totNanos, NANOS_PER_DAY);

View File

@ -307,14 +307,14 @@ final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate>
if ((hours | minutes | seconds | nanos) == 0) {
return with(newDate, time);
}
long totDays = nanos / NANOS_PER_DAY + // max/24*60*60*1B
seconds / SECONDS_PER_DAY + // max/24*60*60
minutes / MINUTES_PER_DAY + // max/24*60
hours / HOURS_PER_DAY; // max/24
long totNanos = nanos % NANOS_PER_DAY + // max 86400000000000
(seconds % SECONDS_PER_DAY) * NANOS_PER_SECOND + // max 86400000000000
(minutes % MINUTES_PER_DAY) * NANOS_PER_MINUTE + // max 86400000000000
(hours % HOURS_PER_DAY) * NANOS_PER_HOUR; // max 86400000000000
long totDays = nanos / NANOS_PER_DAY // max/24*60*60*1B
+ seconds / SECONDS_PER_DAY // max/24*60*60
+ minutes / MINUTES_PER_DAY // max/24*60
+ hours / HOURS_PER_DAY; // max/24
long totNanos = nanos % NANOS_PER_DAY // max 86400000000000
+ (seconds % SECONDS_PER_DAY) * NANOS_PER_SECOND // max 86400000000000
+ (minutes % MINUTES_PER_DAY) * NANOS_PER_MINUTE // max 86400000000000
+ (hours % HOURS_PER_DAY) * NANOS_PER_HOUR; // max 86400000000000
long curNoD = time.toNanoOfDay(); // max 86400000000000
totNanos = totNanos + curNoD; // total 432000000000000
totDays += Jdk8Methods.floorDiv(totNanos, NANOS_PER_DAY);

View File

@ -48,7 +48,6 @@ package org.threeten.bp.chrono;
import static org.threeten.bp.temporal.ChronoField.ERA;
import java.util.Locale;
import org.threeten.bp.format.DateTimeFormatterBuilder;
import org.threeten.bp.format.TextStyle;
import org.threeten.bp.temporal.ChronoField;

View File

@ -51,7 +51,6 @@ import static org.threeten.bp.temporal.ChronoUnit.DAYS;
import static org.threeten.bp.temporal.ChronoUnit.FOREVER;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import org.threeten.bp.DateTimeException;
import org.threeten.bp.chrono.Chronology;

View File

@ -70,40 +70,40 @@ public class JavaScriptBodyConversionTest {
assertEquals(int[].class, returnAsIntArray(new Integer[] { 23, 42 }).getClass());
}
@JavaScriptBody(args = { "value" }, body = "return value;")
@JavaScriptBody(args = "value", body = "return value;")
private native int returnAsInt(Object value);
@JavaScriptBody(args = { "value" }, body = "return value;")
@JavaScriptBody(args = "value", body = "return value;")
private native boolean returnAsBoolean(Object value);
@JavaScriptBody(args = { "value" }, body = "return value;")
@JavaScriptBody(args = "value", body = "return value;")
private native Boolean returnAsBooleanWrapper(boolean value);
@JavaScriptBody(args = { "value" }, body = "return value;")
@JavaScriptBody(args = "value", body = "return value;")
private native Integer returnAsInteger(Integer value);
@JavaScriptBody(args = { "value" }, body = "return value;")
@JavaScriptBody(args = "value", body = "return value;")
private native Object returnAsObject(int value);
@JavaScriptBody(args = { "value" }, body = "return value + 1;")
@JavaScriptBody(args = "value", body = "return value + 1;")
private native int addOne(Object value);
@JavaScriptBody(args = { "value" }, body = "return value + 1;")
@JavaScriptBody(args = "value", body = "return value + 1;")
private native Integer addOne(Integer value);
@JavaScriptBody(args = { "value" }, body = "return value + 1;")
@JavaScriptBody(args = "value", body = "return value + 1;")
private native int addOne(int value);
@JavaScriptBody(args = { "array" }, body = "return array;")
@JavaScriptBody(args = "array", body = "return array;")
private native Object returnAsObject(Object array);
@JavaScriptBody(args = { "array" }, body = "return array;")
@JavaScriptBody(args = "array", body = "return array;")
private native int[] returnAsIntArray(Object array);
@JavaScriptBody(args = { "array" }, body = "return array;")
@JavaScriptBody(args = "array", body = "return array;")
private native Integer[] returnAsIntegerArray(Object array);
@JavaScriptBody(args = { "value" }, body = "value[0] = 1; return value;")
@JavaScriptBody(args = "value", body = "value[0] = 1; return value;")
private native Object modifyIntegerArray(Object value);
@JavaScriptBody(args = { "array", "index" }, body = "return array[index];")

View File

@ -90,19 +90,19 @@ public class JavaScriptBodyTest {
@JavaScriptBody(args = {}, body = "return 23;")
private native int simpleNativeMethod();
@JavaScriptBody(args = { "value" }, body = "return value;")
@JavaScriptBody(args = "value", body = "return value;")
private native Object returnValuePassed(Object value);
@JavaScriptBody(args = { "obj" }, body = "window._global_ = obj;")
@JavaScriptBody(args = "obj", body = "window._global_ = obj;")
private native void storeObject(Object obj);
@JavaScriptBody(args = {}, body = "return window._global_;")
private native Object retrieveObject();
@JavaScriptBody(args = { "callback" }, body = "return callback.@org.teavm.html4j.test.A::foo()()", javacall = true)
@JavaScriptBody(args = "callback", body = "return callback.@org.teavm.html4j.test.A::foo()()", javacall = true)
private native int invokeCallback(A callback);
@JavaScriptBody(args = { "callback" }, body = ""
@JavaScriptBody(args = "callback", body = ""
+ "return callback."
+ "@org.teavm.html4j.test.B::bar("
+ "Lorg/teavm/html4j/test/A;)(_global_)",
@ -113,7 +113,7 @@ public class JavaScriptBodyTest {
return a.foo();
}
@JavaScriptBody(args = { "a" }, body = "return "
@JavaScriptBody(args = "a", body = "return "
+ "@org.teavm.html4j.test.JavaScriptBodyTest::staticCallback("
+ "Lorg/teavm/html4j/test/A;)(a)", javacall = true)
private native int invokeStaticCallback(A a);

View File

@ -16,7 +16,6 @@
package org.teavm.jso.ajax;
import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject;
@JSFunctor

View File

@ -105,7 +105,7 @@ public abstract class Window implements JSObject, WindowEventTarget, StorageProv
@JSBody(params = { "handler", "delay" }, script = "return setTimeout(handler, delay);")
public static native int setTimeout(TimerHandler handler, double delay);
@JSBody(params = { "timeoutId" }, script = "clearTimeout(timeoutId);")
@JSBody(params = "timeoutId", script = "clearTimeout(timeoutId);")
public static native void clearTimeout(int timeoutId);
@JSBody(params = { "handler", "delay" }, script = "return setInterval(handler, delay);")
@ -114,13 +114,13 @@ public abstract class Window implements JSObject, WindowEventTarget, StorageProv
@JSBody(params = { "handler", "delay" }, script = "return setInterval(handler, delay);")
public static native int setInterval(TimerHandler handler, double delay);
@JSBody(params = { "timeoutId" }, script = "clearInterval(timeoutId);")
@JSBody(params = "timeoutId", script = "clearInterval(timeoutId);")
public static native void clearInterval(int timeoutId);
@JSBody(params = { "callback" }, script = "return requestAnimationFrame(callback);")
@JSBody(params = "callback", script = "return requestAnimationFrame(callback);")
public static native int requestAnimationFrame(AnimationFrameCallback callback);
@JSBody(params = { "requestId" }, script = "cancelAnimationFrame(requestId);")
@JSBody(params = "requestId", script = "cancelAnimationFrame(requestId);")
public static native void cancelAnimationFrame(int requestId);
public abstract void blur();

View File

@ -22,9 +22,9 @@ public final class JSON {
private JSON() {
}
@JSBody(params = { "object" }, script = "return JSON.stringify(object);")
@JSBody(params = "object", script = "return JSON.stringify(object);")
public static native String stringify(JSObject object);
@JSBody(params = { "string" }, script = "return JSON.parse(string);")
@JSBody(params = "string", script = "return JSON.parse(string);")
public static native JSObject parse(String string);
}

View File

@ -105,6 +105,7 @@
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
<wagon-ftp.version>3.4.3</wagon-ftp.version>
<checkstyle.version>8.41</checkstyle.version>
<teavm.test.incremental>false</teavm.test.incremental>
<teavm.test.threads>1</teavm.test.threads>
@ -337,6 +338,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>

View File

@ -22,7 +22,6 @@ import static org.junit.Assert.fail;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;

View File

@ -21,7 +21,6 @@ import static org.junit.Assert.fail;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;

View File

@ -48,12 +48,10 @@ package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
import java.time.DateTimeException;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.util.List;
import org.testng.annotations.Test;
/**

View File

@ -47,7 +47,6 @@
package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;

View File

@ -48,7 +48,6 @@ package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import java.time.Clock;
import java.time.Instant;
import java.time.LocalDateTime;

View File

@ -48,7 +48,6 @@ package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;

View File

@ -49,7 +49,6 @@ package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.fail;
import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;

View File

@ -48,7 +48,6 @@ package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;

View File

@ -47,7 +47,6 @@
package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;

View File

@ -52,7 +52,6 @@ import static java.time.DayOfWeek.WEDNESDAY;
import static java.time.temporal.ChronoField.DAY_OF_WEEK;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import java.time.DateTimeException;
import java.time.DayOfWeek;
import java.time.LocalDate;
@ -69,7 +68,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;

View File

@ -57,14 +57,12 @@ import static java.time.temporal.ChronoUnit.SECONDS;
import static java.time.temporal.ChronoUnit.WEEKS;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
import java.time.DateTimeException;
import java.time.Duration;
import java.time.Instant;
import java.time.format.DateTimeParseException;
import java.time.temporal.TemporalUnit;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
@ -900,13 +898,13 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), expectedNanoOfSecond);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void plusSeconds_long_overflowTooBig() {
Duration t = Duration.ofSeconds(1, 0);
t.plusSeconds(Long.MAX_VALUE);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void plusSeconds_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(-1, 0);
t.plusSeconds(Long.MIN_VALUE);
@ -1002,7 +1000,7 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), 999999999);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void plusMillis_long_overflowTooBig() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 999000000);
t.plusMillis(1);
@ -1016,7 +1014,7 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), 0);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void plusMillis_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.plusMillis(-1);
@ -1106,13 +1104,13 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), expectedNanoOfSecond);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void plusNanos_long_overflowTooBig() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 999999999);
t.plusNanos(1);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void plusNanos_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.plusNanos(-1);
@ -1399,13 +1397,13 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), expectedNanoOfSecond);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusSeconds_long_overflowTooBig() {
Duration t = Duration.ofSeconds(1, 0);
t.minusSeconds(Long.MIN_VALUE + 1);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusSeconds_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(-2, 0);
t.minusSeconds(Long.MAX_VALUE);
@ -1501,7 +1499,7 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), 999999999);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusMillis_long_overflowTooBig() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 999000000);
t.minusMillis(-1);
@ -1515,7 +1513,7 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), 0);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusMillis_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.minusMillis(1);
@ -1605,13 +1603,13 @@ public class TestDuration extends AbstractTest {
assertEquals(t.getNano(), expectedNanoOfSecond);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusNanos_long_overflowTooBig() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 999999999);
t.minusNanos(-1);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusNanos_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.minusNanos(1);

View File

@ -1177,13 +1177,13 @@ public class TestInstant extends AbstractDateTimeTest {
assertEquals(i.getNano(), expectedNanoOfSecond);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusSeconds_long_overflowTooBig() {
Instant i = Instant.ofEpochSecond(1, 0);
i.minusSeconds(Long.MIN_VALUE + 1);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void minusSeconds_long_overflowTooSmall() {
Instant i = Instant.ofEpochSecond(-2, 0);
i.minusSeconds(Long.MAX_VALUE);

View File

@ -521,7 +521,7 @@ public class TestLocalDate extends AbstractDateTimeTest {
};
}
@Test(dataProvider = "sampleBadParse", expectedExceptions = {DateTimeParseException.class})
@Test(dataProvider = "sampleBadParse", expectedExceptions = DateTimeParseException.class)
public void factory_parse_invalidText(String unparsable) {
LocalDate.parse(unparsable);
}
@ -1069,7 +1069,7 @@ public class TestLocalDate extends AbstractDateTimeTest {
assertEquals(test, LocalDate.of((int) (-40L + months / 12), 6 + (int) (months % 12), 1));
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusMonths_long_invalidTooLarge() {
LocalDate.of(Year.MAX_VALUE, 12, 1).plusMonths(1);
}
@ -1086,7 +1086,7 @@ public class TestLocalDate extends AbstractDateTimeTest {
test.plusMonths(Long.MIN_VALUE);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusMonths_long_invalidTooSmall() {
LocalDate.of(Year.MIN_VALUE, 1, 1).plusMonths(-1);
}
@ -1147,22 +1147,22 @@ public class TestLocalDate extends AbstractDateTimeTest {
assertEquals(t, expected);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusWeeks_invalidTooLarge() {
LocalDate.of(Year.MAX_VALUE, 12, 25).plusWeeks(1);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusWeeks_invalidTooSmall() {
LocalDate.of(Year.MIN_VALUE, 1, 7).plusWeeks(-1);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void test_plusWeeks_invalidMaxMinusMax() {
LocalDate.of(Year.MAX_VALUE, 12, 25).plusWeeks(Long.MAX_VALUE);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void test_plusWeeks_invalidMaxMinusMin() {
LocalDate.of(Year.MAX_VALUE, 12, 25).plusWeeks(Long.MIN_VALUE);
}
@ -1223,12 +1223,12 @@ public class TestLocalDate extends AbstractDateTimeTest {
assertEquals(t, expected);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusDays_invalidTooLarge() {
LocalDate.of(Year.MAX_VALUE, 12, 31).plusDays(1);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusDays_invalidTooSmall() {
LocalDate.of(Year.MIN_VALUE, 1, 1).plusDays(-1);
}
@ -1424,7 +1424,7 @@ public class TestLocalDate extends AbstractDateTimeTest {
assertEquals(test, LocalDate.of((int) (40L - months / 12), 6 - (int) (months % 12), 1));
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusMonths_long_invalidTooLarge() {
LocalDate.of(Year.MAX_VALUE, 12, 1).minusMonths(-1);
}
@ -1441,7 +1441,7 @@ public class TestLocalDate extends AbstractDateTimeTest {
test.minusMonths(Long.MIN_VALUE);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusMonths_long_invalidTooSmall() {
LocalDate.of(Year.MIN_VALUE, 1, 1).minusMonths(1);
}
@ -1502,22 +1502,22 @@ public class TestLocalDate extends AbstractDateTimeTest {
assertEquals(t, expected);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusWeeks_invalidTooLarge() {
LocalDate.of(Year.MAX_VALUE, 12, 25).minusWeeks(-1);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusWeeks_invalidTooSmall() {
LocalDate.of(Year.MIN_VALUE, 1, 7).minusWeeks(1);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void test_minusWeeks_invalidMaxMinusMax() {
LocalDate.of(Year.MAX_VALUE, 12, 25).minusWeeks(Long.MAX_VALUE);
}
@Test(expectedExceptions = {ArithmeticException.class})
@Test(expectedExceptions = ArithmeticException.class)
public void test_minusWeeks_invalidMaxMinusMin() {
LocalDate.of(Year.MAX_VALUE, 12, 25).minusWeeks(Long.MIN_VALUE);
}
@ -1578,12 +1578,12 @@ public class TestLocalDate extends AbstractDateTimeTest {
assertEquals(t, expected);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusDays_invalidTooLarge() {
LocalDate.of(Year.MAX_VALUE, 12, 31).minusDays(-1);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusDays_invalidTooSmall() {
LocalDate.of(Year.MIN_VALUE, 1, 1).minusDays(1);
}

View File

@ -516,7 +516,7 @@ public class TestLocalTime extends AbstractDateTimeTest {
};
}
@Test(dataProvider = "sampleBadParse", expectedExceptions = {DateTimeParseException.class})
@Test(dataProvider = "sampleBadParse", expectedExceptions = DateTimeParseException.class)
public void factory_parse_invalidText(String unparsable) {
LocalTime.parse(unparsable);
}
@ -538,7 +538,7 @@ public class TestLocalTime extends AbstractDateTimeTest {
}
//-----------------------------------------------------------------------s
@Test(expectedExceptions = {NullPointerException.class})
@Test(expectedExceptions = NullPointerException.class)
public void factory_parse_nullTest() {
LocalTime.parse(null);
}
@ -961,7 +961,7 @@ public class TestLocalTime extends AbstractDateTimeTest {
};
}
@Test(groups = {"tck"}, dataProvider = "truncatedToValid")
@Test(groups = "tck", dataProvider = "truncatedToValid")
public void test_truncatedTo_valid(LocalTime input, TemporalUnit unit, LocalTime expected) {
assertEquals(input.truncatedTo(unit), expected);
}
@ -976,12 +976,12 @@ public class TestLocalTime extends AbstractDateTimeTest {
};
}
@Test(groups = {"tck"}, dataProvider = "truncatedToInvalid", expectedExceptions = DateTimeException.class)
@Test(groups = "tck", dataProvider = "truncatedToInvalid", expectedExceptions = DateTimeException.class)
public void test_truncatedTo_invalid(LocalTime input, TemporalUnit unit) {
input.truncatedTo(unit);
}
@Test(expectedExceptions = NullPointerException.class, groups = {"tck"})
@Test(expectedExceptions = NullPointerException.class, groups = "tck")
public void test_truncatedTo_null() {
test12x30x40x987654321.truncatedTo(null);
}

View File

@ -47,7 +47,6 @@
package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalDate;

View File

@ -406,23 +406,23 @@ public class TestOffsetTime extends AbstractDateTimeTest {
};
}
@Test(dataProvider = "sampleBadParse", expectedExceptions = {DateTimeParseException.class})
@Test(dataProvider = "sampleBadParse", expectedExceptions = DateTimeParseException.class)
public void factory_parse_invalidText(String unparsable) {
OffsetTime.parse(unparsable);
}
//-----------------------------------------------------------------------s
@Test(expectedExceptions = {DateTimeParseException.class})
@Test(expectedExceptions = DateTimeParseException.class)
public void factory_parse_illegalHour() {
OffsetTime.parse("25:00+01:00");
}
@Test(expectedExceptions = {DateTimeParseException.class})
@Test(expectedExceptions = DateTimeParseException.class)
public void factory_parse_illegalMinute() {
OffsetTime.parse("12:60+01:00");
}
@Test(expectedExceptions = {DateTimeParseException.class})
@Test(expectedExceptions = DateTimeParseException.class)
public void factory_parse_illegalSecond() {
OffsetTime.parse("12:12:60+01:00");
}

View File

@ -48,7 +48,6 @@ package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import java.time.LocalDate;
import java.time.Period;
import org.junit.runner.RunWith;

View File

@ -47,11 +47,9 @@
package org.teavm.classlib.java.time.format;
import static org.testng.Assert.assertEquals;
import java.time.format.DecimalStyle;
import java.util.Locale;
import java.util.Set;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMProperties;
import org.teavm.junit.TeaVMProperty;

View File

@ -48,7 +48,6 @@ package org.teavm.classlib.java.time.temporal;
import static java.time.temporal.ChronoUnit.MONTHS;
import static java.time.temporal.ChronoUnit.WEEKS;
import java.time.DateTimeException;
import java.time.format.ResolverStyle;
import java.time.temporal.Temporal;

View File

@ -47,7 +47,6 @@
package org.teavm.classlib.java.time.temporal;
import static org.testng.Assert.assertEquals;
import java.time.temporal.ChronoField;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;

View File

@ -47,7 +47,6 @@
package org.teavm.classlib.java.time.temporal;
import static org.testng.Assert.assertEquals;
import java.time.LocalDate;
import java.time.temporal.ChronoField;
import java.time.temporal.JulianFields;

View File

@ -47,7 +47,6 @@
package org.teavm.classlib.java.time.temporal;
import static org.testng.Assert.assertEquals;
import java.time.temporal.ValueRange;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.AbstractTest;

View File

@ -622,7 +622,7 @@ public class TestYearMonth extends AbstractDateTimeTest {
assertEquals(test.plusMonths(months), YearMonth.of((int) (-40L + months / 12), 6 + (int) (months % 12)));
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusMonths_long_invalidTooLarge() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
test.plusMonths(1);
@ -640,7 +640,7 @@ public class TestYearMonth extends AbstractDateTimeTest {
test.plusMonths(Long.MIN_VALUE);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_plusMonths_long_invalidTooSmall() {
YearMonth test = YearMonth.of(Year.MIN_VALUE, 1);
test.plusMonths(-1);
@ -737,7 +737,7 @@ public class TestYearMonth extends AbstractDateTimeTest {
assertEquals(test.minusMonths(months), YearMonth.of((int) (40L - months / 12), 6 - (int) (months % 12)));
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusMonths_long_invalidTooLarge() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
test.minusMonths(-1);
@ -755,7 +755,7 @@ public class TestYearMonth extends AbstractDateTimeTest {
test.minusMonths(Long.MIN_VALUE);
}
@Test(expectedExceptions = {DateTimeException.class})
@Test(expectedExceptions = DateTimeException.class)
public void test_minusMonths_long_invalidTooSmall() {
YearMonth test = YearMonth.of(Year.MIN_VALUE, 1);
test.minusMonths(1);

View File

@ -47,7 +47,6 @@
package org.teavm.classlib.java.time.zone;
import static org.testng.Assert.assertEquals;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;

View File

@ -788,7 +788,7 @@ public class HashtableTest {
ht10.put("Key" + i, "Val" + i);
}
String newVal = ht10.computeIfAbsent("absent key", (k) -> "added");
String newVal = ht10.computeIfAbsent("absent key", k -> "added");
assertEquals("added", newVal);
assertEquals(11, ht10.size());
@ -805,7 +805,7 @@ public class HashtableTest {
ht10.put("Key" + i, "Val" + i);
}
String newVal = ht10.computeIfAbsent("Key5", (v) -> "changed");
String newVal = ht10.computeIfAbsent("Key5", v -> "changed");
assertEquals("Val5", newVal);
assertEquals(10, ht10.size());
@ -821,7 +821,7 @@ public class HashtableTest {
ht10.put("Key" + i, "Val" + i);
}
String newVal = ht10.computeIfAbsent("absent key", (v) -> null);
String newVal = ht10.computeIfAbsent("absent key", v -> null);
assertEquals(null, newVal);
assertEquals(10, ht10.size());

View File

@ -19,7 +19,6 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -27,7 +26,6 @@ import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;

View File

@ -45,7 +45,7 @@ public class ImplementationTest {
assertEquals(1, instance.counter);
}
@JSBody(params = { "a" }, script = "console.log(a, a);")
@JSBody(params = "a", script = "console.log(a, a);")
private static native void wrongInlineCandidate(JSObject a);
static class ForInliningTest implements JSObject {

View File

@ -36,7 +36,7 @@ public class JavaInvocationTest {
assertEquals(7, Num.create(5).add(Num.create(2)).value());
}
@JSBody(params = { "a" }, script = "return javaMethods.get('org.teavm.jso.test.JavaInvocationTest.sum(II)I')"
@JSBody(params = "a", script = "return javaMethods.get('org.teavm.jso.test.JavaInvocationTest.sum(II)I')"
+ ".invoke(a, 2);")
private static native int staticInvocation(int a);

View File

@ -243,6 +243,7 @@ public class BrowserRunStrategy implements TestRunStrategy {
resp.getOutputStream().flush();
return;
}
break;
}
case "/client.js":
case "/frame.js":
@ -255,6 +256,7 @@ public class BrowserRunStrategy implements TestRunStrategy {
resp.getOutputStream().flush();
return;
}
break;
}
}
if (path.startsWith("/tests/")) {