Skip to content

Instantly share code, notes, and snippets.

@joa
Created July 30, 2015 10:42
Show Gist options
  • Select an option

  • Save joa/b33da09d811e8f269fe9 to your computer and use it in GitHub Desktop.

Select an option

Save joa/b33da09d811e8f269fe9 to your computer and use it in GitHub Desktop.

Revisions

  1. joa created this gist Jul 30, 2015.
    19 changes: 19 additions & 0 deletions Foo.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    import java.lang.reflect.Constructor;
    import java.util.Arrays;
    import java.util.List;

    public final class Foo {
    public static void main(String[] args) {
    final Constructor<?>[] ctors = A.class.getDeclaredConstructors();
    for(Constructor<?> ctor : ctors) {
    System.out.println(Arrays.toString(ctor.getParameterTypes()));
    System.out.println(Arrays.toString(ctor.getGenericParameterTypes()));
    System.out.println();
    }
    }

    private class A {
    A(String a) {}
    A(List<String> a) {}
    }
    }