Name collision with Java builtin method

6 views
Skip to first unread message

Yuta Higuchi

unread,
Aug 11, 2017, 1:21:28 AM8/11/17
to ONOS Dynamic Configuration Brigade
Hi Gaurav, 

I've encountered another type of collision.

This time, .yang contained something like:

       container periodic-traceroute {
         ...
         leaf wait {
           ...
         }
       }

compiler generated wait() method on the .java file,
but it collides with Object#wait() which is declared final, and compilation of that file fails.

I'm not completely sure how to resolve this issue.
May be, maintain a blacklist of built-in methods names,
and if the method compiler attempt to create matches it,
add prefix or suffix. 

I'm hoping this approach will work assuming, 
no one will try to invoke method via reflection based on 
yang schema, which probably is unlikely.

What do you think?

Thanks,
Yuta



Yuta Higuchi

unread,
Aug 14, 2017, 7:13:51 PM8/14/17
to ONOS Dynamic Configuration Brigade
It turned out that actually, there already was a black listing mechanism to avoid stepping on Java defined keywords, etc.
I've added the wait and other methods defined on Object class to that black list.

Reply all
Reply to author
Forward
0 new messages