Awesome!
> This message is caused by using JDK7:
> [INFO] diagnostic warning: Supported source version 'RELEASE_6' from
> annotation processor 'org.bindgen.processor.Processor' less than -
> source '1.7'
Oh, huh. Didn't think of that. I haven't switched to JDK7 myself yet.
> Is there a step missing in the instructions or have I done something wrong?
It should work. Those jars are downloaded by ivy, specifically by running "ant
ivy.retrieve".
> Also, was JDK7 support planned in the near future for bindgen?
Now that you brought it to my attention, sure! I'll try getting a JDK7 install
going and seeing what happens; might be a day or so before I get to it. Let me
know if you beat me to it.
- Stephen
Maybe it will turn up good advice!
>> Is there a step missing in the instructions or have I done something wrong?
> It should work. Those jars are downloaded by ivy, specifically by running "ant
> ivy.retrieve".
That's probably what I was missing. I didn't understand this command had
to be run. I'll install ant and give it a try.
>> Also, was JDK7 support planned in the near future for bindgen?
> Now that you brought it to my attention, sure! I'll try getting a JDK7 install
> going and seeing what happens; might be a day or so before I get to it. Let me
> know if you beat me to it.
Great! Since it works in Eclipse and not Maven, I started migrating to
Gradle to see if it works there. I'll reply with any progress.
Regards,
Bertrand
If I can save you any time, it'll probably not work with gradle because
I think the issue is in javac itself, which both maven and gradle use.
- Stephen
Some findings:
I first modified the Bindable.java annotation to:
@Target(value = { ElementType.TYPE, ElementType.PACKAGE })
since it is used in the examples in
/bindgen-examples/src/main/java/org/bindgen/example/subpackage/package-info.java.
Isn't this an error also for jdk 6?.
My tests were done with a jdk6 compiled version of the annotation
processor while using jdk7 for compiling the examples. Here are the
problems I found:
===================
bindgen.properties:
I put skipGeneratedTimestamps=true in bindgen.properties to facilitate
directory comparison between the jdk6 and jdk7 versions of the example
generated sources. The property was only honored for jdk6.
There are differences in the generated BindKeyword.java and
BindKeyword.txt files. Classes in the org.bindgen.outofscope package are
in the jdk7 version.
===================
In RawTypesExampleTest.java:
b.fieldGiven().set(this.e);
Assert.assertSame(this.e, b.fieldGiven().get());
b.fieldFixed().set(this.e); // <<< error!
// changing to b.fieldFixed().set((Enumeration<?>) this.e);
also doesn't work
Assert.assertSame(this.e, b.fieldFixed().get());
The same error is present in testMethod(). Here it is:
The method set(Enumeration<capture#1-of ?>) in the type
AbstractBinding<RawTypesExample,Enumeration<capture#1-of ?>> is not
applicable for the arguments (Enumeration<String>)
RawTypesExampleTest.java
/bindgen-examples/src/test/java/org/bindgen/example/fixRawTypes line
21 Java Problem
Could this be caused by different versions of the Enumeration class in
jdk6 and jdk7?
Also, some differences between the jdk6 and jdk7 versions of
RawTypesExampleBindingPath.java:
<<< private EnumerationBindingPath<R, String> methodFixed;
>>> private EnumerationBindingPath<R, ?> methodFixed;
<<< private EnumerationBindingPath<R, String> fieldFixed;
>>> private EnumerationBindingPath<R, ?> fieldFixed;
<<< public class MyMethodFixedBinding extends
EnumerationBindingPath<R, String> {
>>> public class MyMethodFixedBinding<E> extends
EnumerationBindingPath<R, E> {
same for MyFieldFixedBinding
===================
In TransactionExampleTest.java, the following statements fail because of
an undefined symbol:
TransactionBlock block = teb.businessLogic();
TransactionBlock block = teb.businessLogicThatCanFail();
Looking at the generated TransactionExampleBindingPath, we can see that
the 2 method bindings are indeed not created.
After much tinkering, I finally found out how to attach a debugger to
the ant compilation of the examples project:
set
ANT_OPTS="-agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=y"
In Eclipse, create a remote debug configuration using port 9009. Run
"ant compile". Run the debug configuration in Eclipse with proper
breakpoints set. This will allow further investigation.
Cheers,
Bertrand