| Summary: | [xtend] Highlight unused fields | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sebastian Zarnekow <sebastian.zarnekow> |
| Component: | Xtext | Assignee: | Holger Schill <Holger.Schill> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | Holger.Schill, sven.efftinge |
| Version: | 2.1.0 | Flags: | sven.efftinge:
juno+
|
| Target Milestone: | M4 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Sebastian Zarnekow
No marker for protected or public fields members, please. Unused local variables should also be marked. pushed validation for XtendField and XVariableDeclaration and tests for that to master. As Sven mentioned only with warnings for private fields and variables. Cool, thanks! We'd need this for private methods as well. No problem. pushed validation and tests for unused XFunctions with resprect to dispatch functions to master. The validation marks used extension fields. fixed in head I don't think that it's a good idea to search usages for all members of each declared extension. a) it would miss the members of the super type b) it would result in false positives The problem is likely caused by the algorithm in the cross references which uses allContents to traverse the content of a resource / an object: XFeatureCall feature = allContents.next() (assuming XFeatureCall#getFeature is still a proxy) references = feature.allReferences XFeatureCall#implicitReceiver = references.next == null XFeatureCall#feature = references.next -> resolve -> #implicitReceiver is set but not considered by the subsequent references.next We may have to use a subclass of UsageCrossReferencer and override boolean containment(EObject eObject) where we could check for XAbstractFeatureCall and invoke #getFeature eager before any cross ref processing happens. (In reply to comment #8) > The problem is likely caused by the algorithm in the cross references which > uses allContents to traverse the content of a resource / an object: > Sven pointed out that it is rather unlikely to be caused by that. When the validation kicks in, all references are already resolved. So what should we so? So what should we do? What I understood is that we should search for XFeatureCalls in the container that use a feature of the type of the extension field. There we should find out if the feature is a feature of the type itself or one of the superclasses? Ok I'll try that. The problem is cause by the semantics of Eobject#eContents Containment references that are marked as derived are not considered by eContents thus the usages will not found. We need a custom model traversal for that, e.g. override UsageCrossReferencer#newContentsIterator and ContentTreeIterator.getEObjectChildren(EObject) and return the derived #implicitXYZ containments as children, too iff the EObject is an XAbstractFeatureCall Introduced org.eclipse.xtext.xbase.util.XbaseUsageCrossReferencer. Fixed in head. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |