Yes, this is type inference based on the target of the assignment, as per JLS section 15.12.2.8. To be explicit, you’d call something like:
Foo.<String>createFoo();
More Related Contents:
- Generic type inference not working with method chaining?
- Java type inference: reference is ambiguous in Java 8, but not Java 7
- Why can this generic method with a bound return any type?
- A peculiar feature of exception type inference in Java 8
- Collections.emptyList() returns a List?
- Cannot use Java 8 method with lambda arguments without specifying type arguments
- What does the ‘static’ keyword do in a class?
- Java generics type erasure: when and what happens?
- What are the reasons why Map.get(Object key) is not (fully) generic
- How to determine the class of a generic type?
- Why can’t we use ‘this’ keyword in a static method
- How to use Class in Java?
- Invoking a static method using reflection
- Why we can’t do List mylist = ArrayList(); [duplicate]
- Comparing the values of two generic Numbers
- How to have Java method return generic list of any type?
- Are static variables inherited
- Casting to generic type in Java doesn’t raise ClassCastException?
- Nested wildcards
- Type erasure, overriding and generics
- How to create ArrayList (ArrayList) from array (int[]) in Java
- How would contravariance be used in Java generics?
- mocking a method that return generics with wildcard using mockito
- Using a generic class to perform basic arithmetic operations
- Unbounded wildcards in Java
- Why generic type is not applicable for argument extends super class for both?
- What do < and > mean such as implements Comparable?
- Consumer mapped Class in HashMap
- Java generics, Unbound wildcards vs
- Static method in Java can be accessed using object instance [duplicate]