Patch based on http://pkgs.fedoraproject.org/cgit/visualvm.git/commit/?id=a37c6bc6123082e7872096345651bd2d2c404945 Original author: Mat Booth <fedora@matbooth.co.uk> diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/CheckModuleConfigs.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/CheckModuleConfigs.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/CheckModuleConfigs.java 2011-04-18 17:20:50.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/CheckModuleConfigs.java 2013-06-23 21:19:00.485397000 +0100 @@ -94,7 +94,7 @@ } File clusterPropertiesFile = new File(nbroot, "nbbuild" + File.separatorChar + "cluster.properties"); @SuppressWarnings("unchecked") - Map<String,String> properties = getProject().getProperties(); + Map<String,Object> properties = getProject().getProperties(); Map<String,Set<String>> clusters = loadModuleClusters(properties, clusterPropertiesFile); Set<String> allClusterModules = new TreeSet<String>(); for (Set<String> s : clusters.values()) { @@ -119,12 +119,12 @@ // Verify sorting and overlaps: Pattern clusterNamePat = Pattern.compile("nb\\.cluster\\.([^.]+)"); Map<String,List<String>> allClusters = new HashMap<String,List<String>>(); - for (Map.Entry<String,String> clusterDef : properties.entrySet()) { + for (Map.Entry<String,Object> clusterDef : properties.entrySet()) { Matcher m = clusterNamePat.matcher(clusterDef.getKey()); if (!m.matches()) { continue; } - allClusters.put(m.group(1), splitToList(clusterDef.getValue(), clusterDef.getKey())); + allClusters.put(m.group(1), splitToList(clusterDef.getValue().toString(), clusterDef.getKey())); } allClusters.get("experimental").removeAll(allClusters.get("stableuc")); // intentionally a superset for (Map.Entry<String,List<String>> entry : allClusters.entrySet()) { @@ -176,19 +176,19 @@ return set; } - private Map<String,Set<String>> loadModuleClusters(Map<String,String> clusterProperties, File clusterPropertiesFile) { + private Map<String,Set<String>> loadModuleClusters(Map<String,Object> clusterProperties, File clusterPropertiesFile) { String fullConfig = "clusters.config.full.list"; - String l = clusterProperties.get(fullConfig); + Object l = clusterProperties.get(fullConfig); if (l == null) { throw new BuildException(clusterPropertiesFile + ": no definition for clusters.config.full.list"); } Map<String,Set<String>> clusters = new TreeMap<String,Set<String>>(); - for (String cluster : splitToSet(l, fullConfig)) { + for (String cluster : splitToSet(l.toString(), fullConfig)) { l = clusterProperties.get(cluster); if (l == null) { throw new BuildException(clusterPropertiesFile + ": no definition for " + cluster); } - clusters.put(cluster, new TreeSet<String>(splitToSet(l, fullConfig))); + clusters.put(cluster, new TreeSet<String>(splitToSet(l.toString(), fullConfig))); } return clusters; } diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ExportedAPICondition.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ExportedAPICondition.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ExportedAPICondition.java 2011-04-18 17:20:50.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ExportedAPICondition.java 2013-06-23 21:10:35.014079000 +0100 @@ -61,12 +61,12 @@ public boolean eval() throws BuildException { @SuppressWarnings("unchecked") - Hashtable<String,String> props = getProject().getProperties(); + Hashtable<String,Object> props = getProject().getProperties(); if (props.get("public.packages").equals("-")) { log("No exported packages", Project.MSG_VERBOSE); return false; } - String friends = props.get("friends"); + Object friends = props.get("friends"); if (friends == null) { log("Public API", Project.MSG_VERBOSE); return true; diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/InsertModuleAllTargets.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/InsertModuleAllTargets.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/InsertModuleAllTargets.java 2011-04-18 17:20:50.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/InsertModuleAllTargets.java 2013-06-23 21:20:54.103914000 +0100 @@ -97,19 +97,19 @@ return; } @SuppressWarnings("unchecked") - Hashtable<String,String> props = prj.getProperties(); + Hashtable<String,Object> props = prj.getProperties(); if (checkModules) { boolean missingModules = false; - String[] clusters = props.get("nb.clusters.list").split(", *"); - String nb_all = props.get("nb_all"); + String[] clusters = props.get("nb.clusters.list").toString().split(", *"); + Object nb_all = props.get("nb_all"); if (nb_all == null) throw new BuildException("Can't file 'nb_all' property, probably not in the NetBeans build system"); - File nbRoot = new File(nb_all); + File nbRoot = new File(nb_all.toString()); for( String cluster: clusters) { if (props.get(cluster) == null) throw new BuildException("Cluster '"+cluster+"' has got empty list of modules. Check configuration of that cluster.",getLocation()); - String[] clusterModules = props.get(cluster).split(", *"); + String[] clusterModules = props.get(cluster).toString().split(", *"); for( String module: clusterModules) { File moduleBuild = new File(nbRoot, module + File.separator + "build.xml"); if (!moduleBuild.exists() || !moduleBuild.isFile()) { @@ -119,18 +119,18 @@ } } if (missingModules) { - String clusterConfig = props.get("cluster.config"); - throw new BuildException("Some modules according your cluster config '" + clusterConfig + "' are missing from checkout, see messages above.",getLocation()); + Object clusterConfig = props.get("cluster.config"); + throw new BuildException("Some modules according your cluster config '" + clusterConfig.toString() + "' are missing from checkout, see messages above.",getLocation()); } } Map<String,String> clustersOfModules = new HashMap<String,String>(); - for (Map.Entry<String,String> pair : props.entrySet()) { + for (Map.Entry<String,Object> pair : props.entrySet()) { String cluster = pair.getKey(); if (!cluster.startsWith("nb.cluster.") || cluster.endsWith(".depends") || cluster.endsWith(".dir")) { continue; } - for (String module : pair.getValue().split(", *")) { + for (String module : pair.getValue().toString().split(", *")) { clustersOfModules.put(module, cluster); } } diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/LayerIndex.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/LayerIndex.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/LayerIndex.java 2011-08-01 08:57:48.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/LayerIndex.java 2013-06-23 21:11:57.545457000 +0100 @@ -73,12 +73,15 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; + import javax.xml.parsers.SAXParserFactory; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.types.ResourceCollection; import org.apache.tools.ant.types.resources.ZipResource; import org.xml.sax.Attributes; @@ -111,7 +114,7 @@ } private String resourceId; - private List<ZipResource> resources; + private List<Resource> resources; /** If this parameter is provided, then this tasks creates a resource * composed from all the layerfiles and makes it accessible under this refId * @param id the refId to associate the collection with @@ -361,7 +364,7 @@ } } - private static final class ZipArray extends ArrayList<ZipResource> + private static final class ZipArray extends ArrayList<Resource> implements ResourceCollection { public boolean isFilesystemOnly() { return false; diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java 2011-10-20 13:43:27.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java 2013-06-23 22:03:14.246264000 +0100 @@ -116,28 +116,29 @@ /** * Find all NBM projects in a root, possibly from cache. */ - private static Map<String,Entry> scanNetBeansOrgSources(File root, Map<String,String> properties, Project project) throws IOException { + private static Map<String,Entry> scanNetBeansOrgSources(File root, Map<String,Object> properties, Project project) throws IOException { Map<String,Entry> entries = SOURCE_SCAN_CACHE.get(root); if (entries == null) { // Similar to #62221: if just invoked from a module in standard clusters, only scan those clusters (faster): Set<String> standardModules = new HashSet<String>(); boolean doFastScan = false; - String basedir = properties.get("basedir"); + Object basedir = properties.get("basedir"); if (basedir != null) { - File basedirF = new File(basedir); - String clusterList = properties.get("nb.clusters.list"); - if (clusterList == null) { - String config = properties.get("cluster.config"); + File basedirF = new File(basedir.toString()); + Object clusterListObj = properties.get("nb.clusters.list"); + if (clusterListObj == null) { + Object config = properties.get("cluster.config"); if (config != null) { - clusterList = properties.get("clusters.config." + config + ".list"); + clusterListObj = properties.get("clusters.config." + config.toString() + ".list"); } } - if (clusterList != null) { - StringTokenizer tok = new StringTokenizer(clusterList, ", "); + if (clusterListObj != null) { + StringTokenizer tok = new StringTokenizer(clusterListObj.toString(), ", "); while (tok.hasMoreTokens()) { String clusterName = tok.nextToken(); - String moduleList = properties.get(clusterName); - if (moduleList != null) { + Object moduleListObj = properties.get(clusterName); + if (moduleListObj != null) { + String moduleList = moduleListObj.toString(); // Hack to treat libs.junit4 as if it were in platform for purposes of building, yet build to another cluster. if (clusterName.equals("nb.cluster.platform")) { moduleList += ",libs.junit4"; @@ -278,7 +279,7 @@ /** * Check a single dir to see if it is an NBM project, and if so, register it. */ - private static boolean scanPossibleProject(File dir, Map<String,Entry> entries, Map<String,String> properties, + private static boolean scanPossibleProject(File dir, Map<String,Entry> entries, Map<String,Object> properties, String path, ModuleType moduleType, Project project, Map<File,Long[]> timestampsAndSizes) throws IOException { File nbproject = new File(dir, "nbproject"); File projectxml = new File(nbproject, "project.xml"); @@ -374,18 +375,21 @@ assert path != null; // Find the associated cluster. // first try direct mapping in nbbuild/netbeans/moduleCluster.properties - String clusterDir = properties.get(path + ".dir"); - if (clusterDir != null) { + Object clusterDirObj = properties.get(path + ".dir"); + String clusterDir = null; + if (clusterDirObj != null) { + clusterDir = clusterDirObj.toString(); clusterDir = clusterDir.substring(clusterDir.lastIndexOf('/') + 1); } else { // not found, try indirect nbbuild/cluster.properties - for (Map.Entry<String, String> entry : properties.entrySet()) { - String val = entry.getValue(); + for (Map.Entry<String, Object> entry : properties.entrySet()) { + String val = entry.getValue().toString(); String[] modules = val.split(", *"); if (Arrays.asList(modules).contains(path)) { String key = entry.getKey(); - clusterDir = properties.get(key + ".dir"); - if (clusterDir != null) { + clusterDirObj = properties.get(key + ".dir"); + if (clusterDirObj != null) { + clusterDir = clusterDirObj.toString(); faketask.setName("cluster.dir"); faketask.setValue(clusterDir); faketask.execute(); @@ -440,10 +444,10 @@ File origBin = null; if (binaryOrigin != null) { String reltext = XMLUtil.findText(binaryOrigin); - String nball = properties.get("nb_all"); + Object nball = properties.get("nb_all"); if (nball != null) { faketask.setName("nb_all"); - faketask.setValue(nball); + faketask.setValue(nball.toString()); faketask.execute(); } fakeproj.setBaseDir(dir); @@ -630,13 +634,13 @@ } } - private static Map<String,Entry> scanSuiteSources(Map<String,String> properties, Project project) throws IOException { - File basedir = new File(properties.get("basedir")); - String suiteDir = properties.get("suite.dir"); + private static Map<String,Entry> scanSuiteSources(Map<String,Object> properties, Project project) throws IOException { + File basedir = new File(properties.get("basedir").toString()); + Object suiteDir = properties.get("suite.dir"); if (suiteDir == null) { throw new IOException("No definition of suite.dir in " + basedir); } - File suite = FileUtils.getFileUtils().resolveFile(basedir, suiteDir); + File suite = FileUtils.getFileUtils().resolveFile(basedir, suiteDir.toString()); if (!suite.isDirectory()) { throw new IOException("No such suite " + suite); } @@ -655,7 +659,7 @@ return entries; } - private static void doScanSuite(Map<String,Entry> entries, File suite, Map<String,String> properties, Project project) throws IOException { + private static void doScanSuite(Map<String,Entry> entries, File suite, Map<String,Object> properties, Project project) throws IOException { Project fakeproj = new Project(); fakeproj.setBaseDir(suite); // in case ${basedir} is used somewhere Property faketask = new Property(); @@ -680,9 +684,9 @@ } } - private static Entry scanStandaloneSource(Map<String,String> properties, Project project) throws IOException { + private static Entry scanStandaloneSource(Map<String,Object> properties, Project project) throws IOException { if (properties.get("project") == null) return null; //Not a standalone module - File basedir = new File(properties.get("project")); + File basedir = new File(properties.get("project").toString()); Entry entry = STANDALONE_SCAN_CACHE.get(basedir); if (entry == null) { Map<String,Entry> entries = new HashMap<String,Entry>(); @@ -717,16 +721,16 @@ * @param type the type of project * @param project a project ref, only for logging (may be null with no loss of semantics) */ - public ModuleListParser(Map<String,String> properties, ModuleType type, Project project) throws IOException { - String nball = properties.get("nb_all"); - File basedir = new File(properties.get("basedir")); + public ModuleListParser(Map<String,Object> properties, ModuleType type, Project project) throws IOException { + Object nball = properties.get("nb_all"); + File basedir = new File(properties.get("basedir").toString()); final FileUtils fu = FileUtils.getFileUtils(); if (type != ModuleType.NB_ORG) { // add extra clusters - String suiteDirS = properties.get("suite.dir"); - boolean hasSuiteDir = suiteDirS != null && suiteDirS.length() > 0; - String clusterPath = properties.get("cluster.path.final"); + Object suiteDirS = properties.get("suite.dir"); + boolean hasSuiteDir = suiteDirS != null && suiteDirS.toString().length() > 0; + Object clusterPath = properties.get("cluster.path.final"); File[] clusters = null; if (clusterPath != null) { @@ -734,10 +738,10 @@ if (hasSuiteDir) { // resolve suite modules against fake suite project Project fakeproj = new Project(); - fakeproj.setBaseDir(new File(suiteDirS)); - clustersS = Path.translatePath(fakeproj, clusterPath); + fakeproj.setBaseDir(new File(suiteDirS.toString())); + clustersS = Path.translatePath(fakeproj, clusterPath.toString()); } else { - clustersS = Path.translatePath(project, clusterPath); + clustersS = Path.translatePath(project, clusterPath.toString()); } clusters = new File[clustersS.length]; if (clustersS != null && clustersS.length > 0) { @@ -768,17 +772,17 @@ } } else { // netbeans.org module. - String buildS = properties.get("netbeans.dest.dir"); + Object buildS = properties.get("netbeans.dest.dir"); if (buildS == null) { throw new IOException("No definition of netbeans.dest.dir in " + basedir); } // Resolve against basedir, and normalize ../ sequences and so on in case they are used. // Neither operation is likely to be needed, but just in case. - File build = fu.normalize(fu.resolveFile(basedir, buildS).getAbsolutePath()); + File build = fu.normalize(fu.resolveFile(basedir, buildS.toString()).getAbsolutePath()); if (nball == null) { - throw new IOException("You must declare either <suite-component/> or <standalone/> for an external module in " + new File(properties.get("basedir"))); + throw new IOException("You must declare either <suite-component/> or <standalone/> for an external module in " + new File(properties.get("basedir").toString())); } - if (!build.equals(new File(new File(nball, "nbbuild"), "netbeans"))) { + if (!build.equals(new File(new File(nball.toString(), "nbbuild"), "netbeans"))) { // Potentially orphaned module to be built against specific binaries, plus perhaps other source deps. if (!build.isDirectory()) { throw new IOException("No such netbeans.dest.dir: " + build); @@ -794,9 +798,9 @@ if (e != null) { entries.put(e.getCnb(), e); } - entries.putAll(scanNetBeansOrgSources(new File(nball), properties, project)); + entries.putAll(scanNetBeansOrgSources(new File(nball.toString()), properties, project)); } else { - entries = scanNetBeansOrgSources(new File(nball), properties, project); + entries = scanNetBeansOrgSources(new File(nball.toString()), properties, project); } } } diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleTestDependencies.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleTestDependencies.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleTestDependencies.java 2011-10-20 13:43:27.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ModuleTestDependencies.java 2013-06-23 21:12:52.349708000 +0100 @@ -91,11 +91,11 @@ public @Override void execute() throws BuildException { try { @SuppressWarnings("unchecked") - Hashtable<String,String> props = getProject().getProperties(); + Hashtable<String,Object> props = getProject().getProperties(); ModuleListParser mlp = new ModuleListParser(props, ModuleType.NB_ORG, getProject()); SortedMap<String,SortedSet<String>> deps = new TreeMap<String,SortedSet<String>>(); SortedMap<String,SortedSet<String>> reverseDeps = reverseOutput != null ? new TreeMap<String,SortedSet<String>>() : null; - File nball = new File(props.get("nb_all")); + File nball = new File(props.get("nb_all").toString()); for (ModuleListParser.Entry entry : mlp.findAll()) { String myCnb = entry.getCnb(); String myCluster = entry.getClusterName(); diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java 2011-10-20 13:43:27.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java 2013-06-23 21:15:31.877440000 +0100 @@ -447,7 +447,7 @@ moduleRunClassPathProperty != null || testTypes.size() > 0) { @SuppressWarnings("unchecked") - Hashtable<String,String> properties = getProject().getProperties(); + Hashtable<String,Object> properties = getProject().getProperties(); properties.put("project", moduleProject.getAbsolutePath()); modules = new ModuleListParser(properties, getModuleType(pDoc), getProject()); ModuleListParser.Entry myself = modules.findByCodeNameBase(cnb); diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/RefreshDependencyVersions.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/RefreshDependencyVersions.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/RefreshDependencyVersions.java 2011-04-18 17:20:50.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/RefreshDependencyVersions.java 2013-06-23 21:13:34.633902000 +0100 @@ -121,7 +121,7 @@ validateInjectedDependencies(injectDeps); - @SuppressWarnings("unchecked") Map<String,String> properties = getProject().getProperties(); + @SuppressWarnings("unchecked") Map<String,Object> properties = getProject().getProperties(); ModuleListParser listParser; try { listParser = new ModuleListParser(properties, ModuleType.NB_ORG, getProject()); diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ShorterPaths.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ShorterPaths.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ShorterPaths.java 2011-05-16 18:42:27.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/ShorterPaths.java 2013-06-23 21:13:44.672948000 +0100 @@ -183,7 +183,7 @@ // copy extra unit.test.properties @SuppressWarnings("unchecked") - Map<String, String> properties = getProject().getProperties(); + Map<String, Object> properties = getProject().getProperties(); StringBuffer outProp = new StringBuffer(); for (String name : properties.keySet()) { if (name.matches("test-(unit|qa-functional)-sys-prop\\..+")) { diff -ur netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/Sigtest.java netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/Sigtest.java --- netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/Sigtest.java 2011-04-18 17:20:50.000000000 +0100 +++ netbeans-platform-7.0.1/nbbuild/antsrc/org/netbeans/nbbuild/Sigtest.java 2013-06-23 21:14:22.257121000 +0100 @@ -51,6 +51,7 @@ import java.net.URLClassLoader; import java.util.StringTokenizer; import java.util.zip.ZipFile; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -296,7 +297,7 @@ setM(task, "setPackages", String.class, packages); setM(task, "setVersion", String.class, version); - Class<?> actionType = url.loadClass("org.netbeans.apitest.Sigtest$ActionType"); + Class<? extends EnumeratedAttribute> actionType = (Class<? extends EnumeratedAttribute>) url.loadClass("org.netbeans.apitest.Sigtest$ActionType"); setM(task, "setAction", EnumeratedAttribute.getInstance(actionType, action.getValue())); Path path = getM(task, "createClasspath", Path.class);