summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross2017-03-23 11:52:31 -0500
committerColin Cross2017-03-23 11:59:40 -0500
commit730169ae5f7cd0b71093cffaf08e8af0bb218269 (patch)
treea156ddb8aa5a8758717b4ef41484f52d6a781b5a /obd2-lib
parent90cd93e9ebc749f9f32790f5df7fa60311adda46 (diff)
downloadplatform-packages-services-car-730169ae5f7cd0b71093cffaf08e8af0bb218269.tar.gz
platform-packages-services-car-730169ae5f7cd0b71093cffaf08e8af0bb218269.tar.xz
platform-packages-services-car-730169ae5f7cd0b71093cffaf08e8af0bb218269.zip
Fix target type inference issue when compiling with javac
javac is unable to determine that the return type of Optional.empty() should be Optional<Float> when called in a lambda inside a hasAtLeast whose return type is inferred from the return value of the function. Work around it by making the type of Optional.empty() explicit. Test: m -j ANDROID_COMPILE_WITH_JACK=false com.android.car.obd2 Change-Id: I1afb868c4b84d99160623c16f8fa53d19c448b05
Diffstat (limited to 'obd2-lib')
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/AmbientAirTemperature.java2
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/CalculatedEngineLoad.java4
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/EngineCoolantTemperature.java4
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/EngineOilTemperature.java4
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/EngineRuntime.java2
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/FuelGaugePressure.java4
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/FuelSystemStatus.java4
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/FuelTankLevel.java2
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/FuelTrimCommand.java2
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/RPM.java2
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/Speed.java4
-rw-r--r--obd2-lib/src/com/android/car/obd2/commands/ThrottlePosition.java2
12 files changed, 24 insertions, 12 deletions
diff --git a/obd2-lib/src/com/android/car/obd2/commands/AmbientAirTemperature.java b/obd2-lib/src/com/android/car/obd2/commands/AmbientAirTemperature.java
index 30108468..d8648553 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/AmbientAirTemperature.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/AmbientAirTemperature.java
@@ -31,6 +31,6 @@ public class AmbientAirTemperature implements Obd2Command.OutputSemanticHandler<
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, 32 1,
33 theData -> Optional.of(theData.consume() * (100.0f / 255.0f)), 33 theData -> Optional.of(theData.consume() * (100.0f / 255.0f)),
34 theData -> Optional.empty()); 34 theData -> Optional.<Float>empty());
35 } 35 }
36} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/CalculatedEngineLoad.java b/obd2-lib/src/com/android/car/obd2/commands/CalculatedEngineLoad.java
index ca06343b..ab40df0b 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/CalculatedEngineLoad.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/CalculatedEngineLoad.java
@@ -29,6 +29,8 @@ public class CalculatedEngineLoad implements Obd2Command.OutputSemanticHandler<F
29 @Override 29 @Override
30 public Optional<Float> consume(IntegerArrayStream data) { 30 public Optional<Float> consume(IntegerArrayStream data) {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, theData -> Optional.of(theData.consume() / 2.25f), theData -> Optional.empty()); 32 1,
33 theData -> Optional.of(theData.consume() / 2.25f),
34 theData -> Optional.<Float>empty());
33 } 35 }
34} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/EngineCoolantTemperature.java b/obd2-lib/src/com/android/car/obd2/commands/EngineCoolantTemperature.java
index 41ad73ce..7cd2f9a7 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/EngineCoolantTemperature.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/EngineCoolantTemperature.java
@@ -29,6 +29,8 @@ public class EngineCoolantTemperature implements Obd2Command.OutputSemanticHandl
29 @Override 29 @Override
30 public Optional<Integer> consume(IntegerArrayStream data) { 30 public Optional<Integer> consume(IntegerArrayStream data) {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, theData -> Optional.of(theData.consume() - 40), theData -> Optional.empty()); 32 1,
33 theData -> Optional.of(theData.consume() - 40),
34 theData -> Optional.<Integer>empty());
33 } 35 }
34} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/EngineOilTemperature.java b/obd2-lib/src/com/android/car/obd2/commands/EngineOilTemperature.java
index 9db714cb..e47b339b 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/EngineOilTemperature.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/EngineOilTemperature.java
@@ -29,6 +29,8 @@ public class EngineOilTemperature implements Obd2Command.OutputSemanticHandler<I
29 @Override 29 @Override
30 public Optional<Integer> consume(IntegerArrayStream data) { 30 public Optional<Integer> consume(IntegerArrayStream data) {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, theData -> Optional.of(theData.consume() - 40), theData -> Optional.empty()); 32 1,
33 theData -> Optional.of(theData.consume() - 40),
34 theData -> Optional.<Integer>empty());
33 } 35 }
34} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/EngineRuntime.java b/obd2-lib/src/com/android/car/obd2/commands/EngineRuntime.java
index 13c886fc..a1b153ab 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/EngineRuntime.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/EngineRuntime.java
@@ -31,6 +31,6 @@ public class EngineRuntime implements Obd2Command.OutputSemanticHandler<Integer>
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 2, 32 2,
33 theData -> Optional.of(theData.consume() * 256 + theData.consume()), 33 theData -> Optional.of(theData.consume() * 256 + theData.consume()),
34 theData -> Optional.empty()); 34 theData -> Optional.<Integer>empty());
35 } 35 }
36} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/FuelGaugePressure.java b/obd2-lib/src/com/android/car/obd2/commands/FuelGaugePressure.java
index fc7aacea..c3b49fd8 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/FuelGaugePressure.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/FuelGaugePressure.java
@@ -29,6 +29,8 @@ public class FuelGaugePressure implements Obd2Command.OutputSemanticHandler<Inte
29 @Override 29 @Override
30 public Optional<Integer> consume(IntegerArrayStream data) { 30 public Optional<Integer> consume(IntegerArrayStream data) {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, theData -> Optional.of(theData.consume() * 3), theData -> Optional.empty()); 32 1,
33 theData -> Optional.of(theData.consume() * 3),
34 theData -> Optional.<Integer>empty());
33 } 35 }
34} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/FuelSystemStatus.java b/obd2-lib/src/com/android/car/obd2/commands/FuelSystemStatus.java
index 65001f8c..67ca6224 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/FuelSystemStatus.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/FuelSystemStatus.java
@@ -29,6 +29,8 @@ public class FuelSystemStatus implements Obd2Command.OutputSemanticHandler<Integ
29 @Override 29 @Override
30 public Optional<Integer> consume(IntegerArrayStream data) { 30 public Optional<Integer> consume(IntegerArrayStream data) {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, theData -> Optional.of(theData.consume()), theData -> Optional.empty()); 32 1,
33 theData -> Optional.of(theData.consume()),
34 theData -> Optional.<Integer>empty());
33 } 35 }
34} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/FuelTankLevel.java b/obd2-lib/src/com/android/car/obd2/commands/FuelTankLevel.java
index 190b5546..d3e4efc6 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/FuelTankLevel.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/FuelTankLevel.java
@@ -31,6 +31,6 @@ public class FuelTankLevel implements Obd2Command.OutputSemanticHandler<Float> {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, 32 1,
33 theData -> Optional.of(theData.consume() * (100.0f / 255.0f)), 33 theData -> Optional.of(theData.consume() * (100.0f / 255.0f)),
34 theData -> Optional.empty()); 34 theData -> Optional.<Float>empty());
35 } 35 }
36} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/FuelTrimCommand.java b/obd2-lib/src/com/android/car/obd2/commands/FuelTrimCommand.java
index 5f22a6e5..5ceb002d 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/FuelTrimCommand.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/FuelTrimCommand.java
@@ -26,7 +26,7 @@ public abstract class FuelTrimCommand implements Obd2Command.OutputSemanticHandl
26 return data.hasAtLeast( 26 return data.hasAtLeast(
27 1, 27 1,
28 theData -> Optional.of(3 * theData.consume() / 1.28f - 100), 28 theData -> Optional.of(3 * theData.consume() / 1.28f - 100),
29 theData -> Optional.empty()); 29 theData -> Optional.<Float>empty());
30 } 30 }
31 31
32 public static class Bank1ShortTermFuelTrimCommand extends FuelTrimCommand { 32 public static class Bank1ShortTermFuelTrimCommand extends FuelTrimCommand {
diff --git a/obd2-lib/src/com/android/car/obd2/commands/RPM.java b/obd2-lib/src/com/android/car/obd2/commands/RPM.java
index c4bb91fd..b277abfc 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/RPM.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/RPM.java
@@ -31,6 +31,6 @@ public class RPM implements Obd2Command.OutputSemanticHandler<Integer> {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 2, 32 2,
33 theData -> Optional.of(theData.consume() * 256 + theData.consume() / 4), 33 theData -> Optional.of(theData.consume() * 256 + theData.consume() / 4),
34 theData -> Optional.empty()); 34 theData -> Optional.<Integer>empty());
35 } 35 }
36} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/Speed.java b/obd2-lib/src/com/android/car/obd2/commands/Speed.java
index c797ce5c..b1108878 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/Speed.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/Speed.java
@@ -29,6 +29,8 @@ public class Speed implements Obd2Command.OutputSemanticHandler<Integer> {
29 @Override 29 @Override
30 public Optional<Integer> consume(IntegerArrayStream data) { 30 public Optional<Integer> consume(IntegerArrayStream data) {
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, theData -> Optional.of(theData.consume()), theData -> Optional.empty()); 32 1,
33 theData -> Optional.of(theData.consume()),
34 theData -> Optional.<Integer>empty());
33 } 35 }
34} 36}
diff --git a/obd2-lib/src/com/android/car/obd2/commands/ThrottlePosition.java b/obd2-lib/src/com/android/car/obd2/commands/ThrottlePosition.java
index 71f4fee9..fea44df5 100644
--- a/obd2-lib/src/com/android/car/obd2/commands/ThrottlePosition.java
+++ b/obd2-lib/src/com/android/car/obd2/commands/ThrottlePosition.java
@@ -31,6 +31,6 @@ public class ThrottlePosition implements Obd2Command.OutputSemanticHandler<Float
31 return data.hasAtLeast( 31 return data.hasAtLeast(
32 1, 32 1,
33 theData -> Optional.of(theData.consume() * 0.392157f), 33 theData -> Optional.of(theData.consume() * 0.392157f),
34 theData -> Optional.empty()); 34 theData -> Optional.<Float>empty());
35 } 35 }
36} 36}