Re: Sporadic errors during compilation, Checking type argument 0 of type 'java.util.Arrays.ArrayList, no default constructor.
I had a similar problem.
I have a bean that has to pass through the layer gwt-rpc in which I declare a getter method that returns a collection of items.
Within the method I instantiate a generic type arraylist. I solved only by explicitly cast to the actual datatype of the getter method.
This is the code the generates the error:
public class ItemTx implements Item {
...
}
public class Order implements Serial {
private List<ItemTx> items;
public List<Item> getItems() {
return CollectionUtils.createList(Item.class, items, ItemTx.class);
}
}
public class CollectionUtils {
public static <I extends Serializable, D extends I> List<I> createList(Class<I> itemInterfaceClass, List<D> items, Class<D> descendantClass) {
List<I> result;
...
result = new ArrayList<I>();
...
return result;
}
}
This is the correction that works for me:
public class Order implements Serial {
public List<Item> getItems() {
return (List<Item>)CollectionUtils.createList(Item.class, items, ItemTx.class);
}
}
Best regards
Marcello De Marco
Il giorno domenica 26 febbraio 2012 02:22:47 UTC+1, Dan ha scritto:
Hi all,
I have an RPC called DeviceService which passes around some
DeviceConfiguration s. DeviceConfiguration is the super class of a
chain of inheritance, all of which are immutable. In roughly half of
the compiles I do (in hosted mode or otherwise) I get the following
snippet:
Computing all possible rebind results for
'com.redbite.device.gwt.client.DeviceService'
Rebinding com.redbite.device.gwt.client.DeviceService
Invoking generator
com.google.gwt.user.rebind.rpc. ServiceInterfaceProxyGenerator
Generating client proxy for remote service interface
'com.redbite.device.gwt.client.DeviceService'
Analyzing
'com.redbite.device.gwt.client.DeviceService' for serializable types
Analyzing methods:
public abstract void
addConfiguration(com.redbite.device.configobjects.device. DeviceConfiguration<?
extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>
conf) throws com.redbite.common.gwt.client.RPCException
Parameter:
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>
conf
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>
Verifying instantiability
com.redbite.device.configobjects.device. Alien9900Configuration
Analyzing the fields of type
'com.redbite.device.configobjects.device. DeviceConfiguration<com. redbite.device.configobjects. device. AlienDeviceConfiguration. AlienDeviceProperty>'
that qualify for serialization
private java.util.Map<T,
java.io.Serializable> properties
java.util.Map<T,
java.io.Serializable>
Verifying
instantiability
java.util.TreeMap<T, java.io.Serializable>
Checking
parameters of 'java.util.TreeMap<T, java.io.Serializable>'
Checking type
argument 1 of type 'java.util.TreeMap<K, V>' because it is directly
exposed in this type or in one of its subtypes
java.io.Serializable
Verifying instantiability
java.util.LinkedList<? extends java.lang.Object>
[WARN] Checking all subtypes of Object which qualify for serialization
Checking type argument 0 of type
'java.util.Arrays.ArrayList<E>' because it is exposed as an array with
a maximum dimension of 1 in this type or one of its subtypes (reached
via com.redbite.device.configobjects.device. DeviceConfiguration<?
extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
Checking type argument 0 of type
'java.util.Arrays.ArrayList<E>' because it is exposed as an array with
a maximum dimension of 1 in this type or one of its subtypes (reached
via com.redbite.device.configobjects.device. DeviceConfiguration<?
extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
Checking type argument 0 of type
'java.util.Arrays.ArrayList<E>' because it is exposed as an array with
a maximum dimension of 1 in this type or one of its subtypes (reached
via com.redbite.device.configobjects.device. DeviceConfiguration<?
extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
Checking type argument 0 of type
'java.util.Arrays.ArrayList<E>' because it is exposed as an array with
a maximum dimension of 1 in this type or one of its subtypes (reached
via com.redbite.device.configobjects.device. DeviceConfiguration<?
extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
Checking type argument 0 of type
'java.util.Arrays.ArrayList<E>' because it is exposed as an array with
a maximum dimension of 1 in this type or one of its subtypes (reached
via com.redbite.device.configobjects.device. DeviceConfiguration<?
extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.CodeDownloadException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.CodeDownloadException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.CodeDownloadException has no available
instantiable subtypes. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR] subtype
com.google.gwt.core.client.CodeDownloadException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>),
etc.
[ERROR]
com.google.gwt.core.client.CodeDownloadException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.CodeDownloadException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
followed by very many similar ERRORs concerning many com.google.gwt
classes's lack of a nullary constructor.
I've been over the serializabilty of DeviceConfiguration with a fine-
toothed comb and not noticed anything alarming, and as I said the
compile works around 50% of the time (also the RPC behaves as expected
when deployed).
Does anyone have a thought on what to investigate next? Your help will
be much appreciated,
Dan.
The rest of the error:
[ERROR]
com.google.gwt.core.client.JavaScriptException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.JavaScriptException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.JavaScriptException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.JavaScriptException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.JavaScriptException has no available
instantiable subtypes. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR] subtype
com.google.gwt.core.client.JavaScriptException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>),
etc.
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpDownloadFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpDownloadFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpDownloadFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpDownloadFailure
has no available instantiable subtypes. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR] subtype
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpDownloadFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>),
etc.
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpDownloadFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpInstallFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpInstallFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpInstallFailure
has no available instantiable subtypes. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR] subtype
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpInstallFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>),
etc.
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpInstallFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.core.client.impl.AsyncFragmentLoader. HttpInstallFailure
is not default instantiable (it must have a zero-argument constructor
or no constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.editor.client.adapters.ListEditorWrapper<T, E> is not
default instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.editor.client.adapters.ListEditorWrapper<T, E> is not
default instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.editor.client.adapters.ListEditorWrapper<T, E> is not
default instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.editor.client.adapters.ListEditorWrapper<T, E> is not
default instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.editor.client.adapters.ListEditorWrapper<T, E> is not
default instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device. DeviceConfiguration<? extends
com.redbite.device.configobjects.device. DeviceConfiguration. DeviceProperty>)
[ERROR]
com.google.gwt.event.shared.UmbrellaException is not default
instantiable (it must have a zero-argument constructor or no
constructors at all) and has no custom serializer. (reached via
com.redbite.device.configobjects.device.