Bug correction for classes with private methods

svn: r1920
This commit is contained in:
Kathy Gray 2006-01-21 23:14:52 +00:00
parent 2577fe88f3
commit cbb9f7bdf6
2 changed files with 23 additions and 9 deletions

View File

@ -509,7 +509,7 @@
(restricted-methods (make-method-names ;(append (accesses-package methods)
(accesses-protected methods);)
overridden-methods))
#;(make-gen-name
(make-gen-name
(lambda (m)
(build-generic-name (class-name)
((if (constructor? (id-string (method-name m))) build-constructor-name mangle-method-name)
@ -520,7 +520,7 @@
(append (accesses-public methods)
(accesses-package methods)
(accesses-protected methods))))
#;(private-generics (map make-gen-name (accesses-private methods)))
(private-generics (map make-gen-name (accesses-private methods)))
(names-for-dynamic (generate-dynamic-names (append (accesses-public methods)
(accesses-package methods)
(accesses-protected methods))
@ -660,7 +660,7 @@
(define private-methods
,(if (null? (accesses-private methods))
'(make-hash-table)
(build-method-table (accesses-private methods) null #;private-generics)))
(build-method-table (accesses-private methods) private-generics)))
,@(map (lambda (i) (translate-initialize (initialize-static i)
(initialize-block i)

View File

@ -4,12 +4,12 @@
(prepare-for-tests "Advanced")
;;Execution tests without errors
(interact-test
'advanced
'("null.m()")
'(error)
"Calling a method on null")
(execute-test
"public class X {
private int x() { return 3; }
}"
'advanced #f "Class with private method")
(execute-test
"public class Something {
@ -228,6 +228,20 @@ class WeeklyPlanner{
;;Interaction tests, mix of right and error
(interact-test
"public class X {
private int x() { return 3; }
}"
'advanced '("X y = new X();" "y.x()")
'((void) error) "Creating class with private method, and trying to access the method")
(interact-test
'advanced
'("null.m()")
'(error)
"Calling a method on null")
(interact-test 'advanced
(list "new int[3] instanceof int[] && true"
"((int[]) new int[3])[1]" "3/2")