to support Java environments without java.nio.file such as Android and J2CL.
184452
@GwtIncompatible
  public static PathSubject assertThat(@NullableDecl Path target) {
    return assertAbout(PathSubject.paths()).that(target);
  }
254975
def _get_java_env(self):
        ""
        env = super(_StreamingAnalyticsSubmitter, self)._get_java_env()
        vcap = streamsx.rest._get_vcap_services(self._vcap_services)
        env['VCAP_SERVICES'] = json.dumps(vcap)
        return env
704431
public RuntimeEnvironment build() {
        final org.kie.api.runtime.manager.RuntimeEnvironmentBuilder jbpmRuntimeEnvironmentBuilder;
        Manifest manifest = _manifestBuilder.build();
        if (manifest instanceof RemoteManifest) {
            RemoteManifest remoteManifest = (RemoteManifest)manifest;
            jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultInMemoryBuilder();
            remoteManifest.addToEnvironment(jbpmRuntimeEnvironmentBuilder);
            // we dont' do any other building for remote usage
            return jbpmRuntimeEnvironmentBuilder.get();
        } else if (manifest instanceof ContainerManifest) {
            ContainerManifest containerManifest = (ContainerManifest)manifest;
            String baseName = containerManifest.getBaseName();
            ReleaseId releaseId = containerManifest.getReleaseId();
            String sessionName = containerManifest.getSessionName();
            if (releaseId != null) {
                if (baseName != null || sessionName != null) {
                    jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultBuilder(releaseId, baseName, sessionName);
                } else {
                    jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultBuilder(releaseId);
                }
                // we can't update classpath containers, so no point adding it to environment below here
                containerManifest.addToEnvironment(jbpmRuntimeEnvironmentBuilder);
            } else if (baseName != null || sessionName != null) {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newClasspathKmoduleDefaultBuilder(baseName, sessionName);
            } else {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newClasspathKmoduleDefaultBuilder();
            }
        } else {
            if (_persistent) {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultBuilder();
            } else {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultInMemoryBuilder();
            }
            if (manifest instanceof ResourcesManifest) {
                ResourcesManifest resourcesManifest = (ResourcesManifest)manifest;
                for (Resource resource : resourcesManifest.buildResources()) {
                    jbpmRuntimeEnvironmentBuilder.addAsset(resource, resource.getResourceType());
                }
            }
        }
        jbpmRuntimeEnvironmentBuilder.classLoader(getClassLoader());
        jbpmRuntimeEnvironmentBuilder.persistence(_persistent);
        // provides a noop EntityManagerFactory if no persistence
        EntityManagerFactory entityManagerFactory = _entityManagerFactoryBuilder.build();
        jbpmRuntimeEnvironmentBuilder.entityManagerFactory(entityManagerFactory);
        jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(EnvironmentName.ENTITY_MANAGER_FACTORY, entityManagerFactory);
        // provides an ootb UserGroupCallback if fallen-back to
        UserGroupCallback userGroupCallback = _userGroupCallbackBuilder.build();
        jbpmRuntimeEnvironmentBuilder.userGroupCallback(userGroupCallback);
        if (_persistent) {
            UserTransaction ut = TransactionManagerLocator.INSTANCE.getUserTransaction();
            TransactionManager tm = TransactionManagerLocator.INSTANCE.getTransactionManager();
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(EnvironmentName.TRANSACTION, ut);
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(EnvironmentName.TRANSACTION_MANAGER, tm);
        } else {
            // TODO: why, when no persistence, do we have to do all this?
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry("IS_JTA_TRANSACTION", Boolean.FALSE);
            TaskEventSupport taskEventSupport = new TaskEventSupport();
            CommandService executor = new TaskCommandExecutorImpl(EnvironmentFactory.newEnvironment(), taskEventSupport);
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(TaskService.class.getName(), new CommandBasedTaskService(executor, taskEventSupport));
        }
        Properties properties = _propertiesBuilder.build();
        for (Object key : properties.keySet()) {
            String name = (String)key;
            String value = properties.getProperty(name);
            jbpmRuntimeEnvironmentBuilder.addConfiguration(name, value); // add to KieSessionConfiguration
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(name, value); // add to Environment (SWITCHYARD-2393)
        }
        // things that need to be done to the original RuntimeEnvironment before the jBPM RuntimeEnvironmentBuilder is built (get->init)
        /*
         * Access<SimpleRuntimeEnvironment> simpleREAccess = new FieldAccess<SimpleRuntimeEnvironment>(
         * org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.class, "runtimeEnvironment");
         * if (simpleREAccess.isReadable()) {
         * SimpleRuntimeEnvironment originalRE = simpleREAccess.read(jbpmRuntimeEnvironmentBuilder);
         */
        KieScanner scanner = null;
        SimpleRuntimeEnvironment originalRE = ((PatchedRuntimeEnvironmentBuilder)jbpmRuntimeEnvironmentBuilder).getRuntimeEnvironment();
        if (originalRE != null) {
            RegisterableItemsFactory originalRIF = originalRE.getRegisterableItemsFactory();
            if (originalRIF instanceof InternalRegisterableItemsFactory) {
                ExtendedRegisterableItemsFactory extendedRIF = _registerableItemsFactoryBuilder.build();
                CompoundRegisterableItemsFactory compoundRIF = new CompoundRegisterableItemsFactory((InternalRegisterableItemsFactory)originalRIF, extendedRIF);
                jbpmRuntimeEnvironmentBuilder.registerableItemsFactory(compoundRIF);
                ExtendedRegisterableItemsFactory.Env.addToEnvironment(jbpmRuntimeEnvironmentBuilder, compoundRIF);
                if (manifest instanceof ContainerManifest && originalRIF instanceof KModuleRegisterableItemsFactory) {
                    Access<KieContainer> kieContainerAccess = new FieldAccess<KieContainer>(KModuleRegisterableItemsFactory.class, "kieContainer");
                    if (kieContainerAccess.isReadable()) {
                        KieContainer kieContainer = kieContainerAccess.read(originalRIF);
                        ((ContainerManifest)manifest).setKieContainer(kieContainer);
                        if (((ContainerManifest)manifest).isScan()) {
                            scanner = _kieServices.newKieScanner(kieContainer);
                            scanner.start(((ContainerManifest)manifest).getScanInterval().longValue());
                        }
                    }
                }
            }
            Mapper mapper;
            AuditMode auditMode;
            if (_persistent) {
                mapper = new JPAMapper(entityManagerFactory);
                auditMode = AuditMode.JPA;
            } else {
                mapper = new InMemoryMapper();
                auditMode = AuditMode.NONE;
            }
            originalRE.setMapper(mapper);
            Environment environmentTemplate = originalRE.getEnvironmentTemplate();
            // set the patched LocalTaskServiceFactory
            originalRE.addToEnvironment(TaskServiceFactory.class.getName(), new PatchedLocalTaskServiceFactory(originalRE));
            // TODO: why, when no persistence, do we have to do all this?
            DeploymentDescriptor deploymentDescriptor = (DeploymentDescriptor)environmentTemplate.get("KieDeploymentDescriptor");
            if (deploymentDescriptor == null) {
                deploymentDescriptor = new DeploymentDescriptorManager().getDefaultDescriptor();
                originalRE.addToEnvironment("KieDeploymentDescriptor", deploymentDescriptor);
            }
            originalRE.addToEnvironment(manifest.getClass().getName(), manifest);
            ((DeploymentDescriptorImpl)deploymentDescriptor).setAuditMode(auditMode);
            if (scanner != null) {
                originalRE.addToEnvironment("KieScanner", scanner);
            }
        }

        /*
         * }
         */
        RuntimeEnvironment runtimeEnvironment = jbpmRuntimeEnvironmentBuilder.get();
        Environment environment = originalRE.getEnvironmentTemplate();
        // our ObjectMarshallingStrategy can be added to the Environment after the jBPM RuntimeEnvironmentBuilder is built (get->init)
        List<ObjectMarshallingStrategy> new_oms = new ArrayList<ObjectMarshallingStrategy>();
        new_oms.add(new SerializerObjectMarshallingStrategy(SerializerFactory.create(FormatType.JSON, null, true)));
        ObjectMarshallingStrategy[] old_oms = (ObjectMarshallingStrategy[])environment.get(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES);
        if (old_oms != null) {
            for (int i = 0; i < old_oms.length; i++) {
                if (old_oms[i] != null) {
                    new_oms.add(old_oms[i]);
                }
            }
        }
        originalRE.addToEnvironment(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new_oms.toArray(new ObjectMarshallingStrategy[new_oms.size()]));
        return runtimeEnvironment;
    }
191450
static Jvm of(final Path javaHome) {
        if (javaHome == null || javaHome.equals(JAVA_HOME)) {
            return DEFAULT;
        }
        final Path path = validateJavaHome(javaHome);
        return new Jvm(path, isModularJavaHome(path));
    }
659831
private Class<?> resolveClassWithCL(String name) throws ClassNotFoundException {
        SecurityManager security = System.getSecurityManager();
        if (security != null) {
            return Class.forName(name, false, getClassLoader(thisClass));
        }

        // The platform classloader is null if we failed to get it when using java 9, or if we are
        // running with a java level below 9. In those cases, the bootstrap classloader
        // is used to resolve the needed class.
        // Note that this change is being made to account for the fact that in java 9, classes
        // such as java.sql.* (java.sql module) are no longer discoverable through the bootstrap
        // classloader. Those classes are now discoverable through the java 9 platform classloader.
        // The platform classloader is between the bootstrap classloader and the app classloader.
        return Class.forName(name, false, platformClassloader);
    }
434444
def _locate_java(self, s):
        '''
        '''
        if 'JAVA_HOME' in self.buildozer.environ:
            return join(self.buildozer.environ['JAVA_HOME'], 'bin', s)
        else:
            return s
1094584
protected Map<Integer, Object> withoutParamPath(ActionExecute execute, List<Class<?>> pathParamTypeList) {
        final Map<Integer, Object> pathParamValueMap;
        if (!pathParamTypeList.isEmpty()) { // e.g. /sea/land/3/ but /sea/land/
            final Map<Integer, Object> valueMap = new LinkedHashMap<Integer, Object>(pathParamTypeList.size());
            int index = 0;
            for (Class<?> paramType : pathParamTypeList) {
                final Object value = isOptionalParameterType(paramType) ? createEmptyOptional(execute, index, paramType) : null;
                valueMap.put(index, value); // null value checked later
                ++index;
            }
            pathParamValueMap = Collections.unmodifiableMap(valueMap);
        } else {
            pathParamValueMap = Collections.emptyMap();
        }
        return pathParamValueMap;
    }
231427
@javax.annotation.Nonnull
    public java.util.Optional<net.morimekta.providence.model.FilePos> optionalValueStartPos() {
        return java.util.Optional.ofNullable(mValueStartPos);
    }
972144
private static Object invokeJavaOptionalOf(Object o) {
    try {
      return JAVA_OPTIONAL_OF_METHOD.invoke(null, o);
    } catch (IllegalAccessException e) {
      throw new SecurityException(e);
    } catch (IllegalArgumentException e) {
      throw new IllegalStateException(e);
    } catch (InvocationTargetException e) {
      throw Throwables.propagate(e.getCause());
    }
  }
6179
@javax.annotation.Nonnull
    public java.util.Optional<java.util.Map<String,net.morimekta.providence.model.ProgramMeta>> optionalIncludes() {
        return java.util.Optional.ofNullable(mIncludes);
    }
351210
private String safeApply( Collection<InstanceContextBean> instances, Options options, String componentPath )
	throws IOException {

		// Parse the filter.
		String installerName = (String) options.hash.get( "installer" );
		final InstanceFilter filter = InstanceFilter.createFilter( componentPath, installerName );

		// Apply the filter.
		final Collection<InstanceContextBean> selectedInstances = filter.apply( instances );

		// Apply the content template of the helper to each selected instance.
		final StringBuilder buffer = new StringBuilder();
		final Context parent = options.context;
		int index = 0;
		final int last = selectedInstances.size() - 1;

		for( final InstanceContextBean instance : selectedInstances ) {
			final Context current = Context.newBuilder( parent, instance )
					.combine( "@index", index )
					.combine( "@first", index == 0 ? "first" : "" )
					.combine( "@last", index == last ? "last" : "" )
					.combine( "@odd", index % 2 == 0 ? "" : "odd" )
					.combine( "@even", index % 2 == 0 ? "even" : "" )
					.build();

			index++;
			buffer.append( options.fn( current ));
		}

		return buffer.toString();
	}
802983
public static <T> DecomposableMatchBuilder0<Optional<T>> none() {
    List<Matcher<Object>> matchers = Lists.of();
    return new DecomposableMatchBuilder0<Optional<T>>(matchers, new OptionalNoneFieldExtractor<>());
  }
1062759
public static JavacProcessingEnvironment instance(Context context) {
        JavacProcessingEnvironment instance = context.get(JavacProcessingEnvironment.class);
        if (instance == null)
            instance = new JavacProcessingEnvironment(context);
        return instance;
    }
936148
private InputStream openResource(String name) throws IOException {
        if (mAppContext == null) {
            throw new RuntimeException("Need to call JodaTimeAndroid.init() before using joda-time-android");
        }

        String resName = ResUtils.getTzResource(name);
        int resId = ResUtils.getIdentifier(R.raw.class, resName);

        if (resId == 0) {
            throw new IOException("Resource not found: \"" + name + "\" (resName: \"" + resName + "\")");
        }

        InputStream in = mAppContext.getResources().openRawResource(resId);

        return in;
    }
718938
@javax.annotation.Nonnull
    public java.util.Optional<java.util.Map<String,String>> optionalNamespaces() {
        return java.util.Optional.ofNullable(mNamespaces);
    }
793153
private static File getToolsJar() {
        String javaHome = System.getProperty("java.home");
        File file = new File(javaHome, "../lib/tools.jar");
        if (!file.exists()) {
            file = new File(javaHome, "lib/tools.jar");
            if (!file.exists()) {
                return null;
            }
        }

        return file;
    }
776465
public static <T> ElementMatcher.Junction<T> not(ElementMatcher<? super T> matcher) {
        return new NegatingMatcher<T>(matcher);
    }