Profiler API cleanup, addresses Bug #258423
authorTomas Hurka <thurka@netbeans.org>
Wed, 29 Jun 2016 10:19:54 +0200
changeset 18367b5d1baefdde0
parent 18366 25e40be87b80
child 18368 bf3816d2231a
Profiler API cleanup, addresses Bug #258423
autoproject.profiler/nbproject/project.xml
autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticAntProjectSupportProvider.java
autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticProfilingSettingsSupportProvider.java
autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticProjectProfilingSupportProvider.java
     1.1 --- a/autoproject.profiler/nbproject/project.xml	Tue Jun 14 21:22:34 2016 +0200
     1.2 +++ b/autoproject.profiler/nbproject/project.xml	Wed Jun 29 10:19:54 2016 +0200
     1.3 @@ -32,15 +32,15 @@
     1.4                      </run-dependency>
     1.5                  </dependency>
     1.6                  <dependency>
     1.7 -                    <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
     1.8 -                    <build-prerequisite/>
     1.9 -                    <compile-dependency/>
    1.10 +                    <code-name-base>org.netbeans.modules.java.source.ant</code-name-base>
    1.11                      <run-dependency>
    1.12                          <specification-version>1.1</specification-version>
    1.13                      </run-dependency>
    1.14                  </dependency>
    1.15                  <dependency>
    1.16 -                    <code-name-base>org.netbeans.modules.java.source.ant</code-name-base>
    1.17 +                    <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
    1.18 +                    <build-prerequisite/>
    1.19 +                    <compile-dependency/>
    1.20                      <run-dependency>
    1.21                          <specification-version>1.1</specification-version>
    1.22                      </run-dependency>
    1.23 @@ -60,7 +60,7 @@
    1.24                      <compile-dependency/>
    1.25                      <run-dependency>
    1.26                          <release-version>1</release-version>
    1.27 -                        <specification-version>1.0</specification-version>
    1.28 +                        <specification-version>1.46</specification-version>
    1.29                      </run-dependency>
    1.30                  </dependency>
    1.31                  <dependency>
    1.32 @@ -69,7 +69,7 @@
    1.33                      <compile-dependency/>
    1.34                      <run-dependency>
    1.35                          <release-version>1</release-version>
    1.36 -                        <specification-version>1.0</specification-version>
    1.37 +                        <specification-version>1.25</specification-version>
    1.38                      </run-dependency>
    1.39                  </dependency>
    1.40                  <dependency>
     2.1 --- a/autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticAntProjectSupportProvider.java	Tue Jun 14 21:22:34 2016 +0200
     2.2 +++ b/autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticAntProjectSupportProvider.java	Wed Jun 29 10:19:54 2016 +0200
     2.3 @@ -41,7 +41,10 @@
     2.4   */
     2.5  package org.netbeans.modules.autoproject.profiler;
     2.6  
     2.7 -import org.netbeans.modules.profiler.spi.project.AntProjectSupportProvider;
     2.8 +import java.util.Map;
     2.9 +import org.netbeans.api.java.classpath.ClassPath;
    2.10 +import org.netbeans.api.project.Project;
    2.11 +import org.netbeans.modules.profiler.nbimpl.project.AntProjectSupportProvider;
    2.12  import org.netbeans.spi.project.ProjectServiceProvider;
    2.13  import org.openide.filesystems.FileObject;
    2.14  import org.openide.filesystems.FileUtil;
    2.15 @@ -52,7 +55,12 @@
    2.16   * @author Jiri Sedlacek
    2.17   */
    2.18  @ProjectServiceProvider(service=AntProjectSupportProvider.class, projectType="org-netbeans-modules-autoproject") // NOI18N
    2.19 -public final class AutomaticAntProjectSupportProvider extends AntProjectSupportProvider {
    2.20 +public final class AutomaticAntProjectSupportProvider extends AntProjectSupportProvider.Abstract {
    2.21 +    
    2.22 +    public AutomaticAntProjectSupportProvider(Project project) {
    2.23 +        super(project);
    2.24 +    }
    2.25 +    
    2.26      @Override
    2.27      public FileObject getProjectBuildScript() {
    2.28          return FileUtil.toFileObject(InstalledFileLocator.getDefault().locate(
    2.29 @@ -64,4 +72,10 @@
    2.30          return getProjectBuildScript();
    2.31      }
    2.32      
    2.33 +    @Override
    2.34 +    public void configurePropertiesForProfiling(Map<String, String> props, FileObject profiledClassFile) {
    2.35 +        ClassPath sourcepath = ClassPath.getClassPath(profiledClassFile, ClassPath.SOURCE); // ??? (moved here from AutomaticProjectProfilingSupportProvider)
    2.36 +        props.put("classpath", ClassPath.getClassPath(profiledClassFile, ClassPath.EXECUTE).toString(ClassPath.PathConversionMode.FAIL)); // NOI18N
    2.37  }
    2.38 +    
    2.39 +}
     3.1 --- a/autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticProfilingSettingsSupportProvider.java	Tue Jun 14 21:22:34 2016 +0200
     3.2 +++ b/autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticProfilingSettingsSupportProvider.java	Wed Jun 29 10:19:54 2016 +0200
     3.3 @@ -1,59 +0,0 @@
     3.4 -/*
     3.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     3.6 - *
     3.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     3.8 - *
     3.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    3.10 - * Other names may be trademarks of their respective owners.
    3.11 - *
    3.12 - * The contents of this file are subject to the terms of either the GNU
    3.13 - * General Public License Version 2 only ("GPL") or the Common
    3.14 - * Development and Distribution License("CDDL") (collectively, the
    3.15 - * "License"). You may not use this file except in compliance with the
    3.16 - * License. You can obtain a copy of the License at
    3.17 - * http://www.netbeans.org/cddl-gplv2.html
    3.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    3.19 - * specific language governing permissions and limitations under the
    3.20 - * License.  When distributing the software, include this License Header
    3.21 - * Notice in each file and include the License file at
    3.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    3.23 - * particular file as subject to the "Classpath" exception as provided
    3.24 - * by Oracle in the GPL Version 2 section of the License file that
    3.25 - * accompanied this code. If applicable, add the following below the
    3.26 - * License Header, with the fields enclosed by brackets [] replaced by
    3.27 - * your own identifying information:
    3.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    3.29 - *
    3.30 - * If you wish your version of this file to be governed by only the CDDL
    3.31 - * or only the GPL Version 2, indicate your decision by adding
    3.32 - * "[Contributor] elects to include this software in this distribution
    3.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    3.34 - * single choice of license, a recipient has the option to distribute
    3.35 - * your version of this file under either the CDDL, the GPL Version 2 or
    3.36 - * to extend the choice of license to its licensees as provided above.
    3.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    3.38 - * Version 2 license, then the option applies only if the new code is
    3.39 - * made subject to such option by the copyright holder.
    3.40 - *
    3.41 - * Contributor(s):
    3.42 - *
    3.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
    3.44 - */
    3.45 -package org.netbeans.modules.autoproject.profiler;
    3.46 -
    3.47 -import org.netbeans.api.project.Project;
    3.48 -import org.netbeans.modules.profiler.spi.project.ProfilingSettingsSupportProvider;
    3.49 -import org.netbeans.spi.project.ProjectServiceProvider;
    3.50 -
    3.51 -/**
    3.52 - *
    3.53 - * @author Jiri Sedlacek
    3.54 - */
    3.55 -@ProjectServiceProvider(service=ProfilingSettingsSupportProvider.class, projectType="org-netbeans-modules-autoproject") // NOI18N
    3.56 -public final class AutomaticProfilingSettingsSupportProvider extends ProfilingSettingsSupportProvider.Default {
    3.57 -    
    3.58 -    public AutomaticProfilingSettingsSupportProvider(Project project) {
    3.59 -        super(project);
    3.60 -    }
    3.61 -    
    3.62 -}
     4.1 --- a/autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticProjectProfilingSupportProvider.java	Tue Jun 14 21:22:34 2016 +0200
     4.2 +++ b/autoproject.profiler/src/org/netbeans/modules/autoproject/profiler/AutomaticProjectProfilingSupportProvider.java	Wed Jun 29 10:19:54 2016 +0200
     4.3 @@ -41,23 +41,13 @@
     4.4   */
     4.5  package org.netbeans.modules.autoproject.profiler;
     4.6  
     4.7 -import java.util.Properties;
     4.8 -import java.util.concurrent.atomic.AtomicBoolean;
     4.9 -import java.util.logging.Level;
    4.10 -import java.util.logging.Logger;
    4.11 -import javax.lang.model.element.TypeElement;
    4.12  import org.netbeans.api.java.classpath.ClassPath;
    4.13 -import org.netbeans.api.java.source.ClasspathInfo;
    4.14 -import org.netbeans.api.java.source.CompilationController;
    4.15 -import org.netbeans.api.java.source.JavaSource;
    4.16 -import org.netbeans.api.java.source.Task;
    4.17  import org.netbeans.api.project.Project;
    4.18  import org.netbeans.modules.profiler.api.JavaPlatform;
    4.19  import org.netbeans.modules.profiler.nbimpl.project.JavaProjectProfilingSupportProvider;
    4.20  import org.netbeans.modules.profiler.spi.project.ProjectProfilingSupportProvider;
    4.21  import org.netbeans.spi.project.ProjectServiceProvider;
    4.22  import org.openide.filesystems.FileObject;
    4.23 -import java.util.Map;
    4.24  
    4.25  /**
    4.26   *
    4.27 @@ -71,6 +61,7 @@
    4.28          return fo.hasExt("java"); // NOI18N
    4.29      }
    4.30  
    4.31 +    @Override
    4.32      protected JavaPlatform resolveProjectJavaPlatform() {
    4.33          return null;
    4.34      }
    4.35 @@ -82,15 +73,6 @@
    4.36                  ClassPath.getClassPath(profiledClassFile, ClassPath.EXECUTE) != null;
    4.37      }
    4.38      
    4.39 -    public void configurePropertiesForProfiling(Properties props, FileObject profilerClassFile) {
    4.40 -        // transitional placeholder for API change
    4.41 -    }
    4.42 -
    4.43 -    public void configurePropertiesForProfiling(Map<String, String> props, FileObject profiledClassFile) {
    4.44 -        ClassPath sourcepath = ClassPath.getClassPath(profiledClassFile, ClassPath.SOURCE);
    4.45 -        props.put("classpath", ClassPath.getClassPath(profiledClassFile, ClassPath.EXECUTE).toString(ClassPath.PathConversionMode.FAIL)); // NOI18N
    4.46 -    }
    4.47 -    
    4.48      public AutomaticProjectProfilingSupportProvider(Project project) {
    4.49          super(project);
    4.50      }