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

Groovy-eclipse sees Traits as interfaces and urges to implement its methods #1267

Closed
injecteer opened this issue Jun 11, 2021 · 13 comments
Closed
Assignees
Labels
Milestone

Comments

@injecteer
Copy link

injecteer commented Jun 11, 2021

I have a super-class implementing 2 traits:

class CRUDController<T extends MongoEntity> implements ControllerTrait, I18nTrait {...}

and it's sub-class:

class ScreenController extends CRUDController<Screen> {...}

The Eclipse of Version: 2021-03 (4.19.0) with Eclipse Groovy Development Tools 4.2.0.v202106101948-e2103 complains in a sub-class about not implemented methods and as quick fixes suggests to either make the class abstract or implement the methods:

image

The traits must supported also in sub-classes as they are compiled by Groovy compiler (ver. 3) just fine.

@eric-milles
Copy link
Member

Can you provide a simple and complete example? Traits are supported, although there are some rough edges since they cannot be fully represented in the Java model.

@injecteer
Copy link
Author

repro.zip

the class SubClass.groovy demonstrates the behaviour

@eric-milles
Copy link
Member

I think this error is in the editor only. Can you confirm that it does not show up in the Problems view and you can compile and test your project successfully?

@injecteer
Copy link
Author

Yes, it's in editor only, the errors do not appear in "Problems"

@eric-milles eric-milles self-assigned this Jun 13, 2021
@eric-milles eric-milles added this to the v4.2.0 milestone Jun 13, 2021
eric-milles added a commit that referenced this issue Jun 13, 2021
* don't add abstract modifier to private interface method
@eric-milles
Copy link
Member

ready to test

@injecteer
Copy link
Author

Looks much better thanks.

The other problem is, that in Editor for classes with @TypeChecked the trait methods are marked with "not found"

image

@eric-milles
Copy link
Member

Can you update your sample project to demonstrate?

@injecteer
Copy link
Author

here you go:

image
repro.zip

@eric-milles
Copy link
Member

ready to test

@injecteer
Copy link
Author

I don't get any new snapshots from https://dist.springsource.org/snapshot/GRECLIPSE/e4.19 now

@eric-milles
Copy link
Member

You may need to restart eclipse for it to reload the update site metadata.

@injecteer
Copy link
Author

it took a while to upgrade eclipse and reinstall Groovy feature 4.19 -> 4.20, but now I don't get any warnings about traits.
Well done!

@eric-milles
Copy link
Member

Cheers. And thanks for filing an issue.

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