vazexqi / CodingSpectator

Watches and analyzes code edits in the Eclipse IDE non-invasively
http://codingspectator.cs.illinois.edu
Other
20 stars 14 forks source link

Descriptors of unavailable refactorings do not contain the required attributes #202

Closed reprogrammer closed 13 years ago

reprogrammer commented 13 years ago

The descriptor of the use super type refactoring is supposed to have a few attributes (See org.eclipse.jdt.core.refactoring.descriptors.UseSupertypeDescriptor.UseSupertypeDescriptor(String, String, String, Map, int) for more details). But, the descriptors that CodingSpectator generates for unavailable invocations of the use super type refactoring do not have the expected attributes. As a result, test usesupertype.T01 fails because the descriptors generated by CodingSpectator cannot be parsed.

reprogrammer commented 13 years ago

@vazexqi: I just realized that our fix does not work because CodingSpectator relies on the existence of the Java project for constructing the most specific refactoring descriptors. By the most specific refactoring descriptors I mean classes such as UseSupertypeDescriptor and IntroduceParameterObjectDescriptor rather than class such as RefactoringDescriptor, DefaultRefactoringDescriptor and JavaRefactoringDescriptor. We missed this issue because CodingSpectator parses the refactoring logs when the original Java project is still available.

reprogrammer commented 13 years ago

@vazexqi: I think a better solution is to make RefactoringLog return instances of DefaultRefactoringDescriptor instead of JavaRefactoringDescriptor. I think it would be sufficient to make org.eclipse.ltk.internal.core.refactoring.history.RefactoringContributionManager.createDescriptor(String, String, String, String, Map, int) return instances of DefaultRefactoringDescriptor when called from RefactoringLog. If this fix works, we won't need the captured-by-codingspectator attribute. So, I suggest to remove this attribute simply because we don't insert it into the descriptors that Eclipse generates. In other words, the captured-by-codingspectator attribute doesn't help us in parsing the descriptors captured by Eclipse.

reprogrammer commented 13 years ago

@vazexqi: I made the test framework create instances of DefaultRefactoringDescriptor from the refactoring log files. So, we no longer need the captured-by-codingspectator attribute. But, I've kept it since it might be helpful to have an easy way to identify the descriptor generated by CodingSpectator.