Enforce leading/trailing zeros in Java numeric constants (#2105)

Enforce that integer literals must not have leading zeros and that floating point literals must have leading or trailing zeros in Java.
This commit is contained in:
Austin Shalit
2019-11-20 23:13:15 -05:00
committed by Peter Johnson
parent fa85fbfc1c
commit 4ebae17123
40 changed files with 92 additions and 72 deletions

View File

@@ -137,7 +137,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
// Delay until the interrupt is complete
while (!function.m_interruptComplete.get()) {
Timer.delay(.005);
Timer.delay(0.005);
}
@@ -176,7 +176,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
setInterruptHigh();
// Wait for the interrupt to complete before moving on
while (!function.m_interruptComplete.getAndSet(false)) {
Timer.delay(.005);
Timer.delay(0.005);
}
}
// Then
@@ -194,7 +194,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
// Given
getInterruptable().requestInterrupts();
final double synchronousDelay = synchronousTimeout / 2.;
final double synchronousDelay = synchronousTimeout / 2.0;
final Runnable runnable = () -> {
Timer.delay(synchronousDelay);
setInterruptLow();
@@ -215,7 +215,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
// The test will not have timed out and:
final double interruptRunTime = (stopTimeStamp - startTimeStamp) * 1e-6;
assertEquals("The interrupt did not run for the expected amount of time (units in seconds)",
synchronousDelay, interruptRunTime, .1);
synchronousDelay, interruptRunTime, 0.1);
}
@Test(timeout = (long) (synchronousTimeout * 1e3))
@@ -236,7 +236,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
// Given
getInterruptable().requestInterrupts();
final double synchronousDelay = synchronousTimeout / 2.;
final double synchronousDelay = synchronousTimeout / 2.0;
final Runnable runnable = () -> {
Timer.delay(synchronousDelay);
setInterruptLow();
@@ -258,7 +258,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
getInterruptable().requestInterrupts();
getInterruptable().setUpSourceEdge(false, true);
final double synchronousDelay = synchronousTimeout / 2.;
final double synchronousDelay = synchronousTimeout / 2.0;
final Runnable runnable = () -> {
Timer.delay(synchronousDelay);
setInterruptHigh();
@@ -290,7 +290,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
setInterruptHigh();
// Wait for the interrupt to complete before moving on
while (!function.m_interruptComplete.getAndSet(false)) {
Timer.delay(.005);
Timer.delay(0.005);
}
}
getInterruptable().disableInterrupts();
@@ -300,7 +300,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
setInterruptLow();
setInterruptHigh();
// Just wait because the interrupt should not fire
Timer.delay(.005);
Timer.delay(0.005);
}
// Then