[java] support static final fields for -java-lib extern interfaces (closes #3091)

See #3091. @waneck please review if this is correct fix.

Also, what about defining externs for such interfaces by hand?