private boolean isValidOrder(final Map<String,SpecificationVersion> firstAPImap, final HashMap<String,SpecificationVersion> secondAPImap) { final HashSet<String> hs = new HashSet<String>(firstAPImap.keySet()); hs.retainAll(secondAPImap.keySet()); if (hs.isEmpty()) return true; for ( final String api : hs ) { if (firstAPImap.get(api).compareTo(secondAPImap.get(api)) >= 0) return true; } return false; } }
static boolean isDesignModeSupported(NbModuleProvider info) { try { SpecificationVersion current = info.getDependencyVersion("org.openide.windows"); if (current == null) { return false; } return current.compareTo(new SpecificationVersion("6.45")) >= 0; // NOI18N } catch (IOException ex) { Logger.getLogger(NewTCIterator.class.getName()).log(Level.INFO, null, ex); return false; } }
private static boolean isAcceptableSourceLevel(String minSourceLevel, String sourceLevel, Set acceptableSourceLevels) { if (minSourceLevel.equals(sourceLevel)) { return true; } SpecificationVersion minSpec = new SpecificationVersion(minSourceLevel); SpecificationVersion spec = new SpecificationVersion(sourceLevel); if (minSpec.compareTo(spec) > 0) { return false; } return acceptableSourceLevels.contains(sourceLevel); }
@SuppressWarnings("deprecation") // Thread.stop private void eqStuck() { Thread eq = TimableEventQueue.eq; if (eq == null) { LOG.warning("event queue thread not determined"); return; } StackTraceElement[] stack = Thread.getAllStackTraces().get(eq); if (stack == null) { LOG.log(Level.WARNING, "no stack trace available for {0}", eq); return; } LOG.log(Level.INFO, "EQ stuck in " + eq, new EQStuck(stack)); if (Dependency.JAVA_SPEC.compareTo(new SpecificationVersion("1.7")) >= 0) { LOG.log(Level.WARNING, "#198918: will not hard restart EQ when running on JDK 7"); eq.interrupt(); // maybe this will be enough return; } for (StackTraceElement line : stack) { if (line.getMethodName().equals("<clinit>")) { LOG.log(Level.WARNING, "Will not hard restart EQ when inside a static initializer: {0}", line); eq.interrupt(); // maybe this will be enough return; } } eq.stop(); }
private static String getCompilerType (ScalaPlatform platform) { assert platform != null; String prop = platform.getSystemProperties().get("java.specification.version"); //NOI18N assert prop != null; SpecificationVersion specificationVersion = new SpecificationVersion (prop); SpecificationVersion jdk13 = new SpecificationVersion("1.3"); //NOI18N int c = specificationVersion.compareTo (jdk13); if (c<0) { return CLASSIC; } else if (c == 0) { return JAVAC13; } else { return MODERN; } }
@CheckForNull private SpecificationVersion max ( @NullAllowed final SpecificationVersion a, @NullAllowed final SpecificationVersion b) { if (a == null) { return b; } else if (b == null) { return a; } else if (a.compareTo(b)>=0) { return a; } else { return b; } }
private boolean getOutdatedJdkVersion( @NonNull final Collection<? super String> invalidVersionProps, @NonNull final SpecificationVersion minVersion) { boolean res = false; for (String vp : versionProps) { final String value = this.eval.getProperty(vp); if (value == null || value.isEmpty()) { continue; } try { final SpecificationVersion vpVersion = new SpecificationVersion(value); if (vpVersion.compareTo(minVersion) < 0) { invalidVersionProps.add(vp); res = true; } } catch (NumberFormatException nfe) { LOG.log( Level.WARNING, "Property: {0} holds non valid version: {1}", //NOI18N new Object[]{ vp, value }); } } return res; }
public boolean canUseMultiview() { try { SpecificationVersion v = getModuleInfo().getDependencyVersion("org.netbeans.core.multiview"); // NOI18N if (v == null) { return false; } SpecificationVersion l = getModuleInfo().getDependencyVersion("org.openide.loaders"); // NOI18N if (l == null) { return false; } return v.compareTo(new SpecificationVersion("1.24")) >= 0 // NOI18N && l.compareTo(new SpecificationVersion("7.26")) >= 0; // NOI18N } catch (IOException ex) { return false; } } public boolean isUseMultiview() {
/** Check whether a simple dependency is met. * Only applicable to Java dependencies. */ static boolean checkJavaDependency(Dependency dep) throws IllegalArgumentException { // Note that "any" comparison is not possible for this type. if (dep.getType() == Dependency.TYPE_JAVA) { if (dep.getName().equals(Dependency.JAVA_NAME)) { if (dep.getComparison() == Dependency.COMPARE_SPEC) { return new SpecificationVersion(dep.getVersion()).compareTo(Dependency.JAVA_SPEC) <= 0; } else { return dep.getVersion().equals(Dependency.JAVA_IMPL); } } else { if (dep.getComparison() == Dependency.COMPARE_SPEC) { return new SpecificationVersion(dep.getVersion()).compareTo(Dependency.VM_SPEC) <= 0; } else { return dep.getVersion().equals(Dependency.VM_IMPL); } } } else { throw new IllegalArgumentException(); } }
@Override public int compareTo(final Object o) { final Profile p = (Profile)o; final int r = getName().compareTo(p.getName()); if (r != 0) return r; if (getVersion() == null) return p.getVersion() == null ? 0 : -1; return p.getVersion() == null ? 1 : getVersion().compareTo(p.getVersion()); }
if (vpVersion.compareTo(platformVersion) > 0) { invalidVersionProps.add(vp); minVersion = max(minVersion,vpVersion);
if (apiVersion == null || apiVersion.compareTo(new SpecificationVersion("1.10")) < 0) { // NOI18N setError(NbBundle.getMessage(OptionsPanel0.class, "MSG_INVALID_PLATFORM")); // NOI18N return;
private static boolean canSetSourceLevel(String sourceLevel) { SpecificationVersion spec = JavaPlatformManager.getDefault().getDefaultPlatform().getSpecification().getVersion(); return spec.compareTo(new SpecificationVersion(sourceLevel)) >= 0; }
void refresh() { removeAllElements(); final JavaPlatform[] platforms = JavaPlatformManager.getDefault().getPlatforms( null, new Specification(type, null)); for (JavaPlatform jp : platforms) { if (minVersion.compareTo(jp.getSpecification().getVersion())<=0) { addElement(jp); } } } }
try { SpecificationVersion javahelpVersion = getModuleInfo().getDependencyVersion("org.netbeans.modules.javahelp"); if (javahelpVersion != null && javahelpVersion.compareTo(new SpecificationVersion("2.20")) < 0) { ann = false;
public boolean hasInvalidJdkVersion () { String javaSource = this.evaluator.getProperty("javac.source"); //NOI18N String javaTarget = this.evaluator.getProperty("javac.target"); //NOI18N if (javaSource == null && javaTarget == null) { //No need to check anything return false; } final String platformId = this.evaluator.getProperty("platform.active"); //NOI18N final JavaPlatform activePlatform = J2SEProjectUtil.getJavaActivePlatform (platformId); if (activePlatform == null) { return true; } SpecificationVersion platformVersion = activePlatform.getSpecification().getVersion(); try { return (javaSource != null && new SpecificationVersion (javaSource).compareTo(platformVersion)>0) || (javaTarget != null && new SpecificationVersion (javaTarget).compareTo(platformVersion)>0); } catch (NumberFormatException nfe) { ErrorManager.getDefault().log("Invalid javac.source: "+javaSource+" or javac.target: "+javaTarget+" of project:" +this.project.getProjectDirectory().getPath()); return true; } }
private boolean hasInvalidJdkVersion() { String javaSource = this.evaluator.getProperty("javac.source"); //NOI18N String javaTarget = this.evaluator.getProperty("javac.target"); //NOI18N if (javaSource == null && javaTarget == null) { //No need to check anything return false; } final String platformId = this.evaluator.getProperty(JAVA_PLATFORM); //NOI18N final JavaPlatform activePlatform = getActivePlatform (platformId); if (activePlatform == null) { return true; } SpecificationVersion platformVersion = activePlatform.getSpecification().getVersion(); try { return (javaSource != null && new SpecificationVersion (javaSource).compareTo(platformVersion)>0) || (javaTarget != null && new SpecificationVersion (javaTarget).compareTo(platformVersion)>0); } catch (NumberFormatException nfe) { ErrorManager.getDefault().log("Invalid javac.source: "+javaSource+" or javac.target: "+javaTarget+" of project:" +this.project.getProjectDirectory().getPath()); return true; } }
) && (platform.getSpecification().getVersion().compareTo(JDK_15) >= 0); //JDK1.5 and higher
private CreatedModifiedFiles generateCreatedModifiedFiles() { assert isSuccessCode(checkFirstPanel()) || isWarningCode(checkFirstPanel()); assert isSuccessCode(checkFinalPanel()); files = new CreatedModifiedFiles(getProject()); boolean useAnnotations = true; try { SpecificationVersion apiVersion = getModuleInfo().getDependencyVersion("org.netbeans.modules.options.api"); useAnnotations = apiVersion == null || apiVersion.compareTo(new SpecificationVersion("1.14")) >= 0; } catch (IOException x) { Logger.getLogger(NewOptionsIterator.class.getName()).log(Level.INFO, null, x); } generateDependencies(); if (useAnnotations && isAdvancedCategory()) { generatePackageInfo(); } else { generateFiles(useAnnotations); } if (!useAnnotations) { generateBundleKeys(); generateLayerEntry(); } if (!isAdvanced()) { FileObject iconFO = FileUtil.toFileObject(icon); if (iconFO != null) { addCreateIconOperation(files, iconFO); } } return files; }
if (JAVA_12.compareTo(specVer)>0) {