Reputation: 9011
`Platform`: Windows 7, MinGW, MSYS, Java 1.5
I have thrift 0.9.1 compiler (prebuilt for windows) and source. I use Ant to build java library. I create one thrift idl and compile it with the compiler. No problem in generating code files. I add these files in my project, and that add slf4j (downloaded from their site) and libthrift. Most of the errors that I have previously (imports etc) are gone except for errors related to overriding methods. So basically it complains like:
The method clear() of type Server must override a superclass method
and similarly for compareTo
, write
, read
etc. In short it complains about all methods that are overridden. This is all thrift compiler generated code and I haven't changed anything.
Is there any incompatibility? I cannot really find any mention of that. I have tried removing and then adding the libraries, I have also tried cleaning, refreshing, validating the project but the errors are still there.
I have also tried to compile the code (thrift code) but MinGW is also a huge headache. It cannot find configure
even though I have installed it. And if I run the msys
console, it is able to configure
but cannot make
complaining about inttypes.h
not present (which is not in msys include directory but is present in MinGW include directory.).
Any suggestion would be appreciated.
Upvotes: 0
Views: 897
Reputation: 1170
Are you using Java 5? With Java 5 @Override
doesn't search for methods on interfaces, only on superclasses.
If you are using a Java 5 compiler trying using a more recent javac (preferably 7 or 8) and see of that works.
EDIT:
Not sure if this is in your version of Thrift, but in mine it looks like there is a flag called java5
that you an specify when generating code to specify that you want the generated code to be Java 5 compliant
java (Java):
beans: Members will be private, and setter methods will return void.
private-members: Members will be private, but setter methods will return 'this' like usual.
nocamel: Do not use CamelCase field accessors with beans.
fullcamel: Convert underscored_accessor_or_service_names to camelCase.
android: Generated structures are Parcelable.
android_legacy: Do not use java.io.IOException(throwable) (available for Android 2.3 and above).
java5: Generate Java 1.5 compliant code (includes android_legacy flag).
reuse-objects: Data objects will not be allocated, but existing instances will be used (read and write).
sorted_containers:
Use TreeSet/TreeMap instead of HashSet/HashMap as a implementation of set/map.
Upvotes: 1