Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning about "missing @Override" only shown for anonymous inner classes #706

Closed
mauromol opened this issue Sep 7, 2018 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@mauromol
Copy link

mauromol commented Sep 7, 2018

My workspace is configured to mark a "Missing @Override annotation" with a Warning, even for interface methods.

Consider this interface:

package test;
public interface I {
	void myMethod(String a, int b);
}

and this Groovy class:

package test
class A implements I {
	public void myMethod(String a, int b) {
		def i = new I() {
			public void myMethod(String a1, int b1) {
			}
		}
	}
}

You can see that A.myMethod(String, int) declaration is not marked with a warning, while new I().myMethod(String, int) is.

@eric-milles
Copy link
Member

At the moment, the difference exists because the anonymous inner types go through an extra resolve step to help with all the refactoring bugs. The error/warning is generated from org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements()

@eric-milles eric-milles self-assigned this Oct 12, 2018
eric-milles added a commit that referenced this issue Oct 16, 2018
- prevents missing @OverRide error/warning in next commit
eric-milles added a commit that referenced this issue Oct 16, 2018
Java steps happen serially for each CompUnitDecl, however Groovy resolve
is run all at once for all CompUnitDecl in the CompUnit.  So the steps
verifyMethods and resolve needed to be called in JDTResolver to ensure
proper sequencing and so a JDT scope is available for Groovy's resolve.

Resolving fields from the same spot resulted in error for enum constants
with statement bodies.
@eric-milles eric-milles added this to the v3.2.0 milestone Oct 17, 2018
@eric-milles
Copy link
Member

Ready to test

@mauromol
Copy link
Author

Verified in 3.2.0.xx-201810230255-e48, thank you 👍

@mauromol
Copy link
Author

Eric please note that this bug appears in https://github.com/groovy/groovy-eclipse/wiki/3.1.0-Release-Notes, while it should not (since its milestone is 3.2.0 and not 3.1.0).

@eric-milles
Copy link
Member

The warning was suppressed for 3.1.0 and is now supported for all methods in 3.2.0

@mauromol
Copy link
Author

Indeed, so I think this fix should not be in 3.1.0 release notes, should it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants