RELEASE 0.97 - XXX
+ From Anonymous:
+
+ - Fix Java parsing to avoid erroneously identifying a new array
+ of class instances as an anonymous inner class.
+
From Chad Austin:
- Allow Help() to be called multiple times, appending to the help
# A regular expression that will find, in a java file: newlines;
# any alphanumeric token (keyword, class name, specifier); open or
# close brackets; a single-line comment "//"; the multi-line comment
- # begin and end tokens /* and */; single or double quotes; and
- # single or double quotes preceeded by a backslash.
+ # begin and end tokens /* and */; single or double quotes;
+ # single or double quotes preceeded by a backslash; array
+ # declarations "[]".
_reToken = re.compile(r'(\n|//|\\[\'"]|[\'"\{\}]|[A-Za-z_][\w\.]*|' +
- r'/\*|\*/)')
+ r'/\*|\*/|\[\])')
class OuterState:
"""The initial state for parsing a Java file for classes,
assert pkg_dir == os.path.join('com', 'sub', 'foo'), pkg_dir
assert classes == ['Example1'], classes
+ def test_arrays(self):
+ """Test arrays of class instances"""
+
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
+public class Test {
+ MyClass abc = new MyClass();
+ MyClass xyz = new MyClass();
+ MyClass _array[] = new MyClass[] {
+ abc,
+ xyz
+ }
+}
+""")
+ assert pkg_dir == None, pkg_dir
+ assert classes == ['Test'], classes
+
if __name__ == "__main__":
suite = unittest.TestSuite()
tclasses = [ parse_javaTestCase ]