[kepler-dev] Compiling Ptolemy with Java 1.4.2

Christopher Brooks cxh at eecs.berkeley.edu
Thu Jul 27 11:53:11 PDT 2006


Hi Edward,

Ptolemy still was not compiling under Java 1.4.2
For example, ComplexToken was failing to compile:

../../../ptolemy/data/ComplexToken.java:115: convert(ptolemy.data.Token) in ptolemy.data.ComplexToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.ComplexToken
required: ptolemy.data.ScalarToken
    public static ComplexToken convert(Token token)

The reason is because of ScalarToken.convert(), which was introduced
earlier this week.

I commented ScalarToken.convert() out and modified type/BaseType.java
so that it no longer calls ScalarToken.convert() and does what
ScalarToken.convert() used to do.

The tree should now compile under Java 1.4.2 again.
However, I'm not sure if my changes will break what you were trying
to do though.


BTW - Here are the error messages:


CLASSPATH="../../..:/export/home1/cxh/src/ptII-1.4.2/vendors/sun/javacc-4.0/JavaCC.zip:/export/home1/cxh/src/ptII-1.4.2/vendors/sun/javacc-4.0/bin/lib/JavaCC.zip" "touch" MatrixParser.jj
making jclass in ptolemy/data/expr/test
rm -f `basename CachedMethod.java .java`.class
CLASSPATH="../../..:/export/home1/cxh/src/ptII-1.4.2/vendors/sun/javacc-4.0/JavaCC.zip:/export/home1/cxh/src/ptII-1.4.2/vendors/sun/javacc-4.0/bin/lib/JavaCC.zip" "/usr/jdk/j2sdk1.4.2_06/bin/javac" -g -O CachedMethod.java
../../../ptolemy/data/ComplexToken.java:115: convert(ptolemy.data.Token) in ptolemy.data.ComplexToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.ComplexToken
required: ptolemy.data.ScalarToken
    public static ComplexToken convert(Token token)
                               ^
../../../ptolemy/data/DoubleToken.java:119: convert(ptolemy.data.Token) in ptolemy.data.DoubleToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.DoubleToken
required: ptolemy.data.ScalarToken
    public static DoubleToken convert(Token token)
                              ^
../../../ptolemy/data/FixToken.java:165: convert(ptolemy.data.Token) in ptolemy.data.FixToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.FixToken
required: ptolemy.data.ScalarToken
    public static FixToken convert(Token token) throws IllegalActionException {
                           ^
../../../ptolemy/data/IntToken.java:113: convert(ptolemy.data.Token) in ptolemy.data.IntToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.IntToken
required: ptolemy.data.ScalarToken
    public static IntToken convert(Token token) throws IllegalActionException {
                           ^
../../../ptolemy/data/LongToken.java:116: convert(ptolemy.data.Token) in ptolemy.data.LongToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.LongToken
required: ptolemy.data.ScalarToken
    public static LongToken convert(Token token) throws IllegalActionException {
                            ^
../../../ptolemy/data/UnsignedByteToken.java:173: convert(ptolemy.data.Token) in ptolemy.data.UnsignedByteToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.UnsignedByteToken
required: ptolemy.data.ScalarToken
    public static UnsignedByteToken convert(Token token)
                                    ^
../../../ptolemy/data/PetiteToken.java:93: convert(ptolemy.data.Token) in ptolemy.data.PetiteToken cannot override convert(ptolemy.data.Token) in ptolemy.data.ScalarToken; attempting to use incompatible return type
found   : ptolemy.data.PetiteToken
required: ptolemy.data.ScalarToken
    public static PetiteToken convert(Token token)
                              ^
7 errors

_Christopher

--------

    
    Dan:
    
    This is a compiler bug in 1.4.2, unfortunately.
    There is no reason you can't override a static method in this way.
    MatrixToken did not used to have a convert() method, so the problem
    is new, due to my changes.
    
    I've checked in a workaround...
    Sorry about breaking the build.
    
    Edward
    
    At 02:29 PM 7/26/2006, Dan Higgins wrote:
    >Hi Christopher,
    >     Our nightly build of Kepler is failing in compiling Ptolemy. The
    >error message is:
    >
    >     [javac]                                  ^
    >     [javac]
    >C:\work\ptII\build\src\ptolemy\data\LongMatrixToken.java:241: conver
    >t(ptolemy.data.Token) in ptolemy.data.LongMatrixToken cannot override
    >convert(pt
    >olemy.data.Token) in ptolemy.data.MatrixToken; attempting to use
    >incompatible re
    >turn type
    >     [javac] found   : ptolemy.data.LongMatrixToken
    >     [javac] required: ptolemy.data.MatrixToken
    >     [javac]     public static LongMatrixToken convert(Token token)
    >     [javac]                                   ^
    >     [javac] C:\work\ptII\build\src\ptolemy\data\LongToken.java:116:
    >convert(ptol
    >emy.data.Token) in ptolemy.data.LongToken cannot override
    >convert(ptolemy.data.T
    >oken) in ptolemy.data.ScalarToken; attempting to use incompatible return
    >type
    >     [javac] found   : ptolemy.data.LongToken
    >     [javac] required: ptolemy.data.ScalarToken
    >     [javac]     public static LongToken convert(Token token) throws
    >IllegalActio
    >nException {
    >
    >.....
    >
    >Strangely enough this error occurs ONLY when compiling with Java 1.4.2.
    >If I use Java 1.5, Ptolemy compiles with no error messages.
    >
    >Did you guys change something in the Token convert code recently, and
    >Are you using Java 1.5 exclusively now? It would seem better if we could
    >still compile with 1.4.2 (or maybe I am wrong here about the Java
    >versioning being a problem)
    >
    >Dan
    >
    >--
    >*******************************************************************
    >Dan Higgins                                  higgins at nceas.ucsb.edu
    >http://www.nceas.ucsb.edu/    Ph: 805-893-5127
    >National Center for Ecological Analysis and Synthesis (NCEAS) Marine 
    >Science Building - Room 3405
    >Santa Barbara, CA 93195
    >*******************************************************************
    >
    >
    >_______________________________________________
    >Kepler-dev mailing list
    >Kepler-dev at ecoinformatics.org
    >http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
    
    ------------
    Edward A. Lee
    Professor, Chair of EECS
    231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
    phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
    eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal  
--------



More information about the Kepler-dev mailing list