You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/11 16:06:10 UTC

svn commit: r1299373 - in /commons/proper/bcel/trunk/src: changes/ changes/changes.xml changes/release-notes.vm main/java/org/apache/bcel/generic/MethodGen.java

Author: sebb
Date: Sun Mar 11 15:06:10 2012
New Revision: 1299373

URL: http://svn.apache.org/viewvc?rev=1299373&view=rev
Log:
Bug 52433 - Why using unstable sort at MethodGen.getLocalVariables() ? 

Added:
    commons/proper/bcel/trunk/src/changes/
    commons/proper/bcel/trunk/src/changes/changes.xml   (with props)
    commons/proper/bcel/trunk/src/changes/release-notes.vm   (with props)
Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java

Added: commons/proper/bcel/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/changes/changes.xml?rev=1299373&view=auto
==============================================================================
--- commons/proper/bcel/trunk/src/changes/changes.xml (added)
+++ commons/proper/bcel/trunk/src/changes/changes.xml Sun Mar 11 15:06:10 2012
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<!--
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+-->
+<!--
+This file is also used by the maven-changes-plugin to generate the release notes.
+Useful ways of finding items to add to this file are:
+
+1.  Add items when you fix a bug or add a feature (this makes the 
+release process easy :-).
+
+2.  Do a JIRA search for tickets closed since the previous release.
+
+3.  Use the report generated by the maven-changelog-plugin to see all
+SVN commits. TBA how to use this with SVN.
+
+To generate the release notes from this file:
+
+mvn changes:announcement-generate -Prelease-notes [-Dchanges.version=nnn]
+
+then tweak the formatting if necessary 
+and commit
+
+The <action> type attribute can be add,update,fix,remove.
+-->
+
+<document>
+    <properties>
+        <title>Changes</title>
+        <author email="dev@commons.apache.org">Apache Commons devlopers</author>
+    </properties>
+
+    <!-- NOTE: 
+    The description below is specially formatted so as to improve the layout of the generated release notes:
+    The parsing process removes all line feeds, replacing them with a single space.
+    The Velocity template in resources/templates has been enhanced to replace pairs of adjacent spaces
+    with a new-line in the release notes. (These spaces are ignored when displaying HTML).
+    If the output is not quite correct, check for invisible trailing spaces!
+    
+    N.B. The release notes template groups actions by type, and only extracts data for the current release.
+    The changes report outputs actions in the order they appear in this file.
+    
+    To regenerate the release notes:
+    mvn changes:announcement-generate -Prelease-notes [-Dchanges.version=nnn]
+
+    Defining changes.version allows one to create the RN without first removing the SNAPSHOT suffix.
+     -->
+
+    <body>
+        <release version="5.3" date="TBA" description="
+TBA
+        ">
+            <action issue="Bugzilla 52433" dev="sebb" type="fix">
+            Why using unstable sort at MethodGen.getLocalVariables() ?
+            </action>
+        </release>
+    </body>
+</document>

Propchange: commons/proper/bcel/trunk/src/changes/changes.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/bcel/trunk/src/changes/release-notes.vm
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/changes/release-notes.vm?rev=1299373&view=auto
==============================================================================
--- commons/proper/bcel/trunk/src/changes/release-notes.vm (added)
+++ commons/proper/bcel/trunk/src/changes/release-notes.vm Sun Mar 11 15:06:10 2012
@@ -0,0 +1,140 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##  http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+              Apache ${project.name} ${version} RELEASE NOTES
+
+The ${developmentTeam} is pleased to announce the release of ${finalName}
+
+$introduction.replaceAll("(?<!\015)\012", "
+")
+
+## N.B. the available variables are described here:
+## http://maven.apache.org/plugins/maven-changes-plugin/examples/using-a-custom-announcement-template.html
+##
+## Hack to improve layout: replace all pairs of spaces with a single new-line
+$release.description.replaceAll("  ", "
+")
+
+#if ($release.getActions().size() == 0)
+No changes defined in this version.
+#else
+Changes in this version include:
+
+## indent to be used if there is no issue attribute.
+## should be the same as the indent in the changes.xml file
+## less 2 spaces for the 'o' and trailing space
+#set($indent='          ')
+#if ($release.getActions('add').size() !=0)
+New features:
+#foreach($actionItem in $release.getActions('add'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue: #else$indent#end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end 
+#end
+
+#if ($release.getActions('fix').size() !=0)
+Fixed Bugs:
+#foreach($actionItem in $release.getActions('fix'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue: #else$indent#end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('update').size() !=0)
+Changes:
+#foreach($actionItem in $release.getActions('update'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue: #else$indent#end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('remove').size() !=0)
+Removed:
+#foreach($actionItem in $release.getActions('remove'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue: #else$indent#end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+## End of main loop
+#end
+
+For complete information on ${project.name}, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache ${project.name} website:
+
+${project.url}
+
+

Propchange: commons/proper/bcel/trunk/src/changes/release-notes.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java?rev=1299373&r1=1299372&r2=1299373&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java Sun Mar 11 15:06:10 2012
@@ -18,6 +18,8 @@
 package org.apache.bcel.generic;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Stack;
@@ -349,37 +351,6 @@ public class MethodGen extends FieldGenO
     }
 
 
-    /**
-     * Sort local variables by index
-     */
-    private static final void sort( LocalVariableGen[] vars, int l, int r ) {
-        int i = l, j = r;
-        int m = vars[(l + r) / 2].getIndex();
-        LocalVariableGen h;
-        do {
-            while (vars[i].getIndex() < m) {
-                i++;
-            }
-            while (m < vars[j].getIndex()) {
-                j--;
-            }
-            if (i <= j) {
-                h = vars[i];
-                vars[i] = vars[j];
-                vars[j] = h; // Swap elements
-                i++;
-                j--;
-            }
-        } while (i <= j);
-        if (l < j) {
-            sort(vars, l, j);
-        }
-        if (i < r) {
-            sort(vars, i, r);
-        }
-    }
-
-
     /*
      * If the range of the variable has not been set yet, it will be set to be valid from
      * the start to the end of the instruction list.
@@ -399,7 +370,11 @@ public class MethodGen extends FieldGenO
             }
         }
         if (size > 1) {
-            sort(lg, 0, size - 1);
+            Arrays.sort(lg, new Comparator<LocalVariableGen>() {
+                public int compare(LocalVariableGen o1, LocalVariableGen o2) {
+                    return o1.getIndex() - o2.getIndex();
+                }
+            });
         }
         return lg;
     }