Calling a Java static method with generics from Scala

Codey McCodeface

I have a Java method of the form

    public interface JavaInterface< T extends A >{
        static < T extends A > JavaInterface< T > callThis(){
         //I want to call this in scala

        }
    }

In Scala I write

val x = JavaInterface[SomeClass].callThis()

but I get an error telling me it "is not a value". How do I call that static method in Scala?

Joe

You want:

val x = JavaInterface.callThis[SomeClass]()

It's the method, not the type, that's parameterised for static methods.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Calling a static void Java method from JNI

From Java

Calling Java Main method from static block

From Java

Calling an overloaded java generic method from scala

From Java

calling static method in java

From Dev

scala - How to call public static method defined in Java from Scala?

From Dev

Efficiency of java static method calling

From Dev

Calling a non static method from a in a static context

From Dev

Spark - UnsupportedOperationException when calling Java method from Scala code

From Java

Calling Java method that receive variable amount of parameters from Scala

From Dev

Calling Scala Method from Java - Set<Object> or Set<Long>?

From Java

What does :_* do when calling a Java vararg method from Scala?

From Java

calling a super method from a static method

From Dev

How to return from Scala method with generics

From Dev

scala override static java method

From Dev

java 8 method reference calling non static method in a static way

From Java

calling non-static method in static method in Java

From Dev

Calling a Java method with unknown type and passing the result in another Java method from Scala doesn't compile

From Javascript

Calling an overridden static method from parent

From Dev

Calling super static method from designated initializer

From Dev

calling static method from inside the class

From Dev

Calling a static method from NSTimer. Is it possible?

From Dev

Calling a static template method from a template function

From Dev

Calling static method from inside a task

From Dev

Calling a static method from a generic constraint Dart

From Dev

Calling a static method from cshtml file

From Dev

Calling java non-static method in Clojure

From Dev

Java calling kotlin method and expecting it to be static

From Java

Calling Java Generic Typed Method from Scala gives a Type mismatch error : Scala

From Dev

Scala factory method with generics

Related Related

  1. 1

    Calling a static void Java method from JNI

  2. 2

    Calling Java Main method from static block

  3. 3

    Calling an overloaded java generic method from scala

  4. 4

    calling static method in java

  5. 5

    scala - How to call public static method defined in Java from Scala?

  6. 6

    Efficiency of java static method calling

  7. 7

    Calling a non static method from a in a static context

  8. 8

    Spark - UnsupportedOperationException when calling Java method from Scala code

  9. 9

    Calling Java method that receive variable amount of parameters from Scala

  10. 10

    Calling Scala Method from Java - Set<Object> or Set<Long>?

  11. 11

    What does :_* do when calling a Java vararg method from Scala?

  12. 12

    calling a super method from a static method

  13. 13

    How to return from Scala method with generics

  14. 14

    scala override static java method

  15. 15

    java 8 method reference calling non static method in a static way

  16. 16

    calling non-static method in static method in Java

  17. 17

    Calling a Java method with unknown type and passing the result in another Java method from Scala doesn't compile

  18. 18

    Calling an overridden static method from parent

  19. 19

    Calling super static method from designated initializer

  20. 20

    calling static method from inside the class

  21. 21

    Calling a static method from NSTimer. Is it possible?

  22. 22

    Calling a static template method from a template function

  23. 23

    Calling static method from inside a task

  24. 24

    Calling a static method from a generic constraint Dart

  25. 25

    Calling a static method from cshtml file

  26. 26

    Calling java non-static method in Clojure

  27. 27

    Java calling kotlin method and expecting it to be static

  28. 28

    Calling Java Generic Typed Method from Scala gives a Type mismatch error : Scala

  29. 29

    Scala factory method with generics

HotTag

Archive