OpenJPA
  1. OpenJPA
  2. OPENJPA-1118

code changes towards broader use of JDK5 features

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0-beta3
    • Component/s: jdbc
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      the current code of OpenJPA can be enhanced by:
      1.) replacing Numbers.valueOf( int ) and Numbers.valueOf( long ) by their conunterparts in Integer and Long, as well as replacing new Integer/Byte/Short/Long/Character by their factory-methods
      2.) replace StringBuffer by StringBuilder, replace .append( "x" ) by .append( 'x' ) where possible
      3.) use more generics ( in Iterators, for example)

      attached is a patch which contains 1.) for the below openjpa-jdbc/..

      1. DvH090604a.diff
        171 kB
        dieter von holten
      2. DvH090711Jira1118b.diff
        156 kB
        dieter von holten
      3. OPENJPA-1118.diff.txt
        59 kB
        Michael Dick

        Issue Links

          Activity

          Hide
          dieter von holten added a comment -

          replaces Numbers.valueOf() by JRE-factory-methods for Byte, Short, Integer, Long, Character
          replaces new BigInteger( 0 ) / BigDecimal(0) and 1 by references to constant global instances
          removes imports obsoleted by this
          trims some trailing blanks

          Show
          dieter von holten added a comment - replaces Numbers.valueOf() by JRE-factory-methods for Byte, Short, Integer, Long, Character replaces new BigInteger( 0 ) / BigDecimal(0) and 1 by references to constant global instances removes imports obsoleted by this trims some trailing blanks
          Hide
          dieter von holten added a comment -

          the attachment patches files below folder openjpa-persistence:

          • replace StringBuffer by StringBuilder
          • replace sb.append( "x" ) by sb.append( 'x' )
          • replace Numbers.valueOf() by Integer.valueOf / Long.valueOf
          • fix some javadoc-comments
          • trim trailing blanks
          Show
          dieter von holten added a comment - the attachment patches files below folder openjpa-persistence: replace StringBuffer by StringBuilder replace sb.append( "x" ) by sb.append( 'x' ) replace Numbers.valueOf() by Integer.valueOf / Long.valueOf fix some javadoc-comments trim trailing blanks
          Hide
          Michael Dick added a comment -

          Hi Dieter,

          Thanks for both of the patches, but this would be a lot easier for me to review if you made each type of change in a single patch. For example put the whitespace changes in one file, Numbers.valueOf() -> Byte/Short/Integer.valueOf() in another one, etc.

          Show
          Michael Dick added a comment - Hi Dieter, Thanks for both of the patches, but this would be a lot easier for me to review if you made each type of change in a single patch. For example put the whitespace changes in one file, Numbers.valueOf() -> Byte/Short/Integer.valueOf() in another one, etc.
          Hide
          Michael Dick added a comment -

          Many of the changes have already been done under separate issues. The major outstanding part is to replace Numbers.valueOf() with JRE factory methods.

          Autoboxing uses Integer.valueOf() automatically and since it makes the code easier to read (subjective) and it's significantly easier to make the changes I've gone that route.

          Attaching a patch with the proposed changes.

          Show
          Michael Dick added a comment - Many of the changes have already been done under separate issues. The major outstanding part is to replace Numbers.valueOf() with JRE factory methods. Autoboxing uses Integer.valueOf() automatically and since it makes the code easier to read (subjective) and it's significantly easier to make the changes I've gone that route. Attaching a patch with the proposed changes.
          Hide
          Donald Woods added a comment -

          Mike, go for it. We have less than 2 weeks before we cut the 2.0.0 branch, so lets get it in now so there is time to test against all DBs and the TCKs.

          Show
          Donald Woods added a comment - Mike, go for it. We have less than 2 weeks before we cut the 2.0.0 branch, so lets get it in now so there is time to test against all DBs and the TCKs.
          Hide
          Michael Dick added a comment -

          It think the main concerns raised here have been addressed - remaining items can be addressed in the linked issues.

          Show
          Michael Dick added a comment - It think the main concerns raised here have been addressed - remaining items can be addressed in the linked issues.

            People

            • Assignee:
              Michael Dick
              Reporter:
              dieter von holten
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development