Static method access dilemma and proposal: @NotInherited

Nick Williams nicholas+openjdk at
Thu Jun 27 12:13:26 PDT 2013

What about something like this (as an alternative to an annotation):

public static local void myMethod(String arg1, Object arg2, etc.) { }

I recognize that a new keyword is a more involved change than an annotation, but it also "feels" more right (to me), and an alternative was solicited. "local" might not be the best keyword, but it's the first thing that came to mind, and I like it.

Just a thought.


On Jun 27, 2013, at 2:01 PM, Brian Goetz wrote:

> Definitely not.  We don't add language features via 
> (implementation-specific) compiler switches!
> I don't disagree that there may be times when finer control over default 
> inheritance is desirable (though that's a completely separate issue than 
> the one being discussed on this thread.)  Its just that adding compiler 
> switches is not how we'd consider doing that.
> On 6/27/2013 2:35 PM, Daniel Latrémolière wrote:
>>> Anything that moves us towards being able to fix this problem
>>> over time is good.
>> Is a new compiler switch "-nodefaults" possible for helping removal
>> (step by step) of unsuitable Java defaults?
>> In this case, you can call javac with this switch and obtain
>> supplemental errors/warnings for bad behaviour (default constructor,
>> default imports, static method call for superclass, etc.).

More information about the lambda-dev mailing list