Finds the first packaging processor on the classpath that supports give {@code packageType}

@param packagingType Package type
@return
345065
@SuppressWarnings({ "rawtypes", "unchecked" })
    public static PackagingProcessor<? extends Archive<?>> find(
            final PackagingType packagingType) {

        ServiceRegistry registry = ServiceRegistry.getInstance();
        Collection<PackagingProcessor> processors = registry.all(PackagingProcessor.class);

        StringBuilder unsupportedFormatMessage = new StringBuilder("No packaging processor for ")
                .append(packagingType.toString()).append(
                        " packaging was found. Supported processors are: ");

        for (PackagingProcessor processor : processors) {
            if (processor.handles(packagingType)) {
                // unchecked cast
                return (PackagingProcessor<? extends Archive<?>>) processor;
            }
            unsupportedFormatMessage.append(processor.getClass()).append(", ");
        }
        // trim
        if (unsupportedFormatMessage.indexOf(", ") != -1) {
            unsupportedFormatMessage.delete(unsupportedFormatMessage.length() - 2, unsupportedFormatMessage.length());
        }

        throw new UnsupportedOperationException(unsupportedFormatMessage.toString());
    }
764301
public static Version getSpecificationVersionFor(Class<?> type)
   {
      Assert.notNull(type, "Type must not be null.");
      final Version result;
      Package pkg = type.getPackage();
      if (pkg == null)
      {
         result = EmptyVersion.getInstance();
      }
      else
      {
         String version = pkg.getSpecificationVersion();
         if (Strings.isNullOrEmpty(version))
         {
            result = EmptyVersion.getInstance();
         }
         else
         {
            result = SingleVersion.valueOf(version);
         }
      }
      return result;
   }
1356226
@Pure
	@Inline(value = "ReflectionUtil.getPackageClasses(($1).getName())", imported = {ReflectionUtil.class})
	public static Collection<Class<?>> getPackageClasses(Package pkg) {
		return getPackageClasses(pkg.getName());
	}
576720
public TypeRepository getTypeRepository() {
        if (typeRepository == null) {
            typeRepository = new DefaultTypeRepository(getPackageNames(), getExclusions(), getUrlClassLoader());
        }
        return typeRepository;
    }
1261807
Package getPackage(IntermediateParseResults intermediateResults, String packageId) {
    Package aPackage = intermediateResults.getPackage(packageId);
    if (aPackage == null) {
      aPackage = dataService.findOneById(PackageMetadata.PACKAGE, packageId, Package.class);
    }
    return aPackage;
  }
1458
public static String classToCLIString(Class<?> aClass, Class<?> requiredType) {
        String className = aClass.getName();
        String packageName = requiredType.getPackage().getName();
        if (className.startsWith(packageName)) {
            // cut off package name
            className = className.substring(packageName.length() + 1, className.length());
        } /*else if (Task.class.isAssignableFrom(aClass)) {
            packageName = Task.class.getPackage().getName();
            if (className.startsWith(packageName)) {
                // cut off task package name
                className = className.substring(packageName.length() + 1,
                        className.length());
            }
        }*/
        return className;
    }
773400
public BasicBlock getSuccessorWithEdgeType(BasicBlock source, @Type int edgeType) {
        Edge edge = getOutgoingEdgeWithType(source, edgeType);
        return edge != null ? edge.getTarget() : null;
    }
608629
public String convert(String type) {
		if (isImplicitSarlTypes() && type.startsWith(IMPLICIT_PACKAGE)) {
			return type;
		}
		if (this.mapping == null) {
			this.mapping = initMapping();
		}
		final String map = this.mapping.get(type);
		if (map != null) {
			if (map.isEmpty() && !isImplicitJvmTypes()) {
				return null;
			}
			return map;
		}
		if (isImplicitJvmTypes()) {
			return type;
		}
		return null;
	}
266888
@SuppressWarnings("unchecked")
    public <T> ProcessorBuilder<T> resolve(final Class<T> type) {
        
        ProcessorBuilder<?> builder = builderMap.get(type);
        if(builder == null && Enum.class.isAssignableFrom(type)) {
            // 列挙型の場合は、具象化されたクラスタイプである必要があるため、別途取得する
            builder = builderMap.get(Enum.class);
        }
        
        return (ProcessorBuilder<T>) builder;
    }
269340
public static PackageDescriptor forName(String packageName,
                                            ClassLoader classLoader) {
        
        PackageDescriptor pd = new PackageDescriptor(packageName);
        if (classLoader == null) {
            classLoader = ClassLoader.getSystemClassLoader();
        }
        
        if (packageName == null || packageName.trim().length() == 0) {
            return pd;
        }
        
        String packageInfoClassName = packageName;

        if (!packageInfoClassName.endsWith(".")) {
            packageInfoClassName = packageInfoClassName + ".";
        }
        
        packageInfoClassName = packageInfoClassName + "PackageInfo";


        Class<?> packageInfoClass = null;
        
        try {
            if (classLoader != null) {
                packageInfoClass = 
                    classLoader.loadClass(packageInfoClassName);
            }
            else {
                packageInfoClass = Class.forName(packageInfoClassName);
            }
        }
        catch (Throwable t) {
        }

        if (packageInfoClass != null) {
            try {
                initFromPackageInfo(pd, packageInfoClass);
            }
            catch (Throwable t) {
            }
        }
        else {

            Package pkg = null;
            
            if (classLoader != null) {
                // Get around getPackage's protected access
                PackageLoader packageLoader = 
                    new PackageLoader(classLoader);
                
                pkg = packageLoader.getPackage(packageName);
            }
            
            if (pkg == null) {
                pkg = Package.getPackage(packageName);
            }                        

            if (pkg != null) {
                initFromPackage(pd, pkg);
            }
        }

        return pd;
    }
1325081
public static SortedSet<String> getClassesForPackage(Package pkg, ClassLoader classLoader) {
        SortedSet<String> classes = new TreeSet<>(new Comparator<String>() {
           public int compare(String o1, String o2) {
              String simpleName1 = getSimpleName(o1);
              String simpleName2 = getSimpleName(o2);
              return simpleName1.compareTo(simpleName2);
           }

           private String getSimpleName(String className) {
              return className.substring(className.lastIndexOf('.'));
           }
        });

        String pkgname = pkg.getName();
        String relPath = pkgname.replace('.', '/');

        // Get a File object for the package
        Enumeration<URL> resources;
        try {
            resources = classLoader.getResources(relPath);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        while(resources.hasMoreElements()) {
            URL resource = resources.nextElement();
            if (resource.toString().startsWith("jar:")) {
                processJarfile(resource, pkgname, classes);
            } else {
                processDirectory(new File(resource.getPath()), pkgname, classes);
            }
        }

        return classes;
    }
474617
public static Predicate<Class<?>> inPackage(final String packageNamePrefix) {
        return clazz -> clazz.getPackage().getName().startsWith(packageNamePrefix);
    }
89238
public static String pathToPackageName(String relativePath)
    {
        String qualifiedName = classFilePathToClassname(relativePath);
        return ClassNameUtil.getPackageName(qualifiedName);
    }
1044529
public final AnnotationProcessor getProcessorFor(Set annotationTypeDeclarations, AnnotationProcessorEnvironment env)
    {

        CoreAnnotationProcessorEnv coreEnv = CoreAnnotationProcessorEnvImpl.get( env );
        AnnotationTypeDeclaration[] atds = new AnnotationTypeDeclaration[ annotationTypeDeclarations.size() ];
        int j = 0;
        for ( Iterator i = annotationTypeDeclarations.iterator(); i.hasNext(); )
        {
            // Wrap each Sun/Mirror annotation type declaration with our core AnnotationTypeDeclaration.
            com.sun.mirror.declaration.AnnotationTypeDeclaration decl =
                    ( com.sun.mirror.declaration.AnnotationTypeDeclaration ) i.next();
            atds[ j++ ] = WrapperFactory.get().getAnnotationTypeDeclaration( decl );
        }

        CoreAnnotationProcessor ap = getCoreProcessorFor( atds, coreEnv );
        return ap != null ? new DelegatingAnnotationProcessor( ap ) : null;
    }
213706
public static <T> Collection<Class<? extends T>> getSubTypesOf(Class<T> type, String... packageNames) {
        List<Class<? extends T>> classes = getClasses(packageNames).stream()
                .filter(aClass -> type.isAssignableFrom(aClass))
                .map(aClass -> (Class<? extends T>) aClass)
                .collect(Collectors.toList()); // TODO: pass a Supplier to toList() to avoid map

        return Collections.unmodifiableCollection(classes);
    }
622500
private ClassReference processType(Type type, TypeReferenceLocation typeReferenceLocation, int lineNumber, int columnNumber, int length,
                String line)
    {
        if (type == null)
            return null;

        ITypeBinding resolveBinding = type.resolveBinding();
        if (resolveBinding == null)
        {
            ResolveClassnameResult resolvedResult = resolveClassname(type.toString());
            ResolutionStatus status = resolvedResult.found ? ResolutionStatus.RECOVERED : ResolutionStatus.UNRESOLVED;
            PackageAndClassName packageAndClassName = PackageAndClassName.parseFromQualifiedName(resolvedResult.result);

            return processTypeAsString(resolvedResult.result, packageAndClassName.packageName, packageAndClassName.className, status,
                        typeReferenceLocation, lineNumber,
                        columnNumber, length, line);
        }
        else
        {
            return processTypeBinding(type.resolveBinding(), ResolutionStatus.RESOLVED, typeReferenceLocation, lineNumber,
                        columnNumber, length, line);
        }

    }
657823
private void definePackageIfNecessary(String className) {
		int lastDot = className.lastIndexOf('.');
		if (lastDot >= 0) {
			String packageName = className.substring(0, lastDot);
			if (getPackage(packageName) == null) {
				try {
					definePackage(className, packageName);
				}
				catch (IllegalArgumentException ex) {
					// Tolerate race condition due to being parallel capable
					if (getPackage(packageName) == null) {
						// This should never happen as the IllegalArgumentException
						// indicates that the package has already been defined and,
						// therefore, getPackage(name) should not have returned null.
						throw new AssertionError(
								"Package " + packageName + " has already been defined "
										+ "but it could not be found");
					}
				}
			}
		}
	}