jeudi 5 juillet 2018

Java annotation to make method parameters final

I am trying to create an annotation which makes all of the method arguments final.

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE,ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,ElementType.CONSTRUCTOR,ElementType.LOCAL_VARIABLE})
public @interface Final_In_Method {

Class<? extends Object> clazz = Runtime.getRuntime().getClass().getMethods();

      Method[] methods = Runtime.getRuntime().getClass().getDeclaredMethods();
      Parameter[] params = Arrays.stream(methods).forEach(method -> Arrays.stream(method.getParameters()).flatMap(parameter -> parameter));


      for(Parameter param : methods.)

    }
}

Need help further. Thanks.





Aucun commentaire:

Enregistrer un commentaire