We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 668a4bd + 1df19df commit 822abecCopy full SHA for 822abec
core/src/main/ruby/jruby/java/core_ext/object.rb
@@ -22,6 +22,14 @@ def java_import(*import_classes)
22
import_classes.map do |import_class|
23
case import_class
24
when String
25
+ cc = java.lang.Character
26
+ valid_name = import_class.split(".").all? do |frag|
27
+ cc.java_identifier_start? frag[0].ord and
28
+ frag.each_char.all? {|c| cc.java_identifier_part? c.ord }
29
+ end
30
+ unless valid_name
31
+ raise ArgumentError.new "not a valid Java identifier: #{import_class}"
32
33
# pull in the class
34
import_class = JavaUtilities.get_proxy_class(import_class)
35
when Module
0 commit comments