Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I downloaded xstream jar and sourcecode and append the sourcecode into jar file using winrar

and i created 2 gwt.xml files.

xstream.gwt.xml is present in com.thoughtworks

<?xml version="1.0" encoding="UTF-8"?> 
<module> 
<source path="xstream"/> 
</module>

and operations.gwt.xml is present in com.thoughworks.xstream

<?xml version="1.0" encoding="UTF-8"?> 
<module> 
<source path="annotations"/> 
<source path="converters"/> 
<source path="core"/> 
<source path="io"/> 
<source path="mapper"/> 
<source path="persistence"/> 
</module>

Edited: its my gwt project xml

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='test'>
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
  <inherits name='com.thoughtworks.xstream'/>
  <entry-point class='com.example.test.client.Index'/>
</module>

but i got an error

Compiling module com.example.test.Test
   Validating newly compiled units
      Ignored 142 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/XStream.java'
      [ERROR] Line 499:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
      [ERROR] Line 500:  The method getConstructor(Class[]) is undefined for the type Class
      [ERROR] Line 764:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
      [ERROR] Line 765:  The method getConstructor(Class[]) is undefined for the type Class
      [ERROR] Line 1062:  The method getPackage() is undefined for the type Class<capture#10-of ? extends XStream>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/basic/NullConverter.java'
      [ERROR] Line 30:  The method isAssignableFrom(Class) is undefined for the type Class<Mapper.Null>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/basic/StringConverter.java'
      [ERROR] Line 73:  The method synchronizedMap(WeakCache) is undefined for the type Collections
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/collections/AbstractCollectionConverter.java'
      [ERROR] Line 77:  The method newInstance() is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/collections/TreeMapConverter.java'
      [ERROR] Line 54:  The method getDeclaredFields() is undefined for the type Class<TreeMap>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/collections/TreeSetConverter.java'
      [ERROR] Line 48:  The method getDeclaredFields() is undefined for the type Class<TreeSet>
      [ERROR] Line 50:  The method isAssignableFrom(Class<capture#1-of ?>) is undefined for the type Class<SortedMap>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/DynamicProxyConverter.java'
      [ERROR] Line 51:  The method getDeclaredField(String) is undefined for the type Class<Proxy>
      [ERROR] Line 60:  The method getClassLoader() is undefined for the type Class<DynamicProxyConverter>
      [ERROR] Line 85:  The method getInterfaces() is undefined for the type Class<capture#2-of ? extends Object>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/JavaClassConverter.java'
      [ERROR] Line 61:  The method getClassLoader() is undefined for the type Class<capture#1-of ?>
      [ERROR] Line 65:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/JavaFieldConverter.java'
      [ERROR] Line 69:  The method getDeclaredField(String) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/JavaMethodConverter.java'
      [ERROR] Line 107:  The method getDeclaredMethod(String, Class[]) is undefined for the type Class
      [ERROR] Line 109:  The method getDeclaredConstructor(Class[]) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/LookAndFeelConverter.java'
      [ERROR] Line 44:  The method isAssignableFrom(Class) is undefined for the type Class<LookAndFeel>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java'
      [ERROR] Line 271:  The method isAssignableFrom(Class<capture#27-of ? extends Object>) is undefined for the type Class
      [ERROR] Line 326:  The method isAssignableFrom(Class<capture#32-of ? extends Object>) is undefined for the type Class
      [ERROR] Line 378:  The method isAssignableFrom(Class) is undefined for the type Class<Collection>
      [ERROR] Line 378:  The method isAssignableFrom(Class) is undefined for the type Class<Map>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/AbstractAttributedCharacterIteratorAttributeConverter.java'
      [ERROR] Line 38:  The method getDeclaredMethod(String, Class[]) is undefined for the type Class<AttributedCharacterIterator.Attribute>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/ExternalizableConverter.java'
      [ERROR] Line 58:  The method isAssignableFrom(Class) is undefined for the type Class<Externalizable>
      [ERROR] Line 104:  The method getDeclaredConstructor(Class[]) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/SerializableConverter.java'
      [ERROR] Line 90:  The method isAssignableFrom(Class) is undefined for the type Class<Serializable>
      [ERROR] Line 214:  The method isAssignableFrom(Class) is undefined for the type Class<Serializable>
      [ERROR] Line 271:  The method getDeclaredField(String) is undefined for the type Class
      [ERROR] Line 462:  The method isAssignableFrom(Class) is undefined for the type Class<Serializable>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/DefaultConverterLookup.java'
      [ERROR] Line 37:  The method synchronizedMap(WeakHashMap) is undefined for the type Collections
      [ERROR] Line 86:  The method synchronizedMap(HashMap) is undefined for the type Collections
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/JVM.java'
      [ERROR] Line 46:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 94:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 185:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 199:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 231:  The method getClassLoader() is undefined for the type Class<capture#1-of ? extends JVM>
      [ERROR] Line 251:  The method newInstance() is undefined for the type Class
      [ERROR] Line 342:  The method getDeclaredFields() is undefined for the type Class<AttributedString>
      [ERROR] Line 350:  The method getDeclaredFields() is undefined for the type Class<JVM>
      [ERROR] Line 361:  The method getProperty(String) is undefined for the type System
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/CompositeClassLoader.java'
      [ERROR] Line 57:  The method getClassLoader() is undefined for the type Class<Object>
      [ERROR] Line 58:  The method getClassLoader() is undefined for the type Class<capture#1-of ? extends CompositeClassLoader>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/CustomObjectInputStream.java'
      [ERROR] Line 95:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/io/xml/XppDriver.java'
      [ERROR] Line 18:  The import org.xmlpull cannot be resolved
      [ERROR] Line 19:  The import org.xmlpull cannot be resolved
      [ERROR] Line 20:  The import org.xmlpull cannot be resolved
      [ERROR] Line 31:  XmlPullParserFactory cannot be resolved to a type
      [ERROR] Line 55:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 55:  XmlPullParserException cannot be resolved to a type
      [ERROR] Line 56:  XmlPullParserFactory cannot be resolved to a type
      [ERROR] Line 57:  XmlPullParserFactory cannot be resolved to a type
      [ERROR] Line 57:  XmlPullParserFactory cannot be resolved
      [ERROR] Line 59:  XmlPullParserFactory cannot be resolved to a type
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/io/xml/AbstractXppDriver.java'
      [ERROR] Line 19:  The import org.xmlpull cannot be resolved
      [ERROR] Line 20:  The import org.xmlpull cannot be resolved
      [ERROR] Line 54:  The method createParser() from the type AbstractXppDriver refers to the missing type XmlPullParser
      [ERROR] Line 55:  XmlPullParserException cannot be resolved to a type
      [ERROR] Line 93:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 93:  XmlPullParserException cannot be resolved to a type
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/MapperWrapper.java'
      [ERROR] Line 103:  The method isAssignableFrom(Class<capture#1-of ? extends MapperWrapper>) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/CachingMapper.java'
      [ERROR] Line 55:  The method synchronizedMap(HashMap) is undefined for the type Collections
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/ClassAliasingMapper.java'
      [ERROR] Line 60:  The method isAssignableFrom(Class) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/DefaultMapper.java'
      [ERROR] Line 47:  The method getClassLoader() is undefined for the type Class<DefaultMapper>
      [ERROR] Line 51:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
      [ERROR] Line 53:  The method forName(String) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/ImplicitCollectionMapper.java'
      [ERROR] Line 97:  The method getDeclaredField(String) is undefined for the type Class
      [ERROR] Line 110:  The method isAssignableFrom(Class<capture#1-of ?>) is undefined for the type Class<Map>
      [ERROR] Line 114:  The method isAssignableFrom(Class<capture#2-of ?>) is undefined for t

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
140 views
Welcome To Ask or Share your Answers For Others

1 Answer

You cannot use reflection in GWT;

  • getDeclaredFields

  • getDeclaredMethod

  • forName

  • getConstructor

and the likes ... are all reflective calls;


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...