Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't call static method on Java 8 interface #1899

Closed
robbiev opened this Issue Aug 13, 2014 · 1 comment

Comments

Projects
None yet
3 participants
@robbiev
Copy link

robbiev commented Aug 13, 2014

Example:

$ cat java8.rb 
require 'java'
puts Java::Java8Class.message
puts Java::Java8Interface.message

Expected

$ ./bin/jruby java8.rb 
hello
hello

Actual

$ ./bin/jruby java8.rb 
hello
NoMethodError: undefined method `message' for Java::Default::Java8Interface:Module
  (root) at java8.rb:3

This is the Java code in the example:

$ cat Java8Interface.java 
public interface Java8Interface {
  static String message() {
    return "hello";
  }
}

$ cat Java8Class.java 
public class Java8Class {
  public static String message() {
    return "hello";
  }
}

To run:

$ javac *.java
$ ./bin/jruby java8.rb 

Version info:

$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

$ javac -version
javac 1.8.0_05

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home

$ ./bin/jruby -v
jruby 1.7.13 (1.9.3p392) 2014-06-24 43f133c on Java HotSpot(TM) 64-Bit Server VM 1.8.0_05-b13 +indy [darwin-x86_64]

headius added a commit that referenced this issue Aug 13, 2014

@headius

This comment has been minimized.

Copy link
Member

headius commented Aug 13, 2014

Should be fixed for 1.7.14+. Thanks for reporting this...I forgot to look into it after Java 8 came out.

@headius headius closed this Aug 13, 2014

@headius headius added this to the JRuby 1.7.14 milestone Aug 13, 2014

@headius headius self-assigned this Aug 13, 2014

@enebo enebo modified the milestones: JRuby 1.7.14, JRuby 1.7.15 Aug 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.