summaryrefslogtreecommitdiff
path: root/library/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/main/src')
-rw-r--r--library/main/src/com/android/setupwizardlib/items/Item.java1
-rw-r--r--library/main/src/com/android/setupwizardlib/items/ReflectionInflater.java18
-rw-r--r--library/main/src/com/android/setupwizardlib/template/Mixin.java4
3 files changed, 13 insertions, 10 deletions
diff --git a/library/main/src/com/android/setupwizardlib/items/Item.java b/library/main/src/com/android/setupwizardlib/items/Item.java
index 0d73e61..812e827 100644
--- a/library/main/src/com/android/setupwizardlib/items/Item.java
+++ b/library/main/src/com/android/setupwizardlib/items/Item.java
@@ -116,6 +116,7 @@ public class Item extends AbstractItem {
return mVisible;
}
+ @Override
public int getViewId() {
return getId();
}
diff --git a/library/main/src/com/android/setupwizardlib/items/ReflectionInflater.java b/library/main/src/com/android/setupwizardlib/items/ReflectionInflater.java
index ed06575..c7af410 100644
--- a/library/main/src/com/android/setupwizardlib/items/ReflectionInflater.java
+++ b/library/main/src/com/android/setupwizardlib/items/ReflectionInflater.java
@@ -39,8 +39,8 @@ public abstract class ReflectionInflater<T> extends SimpleInflater<T> {
/* static section */
- private static final Class[] CONSTRUCTOR_SIGNATURE =
- new Class[] {Context.class, AttributeSet.class};
+ private static final Class<?>[] CONSTRUCTOR_SIGNATURE =
+ new Class<?>[] {Context.class, AttributeSet.class};
private static final HashMap<String, Constructor<?>> sConstructorMap = new HashMap<>();
@@ -87,13 +87,16 @@ public abstract class ReflectionInflater<T> extends SimpleInflater<T> {
if (prefix != null && qualifiedName.indexOf('.') == -1) {
qualifiedName = prefix.concat(qualifiedName);
}
- Constructor constructor = sConstructorMap.get(qualifiedName);
+ @SuppressWarnings("unchecked") // qualifiedName should correspond to a subclass of T
+ Constructor<? extends T> constructor =
+ (Constructor<? extends T>) sConstructorMap.get(qualifiedName);
try {
if (constructor == null) {
- // Class not found in the cache, see if it's real,
- // and try to add it
- Class<?> clazz = mContext.getClassLoader().loadClass(qualifiedName);
+ // Class not found in the cache, see if it's real, and try to add it
+ @SuppressWarnings("unchecked") // qualifiedName should correspond to a subclass of T
+ Class<? extends T> clazz =
+ (Class<? extends T>) mContext.getClassLoader().loadClass(qualifiedName);
constructor = clazz.getConstructor(CONSTRUCTOR_SIGNATURE);
constructor.setAccessible(true);
sConstructorMap.put(tagName, constructor);
@@ -101,8 +104,7 @@ public abstract class ReflectionInflater<T> extends SimpleInflater<T> {
mTempConstructorArgs[0] = mContext;
mTempConstructorArgs[1] = attrs;
- // noinspection unchecked
- final T item = (T) constructor.newInstance(mTempConstructorArgs);
+ final T item = constructor.newInstance(mTempConstructorArgs);
mTempConstructorArgs[0] = null;
mTempConstructorArgs[1] = null;
return item;
diff --git a/library/main/src/com/android/setupwizardlib/template/Mixin.java b/library/main/src/com/android/setupwizardlib/template/Mixin.java
index 285ea31..b7b8893 100644
--- a/library/main/src/com/android/setupwizardlib/template/Mixin.java
+++ b/library/main/src/com/android/setupwizardlib/template/Mixin.java
@@ -19,8 +19,8 @@ package com.android.setupwizardlib.template;
/**
* Marker interface to indicate Mixin classes.
*
- * @see TemplateLayout#registerMixin(Class, Mixin)
- * @see TemplateLayout#getMixin(Class)
+ * @see com.android.setupwizardlib.TemplateLayout#registerMixin(Class, Mixin)
+ * @see com.android.setupwizardlib.TemplateLayout#getMixin(Class)
*/
public interface Mixin {
}