summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool/JavaCommonTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Tool/JavaCommonTests.py')
-rw-r--r--src/engine/SCons/Tool/JavaCommonTests.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py
index 40f0a47..358f675 100644
--- a/src/engine/SCons/Tool/JavaCommonTests.py
+++ b/src/engine/SCons/Tool/JavaCommonTests.py
@@ -418,6 +418,39 @@ public class NestedExample
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"""
+
+ input = """\
+class test
+{
+ test()
+ {
+ super();
+ new inner();
+ }
+
+ static class inner
+ {
+ private inner() {}
+ }
+}
+"""
+
+ # This is what we *should* generate, apparently due to the
+ # private instantiation of the inner class, but don't today.
+ #expect = [ 'test$1', 'test$inner', 'test' ]
+
+ # What our parser currently generates, which doesn't match
+ # what the Java compiler actually generates.
+ expect = [ 'test$inner', 'test' ]
+
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '1.4')
+ assert expect == classes, (expect, classes)
+
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input, '1.5')
+ assert expect == classes, (expect, classes)
+
if __name__ == "__main__":