private static boolean isInstantiableWithNewOperator (JClassType t) { if (!t.isDefaultInstantiable() || t instanceof JArrayType || t instanceof JEnumType) return false; try { JConstructor constructor = t.getConstructor(new JType[0]); return constructor != null && constructor.isPublic(); } catch (NotFoundException e) { return false; } }
private static boolean isInstantiableWithNewOperator (JClassType t) { if (!t.isDefaultInstantiable() || t instanceof JArrayType || t instanceof JEnumType) return false; try { JConstructor constructor = t.getConstructor(new JType[0]); return constructor != null && constructor.isPublic(); } catch (NotFoundException e) { return false; } }
public static boolean isDefaultInstantiable(JType type) { if (type == null) { return false; } JClassType classType = type.isClass(); if (classType == null) { return false; } return classType.isDefaultInstantiable(); }
protected void generateCreator(SourceWriter sourceWriter, JClassType classType) { if (classType.isDefaultInstantiable()) { sourceWriter.println(GWT.class.getSimpleName() + ".create(" + classType.getParameterizedQualifiedSourceName() + ".class);"); } }
private static boolean isInstantiableWithNewOperator (JClassType t) { if (!t.isDefaultInstantiable() || t instanceof JArrayType || t instanceof JEnumType) return false; try { JConstructor constructor = t.getConstructor(new JType[0]); return constructor != null && constructor.isPublic(); } catch (NotFoundException e) { return false; } }
private static boolean isInstantiableWithNewOperator (JClassType t) { if (!t.isDefaultInstantiable() || t instanceof JArrayType || t instanceof JEnumType) return false; try { JConstructor constructor = t.getConstructor(new JType[0]); return constructor != null && constructor.isPublic(); } catch (NotFoundException e) { return false; } }
if (!serializee.isDefaultInstantiable() && !serializee.isAbstract()) {
if (!serializee.isDefaultInstantiable() && !serializee.isAbstract()) {
static boolean canBeInstantiated(JClassType type, ProblemReport problems) { if (type.isEnum() == null) { if (type.isAbstract()) { // Abstract types will be picked up if there is an instantiable // subtype. return false; } if (!type.isDefaultInstantiable() && !isManuallySerializable(type)) { // Warn and return false. problems.add(type, type.getParameterizedQualifiedSourceName() + " is not default instantiable (it must have a zero-argument " + "constructor or no constructors at all) and has no custom " + "serializer.", Priority.DEFAULT); return false; } } else { /* * Enums are always instantiable regardless of abstract or default * instantiability. */ } return true; }
static boolean canBeInstantiated(JClassType type, ProblemReport problems) { if (type.isEnum() == null) { if (type.isAbstract()) { // Abstract types will be picked up if there is an instantiable // subtype. return false; } if (!type.isDefaultInstantiable() && !isManuallySerializable(type)) { // Warn and return false. problems.add(type, type.getParameterizedQualifiedSourceName() + " is not default instantiable (it must have a zero-argument " + "constructor or no constructors at all) and has no custom " + "serializer.", Priority.DEFAULT); return false; } } else { /* * Enums are always instantiable regardless of abstract or default * instantiability. */ } return true; }
+ "' cannot be instantiated.", null); throw new UnableToCompleteException(); } else if (!type.isDefaultInstantiable()) {
if (injectionType.isDefaultInstantiable() && !(injectionType instanceof JEnumType)) { NewInstanceStrategy newInst = getNewInstanceStrategy(logger, strategy, injectionType, context); implementNewInstance(logger, newInst, cls, clsToEnhance, cls.createMethod("public "+returnName+" newInstance()"), context);
if (injectionType.isDefaultInstantiable() && !(injectionType instanceof JEnumType)) { final NewInstanceStrategy newInst = getNewInstanceStrategy(logger, strategy, injectionType, context); implementNewInstance(logger, newInst, cls, clsToEnhance, cls.createMethod("public "+returnName+" newInstance()"), context);
&& (serializableClass.isAbstract() || !serializableClass.isDefaultInstantiable())) {
&& (serializableClass.isAbstract() || !serializableClass.isDefaultInstantiable())) {
.println("public Object create(SerializationStreamReader reader) throws SerializationException {"); sourceWriter.indent(); if (serializableClass.isEnum() != null || serializableClass.isDefaultInstantiable() || customFieldSerializerHasInstantiate) { sourceWriter.print("return ");
.println("public Object create(SerializationStreamReader reader) throws SerializationException {"); sourceWriter.indent(); if (serializableClass.isEnum() != null || serializableClass.isDefaultInstantiable() || customFieldSerializerHasInstantiate) { sourceWriter.print("return ");