This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Error: Non-static method overrides static method
Chris> Sometimes I'm glad I only have to deal with bytecode. :0 Out of
Chris> curiosity, what means "evaluates `expr' for side effects"? Is
Chris> instanceOfFoo.instanceMethod().staticMethod()
Chris> somehow different to
Chris> instanceOfFoo.instanceMethod(); Foo.staticMethod();
Chris> or is there some other magic involved?
There's no real difference. One minor detail is that you can't
always make the source transformation from:
expr.staticMethod();
to:
expr;
Klass.staticMethod();
... since not all expressions are valid as statements.
Other than that, if the expression can't have a side effect, the
compiler is free to just drop it afaik. There are a couple instances
of this construct in Classpath, but my impression is that they are
usually mistakes where the intent was something else.
Tom