I’m really having problems sleeping lately, so tonight I’ve been doing some thinking about @SuppressSubtypingWarning
. At first, I thought I’d just bake it into the PredicateLink
and Combine
meta-annotations, but then it would mean that an annotation will always suppress subtyping warnings, and I don’t think that’s desired.
So the @SuppressSubtypingWarning
annotation has to be a meta-annotation that gets applied to an annotation at the usage site. For example:
@SuppressSubtypingWarning @OnlyEventThread.AfterRealized
private void handleButton() {
System.out.println("Button was pushed");
final Thread ct = Thread.currentThread();
System.out.println("thread name = '" + ct.getName() + "'");
System.out.println("thread id = " + ct.getId());
System.out.println("thread grp = '" + ct.getThreadGroup().getName() + "'");
}
Unfortunately, Java’s grammar doesn’t let you apply annotations to the usage sites of other annotations, only to their definitions. So this approach isn’t going to work.
I could use a @SuppressSubtypingWarning
annotation applied to a class or method to completely disable subtyping warnings for all annotations on that class or method, but I’d rather have it fine-grained. I’ll have to think some more about it.