All type objects exposed, such as {@link com.google.gwt.core.ext.typeinfo.JClassType} and others, have a stableidentity relative to this type oracle instance. Consequently, you can reliably compare object identity of any objects this type oracle produces. For example, the following code relies on this stable identity guarantee:
JClassType o = typeOracle.getJavaLangObject(); JClassType s1 = typeOracle.getType("java.lang.String"); JClassType s2 = typeOracle.getType("java.lang.String"); assert(s1 == s2); assert(o == s1.getSuperclass()); JParameterizedType ls = typeOracle.parse("java.util.List<java.lang.String>"); assert(ls.getTypeArgs()[0] == s1);
All type objects exposed, such as {@link com.google.gwt.core.ext.typeinfo.JClassType} and others, have a stableidentity relative to this type oracle instance. Consequently, you can reliably compare object identity of any objects this type oracle produces. For example, the following code relies on this stable identity guarantee:
JClassType o = typeOracle.getJavaLangObject(); JClassType s1 = typeOracle.getType("java.lang.String"); JClassType s2 = typeOracle.getType("java.lang.String"); assert (s1 == s2); assert (o == s1.getSuperclass()); JParameterizedType ls = typeOracle.parse("java.util.List<java.lang.String>"); assert (ls.getTypeArgs()[0] == s1);
|
|
|
|