Remove outdated hack when Class.parent could be non-null for root classes

This commit is contained in:
Alexey Andreev 2017-10-29 21:41:49 +03:00
parent 680f0dabb5
commit 25011ee7a6
9 changed files with 15 additions and 16 deletions

View File

@ -302,7 +302,7 @@ public class WasmClassGenerator {
if (cls.getName().equals(Structure.class.getName()) || cls.getName().equals(Function.class.getName())) {
return false;
}
if (cls.getParent() == null || cls.getParent().equals(cls.getName())) {
if (cls.getParent() == null) {
return true;
}
cls = classSource.get(cls.getParent());
@ -385,7 +385,7 @@ public class WasmClassGenerator {
data.start = -1;
data.function = true;
return;
} else if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
} else if (cls.getParent() != null) {
addClass(ValueType.object(cls.getParent()));
ClassBinaryData parentData = binaryDataMap.get(ValueType.object(cls.getParent()));
data.size = parentData.size;

View File

@ -292,7 +292,7 @@ public class DependencyChecker implements DependencyInfo {
}
ClassReader cls = classSource.get(className);
if (cls != null) {
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
addClassAccess(node, cls.getParent(), loc);
}
for (String iface : cls.getInterfaces()) {
@ -306,7 +306,7 @@ public class DependencyChecker implements DependencyInfo {
ClassReader cls = classSource.get(className);
ClassDependency dependency = new ClassDependency(this, className, cls);
if (!dependency.isMissing()) {
if (cls.getParent() != null && !cls.getParent().equals(className)) {
if (cls.getParent() != null) {
linkClass(cls.getParent(), null);
}
for (String ifaceName : cls.getInterfaces()) {

View File

@ -33,7 +33,7 @@ public interface ClassReaderSource {
ClassReader currentClass = get(name);
@Override public ClassReader next() {
ClassReader result = currentClass;
if (currentClass.getParent() != null && !currentClass.getName().equals(currentClass.getParent())) {
if (currentClass.getParent() != null) {
currentClass = get(currentClass.getParent());
} else {
currentClass = null;
@ -120,7 +120,7 @@ public interface ClassReaderSource {
if (cls == null) {
return Optional.empty();
}
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
if (isSuperType(superType, cls.getParent()).orElse(false)) {
return Optional.of(true);
}

View File

@ -94,7 +94,7 @@ public class TagRegistry {
return null;
}
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
String candidate = findTopmostImplementor(classSource, cls.getParent(), ifaceName);
if (candidate != null) {
return candidate;

View File

@ -75,7 +75,7 @@ public class ClassInitializerEliminator {
if (cls == null) {
return false;
}
if (cls.getParent() == null || cls.getName().equals(cls.getParent())) {
if (cls.getParent() == null) {
return false;
}
className = cls.getParent();

View File

@ -235,7 +235,7 @@ public class AsyncMethodFinder {
private Set<MethodReference> findOverriddenMethods(ClassReader cls, MethodReference methodRef) {
List<String> parents = new ArrayList<>();
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
parents.add(cls.getParent());
}
parents.addAll(cls.getInterfaces());
@ -266,7 +266,7 @@ public class AsyncMethodFinder {
result.add(methodRef);
}
} else {
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
findOverriddenMethods(new MethodReference(cls.getParent(), methodRef.getDescriptor()), result, visited);
}
for (String iface : cls.getInterfaces()) {

View File

@ -213,7 +213,7 @@ class JSClassProcessor {
}
}
} else if (typeHelper.isJavaScriptImplementation(cls.getName())) {
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
ClassReader parentCls = classSource.get(cls.getParent());
if (parentCls != null) {
findInheritedMethods(parentCls, methods, visited);
@ -718,8 +718,7 @@ class JSClassProcessor {
if (method != null) {
return method;
}
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())
&& !cls.getParent().equals("java.lang.Object")) {
if (cls.getParent() != null && !cls.getParent().equals("java.lang.Object")) {
method = getMethod(new MethodReference(cls.getParent(), ref.getDescriptor()));
if (method != null) {
return method;

View File

@ -184,7 +184,7 @@ class JSObjectClassTransformer implements ClassHolderTransformer {
if (cls.hasModifier(ElementModifier.INTERFACE)) {
return;
}
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
ExposedClass parent = getExposedClass(cls.getParent());
exposedCls.inheritedMethods.putAll(parent.inheritedMethods);
exposedCls.inheritedMethods.putAll(parent.methods);

View File

@ -47,7 +47,7 @@ class JSTypeHelper {
if (cls == null || !(cls.hasModifier(ElementModifier.INTERFACE) || cls.hasModifier(ElementModifier.ABSTRACT))) {
return false;
}
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
if (isJavaScriptClass(cls.getParent())) {
return true;
}
@ -63,7 +63,7 @@ class JSTypeHelper {
if (cls == null) {
return false;
}
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
if (cls.getParent() != null) {
if (isJavaScriptClass(cls.getParent())) {
return true;
}