0

I would like to make sure that every method annotated with custom @MyMethod has at least one parameter annotated with @MyParam. Is it possible to enforce compile time, i.e. the below compiles, and without @MyParam in the args it would not compile.

@MyMethod
public void someMethod (int x, @MyParam int y) {
...
}

1 Answer 1

1

Yes, it is possible if you use annotation processing

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, annotation processing should do it, is anyone willing to provide a sample code snippet?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.