private void doXmlAttribute(Annotation annotation, XMLAttribute xmlAttr) { if (current == null) { if (clazz.isInterface()) { ocd.addExtensionAttribute(xmlAttr, annotation); } } else { current.addExtensionAttribute(xmlAttr, annotation); } }
private void doXmlAttribute(Annotation annotation, XMLAttribute xmlAttr) { if (current == null) { if (clazz.isInterface()) { ocd.addExtensionAttribute(xmlAttr, annotation); } } else { current.addExtensionAttribute(xmlAttr, annotation); } }
@Override public void implementsInterfaces(TypeRef names[]) throws Exception { Arrays.sort(names); // ignore type reordering for (TypeRef name : names) { String comment = null; if (clazz.isInterface() || clazz.isAbstract()) comment = inherit(members, name); members.add(new Element(IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR, comment)); } }
@Override public void implementsInterfaces(TypeRef names[]) throws Exception { Arrays.sort(names); // ignore type reordering for (TypeRef name : names) { String comment = null; if (clazz.isInterface() || clazz.isAbstract()) comment = inherit(members, name); members.add(new Element(IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR, comment)); } }
@Override public void implementsInterfaces(TypeRef names[]) throws Exception { // TODO is interface reordering important for binary // compatibility?? for (TypeRef name : names) { String comment = null; if (clazz.isInterface() || clazz.isAbstract()) comment = inherit(members, name); members.add(new Element(Type.IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR, comment)); } }
@Override public void implementsInterfaces(TypeRef names[]) throws Exception { // TODO is interface reordering important for binary // compatibility?? for (TypeRef name : names) { String comment = null; if (clazz.isInterface() || clazz.isAbstract()) comment = inherit(members, name); members.add(new Element(Type.IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR, comment)); } }
@Override public void implementsInterfaces(TypeRef names[]) throws Exception { // TODO is interface reordering important for binary // compatibility?? for (TypeRef name : names) { String comment = null; if (clazz.isInterface() || clazz.isAbstract()) comment = inherit(members, name); members.add(new Element(Type.IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR, comment)); } }
private boolean acceptableType(String rtype) { TypeRef ref = analyzer.getTypeRef(rtype); try { Clazz returnType = analyzer.findClass(ref); if (returnType.isEnum()) { return true; } // TODO check this is true for interfaces and annotations if (!returnType.isAbstract() || (returnType.isInterface() && options.contains(Options.nested))) { return true; } if (!returnType.isInterface()) { analyzer.error("Abstract classes not allowed as interface method return values: %s", rtype); } else { analyzer.error("Nested metatype only allowed with option: nested type %s", rtype); } return false; } catch (Exception e) { analyzer.exception(e, "could not examine class for return type %s, exception message: %s", rtype, e); return false; } }
@Override public void extendsClass(TypeRef name) throws Exception { String comment = null; if (!clazz.isInterface()) comment = inherit(members, name); Clazz c = analyzer.findClass(name); if ((c == null || c.isPublic()) && !name.isObject()) members.add(new Element(EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment)); }
private boolean acceptableType(String rtype) { TypeRef ref = analyzer.getTypeRef(rtype); try { Clazz returnType = analyzer.findClass(ref); if (returnType.isEnum()) { return true; } // TODO check this is true for interfaces and annotations if (!returnType.isAbstract() || (returnType.isInterface() && options.contains(Options.nested))) { return true; } if (!returnType.isInterface()) { analyzer.error("Abstract classes not allowed as interface method return values: %s", rtype); } else { analyzer.error("Nested metatype only allowed with option: nested type %s", rtype); } return false; } catch (Exception e) { analyzer.exception(e, "could not examine class for return type %s, exception message: %s", rtype, e); return false; } }
@Override public void extendsClass(TypeRef name) throws Exception { String comment = null; if (!clazz.isInterface()) comment = inherit(members, name); Clazz c = analyzer.findClass(name); if ((c == null || c.isPublic()) && !name.isObject()) members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment)); }
@Override public void extendsClass(TypeRef name) throws Exception { String comment = null; if (!clazz.isInterface()) comment = inherit(members, name); Clazz c = analyzer.findClass(name); if ((c == null || c.isPublic()) && !name.isObject()) members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment)); }
@Override public void extendsClass(TypeRef name) throws Exception { String comment = null; if (!clazz.isInterface()) comment = inherit(members, name); Clazz c = analyzer.findClass(name); if ((c == null || c.isPublic()) && !name.isObject()) members.add(new Element(EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment)); }
@Override public void extendsClass(TypeRef name) throws Exception { String comment = null; if (!clazz.isInterface()) comment = inherit(members, name); Clazz c = analyzer.findClass(name); if ((c == null || c.isPublic()) && !name.isObject()) members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment)); }
private boolean identifiableCollection(TypeRef type, boolean intface, boolean topLevel) { try { Clazz clazz = analyzer.findClass(type); if (clazz != null && (!topLevel || !clazz.isAbstract()) && ((intface && clazz.isInterface()) ^ clazz.hasPublicNoArgsConstructor())) { TypeRef[] intfs = clazz.getInterfaces(); if (intfs != null) { for (TypeRef intf : intfs) { if (COLLECTION.matcher(intf.getFQN()) .matches() || identifiableCollection(intf, true, false)) { return true; } } } TypeRef ext = clazz.getSuper(); return ext != null && identifiableCollection(ext, false, false); } } catch (Exception e) { return false; } return false; }
private boolean identifiableCollection(TypeRef type, boolean intface, boolean topLevel) { try { Clazz clazz = analyzer.findClass(type); if (clazz != null && (!topLevel || !clazz.isAbstract()) && ((intface && clazz.isInterface()) ^ clazz.hasPublicNoArgsConstructor())) { TypeRef[] intfs = clazz.getInterfaces(); if (intfs != null) { for (TypeRef intf : intfs) { if (COLLECTION.matcher(intf.getFQN()) .matches() || identifiableCollection(intf, true, false)) { return true; } } } TypeRef ext = clazz.getSuper(); return ext != null && identifiableCollection(ext, false, false); } } catch (Exception e) { return false; } return false; }
private List<BeanDef> getDefs() throws Exception { if (clazz.isEnum() || clazz.isInterface() || clazz.isAnnotation()) {
clazz.parseClassFileWithCollector( new ComponentPropertyTypeDataCollector(propertyDefKey, memberDescriptor, details)); } else if (clazz.isInterface() && options.contains(Options.felixExtensions)) { component.updateVersion(V1_3); } else {
private void doOCD(ObjectClassDefinition o, Annotation annotation) { if (ocd.id == null) { if (clazz.isInterface()) { ocd.id = annotation.get("id") == null ? name.getFQN() : o.id(); ocd.name = annotation.get("name") == null ? space(ocd.id) : o.name(); ocd.description = annotation.get("description") == null ? "" : o.description(); ocd.localization = annotation.get("localization") == null ? "OSGI-INF/l10n/" + name.getFQN() : o.localization(); if (annotation.get("pid") != null) { String[] pids = o.pid(); designates(name.getFQN(), pids, false); } if (annotation.get("factoryPid") != null) { String[] pids = o.factoryPid(); designates(name.getFQN(), pids, true); } if (annotation.get("icon") != null) { Icon[] icons = o.icon(); for (Icon icon : icons) { ocd.icons.add(new IconDef(icon.resource(), icon.size())); } } } else { analyzer.error("ObjectClassDefinition applied to non-interface, non-annotation class %s", clazz); } } }
private void doOCD(ObjectClassDefinition o, Annotation annotation) { if (ocd.id == null) { if (clazz.isInterface()) { ocd.id = annotation.get("id") == null ? name.getFQN() : o.id(); ocd.name = annotation.get("name") == null ? space(ocd.id) : o.name(); ocd.description = annotation.get("description") == null ? "" : o.description(); ocd.localization = annotation.get("localization") == null ? "OSGI-INF/l10n/" + name.getFQN() : o.localization(); if (annotation.get("pid") != null) { String[] pids = o.pid(); designates(name.getFQN(), pids, false); } if (annotation.get("factoryPid") != null) { String[] pids = o.factoryPid(); designates(name.getFQN(), pids, true); } if (annotation.get("icon") != null) { Icon[] icons = o.icon(); for (Icon icon : icons) { ocd.icons.add(new IconDef(icon.resource(), icon.size())); } } } else { analyzer.error("ObjectClassDefinition applied to non-interface, non-annotation class %s", clazz); } } }