I'm getting ready to roll up my sleeves and integrate java.util.concurrent support because I need this yesterday. Has anyone already made these changes? Should I post the results here?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Wow, that wasn't too hard. The following must be changed in RetroWeaver.java:
// Change all references from java.lang.Enum to our own Enum_ class
// which is signature compatible with Enum.
//
if ( newName.indexOf( "java/lang/Enum" ) != -1 ) {
// System.out.println( "Replacing Enum." );
newName = newName.replace( "java/lang/Enum", "com/rc/retroweaver/runtime/Enum_" );
}
// Change all references from java.util.concurrent.ConcurrentHashMap to edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap (GW).
if ( newName.indexOf( "java/util/concurrent/ConcurrentHashMap" ) != -1 ) {
// System.out.println( "Replacing ConcurrentHashMap." );
newName = newName.replace( "java/util/concurrent/ConcurrentHashMap", "edu/emory/mathcs/backport/java/util/concurrent/ConcurrentHashMap" );
}
// Change all references from java.util.concurrent.CopyOnWriteArrayList to edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList (GW).
if ( newName.indexOf( "java/util/concurrent/CopyOnWriteArrayList" ) != -1 ) {
// System.out.println( "Replacing CopyOnWriteArrayList." );
newName = newName.replace( "java/util/concurrent/CopyOnWriteArrayList", "edu/emory/mathcs/backport/java/util/concurrent/CopyOnWriteArrayList" );
}
// Change all references from java.util.concurrent.CopyOnWriteArraySet to edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet (GW).
if ( newName.indexOf( "java/util/concurrent/CopyOnWriteArraySet" ) != -1 ) {
// System.out.println( "Replacing CopyOnWriteArraySet." );
newName = newName.replace( "java/util/concurrent/CopyOnWriteArraySet", "edu/emory/mathcs/backport/java/util/concurrent/CopyOnWriteArraySet" );
}
I changed the following in build.xml so that the edu.emory.mathcs.backport.* classes will automatically get included in retroweaver-rt.jar (assuming the backport classes are in lib\):
There's a little problem: the backport classes are in a edu.emory.mathcs.backport.java.concurrent.* hierarchy, and RetroWeaver does naive replacements that ignore substring position. This means that running RetroWeaver multiple times on the same class files will result in edu/emory/mathcs/backport/edu/emory/mathcs/backport/java...
1. RetroWeaver's replacement algorithm should be updated to make sure the replaced strings are prefixes instead of substrings.
2. RetroWeaver should be updated to include other JDK 5.0 concurrent collections.
3. Now that more than two or three classes are being included, the hard-coded strings should be replaced with some collection of class names and their replacements---or better yet, a configuration file.
I don't mind doing all this, but I'd like to have a tidy place to dump this so that I don't have to do this work all over again whenever the next official version is released. Is there a Subversion repository I can get permission to access?
Garret
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Toby,
Any ideas about the timeframe of the next version.
There are a couple of fixes that all retroweaver users are eagerly waiting for.
- verifer improvements
- class literals bug
- java.util.concurrent (which could be replaced by http://www.mathcs.emory.edu/dcl/util/backport-util-concurrent/\)
- ant task improvements
-1170383
-1124707
I already submitted some patches for some of this issues, and I would also be willing to help integrate them into the codebase if you want.
Mike
I'm getting ready to roll up my sleeves and integrate java.util.concurrent support because I need this yesterday. Has anyone already made these changes? Should I post the results here?
Wow, that wasn't too hard. The following must be changed in RetroWeaver.java:
// Change all references from java.lang.Enum to our own Enum_ class
// which is signature compatible with Enum.
//
if ( newName.indexOf( "java/lang/Enum" ) != -1 ) {
// System.out.println( "Replacing Enum." );
newName = newName.replace( "java/lang/Enum", "com/rc/retroweaver/runtime/Enum_" );
}
// Change all references from java.util.concurrent.ConcurrentHashMap to edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap (GW).
if ( newName.indexOf( "java/util/concurrent/ConcurrentHashMap" ) != -1 ) {
// System.out.println( "Replacing ConcurrentHashMap." );
newName = newName.replace( "java/util/concurrent/ConcurrentHashMap", "edu/emory/mathcs/backport/java/util/concurrent/ConcurrentHashMap" );
}
// Change all references from java.util.concurrent.CopyOnWriteArrayList to edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList (GW).
if ( newName.indexOf( "java/util/concurrent/CopyOnWriteArrayList" ) != -1 ) {
// System.out.println( "Replacing CopyOnWriteArrayList." );
newName = newName.replace( "java/util/concurrent/CopyOnWriteArrayList", "edu/emory/mathcs/backport/java/util/concurrent/CopyOnWriteArrayList" );
}
// Change all references from java.util.concurrent.CopyOnWriteArraySet to edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet (GW).
if ( newName.indexOf( "java/util/concurrent/CopyOnWriteArraySet" ) != -1 ) {
// System.out.println( "Replacing CopyOnWriteArraySet." );
newName = newName.replace( "java/util/concurrent/CopyOnWriteArraySet", "edu/emory/mathcs/backport/java/util/concurrent/CopyOnWriteArraySet" );
}
I changed the following in build.xml so that the edu.emory.mathcs.backport.* classes will automatically get included in retroweaver-rt.jar (assuming the backport classes are in lib\):
<unjar src="lib\backport-util-concurrent.jar" dest="${classes.new.dir}"/>
<jar destfile="${release.dir}/retroweaver-rt.jar">
<fileset dir="${classes.new.dir}">
<include name="com/rc/retroweaver/runtime/*.class"/>
<include name="edu/emory/mathcs/backport/**/*.class"/>
</fileset>
</jar>
There's a little problem: the backport classes are in a edu.emory.mathcs.backport.java.concurrent.* hierarchy, and RetroWeaver does naive replacements that ignore substring position. This means that running RetroWeaver multiple times on the same class files will result in edu/emory/mathcs/backport/edu/emory/mathcs/backport/java...
1. RetroWeaver's replacement algorithm should be updated to make sure the replaced strings are prefixes instead of substrings.
2. RetroWeaver should be updated to include other JDK 5.0 concurrent collections.
3. Now that more than two or three classes are being included, the hard-coded strings should be replaced with some collection of class names and their replacements---or better yet, a configuration file.
I don't mind doing all this, but I'd like to have a tidy place to dump this so that I don't have to do this work all over again whenever the next official version is released. Is there a Subversion repository I can get permission to access?
Garret