SHARE
TWEET

Untitled

a guest Jun 18th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.lang.reflect.*;
  2. import java.util.Arrays;
  3.  
  4. class Test {
  5.     class Inner {
  6.         public <T> Inner(T arg) {}
  7.     }
  8.  
  9.     public static void main(String[] args) {
  10.         Constructor<?> constructor = Test.Inner.class.getConstructors( )[0];
  11.         System.out.println(
  12.             "Regular parameters: " +
  13.             Arrays.toString(constructor.getParameterTypes()) +
  14.             "nGeneric parameters: " +
  15.             Arrays.toString(constructor.getGenericParameterTypes())
  16.         );
  17.     }
  18. }
  19.      
  20. Test.Inner foo = new Test().new Inner(new Object());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top