Class ImportConflictDetector

java.lang.Object
spoon.processing.AbstractProcessor<CtElement>
spoon.reflect.visitor.ImportConflictDetector
All Implemented Interfaces:
FactoryAccessor, Processor<CtElement>

public class ImportConflictDetector extends AbstractProcessor<CtElement>
Detects conflicts needed to be required be a fully-qualified name. 1) Example: conflict of field name with an variable name and fixes it by making field target explicit.
 class A {
  int xxx;
  void m(String xxx) {
    this.xxx //the target `this.` must be explicit, otherwise parameter `String xxx` hides it
  }
 }
2) Example: conflict of package name with an variable name and fixes it by making field target implicit.
 class A {
  int com;
  void m() {
    com.package.Type.doSomething(); //the package `com` is in conflict with field `com`. Must be imported
  }
 }
and fixes them by call of CtElement.setImplicit(boolean) and CtTypeReference.setSimplyQualified(boolean)
  • Field Details

  • Constructor Details

    • ImportConflictDetector

      public ImportConflictDetector()
  • Method Details