Warnings.
authorJesse Glick <jglick@netbeans.org>
Fri, 23 Mar 2012 16:07:40 -0400
changeset 1780119ff5359e176
parent 17800 a751ac091ded
child 17802 6740b75b4ebc
child 17803 d0cdc71cfd8f
Warnings.
autoproject.core/nbproject/project.properties
autoproject.core/src/org/netbeans/modules/autoproject/core/LogicalViewImpl.java
autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectPanelVisual.java
autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectWizardIterator.java
autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectWizardPanel.java
autoproject.java/nbproject/project.properties
autoproject.java/nbproject/project.xml
autoproject.java/src/org/netbeans/modules/autoproject/java/LibrariesNode.java
autoproject.java/src/org/netbeans/modules/autoproject/java/LookupProviderImpl.java
autoproject.java/src/org/netbeans/modules/autoproject/java/SourceLevelQueryImpl.java
autoproject.profiler/nbproject/project.properties
autoproject.web/nbproject/project.properties
     1.1 --- a/autoproject.core/nbproject/project.properties	Thu Mar 22 13:06:32 2012 -0400
     1.2 +++ b/autoproject.core/nbproject/project.properties	Fri Mar 23 16:07:40 2012 -0400
     1.3 @@ -1,2 +1,2 @@
     1.4 -javac.source=1.5
     1.5 +javac.source=1.6
     1.6  javac.compilerargs=-Xlint -Xlint:-serial
     2.1 --- a/autoproject.core/src/org/netbeans/modules/autoproject/core/LogicalViewImpl.java	Thu Mar 22 13:06:32 2012 -0400
     2.2 +++ b/autoproject.core/src/org/netbeans/modules/autoproject/core/LogicalViewImpl.java	Fri Mar 23 16:07:40 2012 -0400
     2.3 @@ -139,7 +139,6 @@
     2.4              actions.addAll(Utilities.actionsForPath("Projects/Profiler_Actions_temporary")); //NOI18N
     2.5              actions.addAll(Utilities.actionsForPath("Projects/org-netbeans-modules-autoproject/Actions")); // NOI18N
     2.6              actions.add(null);
     2.7 -            actions.add(CommonProjectActions.setAsMainProjectAction());
     2.8              actions.add(CommonProjectActions.openSubprojectsAction());
     2.9              actions.add(CommonProjectActions.closeProjectAction());
    2.10              actions.add(null);
     3.1 --- a/autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectPanelVisual.java	Thu Mar 22 13:06:32 2012 -0400
     3.2 +++ b/autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectPanelVisual.java	Fri Mar 23 16:07:40 2012 -0400
     3.3 @@ -58,6 +58,7 @@
     3.4  
     3.5      private AutoProjectWizardPanel panel;
     3.6  
     3.7 +    @SuppressWarnings("LeakingThisInConstructor")
     3.8      public AutoProjectPanelVisual(AutoProjectWizardPanel panel) {
     3.9          initComponents();
    3.10          this.panel = panel;
    3.11 @@ -136,7 +137,6 @@
    3.12  
    3.13      private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    3.14          JFileChooser chooser = new JFileChooser();
    3.15 -        FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
    3.16          chooser.setDialogTitle("Select Project Location");
    3.17          chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    3.18          String path = this.projectLocationTextField.getText();
     4.1 --- a/autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectWizardIterator.java	Thu Mar 22 13:06:32 2012 -0400
     4.2 +++ b/autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectWizardIterator.java	Fri Mar 23 16:07:40 2012 -0400
     4.3 @@ -53,7 +53,6 @@
     4.4  import org.netbeans.api.templates.TemplateRegistration;
     4.5  import org.netbeans.modules.autoproject.spi.Cache;
     4.6  import org.netbeans.spi.project.ui.support.ProjectChooser;
     4.7 -import org.netbeans.spi.project.ui.templates.support.Templates;
     4.8  import org.openide.WizardDescriptor;
     4.9  import org.openide.filesystems.FileLock;
    4.10  import org.openide.filesystems.FileObject;
    4.11 @@ -116,7 +115,6 @@
    4.12                  }
    4.13              })./* otherwise will not recognize dir as AP */waitFinished();
    4.14          }
    4.15 -        Templates.setDefinesMainProject(wiz, false);
    4.16          return Collections.singleton(d);
    4.17      }
    4.18  
     5.1 --- a/autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectWizardPanel.java	Thu Mar 22 13:06:32 2012 -0400
     5.2 +++ b/autoproject.core/src/org/netbeans/modules/autoproject/wizard/AutoProjectWizardPanel.java	Fri Mar 23 16:07:40 2012 -0400
     5.3 @@ -44,7 +44,6 @@
     5.4  import org.openide.WizardDescriptor;
     5.5  import org.openide.util.ChangeSupport;
     5.6  import org.openide.util.HelpCtx;
     5.7 -import org.openide.util.NbBundle;
     5.8  
     5.9  public class AutoProjectWizardPanel implements WizardDescriptor.Panel<WizardDescriptor> {
    5.10  
    5.11 @@ -62,7 +61,7 @@
    5.12      }
    5.13  
    5.14      public HelpCtx getHelp() {
    5.15 -        return new HelpCtx(AutoProjectWizardPanel.class);
    5.16 +        return HelpCtx.DEFAULT_HELP;
    5.17      }
    5.18  
    5.19      public boolean isValid() {
     6.1 --- a/autoproject.java/nbproject/project.properties	Thu Mar 22 13:06:32 2012 -0400
     6.2 +++ b/autoproject.java/nbproject/project.properties	Fri Mar 23 16:07:40 2012 -0400
     6.3 @@ -1,4 +1,4 @@
     6.4 -javac.source=1.5
     6.5 +javac.source=1.6
     6.6  javac.compilerargs=-Xlint -Xlint:-serial
     6.7  nbm.homepage=http://wiki.netbeans.org/AutomaticProjects
     6.8  nbm.module.author=Jesse Glick <jglick@netbeans.org>
     7.1 --- a/autoproject.java/nbproject/project.xml	Thu Mar 22 13:06:32 2012 -0400
     7.2 +++ b/autoproject.java/nbproject/project.xml	Fri Mar 23 16:07:40 2012 -0400
     7.3 @@ -20,7 +20,7 @@
     7.4                      <compile-dependency/>
     7.5                      <run-dependency>
     7.6                          <release-version>1</release-version>
     7.7 -                        <specification-version>1.28</specification-version>
     7.8 +                        <specification-version>1.30</specification-version>
     7.9                      </run-dependency>
    7.10                  </dependency>
    7.11                  <dependency>
    7.12 @@ -115,7 +115,7 @@
    7.13                      <build-prerequisite/>
    7.14                      <compile-dependency/>
    7.15                      <run-dependency>
    7.16 -                        <specification-version>7.19</specification-version>
    7.17 +                        <specification-version>7.57</specification-version>
    7.18                      </run-dependency>
    7.19                  </dependency>
    7.20                  <dependency>
     8.1 --- a/autoproject.java/src/org/netbeans/modules/autoproject/java/LibrariesNode.java	Thu Mar 22 13:06:32 2012 -0400
     8.2 +++ b/autoproject.java/src/org/netbeans/modules/autoproject/java/LibrariesNode.java	Fri Mar 23 16:07:40 2012 -0400
     8.3 @@ -45,7 +45,6 @@
     8.4  import java.beans.PropertyChangeEvent;
     8.5  import java.beans.PropertyChangeListener;
     8.6  import java.io.File;
     8.7 -import java.net.URL;
     8.8  import java.util.ArrayList;
     8.9  import java.util.Collection;
    8.10  import java.util.Collections;
    8.11 @@ -71,7 +70,6 @@
    8.12  import org.openide.nodes.Node;
    8.13  import org.openide.util.lookup.Lookups;
    8.14  import org.netbeans.spi.project.support.GenericSources;
    8.15 -import org.openide.filesystems.FileStateInvalidException;
    8.16  import org.openide.util.ImageUtilities;
    8.17  import org.openide.util.WeakListeners;
    8.18  
    8.19 @@ -131,11 +129,11 @@
    8.20              sources.addChangeListener(WeakListeners.change(this, sources));
    8.21          }
    8.22  
    8.23 -        public void stateChanged(ChangeEvent e) {
    8.24 +        @Override public void stateChanged(ChangeEvent e) {
    8.25              setKeys(getKeys());
    8.26          }
    8.27  
    8.28 -        public void propertyChange(PropertyChangeEvent evt) {
    8.29 +        @Override public void propertyChange(PropertyChangeEvent evt) {
    8.30              setKeys(getKeys());
    8.31          }
    8.32  
    8.33 @@ -161,14 +159,10 @@
    8.34                      cp.removePropertyChangeListener(cpListener);
    8.35                      cp.addPropertyChangeListener(cpListener);
    8.36                      BINROOT: for (FileObject binRoot : cp.getRoots()) {
    8.37 -                        try {
    8.38 -                            for (FileObject matchingRoot : SourceForBinaryQuery.findSourceRoots(binRoot.getURL()).getRoots()) {
    8.39 -                                if (sourceRoots.contains(matchingRoot)) {
    8.40 -                                    continue BINROOT;
    8.41 -                                }
    8.42 +                        for (FileObject matchingRoot : SourceForBinaryQuery.findSourceRoots(binRoot.toURL()).getRoots()) {
    8.43 +                            if (sourceRoots.contains(matchingRoot)) {
    8.44 +                                continue BINROOT;
    8.45                              }
    8.46 -                        } catch (FileStateInvalidException x) {
    8.47 -                            assert false : x;
    8.48                          }
    8.49                          keys.add(binRoot);
    8.50                      }
    8.51 @@ -177,15 +171,8 @@
    8.52              return keys;
    8.53          }
    8.54  
    8.55 -        protected Node[] createNodes(FileObject root) {
    8.56 -            URL u;
    8.57 -            try {
    8.58 -                u = root.getURL();
    8.59 -            } catch (FileStateInvalidException fsie) {
    8.60 -                assert false : fsie;
    8.61 -                return null;
    8.62 -            }
    8.63 -            File jar = FileUtil.archiveOrDirForURL(u);
    8.64 +        @Override protected Node[] createNodes(FileObject root) {
    8.65 +            File jar = FileUtil.archiveOrDirForURL(root.toURL());
    8.66              String label = jar != null && jar.isFile() ? jar.getName() : FileUtil.getFileDisplayName(root);
    8.67              return new Node[] {PackageView.createPackageView(GenericSources.group(
    8.68                      prj, root, root.toString(), label, ARCHIVE_ICON,ARCHIVE_ICON))};
     9.1 --- a/autoproject.java/src/org/netbeans/modules/autoproject/java/LookupProviderImpl.java	Thu Mar 22 13:06:32 2012 -0400
     9.2 +++ b/autoproject.java/src/org/netbeans/modules/autoproject/java/LookupProviderImpl.java	Fri Mar 23 16:07:40 2012 -0400
     9.3 @@ -65,7 +65,7 @@
     9.4                  new AnnotationProcessingQueryImpl(),
     9.5                  new ProjectInformationImpl(p),
     9.6                  new SourcesImpl(p),
     9.7 -                new SourceLevelQueryImpl(p),
     9.8 +                new SourceLevelQueryImpl(),
     9.9                  new OpenHook(p, cpp),
    9.10                  new ActionProviderImpl(p),
    9.11                  new SubprojectProviderImpl(p));
    10.1 --- a/autoproject.java/src/org/netbeans/modules/autoproject/java/SourceLevelQueryImpl.java	Thu Mar 22 13:06:32 2012 -0400
    10.2 +++ b/autoproject.java/src/org/netbeans/modules/autoproject/java/SourceLevelQueryImpl.java	Fri Mar 23 16:07:40 2012 -0400
    10.3 @@ -39,34 +39,54 @@
    10.4  
    10.5  package org.netbeans.modules.autoproject.java;
    10.6  
    10.7 +import java.beans.PropertyChangeEvent;
    10.8 +import java.beans.PropertyChangeListener;
    10.9 +import java.io.File;
   10.10 +import javax.swing.event.ChangeListener;
   10.11  import org.netbeans.modules.autoproject.spi.Cache;
   10.12 -import java.io.File;
   10.13 -import org.netbeans.api.project.Project;
   10.14 -import org.netbeans.spi.java.queries.SourceLevelQueryImplementation;
   10.15 +import org.netbeans.spi.java.queries.SourceLevelQueryImplementation2;
   10.16  import org.openide.filesystems.FileObject;
   10.17  import org.openide.filesystems.FileUtil;
   10.18 +import org.openide.util.ChangeSupport;
   10.19 +import org.openide.util.WeakListeners;
   10.20  
   10.21  /**
   10.22   * Just notes 'source' attribute on &lt;javac&gt; currently.
   10.23   */
   10.24 -class SourceLevelQueryImpl implements SourceLevelQueryImplementation {
   10.25 +class SourceLevelQueryImpl implements SourceLevelQueryImplementation2 {
   10.26  
   10.27 -    private final Project p;
   10.28 -
   10.29 -    public SourceLevelQueryImpl(Project p) {
   10.30 -        this.p = p;
   10.31 -    }
   10.32 -
   10.33 -    public String getSourceLevel(FileObject fo) {
   10.34 +    @Override public Result getSourceLevel(FileObject fo) {
   10.35          File f = FileUtil.toFile(fo);
   10.36          while (f != null) {
   10.37 -            String lvl = Cache.get(f + JavaCacheConstants.SOURCE_LEVEL);
   10.38 -            if (lvl != null) {
   10.39 -                return lvl;
   10.40 +            if (Cache.get(f + JavaCacheConstants.SOURCE_LEVEL) != null) {
   10.41 +                return new R(f + JavaCacheConstants.SOURCE_LEVEL);
   10.42              }
   10.43              f = f.getParentFile();
   10.44          }
   10.45          return null;
   10.46      }
   10.47  
   10.48 +    private static class R implements Result, PropertyChangeListener {
   10.49 +        private final String key;
   10.50 +        private final ChangeSupport cs = new ChangeSupport(this);
   10.51 +        @SuppressWarnings("LeakingThisInConstructor")
   10.52 +        R(String key) {
   10.53 +            this.key = key;
   10.54 +            Cache.addPropertyChangeListener(WeakListeners.propertyChange(this, Cache.class));
   10.55 +        }
   10.56 +        @Override public String getSourceLevel() {
   10.57 +            return Cache.get(key);
   10.58 +        }
   10.59 +        @Override public void addChangeListener(ChangeListener listener) {
   10.60 +            cs.addChangeListener(listener);
   10.61 +        }
   10.62 +        @Override public void removeChangeListener(ChangeListener listener) {
   10.63 +            cs.removeChangeListener(listener);
   10.64 +        }
   10.65 +        @Override public void propertyChange(PropertyChangeEvent evt) {
   10.66 +            if (key.equals(evt.getPropertyName())) {
   10.67 +                cs.fireChange();
   10.68 +            }
   10.69 +        }
   10.70 +    }
   10.71  }
    11.1 --- a/autoproject.profiler/nbproject/project.properties	Thu Mar 22 13:06:32 2012 -0400
    11.2 +++ b/autoproject.profiler/nbproject/project.properties	Fri Mar 23 16:07:40 2012 -0400
    11.3 @@ -1,3 +1,3 @@
    11.4  is.eager=true
    11.5 -javac.source=1.5
    11.6 +javac.source=1.6
    11.7  javac.compilerargs=-Xlint -Xlint:-serial
    12.1 --- a/autoproject.web/nbproject/project.properties	Thu Mar 22 13:06:32 2012 -0400
    12.2 +++ b/autoproject.web/nbproject/project.properties	Fri Mar 23 16:07:40 2012 -0400
    12.3 @@ -1,3 +1,3 @@
    12.4  is.eager=true
    12.5 -javac.source=1.5
    12.6 +javac.source=1.6
    12.7  javac.compilerargs=-Xlint -Xlint:-serial