Some more fixes
authorjlahoda
Sun, 09 Aug 2015 11:26:06 +0200
changeset 100729f8e222a67f
parent 1006 59bc00399d46
child 1008 f25092ba0d0c
Some more fixes
cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java
cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/MainTest.java
java.hints/java.hints.test/nbproject/genfiles.properties
     1.1 --- a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java	Mon Aug 03 20:43:34 2015 +0200
     1.2 +++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java	Sun Aug 09 11:26:06 2015 +0200
     1.3 @@ -94,6 +94,8 @@
     1.4  import org.netbeans.modules.java.source.DefaultPositionRefProvider;
     1.5  import org.netbeans.modules.java.source.PositionRefProvider;
     1.6  import org.netbeans.modules.java.source.tasklist.CompilerSettings;
     1.7 +import org.netbeans.modules.openide.util.DefaultMutexImplementation;
     1.8 +import org.netbeans.modules.openide.util.NbMutexEventProvider;
     1.9  import org.netbeans.modules.parsing.impl.indexing.implspi.ActiveDocumentProvider;
    1.10  import org.netbeans.modules.parsing.implspi.EnvironmentFactory;
    1.11  import org.netbeans.modules.parsing.nb.DataObjectEnvFactory;
    1.12 @@ -106,6 +108,8 @@
    1.13  import org.openide.filesystems.MIMEResolver;
    1.14  import org.openide.util.NbCollections;
    1.15  import org.openide.util.NbPreferences.Provider;
    1.16 +import org.openide.util.spi.MutexEventProvider;
    1.17 +import org.openide.util.spi.MutexImplementation;
    1.18  import org.openide.xml.EntityCatalog;
    1.19  import org.openide.xml.XMLUtil;
    1.20  import org.w3c.dom.Document;
    1.21 @@ -284,6 +288,8 @@
    1.22          registrations.add(new MetaInfRegistration(EditorMimeTypesImplementation.class.getName(), EditorMimeTypesImplementationImpl.class.getName()));
    1.23          registrations.add(new MetaInfRegistration(PositionRefProvider.Factory.class.getName(), DefaultPositionRefProvider.FactoryImpl.class.getName()));
    1.24          registrations.add(new MetaInfRegistration(CompilerSettings.class.getName(), CompilerSettingsImpl.class.getName()));
    1.25 +        registrations.add(new MetaInfRegistration(MutexImplementation.class.getName(), DefaultMutexImplementation.class.getName()));
    1.26 +        registrations.add(new MetaInfRegistration(MutexEventProvider.class.getName(), NbMutexEventProvider.class.getName()));
    1.27          registrations.addAll(info.metaInf);
    1.28  
    1.29          Map<String, Collection<MetaInfRegistration>> api2Registrations = new HashMap<String, Collection<MetaInfRegistration>>();
    1.30 @@ -498,7 +504,9 @@
    1.31              NbProjectManager.class.getName(),
    1.32              DefaultGlobalPathRegistryImplementation.class.getName(),
    1.33              DefaultPositionRefProvider.FactoryImpl.class.getName(),
    1.34 -            CompilerSettingsImpl.class.getName()
    1.35 +            CompilerSettingsImpl.class.getName(),
    1.36 +            NbMutexEventProvider.class.getName(),
    1.37 +            DefaultMutexImplementation.class.getName()
    1.38          ));
    1.39  
    1.40      private static final Set<String> COPY_REGISTRATION = new HashSet<String>(Arrays.<String>asList(
     2.1 --- a/cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/MainTest.java	Mon Aug 03 20:43:34 2015 +0200
     2.2 +++ b/cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/MainTest.java	Sun Aug 09 11:26:06 2015 +0200
     2.3 @@ -365,6 +365,42 @@
     2.4                        "1.6");
     2.5      }
     2.6  
     2.7 +    public void testSourcePath() throws Exception {
     2.8 +        String golden =
     2.9 +            "package test;\n" +
    2.10 +            "public class Test {\n" +
    2.11 +            "    private void test() {\n" +
    2.12 +            "        String s = test2.Test2.C;\n" +
    2.13 +            "    }\n" +
    2.14 +            "}\n";
    2.15 +
    2.16 +        doRunCompiler(golden,
    2.17 +                      null,
    2.18 +                      null,
    2.19 +                      "src/test/Test.java",
    2.20 +                      "package test;\n" +
    2.21 +                      "public class Test {\n" +
    2.22 +                      "    private void test() {\n" +
    2.23 +                      "        String s = test2.Test2.C.intern();\n" +
    2.24 +                      "    }\n" +
    2.25 +                      "}\n",
    2.26 +                      "src/test2/Test2.java",
    2.27 +                      "package test2;\n" +
    2.28 +                      "public class Test2 {\n" +
    2.29 +                      "    public static final String C = \"a\";\n" +
    2.30 +                      "}\n",
    2.31 +                      null,
    2.32 +                      DONT_APPEND_PATH,
    2.33 +                      "--apply",
    2.34 +                      "--hint",
    2.35 +                      "String.intern() called on constant",
    2.36 +                      "--sourcepath",
    2.37 +                      "${workdir}/src",
    2.38 +                      "${workdir}/src/test");
    2.39 +    }
    2.40 +
    2.41 +    private static final String DONT_APPEND_PATH = new String("DONT_APPEND_PATH");
    2.42 +
    2.43      private void doRunCompiler(String golden, String stdOut, String stdErr, String... fileContentAndExtraOptions) throws Exception {
    2.44          List<String> fileAndContent = new LinkedList<String>();
    2.45          List<String> extraOptions = new LinkedList<String>();
    2.46 @@ -395,13 +431,20 @@
    2.47          File source = new File(wd, "src/test/Test.java");
    2.48  
    2.49          List<String> options = new LinkedList<String>();
    2.50 +        boolean appendPath = true;
    2.51  
    2.52          options.add("--cache");
    2.53          options.add("/tmp/cachex");
    2.54          for (String extraOption : extraOptions) {
    2.55 +            if (extraOption == DONT_APPEND_PATH) {
    2.56 +                appendPath = false;
    2.57 +                continue;
    2.58 +            }
    2.59              options.add(extraOption.replace("${workdir}", wd.getAbsolutePath()));
    2.60          }
    2.61 -        options.add(wd.getAbsolutePath());
    2.62 +
    2.63 +        if (appendPath)
    2.64 +            options.add(wd.getAbsolutePath());
    2.65  
    2.66          String[] output = new String[2];
    2.67  
     3.1 --- a/java.hints/java.hints.test/nbproject/genfiles.properties	Mon Aug 03 20:43:34 2015 +0200
     3.2 +++ b/java.hints/java.hints.test/nbproject/genfiles.properties	Sun Aug 09 11:26:06 2015 +0200
     3.3 @@ -1,8 +1,8 @@
     3.4 -build.xml.data.CRC32=a15e90ee
     3.5 +build.xml.data.CRC32=bdfc486d
     3.6  build.xml.script.CRC32=fb578ef0
     3.7  build.xml.stylesheet.CRC32=a56c6a5b@2.70
     3.8  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     3.9  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    3.10 -nbproject/build-impl.xml.data.CRC32=a15e90ee
    3.11 +nbproject/build-impl.xml.data.CRC32=bdfc486d
    3.12  nbproject/build-impl.xml.script.CRC32=c676886e
    3.13  nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.70