diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2009-05-29 01:16:27 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2009-05-29 01:16:27 (GMT) |
commit | e37968dcdb65b228ec5bf0f738ca9121dd9282f2 (patch) | |
tree | 63665c6846af12f3677bada7e512b7a6e6b9b8d6 /src | |
parent | fe651b112c2182a058312b8803b86b99db59f8ff (diff) | |
download | SCons-e37968dcdb65b228ec5bf0f738ca9121dd9282f2.zip SCons-e37968dcdb65b228ec5bf0f738ca9121dd9282f2.tar.gz SCons-e37968dcdb65b228ec5bf0f738ca9121dd9282f2.tar.bz2 |
Fix for issue 2088: Java version 5 is same as 1.5 and 6 is same as 1.6.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Tool/JavaCommon.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/JavaCommonTests.py | 27 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 6f513f1..cc2c536 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -65,7 +65,8 @@ if java_parsing: 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 @@ -171,7 +172,7 @@ if java_parsing: 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) diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py index 1d01087..92649b2 100644 --- a/src/engine/SCons/Tool/JavaCommonTests.py +++ b/src/engine/SCons/Tool/JavaCommonTests.py @@ -184,6 +184,23 @@ class Private { ] 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): @@ -386,6 +403,9 @@ public class Foo { 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): @@ -433,6 +453,10 @@ public class NestedExample 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""" @@ -535,6 +559,9 @@ public class Foo 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__": |