You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
publicfinalclassExtraInjectedActivity_extendsExtraInjectedActivity
{
// ...privatevoidinit_(BundlesavedInstanceState) {
Bundleextras_ = this.getIntent().getExtras();
if (extras_!= null) {
if (extras_.containsKey("intExtra")) {
try {
intExtra = cast_(extras_.get("intExtra"));
} catch (ClassCastExceptione) {
Log.e("ExtraInjectedActivity_", "Could not cast extra to expected type, the field is left to its default value", e);
}
}
}
}
@SuppressWarnings("unchecked")
private<T >Tcast_(Objectobject) {
return ((T) object);
}
}
It compiles well with Eclipse compiler.
It does not compile with javac compiler, giving the following error :
type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds int,java.lang.Object
The problematic line is:
intExtra = cast_(extras_.get("intExtra"));
The problem is kind of related to the one described here.