Skip to content

Commit

Permalink
Modify Java typer to gracefully fail to infer if it can't resolve Jav…
Browse files Browse the repository at this point in the history
…a classes for incoming types.

git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@7612 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
headius committed Aug 31, 2008
1 parent 62597f6 commit 2c94e5f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/ruby/site_ruby/1.8/duby/plugin/java.rb
Expand Up @@ -20,8 +20,13 @@ def mapped_type(type)
end

def method_type(typer, target_type, name, parameter_types)
java_type = Java::JavaClass.for_name(mapped_type(target_type).name)
arg_types = parameter_types.map {|type| Java::JavaClass.for_name(mapped_type(type).name)}
begin
java_type = Java::JavaClass.for_name(mapped_type(target_type).name)
arg_types = parameter_types.map {|type| Java::JavaClass.for_name(mapped_type(type).name)}
rescue NameError
log "Failed to infer Java types for method \"#{name}\" #{parameter_types} on #{target_type}"
return nil
end
method = java_type.java_method(name, *arg_types)

result = AST::type(method.return_type.name)
Expand Down

0 comments on commit 2c94e5f

Please sign in to comment.