Package aQute.bnd.osgi
Class Analyzer
- java.lang.Object
-
- aQute.bnd.osgi.Domain
-
- aQute.bnd.osgi.Processor
-
- aQute.bnd.osgi.Analyzer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Analyzer.Check
-
Nested classes/interfaces inherited from class aQute.bnd.osgi.Processor
Processor.CL, Processor.FileLine, Processor.SetLocationImpl
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
_classesHelp
The extends macro traverses all classes and returns a list of class names that extend a base class.(package private) static java.lang.String
_md5Help
(package private) static java.lang.String
_packagesHelp
(package private) static java.lang.String
_sha1Help
SHA1 macroprivate Descriptors.TypeRef
activator
private boolean
analyzed
private AnnotationHeaders
annotationHeaders
private MultiMap<Descriptors.PackageRef,Descriptors.PackageRef>
apiUses
private static java.util.regex.Pattern
BASE64HEX_P
md5 macroprivate java.util.Map<Descriptors.TypeRef,java.lang.String>
bcpTypes
(package private) static java.util.Properties
bndInfo
private java.util.Set<Analyzer.Check>
checks
private java.util.List<Jar>
classpath
private Packages
classpathExports
private java.util.Map<Descriptors.TypeRef,Clazz>
classspace
private Packages
contained
private Contracts
contracts
(package private) static java.lang.String
DEFAULT_CONSUMER_POLICY
(package private) static java.lang.String
DEFAULT_PROVIDER_POLICY
private Descriptors
descriptors
private boolean
diagnostics
private Jar
dot
private java.util.SortedSet<Clazz.JAVA>
ees
private Packages
exports
(package private) boolean
firstUse
private static VersionRange
frameworkPreR7
(package private) static java.util.regex.Pattern
fuzzyModifier
(package private) static java.util.regex.Pattern
fuzzyVersion
Clean up version parameters.(package private) static java.util.regex.Pattern
fuzzyVersionRange
private java.util.Map<Descriptors.TypeRef,Clazz>
importedClassesCache
private Packages
imports
private boolean
inited
private static org.slf4j.Logger
logger
protected AnalyzerMessages
msgs
private java.util.Set<Descriptors.PackageRef>
nonClassReferences
(package private) static java.util.regex.Pattern
OBJECT_REFERENCE
(package private) static java.util.regex.Pattern
OLD_PACKAGEINFO_SYNTAX_P
private java.util.Set<Descriptors.PackageRef>
packagesVisited
private Packages
referred
private static java.lang.String
STATUS_PROPERTY
private MultiMap<Descriptors.PackageRef,Descriptors.PackageRef>
uses
-
Fields inherited from class aQute.bnd.osgi.Processor
_frangeHelp, _uriHelp, basicPlugins, BUFFER_SIZE, current, errors, exceptions, fileMustExist, filter, fixupMessages, LIST_SPLITTER, locations, log, missingCommand, parent, pedantic, pluginLoader, profile, properties, random, strict, trace, upto, warnings
-
Fields inherited from class aQute.bnd.osgi.Domain
translation
-
Fields inherited from interface aQute.bnd.osgi.Constants
ACCESS_ATTRIBUTE, AUGMENT, AUGMENT_CAPABILITY_DIRECTIVE, AUGMENT_RANGE_ATTRIBUTE, AUGMENT_REQUIREMENT_DIRECTIVE, AUTOMATIC_MODULE_NAME, BASELINE, BASELINEREPO, BLUEPRINT_TIMEOUT_ATTRIBUTE, BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE, BND_ADDXMLTOTEST, BND_LASTMODIFIED, BNDDRIVER, BNDDRIVER_ANT, BNDDRIVER_BND, BNDDRIVER_ECLIPSE, BNDDRIVER_GRADLE, BNDDRIVER_GRADLE_NATIVE, BNDDRIVER_INTELLIJ, BNDDRIVER_MAVEN, BNDDRIVER_OSMORC, BNDDRIVER_SBT, BSN_SOURCE_SUFFIX, BUILDERIGNORE, BUILDFILES, BUILDPACKAGES, BUILDPATH, BUILDREPO, BUMPPOLICY, BUNDLE_ACTIVATIONPOLICY, BUNDLE_ACTIVATOR, BUNDLE_BLUEPRINT, BUNDLE_CATEGORY, BUNDLE_CLASSPATH, BUNDLE_CONTACTADDRESS, BUNDLE_CONTRIBUTORS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION, BUNDLE_DEVELOPERS, BUNDLE_DOCURL, BUNDLE_ICON, BUNDLE_LICENSE, BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION, BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SCM, BUNDLE_SPECIFIC_HEADERS, BUNDLE_SYMBOLIC_NAME_ATTRIBUTE, BUNDLE_SYMBOLICNAME, BUNDLE_UPDATELOCATION, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_VERSION_ATTRIBUTE, BUNDLEANNOTATIONS, CACHEDIR, CARDINALITY_DIRECTIVE, CDIANNOTATIONS, CHECK, CLASS_ATTRIBUTE, CLASSPATH, COMMAND_DIRECTIVE, COMPILER_SOURCE, COMPILER_TARGET, COMPONENT_ACTIVATE, COMPONENT_CONFIGURATION_POLICY, COMPONENT_DEACTIVATE, COMPONENT_DESCRIPTORS, COMPONENT_DESIGNATE, COMPONENT_DESIGNATEFACTORY, COMPONENT_DYNAMIC, COMPONENT_ENABLED, COMPONENT_FACTORY, COMPONENT_GREEDY, COMPONENT_IMMEDIATE, COMPONENT_IMPLEMENTATION, COMPONENT_MODIFIED, COMPONENT_MULTIPLE, COMPONENT_NAME, COMPONENT_NAMESPACE, COMPONENT_OPTIONAL, COMPONENT_PROPERTIES, COMPONENT_PROVIDE, COMPONENT_SERVICEFACTORY, COMPONENT_VERSION, componentDirectives, COMPRESSION, CONDITIONAL_PACKAGE, CONDITIONALPACKAGE, CONDUIT, CONNECTION_SETTINGS, CONSUMER_POLICY, CONTRACT, CREATED_BY, CURRENT_BUNDLESYMBOLICNAME, CURRENT_BUNDLEVERSION, CURRENT_PACKAGE, CURRENT_USES, CURRENT_VERSION, DEBUG, DEFAULT_BAR_EXTENSION, DEFAULT_BND_EXTENSION, DEFAULT_BNDRUN_EXTENSION, DEFAULT_CHARSET, DEFAULT_DO_NOT_COPY, DEFAULT_JAR_EXTENSION, DEFAULT_LAUNCHER_BSN, DEFAULT_PREPROCESSS_MATCHERS, DEFAULT_PROP_BIN_DIR, DEFAULT_PROP_SRC_DIR, DEFAULT_PROP_TARGET_DIR, DEFAULT_PROP_TESTBIN_DIR, DEFAULT_PROP_TESTSRC_DIR, DEFAULT_TESTER_BSN, DEFINE_CONTRACT, DEPENDSON, DEPLOY, DEPLOYREPO, DESCRIPTION_ATTRIBUTE, DIFFIGNORE, DIFFPACKAGES, DIGESTS, directives, DISTRO, DONOTCOPY, DSANNOTATIONS, DSANNOTATIONS_OPTIONS, DUPLICATE_MARKER, DYNAMICIMPORT_PACKAGE, EE_ATTRIBUTE, EEPROFILE, EEPROFILE_AUTO_ATTRIBUTE, EFFECTIVE_DIRECTIVE, EMBEDDED_REPO, EMPTY, EMPTY_HEADER, EXCLUDE_DIRECTIVE, EXECUTABLE, EXPERIMENTS, EXPORT, EXPORT_APIGUARDIAN, EXPORT_BSN, EXPORT_CONTENTS, EXPORT_NAME, EXPORT_PACKAGE, EXPORT_SERVICE, EXPORT_TYPE, EXPORT_VERSION, EXPORTS_ATTRIBUTE, EXPORTTYPE, EXTENSION, EXTENSION_DIRECTIVE, FAIL_OK, FILTER_DIRECTIVE, FIXUPMESSAGES, FIXUPMESSAGES_IS_DIRECTIVE, FIXUPMESSAGES_IS_ERROR, FIXUPMESSAGES_IS_IGNORE, FIXUPMESSAGES_IS_WARNING, FIXUPMESSAGES_REPLACE_DIRECTIVE, FIXUPMESSAGES_RESTRICT_DIRECTIVE, FRAGMENT_ATTACHMENT_DIRECTIVE, FRAGMENT_HOST, FROM_DIRECTIVE, GENERATE, GESTALT, GESTALT_BATCH, GESTALT_CI, GESTALT_INTERACTIVE, GESTALT_OFFLINE, GESTALT_SHELL, GROUPID, headers, IDENTITY_INITIAL_RESOURCE, IDENTITY_SYSTEM_RESOURCE, IGNORE_ATTRIBUTE, IGNORE_PACKAGE, IGNORE_STANDALONE, IMPORT_DIRECTIVE, IMPORT_PACKAGE, IMPORT_PRIVATE, IMPORT_REFERENCE, IMPORT_SERVICE, importDirectives, INCLUDE, INCLUDE_DIRECTIVE, INCLUDE_RESOURCE, INCLUDEPACKAGE, INCLUDERESOURCE, INIT, INTERNAL_BUNDLESYMBOLICNAME_DIRECTIVE, INTERNAL_BUNDLEVERSION_DIRECTIVE, INTERNAL_EXPORT_TO_MODULES_DIRECTIVE, INTERNAL_EXPORTED_DIRECTIVE, INTERNAL_MODULE_VERSION_DIRECTIVE, INTERNAL_OPEN_TO_MODULES_DIRECTIVE, INTERNAL_SOURCE_DIRECTIVE, INVALIDFILENAMES, JAVA, JAVA_DEBUG, JAVAAGENT, JAVAC, JAVAC_ENCODING, JAVAC_PROFILE, JAVAC_SOURCE, JAVAC_TARGET, JIDENTIFIER, JPMS_MODULE_INFO, JPMS_MODULE_INFO_OPTIONS, KEYSTORE_LOCATION_DIRECTIVE, KEYSTORE_PASSWORD_DIRECTIVE, KEYSTORE_PROVIDER_DIRECTIVE, LANGUAGE_ATTRIBUTE, LAUNCH_ACTIVATION_EAGER, LAUNCH_ACTIVATORS, LAUNCH_RUNBUNDLES_ATTRS, LAUNCH_STARTLEVEL_DEFAULT, LAUNCH_TRACE, LAUNCHER_PLUGIN, LIB_DIRECTIVE, LINK_ATTRIBUTE, LITERAL_ATTRIBUTE, MAIN_CLASS, MAKE, MANDATORY_DIRECTIVE, MANIFEST, MANIFEST_NAME, MAVEN_DEPENDENCIES, MAVEN_RELEASE, MAVEN_SCOPE, META_PERSISTENCE, METAPACKAGES, METATYPE, METATYPE_ANNOTATIONS, METATYPE_ANNOTATIONS_OPTIONS, MIME_TYPE_BUNDLE, MIME_TYPE_JAR, MODULE_INFO_CLASS, MODULES_ATTRIBUTE, NAME_ATTRIBUTE, NAMESECTION, NAMESPACE_STEM, NO_IMPORT_DIRECTIVE, NOANNOTATIONS, NOBUILDINCACHE, NOBUNDLES, NOCLASSFORNAME, NODEFAULTVERSION, NOEE, NOEXTRAHEADERS, NOIMPORTJAVA, NOJUNIT, NOJUNITOSGI, NOMANIFEST, NONE, NOT_A_BUNDLE_S, NOUSES, OPTIONAL, options, OSGI_SYNTAX_HEADERS, OSNAME_ATTRIBUTE, OSVERSION_ATTRIBUTE, OUTPUT, OUTPUTMASK, PACKAGE, PACKAGEINFOTYPE, PATH_DIRECTIVE, PEDANTIC, PLUGIN, PLUGINPATH, PLUGINPATH_SHA1_ATTR, PLUGINPATH_URL_ATTR, POM, PREPROCESSMATCHERS, PRESENCE_DIRECTIVE, PRIVATE_DIRECTIVE, PRIVATE_PACKAGE, PRIVATEPACKAGE, PROCESSOR_ATTRIBUTE, PROFILE, PROVIDE_CAPABILITY, PROVIDE_DIRECTIVE, PROVIDER_POLICY, PROVIDER_TYPE_DIRECTIVE, RELEASEREPO, REMOTEWORKSPACE, REMOVE_ATTRIBUTE_DIRECTIVE, REMOVEHEADERS, REPORTNEWER, REPOSITORIES, REPRODUCIBLE, REQUIRE_BND, REQUIRE_BUNDLE, REQUIRE_CAPABILITY, RESOLUTION, RESOLUTION_DIRECTIVE, RESOLUTION_DYNAMIC, RESOLVE, RESOURCEONLY, RUNBLACKLIST, RUNBUILDS, RUNBUNDLES, RUNBUNDLES_STARTLEVEL_ATTRIBUTE, RUNEE, RUNENV, RUNFRAMEWORK, RUNFRAMEWORK_NONE, RUNFRAMEWORK_SERVICES, RUNFRAMEWORKRESTART, RUNFW, RUNJDB, RUNKEEP, RUNNOREFERENCES, RUNOPTIONS, RUNOPTIONS_EAGER, RUNPATH, RUNPATH_LAUNCHER_DIRECTIVE, RUNPATH_MAIN_DIRECTIVE, RUNPROGRAMARGS, RUNPROPERTIES, RUNPROVIDEDCAPABILITIES, RUNREMOTE, RUNREPOS, RUNREQUIRE, RUNREQUIRES, RUNSTARTLEVEL, RUNSTARTLEVEL_BEGIN, RUNSTARTLEVEL_ORDER, RUNSTARTLEVEL_STEP, RUNSTORAGE, RUNSYSTEMCAPABILITIES, RUNSYSTEMPACKAGES, RUNTIMEOUT, RUNTRACE, RUNVM, SAVEMANIFEST, SELECTION_FILTER_ATTRIBUTE, SERVICE_COMPONENT, SERVICELOADER_NAMESPACE, SERVICELOADER_REGISTER_DIRECTIVE, SET_COMPONENT_DIRECTIVES, SET_COMPONENT_DIRECTIVES_1_1, SET_COMPONENT_DIRECTIVES_1_2, SIGN, SIGN_PASSWORD_DIRECTIVE, SIGNATURE_TEST, SINGLETON_DIRECTIVE, SIZE_ATTRIBUTE, SNAPSHOT, SOURCEPATH, SOURCES, SPECIFICATION_VERSION, SPLIT_PACKAGE_DIRECTIVE, STALECHECK, STANDALONE, STATIC_ATTRIBUTE, STRICT, SUB, SUBSTITUTE_ATTRIBUTE, SYSTEMPROPERTIES, TESTCASES, TESTCONTINUOUS, TESTER, TESTER_PLUGIN, TESTPACKAGES, TESTPATH, TESTREPORT, TESTSOURCES, TESTSUITES, TESTUNRESOLVED, TOOL, TRANSITIVE_ATTRIBUTE, TSTAMP, UNDERTEST, UPTO, USES_DIRECTIVE, USES_USES, VALID_PROPERTY_TYPES, VERBOSE, VERSION_ATTR_HASH, VERSION_ATTR_LATEST, VERSION_ATTR_PROJECT, VERSION_ATTR_SNAPSHOT, VERSION_ATTRIBUTE, VERSION_FILTER, VISIBILITY_DIRECTIVE, WAB, WABLIB, WORKINGSET, WORKINGSET_MEMBER
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
_bsn(java.lang.String[] args)
java.lang.String
_classes(java.lang.String... args)
java.lang.String
_ee(java.lang.String[] args)
java.lang.String
_exporters(java.lang.String[] args)
Get the exporter of a package ...java.lang.String
_exports(java.lang.String[] args)
java.lang.String
_findname(java.lang.String[] args)
java.lang.String
_findpath(java.lang.String[] args)
Findpath looks through the contents of the JAR and finds paths that end with the given regular expression ${findpath (; reg-expr (; replacement)? )? }java.lang.String
_imports(java.lang.String[] args)
java.lang.String
_md5(java.lang.String[] args)
java.lang.String
_packageattribute(java.lang.String[] args)
Return an attribute of a packagejava.lang.String
_packages(java.lang.String... args)
java.lang.String
_sha1(java.lang.String[] args)
void
addClasspath(Jar jar)
void
addClasspath(java.io.File cp)
void
addClasspath(java.util.Collection<?> jars)
private void
addDefinedContracts()
void
analyze()
Calculates the data structures for generating a manifest.private void
analyzeBundleClasspath()
private boolean
analyzeJar(Jar jar, java.lang.String prefix, boolean okToIncludeDirs, java.lang.String bcpEntry)
We traverse through all the classes that we can find and calculate the contained and referred set and uses.(package private) java.lang.String
applyVersionPolicy(java.lang.String exportVersion, java.lang.String importRange, boolean provider)
boolean
assignable(Clazz annoServiceClazz, Clazz inferredServiceClazz)
boolean
assignable(Clazz annoServiceClazz, Clazz inferredServiceClazz, boolean unknownResult)
boolean
assignable(java.lang.String annoService, java.lang.String inferredService)
boolean
assignable(java.lang.String annoService, java.lang.String inferredService, boolean unknownResult)
private java.lang.Boolean
assignable0(Clazz annoServiceClazz, Clazz inferredServiceClazz)
(package private) void
augmentExports(Packages exports)
Provide any macro substitutions and versions for exported packages.(package private) void
augmentImports(Packages imports, Packages exports)
Find some more information about imports in manifest and other places.protected void
begin()
java.util.jar.Manifest
calcManifest()
One of the main workhorses of this class.java.lang.String
calculateExportsFromContents(Jar bundle)
Calculate an export header solely based on the contents of a JAR file(package private) java.lang.String
calculateVersionRange(java.lang.String version, boolean impl)
Calculate a version from a version policy.boolean
check(Analyzer.Check key)
Check if we have an a check option(package private) static void
cleanupModifier(java.lang.StringBuilder result, java.lang.String modifier)
java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>>
cleanupUses(java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> apiUses, boolean removeJava)
Remove the own references and optional java references from the uses libstatic java.lang.String
cleanupVersion(java.lang.String version)
void
clear()
void
close()
(package private) Pair<Packages,Parameters>
divideRegularAndDynamicImports()
private void
doConditionalPackages()
private java.lang.String
doEEProfiles(Clazz.JAVA highest)
Added for 1.8 profiles.(package private) Packages
doExportsToImports(Packages exports)
We will add all exports to the imports unless there is a -noimport directive specified on an export.private void
doHeader(java.util.jar.Attributes main, java.lang.String header)
private void
doNamesection(Jar dot, java.util.jar.Manifest manifest)
Parse the namesection as instructions and then match them against the current set of resources For example:(package private) void
doNameSection(java.util.jar.Manifest manifest, java.lang.String header)
This method is called when the header starts with a @, signifying a name section header.(package private) void
doPlugins()
protected void
doRequireBnd()
Ensure that we are running on the correct bnd.protected void
doUses(Descriptors.PackageRef packageRef, Packages exports, java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> uses, Packages imports)
(package private) void
doUses(Packages exports, java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> uses, Packages imports)
Add the uses clauses.(package private) Packages
filter(Instructions instructions, Packages source, java.util.Set<Instruction> nomatch)
Merge the attributes of two maps, where the first map can contain wildcarded names.private <T> java.util.Collection<T>
filter(java.util.Collection<T> list, java.lang.String[] args)
Clazz
findClass(Descriptors.TypeRef typeRef)
Find a clazz on the class path.Jar
findClasspathEntry(java.lang.String bsn, java.lang.String r)
Find a class path entry based on bsn and versionrange(package private) java.lang.String
findPath(java.lang.String name, java.lang.String[] args, boolean fullPathName)
(package private) java.util.Set<Descriptors.PackageRef>
findProvidedPackages()
Find the packages we depend on, where we implement an interface that is a Provider Type.Resource
findResource(java.lang.String path)
Locate a resource on the class path.java.util.stream.Stream<Resource>
findResources(java.util.function.Predicate<java.lang.String> matches)
(package private) void
fixupAttributes(Descriptors.PackageRef packageRef, Attrs attributes)
Fixup Attributes Execute any macros on an export andprivate void
fixupOldStyleVersions(Attrs attrs)
void
forceRefresh()
java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>>
getAPIUses()
java.lang.String
getBndInfo(java.lang.String key, java.lang.String defaultValue)
long
getBndLastModified()
java.lang.String
getBndVersion()
Get the version for this bndjava.lang.String
getBsn()
Clear the key part of a header.java.util.Optional<java.lang.String>
getBundleClassPathEntry(Clazz clazz)
java.util.Collection<Clazz>
getClasses(java.lang.String... args)
java.util.List<Jar>
getClasspath()
Packages
getClasspathExports()
ClassSignature
getClassSignature(java.lang.String signature)
java.util.Map<Descriptors.TypeRef,Clazz>
getClassspace()
java.util.Set<Clazz>
getClassspace(Descriptors.PackageRef source)
Return the classes for a given source package.Packages
getContained()
Descriptors.Descriptor
getDescriptor(java.lang.String descriptor)
java.util.SortedSet<Clazz.JAVA>
getEEs()
Return the EEsprivate Parameters
getExportedByAnnotation()
Packages
getExports()
protected Jar
getExtra()
FieldSignature
getFieldSignature(java.lang.String signature)
Clazz.JAVA
getHighestEE()
java.util.Optional<java.util.Set<Descriptors.PackageRef>>
getHostPackages()
Get the packages from the host if this is a fragment bundlePackages
getImports()
Jar
getJar()
Jar
getJarFromName(java.lang.String name, java.lang.String from)
Try to get a Jar from a file name/path or a url, or in last resort from the classpath name part of their files.java.util.List<Jar>
getJarsFromName(java.lang.String name, java.lang.String from)
Clazz.JAVA
getLowestEE()
static java.util.Properties
getManifest(java.io.File dirOrJar)
Specifically for Mavenprivate void
getManifestInfoFromClasspath(Jar jar, Packages classpathExports, Contracts contracts)
MethodSignature
getMethodSignature(java.lang.String signature)
protected java.lang.String
getName(Jar jar)
java.io.File
getOutputFile(java.lang.String output)
Calculate the output file for the given target.Clazz
getPackageInfo(Descriptors.PackageRef packageRef)
Descriptors.PackageRef
getPackageRef(java.lang.String binaryName)
java.util.Collection<Descriptors.PackageRef>
getPackages(Packages scope, java.lang.String... args)
java.util.Set<Descriptors.PackageRef>
getPrivates()
Packages
getReferred()
java.util.Optional<java.util.Set<Descriptors.PackageRef>>
getRequireBundlePackages()
Find the packages belonging to the required bundlesjava.lang.String
getSourceFileFor(Descriptors.TypeRef type)
Find the source file for this typejava.lang.String
getSourceFileFor(Descriptors.TypeRef type, java.util.Collection<java.io.File> sourcePath)
Jar
getTarget()
Descriptors.TypeRef
getTypeRef(java.lang.String binaryClassName)
Descriptors.TypeRef
getTypeRefFromFQN(java.lang.String fqn)
Descriptors.TypeRef
getTypeRefFromPath(java.lang.String path)
java.util.Set<Descriptors.PackageRef>
getUnreachable()
Return the set of unreachable code depending on exports and the bundle activator.java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>>
getUses()
java.lang.String
getVersion()
Answer the bundle version.java.lang.String
getVersionPolicy(boolean implemented)
java.util.Map<Clazz.Def,java.util.List<Descriptors.TypeRef>>
getXRef(Descriptors.PackageRef source, java.util.Collection<Descriptors.PackageRef> dest, int sourceModifiers)
Create a cross reference from package source, to packages in destboolean
isImported(Descriptors.PackageRef packageRef)
private static boolean
isInteger(java.lang.String minor)
TRhe cleanup version got confused when people used numeric dates like 201209091230120 as qualifiers.boolean
isNoBundle()
private boolean
isNormalPackage(Descriptors.PackageRef pRef)
private boolean
isProvider(Descriptors.TypeRef t)
(package private) boolean
isResourceOnly()
private void
learnPackage(Jar jar, java.lang.String prefix, Descriptors.PackageRef packageRef, Packages map)
private void
merge(java.util.jar.Manifest result, java.util.jar.Manifest old)
void
mergeManifest(java.util.jar.Manifest manifest)
Merge the existing manifest with the instructions but do not override existing properties.void
nonClassReferTo(Descriptors.TypeRef ref)
(package private) Attrs
parsePackageinfo(Descriptors.PackageRef packageRef, Resource r)
private Attrs
parsePackageInfoClass(Resource r)
void
putAll(java.util.Map<java.lang.String,java.lang.String> additional, boolean force)
private java.util.Set<Descriptors.PackageRef>
referencesByAnnotation(Clazz clazz)
boolean
referred(Descriptors.PackageRef packageName)
void
referTo(Descriptors.TypeRef ref)
void
referToByBinaryName(java.lang.String binaryClassName)
(package private) void
removeAttributes(Attrs attributes)
Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE.(package private) void
removeDynamicImports(Packages referredAndExported)
Discussed with BJ and decided to kill the .private static java.lang.String
removeLeadingZeroes(java.lang.String group)
(package private) void
removeTransitive(Descriptors.PackageRef name, java.util.Set<Descriptors.PackageRef> unreachable)
Transitively remove all elemens from unreachable through the uses link.void
report(java.util.Map<java.lang.String,java.lang.Object> table)
Report the details of this analyzerboolean
save(java.io.File output, boolean force)
Utility function to carefully save the file.void
setBase(java.io.File file)
void
setClasspath(Jar[] classpath)
void
setClasspath(java.io.File[] classpath)
void
setClasspath(java.lang.String[] classpath)
void
setClasspath(java.util.Collection<?> classpath)
Set the classpath for this analyzer by file.void
setDefaults(java.lang.String bsn, Version version)
Set default import and export instructions if none are setvoid
setDiagnostics(boolean b)
Jar
setJar(Jar jar)
Set the JAR directly we are going to work on.Jar
setJar(java.io.File file)
Set the JAR file we are going to work in.void
setTypeLocation(Reporter.SetLocation location, Descriptors.TypeRef type)
Set location information for a type.protected void
setTypeSpecificPlugins(java.util.Set<java.lang.Object> list)
private Jar
toJar(java.util.Map.Entry<java.lang.String,Attrs> host)
java.lang.String
validResourcePath(java.lang.String name, java.lang.String reportIfWrong)
private void
verifyAttribute(java.lang.String path, java.lang.String where, java.lang.String key, java.lang.String value)
(package private) void
verifyManifestHeadersCase(java.util.Properties properties)
Bnd is case sensitive for the instructions so we better check people are not using an invalid case.-
Methods inherited from class aQute.bnd.osgi.Processor
_basedir, _fileuri, _findfile, _frange, _native_capability, _propertiesdir, _propertiesname, _random, _thisfile, _uri, addBasicPlugin, addClose, addExtensions, addIncluded, addProperties, addProperties, append, appendPath, beginHandleErrors, check, concat, customize, decorated, decorated, doAttrbutes, doIncludeFile, doIncludeFile, endHandleErrors, error, error, exception, exists, findHeader, findHeader, findHeader, formatArrays, get, get, getBase, getBaseURI, getChecksum, getClass, getDuration, getErrors, getExecutor, getFile, getFile, getFlattenedProperties, getFlattenedProperties, getHeader, getHeader, getHeader, getHeader, getIncluded, getInfo, getInfo, getInstructions, getJavaExecutable, getLine, getLoader, getLocation, getLogger, getMacroDomains, getManifestAsProperties, getMergedParameters, getParameters, getParent, getPlugin, getPlugins, getPlugins, getProfile, getPromiseFactory, getProperties, getPropertiesFile, getProperty, getProperty, getProperty, getPropertyKeys, getReplacer, getScheduledExecutor, getSelfAndAncestors, getSettings, getTop, getUnexpandedProperty, getUnprocessedProperty, getWarnings, is, isDuplicate, isExceptions, isFailOk, isInteractive, isMissingPlugin, isOk, isPedantic, isPerfect, isStrict, isTrace, isTrue, iterator, join, join, join, join, join, join, keySet, lastModified, loadPlugins, loadProperties, loadProperties0, makePrintable, merge, mergeLocalProperties, mergeProperties, mergeProperties, mergeProperties, mergeProperties, newHashMap, newList, newList, newMap, newMap, newSet, newSet, normalize, normalize, parseHeader, parseHeader, printClause, printClauses, printClauses, printExceptionSummary, printStackTrace, progress, progress, propertiesChanged, quote, read, refresh, removeBasicPlugin, removeClose, removeDuplicateMarker, replaceAll, replaceExtension, report, set, setExceptions, setFileMustExist, setForceLocal, setLocation, setParent, setPedantic, setProperties, setProperties, setProperties, setProperties, setProperty, setTrace, signal, since, split, split, split, spliterator, stream, system, system, toFullHeaderPattern, toString, trace, tree, unsetProperty, updateModified, use, warning
-
Methods inherited from class aQute.bnd.osgi.Domain
copyFrom, domain, domain, domain, domain, domain, domain, domain, getBundleActivator, getBundleCategory, getBundleClasspath, getBundleClassPath, getBundleContactAddress, getBundleCopyright, getBundleDescription, getBundleDocURL, getBundleName, getBundleNative, getBundleRequiredExecutionEnvironment, getBundleSymbolicName, getBundleVendor, getBundleVersion, getDynamicImportPackage, getExportContents, getExportPackage, getFragmentHost, getIcon, getImportPackage, getIncludeResource, getParameters, getParameters, getParameters, getParameters, getPrivatePackage, getProvideCapability, getRequireBundle, getRequireCapability, getRunblacklist, getRunee, isSources, normalizeKey, setAugment, setBundleActivator, setBundleClasspath, setBundleRequiredExecutionEnvironment, setBundleSymbolicName, setBundleVersion, setBundleVersion, setConditionalPackage, setExportContents, setExportPackage, setFailOk, setImportPackage, setIncludePackage, setIncludeResource, setPrivatePackage, setRunblacklist, setRunee, setRunfw, setRunRequires, setSources, setTranslation, translate, translate
-
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
-
frameworkPreR7
private static final VersionRange frameworkPreR7
-
ees
private final java.util.SortedSet<Clazz.JAVA> ees
-
bndInfo
static java.util.Properties bndInfo
-
dot
private Jar dot
-
contained
private final Packages contained
-
referred
private final Packages referred
-
exports
private Packages exports
-
imports
private Packages imports
-
activator
private Descriptors.TypeRef activator
-
uses
private final MultiMap<Descriptors.PackageRef,Descriptors.PackageRef> uses
-
apiUses
private final MultiMap<Descriptors.PackageRef,Descriptors.PackageRef> apiUses
-
contracts
private final Contracts contracts
-
classpathExports
private final Packages classpathExports
-
descriptors
private final Descriptors descriptors
-
classpath
private final java.util.List<Jar> classpath
-
classspace
private final java.util.Map<Descriptors.TypeRef,Clazz> classspace
-
importedClassesCache
private final java.util.Map<Descriptors.TypeRef,Clazz> importedClassesCache
-
analyzed
private boolean analyzed
-
diagnostics
private boolean diagnostics
-
inited
private boolean inited
-
msgs
protected final AnalyzerMessages msgs
-
annotationHeaders
private AnnotationHeaders annotationHeaders
-
packagesVisited
private java.util.Set<Descriptors.PackageRef> packagesVisited
-
nonClassReferences
private java.util.Set<Descriptors.PackageRef> nonClassReferences
-
checks
private java.util.Set<Analyzer.Check> checks
-
bcpTypes
private final java.util.Map<Descriptors.TypeRef,java.lang.String> bcpTypes
-
STATUS_PROPERTY
private static final java.lang.String STATUS_PROPERTY
- See Also:
- Constant Field Values
-
OLD_PACKAGEINFO_SYNTAX_P
static final java.util.regex.Pattern OLD_PACKAGEINFO_SYNTAX_P
-
OBJECT_REFERENCE
static final java.util.regex.Pattern OBJECT_REFERENCE
-
firstUse
boolean firstUse
-
fuzzyVersion
static final java.util.regex.Pattern fuzzyVersion
Clean up version parameters. Other builders use more fuzzy definitions of the version syntax. This method cleans up such a version to match an OSGi version.
-
fuzzyVersionRange
static final java.util.regex.Pattern fuzzyVersionRange
-
fuzzyModifier
static final java.util.regex.Pattern fuzzyModifier
-
DEFAULT_PROVIDER_POLICY
static final java.lang.String DEFAULT_PROVIDER_POLICY
- See Also:
- Constant Field Values
-
DEFAULT_CONSUMER_POLICY
static final java.lang.String DEFAULT_CONSUMER_POLICY
- See Also:
- Constant Field Values
-
_classesHelp
static final java.lang.String _classesHelp
The extends macro traverses all classes and returns a list of class names that extend a base class.
-
_packagesHelp
static final java.lang.String _packagesHelp
-
BASE64HEX_P
private static final java.util.regex.Pattern BASE64HEX_P
md5 macro
-
_md5Help
static final java.lang.String _md5Help
- See Also:
- Constant Field Values
-
_sha1Help
static final java.lang.String _sha1Help
SHA1 macro- See Also:
- Constant Field Values
-
-
Method Detail
-
setTypeSpecificPlugins
protected void setTypeSpecificPlugins(java.util.Set<java.lang.Object> list)
- Overrides:
setTypeSpecificPlugins
in classProcessor
-
getManifest
public static java.util.Properties getManifest(java.io.File dirOrJar) throws java.lang.Exception
Specifically for Maven- Throws:
java.lang.Exception
-
analyze
public void analyze() throws java.lang.Exception
Calculates the data structures for generating a manifest.- Throws:
java.io.IOException
java.lang.Exception
-
getHostPackages
public java.util.Optional<java.util.Set<Descriptors.PackageRef>> getHostPackages()
Get the packages from the host if this is a fragment bundle- Returns:
- the host packages or an empty set if not a fragment
-
getRequireBundlePackages
public java.util.Optional<java.util.Set<Descriptors.PackageRef>> getRequireBundlePackages()
Find the packages belonging to the required bundles- Returns:
- the packages from the required bundles, with no Require-Bundle return an empty Optional
-
isNormalPackage
private boolean isNormalPackage(Descriptors.PackageRef pRef)
-
getExportedByAnnotation
private Parameters getExportedByAnnotation()
-
referencesByAnnotation
private java.util.Set<Descriptors.PackageRef> referencesByAnnotation(Clazz clazz)
-
getPackageInfo
public Clazz getPackageInfo(Descriptors.PackageRef packageRef)
-
doConditionalPackages
private void doConditionalPackages() throws java.lang.Exception
- Throws:
java.lang.Exception
-
learnPackage
private void learnPackage(Jar jar, java.lang.String prefix, Descriptors.PackageRef packageRef, Packages map) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getName
protected java.lang.String getName(Jar jar) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parsePackageinfo
Attrs parsePackageinfo(Descriptors.PackageRef packageRef, Resource r) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parsePackageInfoClass
private Attrs parsePackageInfoClass(Resource r) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeDynamicImports
void removeDynamicImports(Packages referredAndExported)
Discussed with BJ and decided to kill the .- Parameters:
referredAndExported
-
-
getExtra
protected Jar getExtra() throws java.lang.Exception
- Throws:
java.lang.Exception
-
doPlugins
void doPlugins()
-
isResourceOnly
boolean isResourceOnly()
- Returns:
true
if the-resourceonly
instruction is set,false
otherwise
-
calcManifest
public java.util.jar.Manifest calcManifest() throws java.lang.Exception
One of the main workhorses of this class. This will analyze the current setup and calculate a new manifest according to this setup.- Throws:
java.io.IOException
java.lang.Exception
-
findClasspathEntry
public Jar findClasspathEntry(java.lang.String bsn, java.lang.String r)
Find a class path entry based on bsn and versionrange- Parameters:
bsn
- The bundle symbolic namer
- The version range specified like in OSGi (version => [version,infinite))- Returns:
- first JAR that matches bsn &r or null if not found
-
doEEProfiles
private java.lang.String doEEProfiles(Clazz.JAVA highest) throws java.io.IOException
Added for 1.8 profiles. A 1.8 profile is a set of packages so the VM can be delivered in smaller versions. This method will look at theConstants.EEPROFILE
option. If it is set, it can be "auto" or it can contain a list of profiles specified as name="a,b,c" values. If we find a package outside the profiles, no profile is set. Otherwise the highest found profile is added. This only works for java packages.- Throws:
java.io.IOException
-
doHeader
private void doHeader(java.util.jar.Attributes main, java.lang.String header)
-
doNamesection
private void doNamesection(Jar dot, java.util.jar.Manifest manifest)
Parse the namesection as instructions and then match them against the current set of resources For example:-namesection: *;baz=true, abc/def/bar/X.class=3
The raw value ofConstants.NAMESECTION
is used but the values of the attributes are replaced where @ is set to the resource name. This allows macro to operate on the resource
-
doNameSection
void doNameSection(java.util.jar.Manifest manifest, java.lang.String header)
This method is called when the header starts with a @, signifying a name section header. The name part is defined by replacing all the @ signs to a /, removing the first and the last, and using the last part as header name:@org@osgi@service@event@Implementation-Title
This will be the header Implementation-Title in the org/osgi/service/event named section.- Parameters:
manifest
-header
-
-
getBsn
public java.lang.String getBsn()
Clear the key part of a header. I.e. remove everything from the first ';'
-
_bsn
public java.lang.String _bsn(java.lang.String[] args)
-
calculateExportsFromContents
public java.lang.String calculateExportsFromContents(Jar bundle)
Calculate an export header solely based on the contents of a JAR file- Parameters:
bundle
- The jar file to analyze
-
getContained
public Packages getContained()
-
getExports
public Packages getExports()
-
getImports
public Packages getImports()
-
getPrivates
public java.util.Set<Descriptors.PackageRef> getPrivates()
-
getJar
public Jar getJar()
-
getReferred
public Packages getReferred()
-
getUnreachable
public java.util.Set<Descriptors.PackageRef> getUnreachable()
Return the set of unreachable code depending on exports and the bundle activator.
-
getUses
public java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> getUses()
-
getAPIUses
public java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> getAPIUses()
-
getClasspathExports
public Packages getClasspathExports()
-
getBndVersion
public java.lang.String getBndVersion()
Get the version for this bnd- Returns:
- version or unknown.
-
getBndLastModified
public long getBndLastModified()
-
getBndInfo
public java.lang.String getBndInfo(java.lang.String key, java.lang.String defaultValue)
-
mergeManifest
public void mergeManifest(java.util.jar.Manifest manifest) throws java.io.IOException
Merge the existing manifest with the instructions but do not override existing properties.- Parameters:
manifest
- The manifest to merge with- Throws:
java.io.IOException
-
setClasspath
public void setClasspath(java.util.Collection<?> classpath) throws java.io.IOException
Set the classpath for this analyzer by file.- Parameters:
classpath
-- Throws:
java.io.IOException
-
setClasspath
public void setClasspath(java.io.File[] classpath) throws java.io.IOException
- Throws:
java.io.IOException
-
setClasspath
public void setClasspath(Jar[] classpath)
-
setClasspath
public void setClasspath(java.lang.String[] classpath)
-
setJar
public Jar setJar(java.io.File file) throws java.io.IOException
Set the JAR file we are going to work in. This will read the JAR in memory.- Parameters:
file
-- Throws:
java.io.IOException
-
getJarFromName
public Jar getJarFromName(java.lang.String name, java.lang.String from)
Try to get a Jar from a file name/path or a url, or in last resort from the classpath name part of their files.- Overrides:
getJarFromName
in classProcessor
- Parameters:
name
- URL or filename relative to the basefrom
- Message identifying the caller for errors- Returns:
- null or a Jar with the contents for the name
-
getJarsFromName
public java.util.List<Jar> getJarsFromName(java.lang.String name, java.lang.String from)
-
merge
private void merge(java.util.jar.Manifest result, java.util.jar.Manifest old)
-
verifyManifestHeadersCase
void verifyManifestHeadersCase(java.util.Properties properties)
Bnd is case sensitive for the instructions so we better check people are not using an invalid case. We do allow this to set headers that should not be processed by us but should be used by the framework.- Parameters:
properties
- Properties to verify.
-
doExportsToImports
Packages doExportsToImports(Packages exports)
We will add all exports to the imports unless there is a -noimport directive specified on an export. This directive is skipped for the manifest. We also remove any version parameter so that augmentImports can do the version policy. The following method is really tricky and evolved over time. Coming from the original background of OSGi, it was a weird idea for me to have a public package that should not be substitutable. I was so much convinced that this was the right rule that I rücksichtlos imported them all. Alas, the real world was more subtle than that. It turns out that it is not a good idea to always import. First, there must be a need to import, i.e. there must be a contained package that refers to the exported package for it to make use importing that package. Second, if an exported package refers to an internal package than it should not be imported. Additionally, it is necessary to treat the exports in groups. If an exported package refers to another exported packages than it must be in the same group. A framework can only substitute exports for imports for the whole of such a group. WHY????? Not clear anymore ...
-
referred
public boolean referred(Descriptors.PackageRef packageName)
-
getManifestInfoFromClasspath
private void getManifestInfoFromClasspath(Jar jar, Packages classpathExports, Contracts contracts)
-
fixupOldStyleVersions
private void fixupOldStyleVersions(Attrs attrs)
-
augmentImports
void augmentImports(Packages imports, Packages exports) throws java.lang.Exception
Find some more information about imports in manifest and other places. It is assumed that the augmentsExports has already copied external attrs from the classpathExports.- Throws:
java.lang.Exception
-
divideRegularAndDynamicImports
Pair<Packages,Parameters> divideRegularAndDynamicImports()
-
applyVersionPolicy
java.lang.String applyVersionPolicy(java.lang.String exportVersion, java.lang.String importRange, boolean provider)
-
findProvidedPackages
java.util.Set<Descriptors.PackageRef> findProvidedPackages() throws java.lang.Exception
Find the packages we depend on, where we implement an interface that is a Provider Type. These packages, when we import them, must use the provider policy.- Throws:
java.lang.Exception
-
isProvider
private boolean isProvider(Descriptors.TypeRef t)
-
augmentExports
void augmentExports(Packages exports) throws java.io.IOException
Provide any macro substitutions and versions for exported packages.- Throws:
java.io.IOException
-
fixupAttributes
void fixupAttributes(Descriptors.PackageRef packageRef, Attrs attributes) throws java.io.IOException
Fixup Attributes Execute any macros on an export and- Throws:
java.io.IOException
-
removeAttributes
void removeAttributes(Attrs attributes)
Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You can add a remove-attribute: directive with a regular expression for attributes that need to be removed. We also remove all attributes that have a value of !. This allows you to use macros with ${if} to remove values.
-
calculateVersionRange
java.lang.String calculateVersionRange(java.lang.String version, boolean impl)
Calculate a version from a version policy.- Parameters:
version
- The actual exported versionimpl
- true for implementations and false for clients
-
doUses
void doUses(Packages exports, java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> uses, Packages imports)
Add the uses clauses. This method iterates over the exports and cal- Parameters:
exports
-uses
-- Throws:
MojoExecutionException
-
doUses
protected void doUses(Descriptors.PackageRef packageRef, Packages exports, java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> uses, Packages imports)
- Parameters:
packageRef
-exports
-uses
-imports
-
-
removeTransitive
void removeTransitive(Descriptors.PackageRef name, java.util.Set<Descriptors.PackageRef> unreachable)
Transitively remove all elemens from unreachable through the uses link.- Parameters:
name
-unreachable
-
-
verifyAttribute
private void verifyAttribute(java.lang.String path, java.lang.String where, java.lang.String key, java.lang.String value) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
-
_findpath
public java.lang.String _findpath(java.lang.String[] args)
Findpath looks through the contents of the JAR and finds paths that end with the given regular expression ${findpath (; reg-expr (; replacement)? )? }- Parameters:
args
-
-
_findname
public java.lang.String _findname(java.lang.String[] args)
-
findPath
java.lang.String findPath(java.lang.String name, java.lang.String[] args, boolean fullPathName)
-
putAll
public void putAll(java.util.Map<java.lang.String,java.lang.String> additional, boolean force)
-
getClasspath
public java.util.List<Jar> getClasspath()
-
addClasspath
public void addClasspath(Jar jar)
-
addClasspath
public void addClasspath(java.util.Collection<?> jars) throws java.io.IOException
- Throws:
java.io.IOException
-
addClasspath
public void addClasspath(java.io.File cp) throws java.io.IOException
- Throws:
java.io.IOException
-
forceRefresh
public void forceRefresh()
- Overrides:
forceRefresh
in classProcessor
-
getTarget
public Jar getTarget()
-
analyzeBundleClasspath
private void analyzeBundleClasspath() throws java.lang.Exception
- Throws:
java.lang.Exception
-
analyzeJar
private boolean analyzeJar(Jar jar, java.lang.String prefix, boolean okToIncludeDirs, java.lang.String bcpEntry) throws java.lang.Exception
We traverse through all the classes that we can find and calculate the contained and referred set and uses. This method ignores the Bundle classpath.- Throws:
java.lang.Exception
-
cleanupVersion
public static java.lang.String cleanupVersion(java.lang.String version)
-
isInteger
private static boolean isInteger(java.lang.String minor)
TRhe cleanup version got confused when people used numeric dates like 201209091230120 as qualifiers. These are too large for Integers. This method checks if the all digit string fits in an integer.maxint = 2,147,483,647 = 10 digits
- Returns:
- if this fits in an integer
-
removeLeadingZeroes
private static java.lang.String removeLeadingZeroes(java.lang.String group)
-
cleanupModifier
static void cleanupModifier(java.lang.StringBuilder result, java.lang.String modifier)
-
getVersionPolicy
public java.lang.String getVersionPolicy(boolean implemented)
-
_classes
public java.lang.String _classes(java.lang.String... args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getClasses
public java.util.Collection<Clazz> getClasses(java.lang.String... args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
_packages
public java.lang.String _packages(java.lang.String... args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getPackages
public java.util.Collection<Descriptors.PackageRef> getPackages(Packages scope, java.lang.String... args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
_exporters
public java.lang.String _exporters(java.lang.String[] args) throws java.lang.Exception
Get the exporter of a package ...- Throws:
java.lang.Exception
-
getClassspace
public java.util.Map<Descriptors.TypeRef,Clazz> getClassspace()
-
_packageattribute
public java.lang.String _packageattribute(java.lang.String[] args)
Return an attribute of a package
-
findResource
public Resource findResource(java.lang.String path)
Locate a resource on the class path.- Parameters:
path
- Path of the reosurce- Returns:
- A resource or
null
-
findResources
public java.util.stream.Stream<Resource> findResources(java.util.function.Predicate<java.lang.String> matches)
-
findClass
public Clazz findClass(Descriptors.TypeRef typeRef) throws java.lang.Exception
Find a clazz on the class path. This class has been parsed.- Throws:
java.lang.Exception
-
getVersion
public java.lang.String getVersion()
Answer the bundle version.
-
isNoBundle
public boolean isNoBundle()
-
referTo
public void referTo(Descriptors.TypeRef ref)
-
nonClassReferTo
public void nonClassReferTo(Descriptors.TypeRef ref)
-
referToByBinaryName
public void referToByBinaryName(java.lang.String binaryClassName)
-
doRequireBnd
protected void doRequireBnd()
Ensure that we are running on the correct bnd.
-
_md5
public java.lang.String _md5(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
_sha1
public java.lang.String _sha1(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getDescriptor
public Descriptors.Descriptor getDescriptor(java.lang.String descriptor)
-
getTypeRef
public Descriptors.TypeRef getTypeRef(java.lang.String binaryClassName)
-
getPackageRef
public Descriptors.PackageRef getPackageRef(java.lang.String binaryName)
-
getTypeRefFromFQN
public Descriptors.TypeRef getTypeRefFromFQN(java.lang.String fqn)
-
getTypeRefFromPath
public Descriptors.TypeRef getTypeRefFromPath(java.lang.String path)
-
getClassSignature
public ClassSignature getClassSignature(java.lang.String signature)
-
getMethodSignature
public MethodSignature getMethodSignature(java.lang.String signature)
-
getFieldSignature
public FieldSignature getFieldSignature(java.lang.String signature)
-
isImported
public boolean isImported(Descriptors.PackageRef packageRef)
-
filter
Packages filter(Instructions instructions, Packages source, java.util.Set<Instruction> nomatch)
Merge the attributes of two maps, where the first map can contain wildcarded names. The idea is that the first map contains instructions (for example *) with a set of attributes. These patterns are matched against the found packages in actual. If they match, the result is set with the merged set of attributes. It is expected that the instructions are ordered so that the instructor can define which pattern matches first. Attributes in the instructions override any attributes from the actual.
A pattern is a modified regexp so it looks like globbing. The * becomes a .* just like the ? becomes a .?. '.' are replaced with \\. Additionally, if the pattern starts with an exclamation mark, it will remove that matches for that pattern (- the !) from the working set. So the following patterns should work:- com.foo.bar
- com.foo.*
- com.foo.???
- com.*.[^b][^a][^r]
- !com.foo.* (throws away any match for com.foo.*)
- Parameters:
instructions
- the instructions with patterns.source
- the actual found packages, contains no duplicates- Returns:
- Only the packages that were filtered by the given instructions
-
setDiagnostics
public void setDiagnostics(boolean b)
-
getLowestEE
public Clazz.JAVA getLowestEE()
-
getHighestEE
public Clazz.JAVA getHighestEE()
-
_ee
public java.lang.String _ee(java.lang.String[] args)
-
getOutputFile
public java.io.File getOutputFile(java.lang.String output)
Calculate the output file for the given target. The strategy is:parameter given if not null and not directory if directory, this will be the output directory based on bsn-version.jar name of the source file if exists Untitled-[n]
- Parameters:
output
- may be null, otherwise a file path relative to base
-
save
public boolean save(java.io.File output, boolean force) throws java.lang.Exception
Utility function to carefully save the file. Will create a backup if the source file has the same path as the output. It will also only save if the file was modified or the force flag is true- Parameters:
output
- the output file, if nullgetOutputFile(String)
is used.force
- if it needs to be overwritten- Throws:
java.lang.Exception
-
setDefaults
public void setDefaults(java.lang.String bsn, Version version)
Set default import and export instructions if none are set
-
cleanupUses
public java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> cleanupUses(java.util.Map<Descriptors.PackageRef,java.util.List<Descriptors.PackageRef>> apiUses, boolean removeJava)
Remove the own references and optional java references from the uses lib- Parameters:
apiUses
-removeJava
-
-
getClassspace
public java.util.Set<Clazz> getClassspace(Descriptors.PackageRef source)
Return the classes for a given source package.- Parameters:
source
- the source package- Returns:
- a set of classes for the requested package.
-
getXRef
public java.util.Map<Clazz.Def,java.util.List<Descriptors.TypeRef>> getXRef(Descriptors.PackageRef source, java.util.Collection<Descriptors.PackageRef> dest, int sourceModifiers) throws java.lang.Exception
Create a cross reference from package source, to packages in dest- Parameters:
source
-dest
-sourceModifiers
-- Throws:
java.lang.Exception
-
_exports
public java.lang.String _exports(java.lang.String[] args)
-
_imports
public java.lang.String _imports(java.lang.String[] args)
-
filter
private <T> java.util.Collection<T> filter(java.util.Collection<T> list, java.lang.String[] args)
-
report
public void report(java.util.Map<java.lang.String,java.lang.Object> table) throws java.lang.Exception
Report the details of this analyzer
-
getEEs
public java.util.SortedSet<Clazz.JAVA> getEEs()
Return the EEs
-
validResourcePath
public java.lang.String validResourcePath(java.lang.String name, java.lang.String reportIfWrong)
- Parameters:
name
-
-
check
public boolean check(Analyzer.Check key)
Check if we have an a check option
-
getSourceFileFor
public java.lang.String getSourceFileFor(Descriptors.TypeRef type) throws java.lang.Exception
Find the source file for this type- Parameters:
type
-- Throws:
java.lang.Exception
-
getSourceFileFor
public java.lang.String getSourceFileFor(Descriptors.TypeRef type, java.util.Collection<java.io.File> sourcePath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setTypeLocation
public void setTypeLocation(Reporter.SetLocation location, Descriptors.TypeRef type) throws java.lang.Exception
Set location information for a type.- Throws:
java.lang.Exception
-
assignable
public boolean assignable(java.lang.String annoService, java.lang.String inferredService)
-
assignable
public boolean assignable(java.lang.String annoService, java.lang.String inferredService, boolean unknownResult)
-
assignable
public boolean assignable(Clazz annoServiceClazz, Clazz inferredServiceClazz, boolean unknownResult)
-
getBundleClassPathEntry
public java.util.Optional<java.lang.String> getBundleClassPathEntry(Clazz clazz)
-
assignable0
private java.lang.Boolean assignable0(Clazz annoServiceClazz, Clazz inferredServiceClazz) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addDefinedContracts
private void addDefinedContracts()
-
-