interfaces, and anonymous inner classes."""
def __init__(self, version=default_java_version):
- if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6'):
+ if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6',
+ '5', '6'):
msg = "Java version %s not supported" % version
raise NotImplementedError, msg
if self.version in ('1.1', '1.2', '1.3', '1.4'):
clazz = self.listClasses[0]
self.listOutputs.append('%s$%d' % (clazz, self.nextAnon))
- elif self.version in ('1.5', '1.6'):
+ elif self.version in ('1.5', '1.6', '5', '6'):
self.stackAnonClassBrackets.append(self.brackets)
className = []
className.extend(self.listClasses)
]
assert classes == expect, (expect, classes)
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '5')
+ assert pkg_dir is None, pkg_dir
+ expect = [
+ 'Empty',
+ 'Listener',
+ 'Test$Inner$1',
+ 'Test$Inner',
+ 'Test$Inner2',
+ 'Test$Inner3',
+ 'Test$1',
+ 'Test$1$1',
+ 'Test',
+ 'Private$1',
+ 'Private',
+ ]
+ assert classes == expect, (expect, classes)
+
def test_comments(self):
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '1.5')
assert classes == ['Foo$1', 'Foo$1$1', 'Foo'], classes
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '6')
+ assert classes == ['Foo$1', 'Foo$1$1', 'Foo'], classes
+
def test_nested_anonymous_inner_classes(self):
expect = [ 'NestedExample$1', 'NestedExample$1$1', 'NestedExample' ]
assert expect == classes, (expect, classes)
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '6')
+ expect = [ 'NestedExample$1', 'NestedExample$1$1', 'NestedExample' ]
+ assert expect == classes, (expect, classes)
+
def test_private_inner_class_instantiation(self):
"""Test anonymous inner class generated by private instantiation"""
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '1.6')
assert expect == classes, (expect, classes)
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '6')
+ assert expect == classes, (expect, classes)
+
if __name__ == "__main__":