On Sun, Oct 4, 2009 at 10:23 PM, William R. Zwicky <[email protected]>wrote:

> denis queffeulou wrote:
> > The build.xml is setting  java source and target to 1.4
> >
> > It is not true: the source is 1.5, just set to 1.5 and compilation
> > was OK.
> >
> > But I don't think I have a SVN account ...
> >
> Fixed.
>
> -Bill
>

Could it be that this new Java version requires
generics<http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html>to
be used?
I get 100 warnings when compiling with
javac -classpath '.:groovy.jar:asm.jar' org/jsynthlib/*/*/*.java
org/jsynthlib/*/*.java

When I add -Xlint:unchecked to the command, the 100 messages are like these:

org/jsynthlib/utils/XMLWriter.java:46: warning: [unchecked] unchecked call
to addFirst(E) as a member of the raw type java.util.LinkedList
        elements.addFirst(element);
                         ^
org/jsynthlib/editorbuilder/Anchor.java:243: warning: [unchecked] unchecked
call to add(E) as a member of the raw type java.util.Collection
        listeners.add(l);
                     ^
org/jsynthlib/editorbuilder/Anchor.java:283: warning: [unchecked] unchecked
call to add(E) as a member of the raw type java.util.Set
        result.add(c);
org/jsynthlib/jsynthlib/xml/XMLPatch.java:367: warning: [unchecked]
unchecked call to put(K,V) as a member of the raw type java.util.HashMap
        cache.put(p, e);
                 ^
org/jsynthlib/editorbuilder/PGSNode.java:24: warning: [unchecked] unchecked
call to add(E) as a member of the raw type java.util.HashSet
        names.add(p.getName());
                 ^
./core/Device.java:341: warning: [unchecked] unchecked call to add(E) as a
member of the raw type java.util.ArrayList
        driverList.add(driver);
                      ^
./core/JSLFrame.java:199: warning: [unchecked] unchecked call to
WeakReference(T) as a member of the raw type java.lang.ref.WeakReference
        parent = new WeakReference(p);
                 ^

When I Googled for info, I found this forum
post<http://www.coderanch.com/t/381445/Java-General/java/compiling-under>where
it is advised to use generics when compiling for Java 1.5.

Quote from that post: "These warning have to do with generics - a good
starting point is
here<http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html>.
Basically whenever you declare a Collection or Map in 1.5, you need to tell
the compiler what sorts of things will go *into* the collection. You do this
with the new <> notation shown in the link.

Note that what you're seeing are warnings, not errors. It's possible to
ignore them. But if you use generics and make the warnings go away, you'll
get much better compile-time checking of the rest of your code that
*uses*the collections and maps.

Also, generics aren't *just* for collections and maps, but that's the most
common case - and the one that applies to your code, apparently."

Should I get started fixing those generics? I get many errors when trying to
run JSL, to test the Roland SPD-11 and Yamaha CS2x drivers that I'm writing,
so I won't mind trying to fix them. I'm just not sure if my level of Java
knowledge is appropriate for this job ... but I guess I'm right if the
switch from Java version 1.4 to 1.5 means we can (should?) now use generics,
and we didn't before.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jsynthlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsynthlib-devel

Reply via email to