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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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