#1 Fixes for CodeHints for Integer and co.

closed-fixed
Artur Hefczyc
None
7
2001-12-29
2001-12-28
Peter M Kahle
No

The version of CodeHints in CVS as of 27 Dec, 2001 has
some serious problems with the code it generates for
get/set methods for the class wrappers around numeric
primitives (Integer, etc) as well as with the long
primitive. In the case of Integer, there was code that
looked like:

setSomeProperty((java.lang.Integer)1);

This was caused by the string conversion inherent in
the transition from new Integer(1) to the code written
out for the test class. My changes fix this by creating
a new set of constants for Integer, Double, etc. that
are arrays of Strings, so that the test case contains
"new Integer(1)" where before it just contained 1.

I also modified the case of longs, because, without the
l behind the number, it wasn't willing to compile.

I also noticed a few minor problems with the generated
files, but they were less important, so I simply fixed
them. The one I remember for sure is that TestAll
should be an instance of TestCase, and have the
single-argument constructor required of it.

Anyway, thanks for the system, hope you can use the
patch. Thanks to it, I've been able to run some simple
tests on PCGen (pcgen.sf.net) and find that I've got a
lot of work cut out for me:
Tests run: 1330, Failures: 18, Errors: 267, Time
elapsed: 3.232 sec
(and that's commenting out the tests for the GUI classes)
Thanks,
P

Discussion

  • Peter M Kahle
    Peter M Kahle
    2001-12-28

    Patch for CodeHints.java

     
    Attachments
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-28

    • assigned_to: nobody --> kobit
    • priority: 5 --> 7
    • status: open --> pending-accepted
     
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-28

    • status: pending-accepted --> open-accepted
     
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-28

    • status: open-accepted --> pending-accepted
     
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-29

    • status: pending-accepted --> open-accepted
     
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-29

    Logged In: YES
    user_id=234194

    For most suggestions: Yes that is right!
    Wrapper classes for primitive types are not
    commonly used so I didn't tested them well.
    Thanks to pkahle code is corrected in right way.

    Apart from one notice:
    TestAll is not TestCase. This class shouldn't
    be run as a TestCase.
    It is created only for running tests from
    command line:
    java -cp "junit.jar;testpackage.jar;otherlibs.jars" TestAll
    And TestAll class should be compiled into testpackage.jar

    This class is something like test runner.

     
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-29

    • status: open-accepted --> closed-fixed
     
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-29

    Logged In: YES
    user_id=234194

    For most suggestions: Yes that is right!
    Wrapper classes for primitive types are not
    commonly used so I didn't tested them well.
    Thanks to pkahle code is corrected in right way.

    Apart from one notice:
    TestAll is not TestCase. This class shouldn't
    be run as a TestCase.
    It is created only for running tests from
    command line:
    java -cp "junit.jar;testpackage.jar;otherlibs.jars" TestAll
    And TestAll class should be compiled into testpackage.jar

    This class is something like test runner.

     
  • Artur Hefczyc
    Artur Hefczyc
    2001-12-29

    Logged In: YES
    user_id=234194

    For most suggestions: Yes that is right!
    Wrapper classes for primitive types are not
    commonly used so I didn't tested them well.
    Thanks to pkahle code is corrected in right way.

    Apart from one notice:
    TestAll is not TestCase. This class shouldn't
    be run as a TestCase.
    It is created only for running tests from
    command line:
    java -cp "junit.jar;testpackage.jar;otherlibs.jars" TestAll
    And TestAll class should be compiled into testpackage.jar

    This class is something like test runner.