public boolean isSyntheticImplentor() { return realType.isInterface(); }
boolean isInterface() { return klass.isInterface(); }
public boolean isSyntheticImplentor() { return realType.isInterface(); }
@Override public String toString() { return "<Synthetic " + (realType.isInterface() ? "Implementor" : "Subclass") + ' ' + realType.toString() + '>'; }
@Override public String toString() { return "<Synthetic " + (realType.isInterface() ? "Implementor" : "Subclass") + ' ' + realType.toString() + '>'; }
@Override public boolean isInterface(TypeReference type) { IClass T = lookupClass(type); assert T != null : "Null lookup for " + type; return T.isInterface(); }
public ConcreteTypeKey(IClass type) { if (type == null) { throw new IllegalArgumentException("type is null"); } if (type.isInterface()) { Assertions.UNREACHABLE("unexpected interface: " + type); } this.type = type; }
public AbstractTypeInNode(CGNode node, IClass type) { if (node == null) { throw new IllegalArgumentException("null node"); } if (type != null && type.isInterface()) { Assertions.UNREACHABLE("unexpected type: " + type); } this.node = node; this.type = type; }
@Override public boolean isInterface(TypeReference type) { IClass T = lookupClass(type); assert T != null : "Null lookup for " + type; return T.isInterface(); }
public AbstractTypeInNode(CGNode node, IClass type) { if (node == null) { throw new IllegalArgumentException("null node"); } if (type != null && type.isInterface()) { Assertions.UNREACHABLE("unexpected type: " + type); } this.node = node; this.type = type; }
public ConcreteTypeKey(IClass type) { if (type == null) { throw new IllegalArgumentException("type is null"); } if (type.isInterface()) { Assertions.UNREACHABLE("unexpected interface: " + type); } this.type = type; }
public boolean isInterface() { return getType().isInterface(); }
@Override public IClass getSuperclass() { if (realType.isInterface()) { IClass result = loader.lookupClass(TypeReference.JavaLangObject.getName()); if (result != null) { return result; } else { throw new IllegalStateException("could not find java.lang.Object"); } } else return realType; }
@Override public Collection<IClass> getAllImplementedInterfaces() { Collection<IClass> realIfaces = realType.getAllImplementedInterfaces(); if (realType.isInterface()) { HashSet<IClass> result = HashSetFactory.make(realIfaces); result.add(realType); return result; } else { return realIfaces; } }
@Override public Collection<IClass> getAllImplementedInterfaces() { Collection<IClass> realIfaces = realType.getAllImplementedInterfaces(); if (realType.isInterface()) { HashSet<IClass> result = HashSetFactory.make(realIfaces); result.add(realType); return result; } else { return realIfaces; } }
@Override public IClass getSuperclass() { if (realType.isInterface()) { IClass result = loader.lookupClass(TypeReference.JavaLangObject.getName()); if (result != null) { return result; } else { throw new IllegalStateException("could not find java.lang.Object"); } } else return realType; }
@Override public Collection<IClass> getDirectInterfaces() { List<IClass> result = new ArrayList<>(); for (TypeName name : superTypeNames) { IClass domoType = lookupClass(name); if (domoType != null && domoType.isInterface()) { result.add(domoType); } if (domoType == null && !getClassHierarchy().getScope().getExclusions().contains(name.toString().substring(1))){ assert false : "Failed to find non-excluded interface: " + name; } } return result; }
@Override public Collection<IClass> getDirectInterfaces() { List<IClass> result = new ArrayList<>(); for (TypeName name : superTypeNames) { IClass domoType = lookupClass(name); if (domoType != null && domoType.isInterface()) { result.add(domoType); } if (domoType == null && !getClassHierarchy().getScope().getExclusions().contains(name.toString().substring(1))){ assert false : "Failed to find non-excluded interface: " + name; } } return result; }
/** * If receiver is a {@link ConstantKey} whose value is an {@link IClass}, return a {@link JavaTypeContext} * representing the type of the IClass. (This corresponds to the case where we know the exact type that will be * allocated by the {@code Class.newInstance()} call.) Otherwise, return {@code null}. */ @Override public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) { if (callee.getReference().equals(ClassNewInstanceContextInterpreter.CLASS_NEW_INSTANCE_REF) && isTypeConstant(receiver[0])) { IClass c = (IClass) ((ConstantKey) receiver[0]).getValue(); if (!c.isAbstract() && !c.isInterface()) { return new JavaTypeContext(new PointType(c)); } } return null; }
public static Iterable<Entrypoint> makePrimordialPublicEntrypoints(ClassHierarchy cha, String pkg) { final HashSet<Entrypoint> result = HashSetFactory.make(); for (IClass clazz : cha) { if (clazz.getName().toString().indexOf(pkg) != -1 && !clazz.isInterface() && !clazz.isAbstract()) { for (IMethod method : clazz.getDeclaredMethods()) { if (method.isPublic() && !method.isAbstract()) { System.out.println("Entry:" + method.getReference()); result.add(new DefaultEntrypoint(method, cha)); } } } } return result::iterator; }