Skip to content

Commit

Permalink
Fixed compiler warnings in compiler.apt.model.ModuleElementImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveeclipse committed Dec 7, 2022
1 parent 1fa375b commit bc4bc6f
Showing 1 changed file with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement {

/**
* In general, clients should call
* {@link Factory#newDeclaredType(org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding)} or
* {@link Factory#newElement(org.eclipse.jdt.internal.compiler.lookup.Binding)}
* to create new instances.
*/
Expand Down Expand Up @@ -108,7 +107,7 @@ public List<? extends Element> getEnclosedElements() {
}
List<Element> enclosed = new ArrayList<>(unique.size());
for (PlainPackageBinding p : unique) {
PackageElement pElement = (PackageElement) _env.getFactory().newElement(p);
PackageElement pElement = (PackageElement) this._env.getFactory().newElement(p);
enclosed.add(pElement);
}
return Collections.unmodifiableList(enclosed);
Expand Down Expand Up @@ -176,37 +175,37 @@ public <R, P> R accept(ElementVisitor<R, P> visitor, P param) {
}
@Override
protected AnnotationBinding[] getAnnotationBindings() {
return ((ModuleBinding) _binding).getAnnotations();
return ((ModuleBinding) this._binding).getAnnotations();
}

abstract class PackageDirectiveImpl {
PackageBinding binding;
final PackageBinding binding1;
List<ModuleElement> targets;

PackageDirectiveImpl(PackageBinding pBinding) {
this.binding = pBinding;
this.binding1 = pBinding;
}

public PackageElement getPackage() {
return _env.getFactory().newPackageElement(binding);
return ModuleElementImpl.this._env.getFactory().newPackageElement(this.binding1);
}

public List<? extends ModuleElement> getTargetModules(String[] restrictions) {
if(this.targets != null) {
return targets;
return this.targets;
}
if (restrictions.length == 0) {
return (this.targets = null);
}
List<ModuleElement> targets = new ArrayList<>(restrictions.length);
List<ModuleElement> targets1 = new ArrayList<>(restrictions.length);
for (String string : restrictions) {
ModuleBinding target = ModuleElementImpl.this.binding.environment.getModule(string.toCharArray());
if (target != null) {
ModuleElement element = ((ModuleElement) _env.getFactory().newElement(target));
targets.add(element);
ModuleElement element = ((ModuleElement) ModuleElementImpl.this._env.getFactory().newElement(target));
targets1.add(element);
}
}
return (this.targets = Collections.unmodifiableList(targets));
return (this.targets = Collections.unmodifiableList(targets1));
}
}

Expand All @@ -228,14 +227,14 @@ public javax.lang.model.element.ModuleElement.DirectiveKind getKind() {

@Override
public PackageElement getPackage() {
return _env.getFactory().newPackageElement(binding);
return ModuleElementImpl.this._env.getFactory().newPackageElement(this.binding1);
}
@Override
public List<? extends ModuleElement> getTargetModules() {
if(this.targets != null) {
return targets;
return this.targets;
}
return getTargetModules(ModuleElementImpl.this.binding.getExportRestrictions(this.binding));
return getTargetModules(ModuleElementImpl.this.binding.getExportRestrictions(this.binding1));
}

}
Expand All @@ -261,7 +260,7 @@ public javax.lang.model.element.ModuleElement.DirectiveKind getKind() {

@Override
public ModuleElement getDependency() {
return (ModuleElement) _env.getFactory().newElement(dependency, ElementKind.MODULE);
return (ModuleElement) ModuleElementImpl.this._env.getFactory().newElement(this.dependency, ElementKind.MODULE);
}

@Override
Expand Down Expand Up @@ -294,17 +293,17 @@ public javax.lang.model.element.ModuleElement.DirectiveKind getKind() {
@Override
public List<? extends ModuleElement> getTargetModules() {
if(this.targets != null) {
return targets;
return this.targets;
}
return getTargetModules(ModuleElementImpl.this.binding.getOpenRestrictions(this.binding));
return getTargetModules(ModuleElementImpl.this.binding.getOpenRestrictions(this.binding1));
}
}

class UsesDirectiveImpl implements ModuleElement.UsesDirective {
TypeBinding binding = null;
final TypeBinding binding1;

UsesDirectiveImpl(TypeBinding binding) {
this.binding = binding;
this.binding1 = binding;
}

@Override
Expand All @@ -319,7 +318,7 @@ public DirectiveKind getKind() {

@Override
public TypeElement getService() {
return (TypeElement) _env.getFactory().newElement(binding);
return (TypeElement) ModuleElementImpl.this._env.getFactory().newElement(this.binding1);
}

}
Expand Down Expand Up @@ -354,7 +353,7 @@ public List<? extends TypeElement> getImplementations() {
}

List<TypeElement> list = new ArrayList<>(implementations2.length);
Factory factory = _env.getFactory();
Factory factory = ModuleElementImpl.this._env.getFactory();
for (TypeBinding type: implementations2) {
TypeElement element = (TypeElement) factory.newElement(type);
list.add(element);
Expand All @@ -364,7 +363,7 @@ public List<? extends TypeElement> getImplementations() {

@Override
public TypeElement getService() {
return (TypeElement) _env.getFactory().newElement(this.service);
return (TypeElement) ModuleElementImpl.this._env.getFactory().newElement(this.service);
}
}
}

0 comments on commit bc4bc6f

Please sign in to comment.