summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Marie Henaff <jmhenaff@google.com>2015-07-22 11:23:54 +0200
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-12-09 02:45:08 +0100
commit83670cb2f2c25105acd35b6b120c70f86fb8dd89 (patch)
treee655cc18f3af6acbbf4e17a73517c5fd57dcb87f
parent0ee96b56528b2d201258cd265928ae6239bf8083 (diff)
downloadtoolchain_jack-83670cb2f2c25105acd35b6b120c70f86fb8dd89.zip
toolchain_jack-83670cb2f2c25105acd35b6b120c70f86fb8dd89.tar.gz
toolchain_jack-83670cb2f2c25105acd35b6b120c70f86fb8dd89.tar.bz2
Remove useless generics in method dealing with library enums
Bug: 22630667 Change-Id: I0a4d4c0e8c59ea159b6ea127f12b96512190d990
-rw-r--r--jack/src/com/android/jack/jayce/v0002/io/JayceInternalReaderImpl.java30
-rw-r--r--jack/src/com/android/jack/jayce/v0002/io/JayceInternalWriterImpl.java15
-rw-r--r--jack/src/com/android/jack/jayce/v0002/util/DispatchKindIdHelper.java4
-rw-r--r--jack/src/com/android/jack/jayce/v0002/util/FieldRefKindIdHelper.java4
-rw-r--r--jack/src/com/android/jack/jayce/v0002/util/MethodKindIdHelper.java4
-rw-r--r--jack/src/com/android/jack/jayce/v0002/util/ReceiverKindIdHelper.java4
-rw-r--r--jack/src/com/android/jack/jayce/v0002/util/RetentionPolicyIdHelper.java4
7 files changed, 35 insertions, 30 deletions
diff --git a/jack/src/com/android/jack/jayce/v0002/io/JayceInternalReaderImpl.java b/jack/src/com/android/jack/jayce/v0002/io/JayceInternalReaderImpl.java
index 76602f2..ce098f1 100644
--- a/jack/src/com/android/jack/jayce/v0002/io/JayceInternalReaderImpl.java
+++ b/jack/src/com/android/jack/jayce/v0002/io/JayceInternalReaderImpl.java
@@ -16,6 +16,10 @@
package com.android.jack.jayce.v0002.io;
+import com.android.jack.ir.ast.FieldKind;
+import com.android.jack.ir.ast.JMethodCall.DispatchKind;
+import com.android.jack.ir.ast.JRetentionPolicy;
+import com.android.jack.ir.ast.MethodKind;
import com.android.jack.jayce.DeclaredTypeNode;
import com.android.jack.jayce.JayceFormatException;
import com.android.jack.jayce.JayceInternalReader;
@@ -26,6 +30,7 @@ import com.android.jack.jayce.v0002.nodes.HasCatchBlockIds;
import com.android.jack.jayce.v0002.nodes.HasSourceInfo;
import com.android.jack.jayce.v0002.nodes.NDeclaredType;
import com.android.jack.jayce.v0002.nodes.NMethod;
+import com.android.jack.jayce.v0002.nodes.NMethodCall.ReceiverKind;
import com.android.jack.jayce.v0002.nodes.NSourceInfo;
import com.android.jack.jayce.v0002.util.DispatchKindIdHelper;
import com.android.jack.jayce.v0002.util.FieldRefKindIdHelper;
@@ -113,34 +118,29 @@ public class JayceInternalReaderImpl implements JayceInternalReader {
return currentLine;
}
- @SuppressWarnings("unchecked")
@Nonnull
- public <T extends Enum<T>> T readRetentionPolicyEnum() throws IOException {
- return (T) RetentionPolicyIdHelper.getValue(readByte());
+ public JRetentionPolicy readRetentionPolicyEnum() throws IOException {
+ return RetentionPolicyIdHelper.getValue(readByte());
}
- @SuppressWarnings("unchecked")
@Nonnull
- public <T extends Enum<T>> T readFieldRefKindEnum() throws IOException {
- return (T) FieldRefKindIdHelper.getValue(readByte());
+ public FieldKind readFieldRefKindEnum() throws IOException {
+ return FieldRefKindIdHelper.getValue(readByte());
}
- @SuppressWarnings("unchecked")
@Nonnull
- public <T extends Enum<T>> T readMethodKindEnum() throws IOException {
- return (T) MethodKindIdHelper.getValue(readByte());
+ public MethodKind readMethodKindEnum() throws IOException {
+ return MethodKindIdHelper.getValue(readByte());
}
- @SuppressWarnings("unchecked")
@Nonnull
- public <T extends Enum<T>> T readReceiverKindEnum() throws IOException {
- return (T) ReceiverKindIdHelper.getValue(readByte());
+ public ReceiverKind readReceiverKindEnum() throws IOException {
+ return ReceiverKindIdHelper.getValue(readByte());
}
- @SuppressWarnings("unchecked")
@Nonnull
- public <T extends Enum<T>> T readDispatchKindEnum() throws IOException {
- return (T) DispatchKindIdHelper.getValue(readByte());
+ public DispatchKind readDispatchKindEnum() throws IOException {
+ return DispatchKindIdHelper.getValue(readByte());
}
@CheckForNull
diff --git a/jack/src/com/android/jack/jayce/v0002/io/JayceInternalWriterImpl.java b/jack/src/com/android/jack/jayce/v0002/io/JayceInternalWriterImpl.java
index 5155a86..15fc84b 100644
--- a/jack/src/com/android/jack/jayce/v0002/io/JayceInternalWriterImpl.java
+++ b/jack/src/com/android/jack/jayce/v0002/io/JayceInternalWriterImpl.java
@@ -17,7 +17,11 @@
package com.android.jack.jayce.v0002.io;
import com.android.jack.JackEventType;
+import com.android.jack.ir.ast.FieldKind;
+import com.android.jack.ir.ast.JMethodCall.DispatchKind;
import com.android.jack.ir.ast.JNode;
+import com.android.jack.ir.ast.JRetentionPolicy;
+import com.android.jack.ir.ast.MethodKind;
import com.android.jack.jayce.JayceInternalWriter;
import com.android.jack.jayce.v0002.NNode;
import com.android.jack.jayce.v0002.NodeFactory;
@@ -25,6 +29,7 @@ import com.android.jack.jayce.v0002.Version;
import com.android.jack.jayce.v0002.nodes.HasCatchBlockIds;
import com.android.jack.jayce.v0002.nodes.HasSourceInfo;
import com.android.jack.jayce.v0002.nodes.NMethod;
+import com.android.jack.jayce.v0002.nodes.NMethodCall.ReceiverKind;
import com.android.jack.jayce.v0002.nodes.NSourceInfo;
import com.android.jack.jayce.v0002.util.DispatchKindIdHelper;
import com.android.jack.jayce.v0002.util.FieldRefKindIdHelper;
@@ -218,23 +223,23 @@ public class JayceInternalWriterImpl implements JayceInternalWriter {
writeString(id);
}
- public void writeRetentionPolicyEnum(@Nonnull Enum<?> enumValue) throws IOException {
+ public void writeRetentionPolicyEnum(@Nonnull JRetentionPolicy enumValue) throws IOException {
writeByte(RetentionPolicyIdHelper.getId(enumValue));
}
- public void writeFieldRefKindEnum(@Nonnull Enum<?> enumValue) throws IOException {
+ public void writeFieldRefKindEnum(@Nonnull FieldKind enumValue) throws IOException {
writeByte(FieldRefKindIdHelper.getId(enumValue));
}
- public void writeMethodKindEnum(@Nonnull Enum<?> enumValue) throws IOException {
+ public void writeMethodKindEnum(@Nonnull MethodKind enumValue) throws IOException {
writeByte(MethodKindIdHelper.getId(enumValue));
}
- public void writeReceiverKindEnum(@Nonnull Enum<?> enumValue) throws IOException {
+ public void writeReceiverKindEnum(@Nonnull ReceiverKind enumValue) throws IOException {
writeByte(ReceiverKindIdHelper.getId(enumValue));
}
- public void writeDispatchKindEnum(@Nonnull Enum<?> enumValue) throws IOException {
+ public void writeDispatchKindEnum(@Nonnull DispatchKind enumValue) throws IOException {
writeByte(DispatchKindIdHelper.getId(enumValue));
}
diff --git a/jack/src/com/android/jack/jayce/v0002/util/DispatchKindIdHelper.java b/jack/src/com/android/jack/jayce/v0002/util/DispatchKindIdHelper.java
index 6697227..977ce31 100644
--- a/jack/src/com/android/jack/jayce/v0002/util/DispatchKindIdHelper.java
+++ b/jack/src/com/android/jack/jayce/v0002/util/DispatchKindIdHelper.java
@@ -43,12 +43,12 @@ public class DispatchKindIdHelper {
}
@Nonnegative
- public static byte getId(@Nonnull Enum<?> enumValue) {
+ public static byte getId(@Nonnull DispatchKind enumValue) {
return ids[enumValue.ordinal()];
}
@Nonnull
- public static Enum<?> getValue(@Nonnegative byte id) {
+ public static DispatchKind getValue(@Nonnegative byte id) {
return values[id];
}
}
diff --git a/jack/src/com/android/jack/jayce/v0002/util/FieldRefKindIdHelper.java b/jack/src/com/android/jack/jayce/v0002/util/FieldRefKindIdHelper.java
index be7823b..862d21f 100644
--- a/jack/src/com/android/jack/jayce/v0002/util/FieldRefKindIdHelper.java
+++ b/jack/src/com/android/jack/jayce/v0002/util/FieldRefKindIdHelper.java
@@ -43,12 +43,12 @@ public class FieldRefKindIdHelper {
}
@Nonnegative
- public static byte getId(@Nonnull Enum<?> enumValue) {
+ public static byte getId(@Nonnull FieldKind enumValue) {
return ids[enumValue.ordinal()];
}
@Nonnull
- public static Enum<?> getValue(@Nonnegative byte id) {
+ public static FieldKind getValue(@Nonnegative byte id) {
return values[id];
}
diff --git a/jack/src/com/android/jack/jayce/v0002/util/MethodKindIdHelper.java b/jack/src/com/android/jack/jayce/v0002/util/MethodKindIdHelper.java
index caf1ce5..7bbb391 100644
--- a/jack/src/com/android/jack/jayce/v0002/util/MethodKindIdHelper.java
+++ b/jack/src/com/android/jack/jayce/v0002/util/MethodKindIdHelper.java
@@ -45,12 +45,12 @@ public class MethodKindIdHelper {
}
@Nonnegative
- public static byte getId(@Nonnull Enum<?> enumValue) {
+ public static byte getId(@Nonnull MethodKind enumValue) {
return ids[enumValue.ordinal()];
}
@Nonnull
- public static Enum<?> getValue(@Nonnegative byte id) {
+ public static MethodKind getValue(@Nonnegative byte id) {
return values[id];
}
}
diff --git a/jack/src/com/android/jack/jayce/v0002/util/ReceiverKindIdHelper.java b/jack/src/com/android/jack/jayce/v0002/util/ReceiverKindIdHelper.java
index a0f6f10..b9d14ea 100644
--- a/jack/src/com/android/jack/jayce/v0002/util/ReceiverKindIdHelper.java
+++ b/jack/src/com/android/jack/jayce/v0002/util/ReceiverKindIdHelper.java
@@ -43,12 +43,12 @@ public class ReceiverKindIdHelper {
}
@Nonnegative
- public static byte getId(@Nonnull Enum<?> enumValue) {
+ public static byte getId(@Nonnull ReceiverKind enumValue) {
return ids[enumValue.ordinal()];
}
@Nonnull
- public static Enum<?> getValue(@Nonnegative byte id) {
+ public static ReceiverKind getValue(@Nonnegative byte id) {
return values[id];
}
}
diff --git a/jack/src/com/android/jack/jayce/v0002/util/RetentionPolicyIdHelper.java b/jack/src/com/android/jack/jayce/v0002/util/RetentionPolicyIdHelper.java
index 10b5752..fceacce 100644
--- a/jack/src/com/android/jack/jayce/v0002/util/RetentionPolicyIdHelper.java
+++ b/jack/src/com/android/jack/jayce/v0002/util/RetentionPolicyIdHelper.java
@@ -49,12 +49,12 @@ public class RetentionPolicyIdHelper {
}
@Nonnegative
- public static byte getId(@Nonnull Enum<?> enumValue) {
+ public static byte getId(@Nonnull JRetentionPolicy enumValue) {
return ids[enumValue.ordinal()];
}
@Nonnull
- public static Enum<?> getValue(@Nonnegative byte id) {
+ public static JRetentionPolicy getValue(@Nonnegative byte id) {
return values[id];
}
}