/** * */ void doPlugins() { for (AnalyzerPlugin plugin : getPlugins(AnalyzerPlugin.class)) { try { boolean reanalyze; Processor previous = beginHandleErrors(plugin.toString()); try { reanalyze = plugin.analyzeJar(this); } finally { endHandleErrors(previous); } if (reanalyze) { classspace.clear(); analyzeBundleClasspath(); } } catch (Exception e) { exception(e, "Analyzer Plugin %s failed %s", plugin, e); } } }
Verifier.verifyFilter(filter, 0); } catch (Exception e) { analyzer.exception(e, "The Requirement annotation with namespace %s applied to class %s has invalid filter information.", annotation.namespace(), current.getFQN());
Verifier.verifyFilter(filter, 0); } catch (Exception e) { analyzer.exception(e, "The Requirement annotation with namespace %s applied to class %s has invalid filter information.", annotation.namespace(), current.getFQN());
/** * */ void doPlugins() { for (AnalyzerPlugin plugin : getPlugins(AnalyzerPlugin.class)) { try { boolean reanalyze; Processor previous = beginHandleErrors(plugin.toString()); try { reanalyze = plugin.analyzeJar(this); } finally { endHandleErrors(previous); } if (reanalyze) { classspace.clear(); analyzeBundleClasspath(); } } catch (Exception e) { exception(e, "Analyzer Plugin %s failed %s", plugin, e); } } }
@Override public void classBegin(int access, TypeRef name) { definitions.get(0).implementation = name; PackageDef packageDef = packageInfos.computeIfAbsent(name.getPackageRef(), k -> { Clazz packageInfoClazz = analyzer.getPackageInfo(k); if (packageInfoClazz != null) { try { PackageDef pd = new PackageDef(); packageInfoClazz.parseClassFileWithCollector(pd); return pd; } catch (Exception e) { analyzer.exception(e, "Error while processing package-info of class %s", clazz); } } return new PackageDef(); }); if (packageDef.marked != null) { definitions.get(0).marked = packageDef.marked.matches(name.getFQN()); } }
Version.parseVersion(annotation.version()); } catch (Exception e) { analyzer.exception(e, "The version declared by the Capability annotation attached to type %s is invalid", current.getFQN());
@Override public void classBegin(int access, TypeRef name) { definitions.get(0).implementation = name; PackageDef packageDef = packageInfos.computeIfAbsent(name.getPackageRef(), k -> { Clazz packageInfoClazz = analyzer.getPackageInfo(k); if (packageInfoClazz != null) { try { PackageDef pd = new PackageDef(); packageInfoClazz.parseClassFileWithCollector(pd); return pd; } catch (Exception e) { analyzer.exception(e, "Error while processing package-info of class %s", clazz); } } return new PackageDef(); }); if (packageDef.marked != null) { definitions.get(0).marked = packageDef.marked.matches(name.getFQN()); } }
@Override public void annotation(Annotation annotation) { try { switch (annotation.getName() .getFQN()) { case "org.osgi.service.cdi.annotations.Bean" : definitions.get(0).marked = true; break; case "org.osgi.service.cdi.annotations.Service" : doService(annotation); break; case "org.osgi.service.cdi.annotations.MinimumCardinality" : int minimumCardinality = (int) annotation.get("value"); if (minimumCardinality > 0) { if (referenceDef == null) { referenceDef = new ReferenceDef(); } referenceDef.cardinality = ReferenceCardinality.AT_LEAST_ONE; } break; case "org.osgi.service.cdi.annotations.Reference" : doReference(annotation, parameter); break; } } catch (Exception e) { analyzer.exception(e, "During bean processing on class %s, exception %s", clazz, e); } }
/** * Ensure that we are running on the correct bnd. */ protected void doRequireBnd() { Attrs require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND)); if (require == null || require.isEmpty()) return; Hashtable<String, String> map = new Hashtable<>(); map.put(Constants.VERSION_FILTER, getBndVersion()); for (String filter : require.keySet()) { try { Filter f = new Filter(filter); if (f.match(map)) continue; error("%s fails for filter %s values=%s", REQUIRE_BND, require.get(filter), map); } catch (Exception t) { exception(t, "%s with value %s throws exception", REQUIRE_BND, require); } } }
/** * Ensure that we are running on the correct bnd. */ protected void doRequireBnd() { Attrs require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND)); if (require == null || require.isEmpty()) return; Hashtable<String, String> map = new Hashtable<>(); map.put(Constants.VERSION_FILTER, getBndVersion()); for (String filter : require.keySet()) { try { Filter f = new Filter(filter); if (f.match(map)) continue; error("%s fails for filter %s values=%s", REQUIRE_BND, require.get(filter), map); } catch (Exception t) { exception(t, "%s with value %s throws exception", REQUIRE_BND, require); } } }
@Override public void annotation(Annotation annotation) { try { switch (annotation.getName() .getFQN()) { case "org.osgi.service.cdi.annotations.Bean" : definitions.get(0).marked = true; break; case "org.osgi.service.cdi.annotations.Service" : doService(annotation); break; case "org.osgi.service.cdi.annotations.MinimumCardinality" : int minimumCardinality = (int) annotation.get("value"); if (minimumCardinality > 0) { if (referenceDef == null) { referenceDef = new ReferenceDef(); } referenceDef.cardinality = ReferenceCardinality.AT_LEAST_ONE; } break; case "org.osgi.service.cdi.annotations.Reference" : doReference(annotation, parameter); break; } } catch (Exception e) { analyzer.exception(e, "During bean processing on class %s, exception %s", clazz, e); } }
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; } }
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 annotation(Annotation annotation) throws Exception { try { switch (annotation.getName() .getFQN()) { case "org.osgi.service.metatype.annotations.ObjectClassDefinition" : doOCD(annotation.getAnnotation(ObjectClassDefinition.class), annotation); break; case "org.osgi.service.metatype.annotations.AttributeDefinition" : current.ad = annotation.getAnnotation(AttributeDefinition.class); current.a = annotation; break; default : XMLAttribute xmlAttr = finder.getXMLAttribute(annotation); if (xmlAttr != null) { doXmlAttribute(annotation, xmlAttr); } break; } } catch (Exception e) { analyzer.exception(e, "During generation of a component on class %s, exception %s", clazz, e); } }
@Override public void annotation(Annotation annotation) throws Exception { try { switch (annotation.getName() .getFQN()) { case "org.osgi.service.metatype.annotations.ObjectClassDefinition" : doOCD(annotation.getAnnotation(ObjectClassDefinition.class), annotation); break; case "org.osgi.service.metatype.annotations.AttributeDefinition" : current.ad = annotation.getAnnotation(AttributeDefinition.class); current.a = annotation; break; default : XMLAttribute xmlAttr = finder.getXMLAttribute(annotation); if (xmlAttr != null) { doXmlAttribute(annotation, xmlAttr); } break; } } catch (Exception e) { analyzer.exception(e, "During generation of a component on class %s, exception %s", clazz, e); } }
private void parseExtends(Clazz clazz) { TypeRef[] inherits = clazz.getInterfaces(); if (inherits != null) { for (TypeRef typeRef : inherits) { if (!typeRef.isJava() && analyzed.add(typeRef)) { try { Clazz inherit = analyzer.findClass(typeRef); if (inherit != null) { inherit.parseClassFileWithCollector(new OCDDataCollector(ocd)); parseExtends(inherit); } else { analyzer.error("Could not obtain super class %s of class %s", typeRef.getFQN(), clazz.getClassName() .getFQN()); } } catch (Exception e) { analyzer.exception(e, "Could not obtain super class %s of class %s; exception %s", typeRef.getFQN(), clazz.getClassName() .getFQN(), e); } } } } }
private void parseExtends(Clazz clazz) { TypeRef[] inherits = clazz.getInterfaces(); if (inherits != null) { for (TypeRef typeRef : inherits) { if (!typeRef.isJava() && analyzed.add(typeRef)) { try { Clazz inherit = analyzer.findClass(typeRef); if (inherit != null) { inherit.parseClassFileWithCollector(new OCDDataCollector(ocd)); parseExtends(inherit); } else { analyzer.error("Could not obtain super class %s of class %s", typeRef.getFQN(), clazz.getClassName() .getFQN()); } } catch (Exception e) { analyzer.exception(e, "Could not obtain super class %s of class %s; exception %s", typeRef.getFQN(), clazz.getClassName() .getFQN(), e); } } } } }
.exception(e, "An error occurred when attempting to process annotation %s, applied to component %s", annotation.getName() .getFQN(),
.exception(e, "Exception looking at annotation type for activation object with descriptor %s, type %s", memberDescriptor, param.binary)
.exception(e, "An error occurred when attempting to process annotation %s, applied to component %s", annotation.getName() .getFQN(),