1.1 --- a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJar.java Sat Dec 29 12:34:23 2012 +0100
1.2 +++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJar.java Tue Jan 01 17:00:23 2013 +0100
1.3 @@ -42,6 +42,9 @@
1.4
1.5 package org.netbeans.modules.jackpot30.cmdline.lib;
1.6
1.7 +import org.netbeans.modules.java.hints.declarative.PatternConvertorImpl;
1.8 +import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
1.9 +
1.10 /**
1.11 *
1.12 * @author lahvac
1.13 @@ -54,7 +57,7 @@
1.14
1.15 @Override
1.16 protected Info computeInfo() {
1.17 - return new Info().addAdditionalRoots(NonNBComputer.class.getName()).setEscapeJavaxLang();
1.18 + return new Info().addAdditionalRoots(NonNBComputer.class.getName(), PatternConvertorImpl.class.getName()).addMetaInfRegistrationToCopy(PatternConvertor.class.getName()).setEscapeJavaxLang();
1.19 }
1.20
1.21 }
2.1 --- a/hudson/trunk Sat Dec 29 12:34:23 2012 +0100
2.2 +++ b/hudson/trunk Tue Jan 01 17:00:23 2013 +0100
2.3 @@ -41,7 +41,7 @@
2.4
2.5 ant -Dnbplatform.active.dir=$PLATFORM -f lib/download.xml download copy-from-platform
2.6
2.7 -SUBPROJECTS="remoting language duplicates cmdline";
2.8 +SUBPROJECTS="remoting duplicates cmdline language";
2.9
2.10 for subproject in $SUBPROJECTS; do
2.11 (cd $subproject; ./build.sh -Dnbplatform.default.harness.dir=$PLATFORM/harness -Dnbplatform.default.netbeans.dest.dir=$PLATFORM -Dnbplatform.active.dir=$PLATFORM) || exit 1
3.1 --- a/language/server/web/language.web.api/nbproject/build-impl.xml Sat Dec 29 12:34:23 2012 +0100
3.2 +++ b/language/server/web/language.web.api/nbproject/build-impl.xml Tue Jan 01 17:00:23 2013 +0100
3.3 @@ -395,6 +395,11 @@
3.4 </and>
3.5 </condition>
3.6 </target>
3.7 + <target name="-init-test-properties">
3.8 + <property name="test.binaryincludes" value="<nothing>"/>
3.9 + <property name="test.binarytestincludes" value=""/>
3.10 + <property name="test.binaryexcludes" value=""/>
3.11 + </target>
3.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
3.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
3.14 <attribute default="${includes}" name="includes"/>
3.15 @@ -418,7 +423,7 @@
3.16 </sequential>
3.17 </macrodef>
3.18 </target>
3.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
3.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
3.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
3.22 <attribute default="${includes}" name="includes"/>
3.23 <attribute default="${excludes}" name="excludes"/>
3.24 @@ -432,6 +437,9 @@
3.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
3.26 <filename name="@{testincludes}"/>
3.27 </fileset>
3.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
3.29 + <filename name="${test.binarytestincludes}"/>
3.30 + </fileset>
3.31 </batchtest>
3.32 <syspropertyset>
3.33 <propertyref prefix="test-sys-prop."/>
3.34 @@ -559,7 +567,7 @@
3.35 </sequential>
3.36 </macrodef>
3.37 </target>
3.38 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
3.39 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
3.40 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.41 <attribute default="${includes}" name="includes"/>
3.42 <attribute default="${excludes}" name="excludes"/>
3.43 @@ -573,6 +581,9 @@
3.44 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
3.45 <filename name="@{testincludes}"/>
3.46 </fileset>
3.47 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
3.48 + <filename name="${test.binarytestincludes}"/>
3.49 + </fileset>
3.50 </batchtest>
3.51 <syspropertyset>
3.52 <propertyref prefix="test-sys-prop."/>
3.53 @@ -929,6 +940,13 @@
3.54 </antcall>
3.55 <antcall target="-maybe-call-dep">
3.56 <param name="call.built.properties" value="${built-jar.properties}"/>
3.57 + <param location="${project.resolve_web_api}" name="call.subproject"/>
3.58 + <param location="${project.resolve_web_api}/build.xml" name="call.script"/>
3.59 + <param name="call.target" value="jar"/>
3.60 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
3.61 + </antcall>
3.62 + <antcall target="-maybe-call-dep">
3.63 + <param name="call.built.properties" value="${built-jar.properties}"/>
3.64 <param location="${project.source_web_api}" name="call.subproject"/>
3.65 <param location="${project.source_web_api}/build.xml" name="call.script"/>
3.66 <param name="call.target" value="jar"/>
3.67 @@ -966,7 +984,7 @@
3.68 <target if="has.persistence.xml" name="-copy-persistence-xml">
3.69 <mkdir dir="${build.classes.dir}/META-INF"/>
3.70 <copy todir="${build.classes.dir}/META-INF">
3.71 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
3.72 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
3.73 </copy>
3.74 </target>
3.75 <target name="-post-compile">
3.76 @@ -1430,6 +1448,13 @@
3.77 </antcall>
3.78 <antcall target="-maybe-call-dep">
3.79 <param name="call.built.properties" value="${built-clean.properties}"/>
3.80 + <param location="${project.resolve_web_api}" name="call.subproject"/>
3.81 + <param location="${project.resolve_web_api}/build.xml" name="call.script"/>
3.82 + <param name="call.target" value="clean"/>
3.83 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
3.84 + </antcall>
3.85 + <antcall target="-maybe-call-dep">
3.86 + <param name="call.built.properties" value="${built-clean.properties}"/>
3.87 <param location="${project.source_web_api}" name="call.subproject"/>
3.88 <param location="${project.source_web_api}/build.xml" name="call.script"/>
3.89 <param name="call.target" value="clean"/>
4.1 --- a/language/server/web/language.web.api/nbproject/genfiles.properties Sat Dec 29 12:34:23 2012 +0100
4.2 +++ b/language/server/web/language.web.api/nbproject/genfiles.properties Tue Jan 01 17:00:23 2013 +0100
4.3 @@ -1,8 +1,8 @@
4.4 -build.xml.data.CRC32=1a6695bf
4.5 +build.xml.data.CRC32=4be6b9c7
4.6 build.xml.script.CRC32=7dcc1ec0
4.7 -build.xml.stylesheet.CRC32=28e38971@1.54.0.46
4.8 +build.xml.stylesheet.CRC32=28e38971@1.56.0.46
4.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
4.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
4.11 -nbproject/build-impl.xml.data.CRC32=1a6695bf
4.12 -nbproject/build-impl.xml.script.CRC32=a2c87df6
4.13 -nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.54.0.46
4.14 +nbproject/build-impl.xml.data.CRC32=4be6b9c7
4.15 +nbproject/build-impl.xml.script.CRC32=76ba8c9e
4.16 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.0.46
5.1 --- a/language/server/web/language.web.api/nbproject/project.properties Sat Dec 29 12:34:23 2012 +0100
5.2 +++ b/language/server/web/language.web.api/nbproject/project.properties Tue Jan 01 17:00:23 2013 +0100
5.3 @@ -27,12 +27,14 @@
5.4 dist.javadoc.dir=${dist.dir}/javadoc
5.5 endorsed.classpath=
5.6 excludes=
5.7 +file.reference.jackpot-lib.jar=../../../../cmdline/lib/build/lib/jackpot-lib.jar
5.8 file.reference.org-netbeans-lib-nbjavac.jar=../../../../lib/org-netbeans-lib-nbjavac.jar
5.9 file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
5.10 file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
5.11 file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
5.12 file.reference.org-netbeans-spi-java-hints.jar=../../../../lib/org-netbeans-spi-java-hints.jar
5.13 file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
5.14 +file.reference.org-openide-util-lookup.jar=../../../../lib/org-openide-util-lookup.jar
5.15 file.reference.util-commons.jar=../../../../remoting/ide/api/external/util-commons.jar
5.16 file.reference.util-pojson.jar=../../../../remoting/ide/api/external/util-pojson.jar
5.17 includes=**
5.18 @@ -54,7 +56,10 @@
5.19 ${reference.source_web_api.jar}:\
5.20 ${file.reference.org-netbeans-modules-java-source.jar}:\
5.21 ${libs.freemarker.classpath}:\
5.22 - ${file.reference.org-netbeans-lib-nbjavac.jar}
5.23 + ${file.reference.org-netbeans-lib-nbjavac.jar}:\
5.24 + ${file.reference.jackpot-lib.jar}:\
5.25 + ${reference.resolve_web_api.jar}:\
5.26 + ${file.reference.org-openide-util-lookup.jar}
5.27 # Space-separated list of extra javac options
5.28 javac.compilerargs=
5.29 javac.deprecation=false
5.30 @@ -94,9 +99,11 @@
5.31 platform.active=default_platform
5.32 project.base_web_api=../../../../remoting/server/web/base.web.api
5.33 project.org_netbeans_modules_jackpot30_indexing=../../../ide/indexing
5.34 +project.resolve_web_api=../../../../remoting/server/web/resolve.web.api
5.35 project.source_web_api=../../../../remoting/server/web/source.web.api
5.36 reference.base_web_api.jar=${project.base_web_api}/dist/base.web.api.jar
5.37 reference.org_netbeans_modules_jackpot30_indexing.module=${project.org_netbeans_modules_jackpot30_indexing}/../build/cluster/modules/org-netbeans-modules-jackpot30-indexing.jar
5.38 +reference.resolve_web_api.jar=${project.resolve_web_api}/dist/resolve.web.api.jar
5.39 reference.source_web_api.jar=${project.source_web_api}/dist/source.web.api.jar
5.40 run.classpath=\
5.41 ${javac.classpath}:\
6.1 --- a/language/server/web/language.web.api/nbproject/project.xml Sat Dec 29 12:34:23 2012 +0100
6.2 +++ b/language/server/web/language.web.api/nbproject/project.xml Tue Jan 01 17:00:23 2013 +0100
6.3 @@ -32,6 +32,14 @@
6.4 <id>module</id>
6.5 </reference>
6.6 <reference>
6.7 + <foreign-project>resolve_web_api</foreign-project>
6.8 + <artifact-type>jar</artifact-type>
6.9 + <script>build.xml</script>
6.10 + <target>jar</target>
6.11 + <clean-target>clean</clean-target>
6.12 + <id>jar</id>
6.13 + </reference>
6.14 + <reference>
6.15 <foreign-project>source_web_api</foreign-project>
6.16 <artifact-type>jar</artifact-type>
6.17 <script>build.xml</script>
7.1 --- a/language/server/web/language.web.api/src/org/netbeans/modules/jackpot30/backend/language/api/API.java Sat Dec 29 12:34:23 2012 +0100
7.2 +++ b/language/server/web/language.web.api/src/org/netbeans/modules/jackpot30/backend/language/api/API.java Tue Jan 01 17:00:23 2013 +0100
7.3 @@ -39,17 +39,16 @@
7.4
7.5 package org.netbeans.modules.jackpot30.backend.language.api;
7.6
7.7 -import com.sun.source.tree.CompilationUnitTree;
7.8 import com.sun.source.tree.Tree;
7.9 -import com.sun.source.util.TreePath;
7.10 -import com.sun.source.util.Trees;
7.11 import com.sun.tools.javac.api.JavacTaskImpl;
7.12 import java.io.IOException;
7.13 import java.net.URI;
7.14 +import java.util.ArrayList;
7.15 import java.util.Arrays;
7.16 import java.util.Collection;
7.17 import java.util.Collections;
7.18 import java.util.LinkedList;
7.19 +import java.util.List;
7.20 import java.util.concurrent.atomic.AtomicBoolean;
7.21 import javax.tools.Diagnostic;
7.22 import javax.tools.JavaCompiler;
7.23 @@ -57,22 +56,29 @@
7.24 import javax.tools.JavaFileObject.Kind;
7.25 import javax.tools.SimpleJavaFileObject;
7.26 import javax.tools.ToolProvider;
7.27 +import javax.ws.rs.DefaultValue;
7.28 import javax.ws.rs.GET;
7.29 import javax.ws.rs.Path;
7.30 import javax.ws.rs.Produces;
7.31 import javax.ws.rs.QueryParam;
7.32 import org.apache.lucene.queryParser.ParseException;
7.33 +import org.netbeans.api.java.source.CompilationInfoHack;
7.34 import org.netbeans.lib.nbjavac.services.NBParserFactory;
7.35 import org.netbeans.lib.nbjavac.services.NBTreeMaker;
7.36 import org.netbeans.modules.jackpot30.backend.base.CategoryStorage;
7.37 import org.netbeans.modules.jackpot30.indexing.index.IndexQuery;
7.38 +import org.netbeans.modules.jackpot30.resolve.api.CompilationInfo;
7.39 +import org.netbeans.modules.jackpot30.resolve.api.ResolveService;
7.40 +import org.netbeans.modules.java.hints.declarative.DeclarativeHintsParser;
7.41 import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
7.42 import org.netbeans.modules.java.hints.providers.spi.HintDescription;
7.43 import org.netbeans.modules.java.hints.providers.spi.HintDescription.AdditionalQueryConstraints;
7.44 import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
7.45 import org.netbeans.modules.java.hints.spiimpl.Utilities;
7.46 +import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
7.47 import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch;
7.48 import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch.BulkPattern;
7.49 +import org.netbeans.spi.editor.hints.ErrorDescription;
7.50
7.51 /**
7.52 *
7.53 @@ -81,15 +87,30 @@
7.54 @Path("/index/language")
7.55 public class API {
7.56
7.57 + static {
7.58 + DeclarativeHintsParser.disableCustomCode = true;
7.59 + }
7.60 +
7.61 @GET
7.62 @Path("/search")
7.63 @Produces("text/plain")
7.64 - public String find(@QueryParam("path") String segment, @QueryParam("pattern") String pattern) throws IOException, InterruptedException, ParseException {
7.65 + public String find(@QueryParam("path") String segment, @QueryParam("pattern") String pattern, @QueryParam("validate") @DefaultValue("false") boolean validate) throws IOException, InterruptedException, ParseException {
7.66 CategoryStorage category = CategoryStorage.forId(segment);
7.67 + Iterable<? extends HintDescription> hints = PatternConvertor.create(pattern);
7.68 + BulkPattern bulkPattern = preparePattern(hints, null);
7.69 StringBuilder sb = new StringBuilder();
7.70 - BulkPattern bulkPattern = preparePattern(pattern, null);
7.71 + List<String> candidates = new ArrayList<String>(IndexQuery.performLocalQuery(category.getIndex(), bulkPattern, false).keySet());
7.72 + Collections.sort(candidates);
7.73
7.74 - for (String candidate : IndexQuery.performLocalQuery(category.getIndex(), bulkPattern, false).keySet()) {
7.75 + for (String candidate : candidates) {
7.76 + if (validate) {
7.77 + CompilationInfo resolvedInfo = ResolveService.parse(segment, candidate);
7.78 + CompilationInfoHack info = new CompilationInfoHack(resolvedInfo);
7.79 + List<ErrorDescription> computedHints = new HintsInvoker(info, new AtomicBoolean()).computeHints(info, hints);
7.80 +
7.81 + if (computedHints.isEmpty()) continue;
7.82 + }
7.83 +
7.84 sb.append(candidate);
7.85 sb.append("\n");
7.86 }
7.87 @@ -101,24 +122,18 @@
7.88 @Path("/searchSpans")
7.89 @Produces("text/plain")
7.90 public String findSpans(@QueryParam("path") String segment, @QueryParam("relativePath") String relativePath, @QueryParam("pattern") String pattern) throws IOException, InterruptedException {
7.91 - CategoryStorage category = CategoryStorage.forId(segment);
7.92 StringBuilder sb = new StringBuilder();
7.93 - BulkPattern bulkPattern = preparePattern(pattern, null);
7.94 - CharSequence source = org.netbeans.modules.jackpot30.source.api.API.readFileContent(category, relativePath);
7.95 - JavacTaskImpl jti = prepareJavacTaskImpl();
7.96 - CompilationUnitTree cut = jti.parse(new JFOImpl(source)).iterator().next();
7.97 - Collection<TreePath> paths = new LinkedList<TreePath>();
7.98 + CompilationInfo resolvedInfo = ResolveService.parse(segment, relativePath);
7.99 + CompilationInfoHack info = new CompilationInfoHack(resolvedInfo);
7.100 + Iterable<? extends HintDescription> hints = PatternConvertor.create(pattern);
7.101
7.102 - for (Collection<TreePath> c : BulkSearch.getDefault().match(null, new AtomicBoolean(), new TreePath(cut), bulkPattern).values()) {
7.103 - paths.addAll(c);
7.104 - }
7.105 + List<ErrorDescription> computedHints = new HintsInvoker(info, new AtomicBoolean()).computeHints(info, hints);
7.106
7.107 - Trees t = Trees.instance(jti);
7.108 -
7.109 - for (TreePath tp : paths) {
7.110 - sb.append(t.getSourcePositions().getStartPosition(cut, tp.getLeaf()));
7.111 + for (ErrorDescription ed : computedHints) {
7.112 + if (!ed.getFile().equals(info.getFileObject())) continue;
7.113 + sb.append(ed.getRange().getBegin().getOffset());
7.114 sb.append(":");
7.115 - sb.append(t.getSourcePositions().getEndPosition(cut, tp.getLeaf()));
7.116 + sb.append(ed.getRange().getEnd().getOffset());
7.117 sb.append(":");
7.118 }
7.119
7.120 @@ -152,7 +167,10 @@
7.121
7.122 //XXX: copied from BatchSearch, may be possible to merge once CompilationInfo is accessible in server mode
7.123 private static BulkPattern preparePattern(final Iterable<? extends HintDescription> patterns, Collection<Diagnostic<? extends JavaFileObject>> errors) {
7.124 - JavacTaskImpl javac = prepareJavacTaskImpl();
7.125 + return preparePattern(prepareJavacTaskImpl(), patterns, errors);
7.126 + }
7.127 +
7.128 + private static BulkPattern preparePattern(JavacTaskImpl javac, final Iterable<? extends HintDescription> patterns, Collection<Diagnostic<? extends JavaFileObject>> errors) {
7.129 Collection<String> code = new LinkedList<String>();
7.130 Collection<Tree> trees = new LinkedList<Tree>();
7.131 Collection<AdditionalQueryConstraints> additionalConstraints = new LinkedList<AdditionalQueryConstraints>();
8.1 --- a/language/server/web/language.web.api/src/org/netbeans/modules/jackpot30/backend/language/api/UI.java Sat Dec 29 12:34:23 2012 +0100
8.2 +++ b/language/server/web/language.web.api/src/org/netbeans/modules/jackpot30/backend/language/api/UI.java Tue Jan 01 17:00:23 2013 +0100
8.3 @@ -56,6 +56,7 @@
8.4 import java.util.LinkedList;
8.5 import java.util.List;
8.6 import java.util.Map;
8.7 +import javax.ws.rs.DefaultValue;
8.8 import javax.ws.rs.GET;
8.9 import javax.ws.rs.Path;
8.10 import javax.ws.rs.Produces;
8.11 @@ -77,7 +78,7 @@
8.12 @GET
8.13 @Path("/search")
8.14 @Produces("text/html")
8.15 - public String search(@Context UriInfo uriInfo, @QueryParam("path") String path, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
8.16 + public String search(@Context UriInfo uriInfo, @QueryParam("path") String path, @QueryParam("pattern") String pattern, @QueryParam("validate") @DefaultValue("false") boolean validate) throws URISyntaxException, IOException, TemplateException {
8.17 String urlBase = uriInfo.getBaseUri().toString();
8.18 Map<String, Object> configurationData = new HashMap<String, Object>();
8.19
8.20 @@ -87,7 +88,7 @@
8.21 configurationData.put("patternEscaped", escapeForQuery(pattern));
8.22
8.23 if (pattern != null && path != null) {
8.24 - URI u = new URI(urlBase + "index/language/search?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern));
8.25 + URI u = new URI(urlBase + "index/language/search?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern) + "&validate=" + validate);
8.26 List<Map<String, Object>> results = new LinkedList<Map<String, Object>>();
8.27 long queryTime = System.currentTimeMillis();
8.28 List<String> candidates = new ArrayList<String>(WebUtilities.requestStringArrayResponse(u));
9.1 --- a/language/server/web/language.web.api/src/org/netbeans/modules/jackpot30/backend/language/api/ui-search.html Sat Dec 29 12:34:23 2012 +0100
9.2 +++ b/language/server/web/language.web.api/src/org/netbeans/modules/jackpot30/backend/language/api/ui-search.html Tue Jan 01 17:00:23 2013 +0100
9.3 @@ -3,7 +3,20 @@
9.4 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
9.5 <#if results??>
9.6 <script type="text/javascript">
9.7 + //XXX: duplicate:
9.8 + function paramValue(param) {
9.9 + var $params = window.location.search.substring(1).split("&");
9.10 +
9.11 + for (var i = 0; i < $params.length; i++) {
9.12 + if ($params[i].indexOf(param + "=") !== (-1)) {
9.13 + return unescape($params[i].substring((param + "=").length));
9.14 + }
9.15 + }
9.16 + }
9.17 $(document).ready(function() {
9.18 + if (paramValue("validate") == "true") {
9.19 + $('#validate').attr("checked", "true");
9.20 + }
9.21 $('#list').find('dd').hide().end().find('dt').click(function() {
9.22 current_dd=$(this).next();
9.23 //XXX: will do the AJAX call for both show and hide!
9.24 @@ -36,6 +49,7 @@
9.25 ${pattern}
9.26 </#if>
9.27 </textarea><br>
9.28 +<input type="checkbox" name="validate" value="true" id="validate">Validate (slower)<br>
9.29 <input type="submit" name="Find Candidates"/>
9.30 </form>
9.31
10.1 --- a/lib/nblibraries.properties Sat Dec 29 12:34:23 2012 +0100
10.2 +++ b/lib/nblibraries.properties Tue Jan 01 17:00:23 2013 +0100
10.3 @@ -1,3 +1,7 @@
10.4 +libs.CopyLibs.classpath=\
10.5 + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
10.6 +libs.CopyLibs.displayName=CopyLibs Task
10.7 +libs.CopyLibs.prop-version=1.0
10.8 libs.jopt-simple.classpath=\
10.9 ${base}/jopt-simple/jopt-simple-3.2.jar
10.10 libs.jopt-simple.javadoc=\
10.11 @@ -14,8 +18,6 @@
10.12 ${base}/junit_4/junit-4.5-api.zip
10.13 libs.junit_4.src=\
10.14 ${base}/junit_4/junit-4.5-src.jar
10.15 -libs.CopyLibs.classpath=\
10.16 - ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
10.17 libs.jersey.classpath=\
10.18 ${base}/jersey-1.1/grizzly-servlet-webserver-1.8.6.3.jar:\
10.19 ${base}/jersey-1.1/jersey-client-1.0.1.jar:\
11.1 --- a/remoting/server/web/resolve.web.api/nbproject/project.properties Sat Dec 29 12:34:23 2012 +0100
11.2 +++ b/remoting/server/web/resolve.web.api/nbproject/project.properties Tue Jan 01 17:00:23 2013 +0100
11.3 @@ -33,6 +33,7 @@
11.4 file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
11.5 file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
11.6 file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
11.7 +file.reference.org-openide-util-lookup.jar=../../../../lib/org-openide-util-lookup.jar
11.8 file.reference.util-commons.jar=../../../ide/api/external/util-commons.jar
11.9 file.reference.util-pojson.jar=../../../ide/api/external/util-pojson.jar
11.10 includes=**
11.11 @@ -50,7 +51,8 @@
11.12 ${file.reference.util-commons.jar}:\
11.13 ${file.reference.util-pojson.jar}:\
11.14 ${file.reference.org-netbeans-modules-lexer.jar}:\
11.15 - ${file.reference.org-netbeans-modules-java-lexer.jar}
11.16 + ${file.reference.org-netbeans-modules-java-lexer.jar}:\
11.17 + ${file.reference.org-openide-util-lookup.jar}
11.18 # Space-separated list of extra javac options
11.19 javac.compilerargs=-Xbootclasspath/p:${libs.javac.classpath}
11.20 javac.deprecation=false
12.1 --- a/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/CompilationInfo.java Sat Dec 29 12:34:23 2012 +0100
12.2 +++ b/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/CompilationInfo.java Tue Jan 01 17:00:23 2013 +0100
12.3 @@ -42,6 +42,7 @@
12.4 package org.netbeans.modules.jackpot30.resolve.api;
12.5
12.6 import com.sun.source.tree.CompilationUnitTree;
12.7 +import com.sun.source.util.JavacTask;
12.8 import com.sun.source.util.Trees;
12.9 import javax.lang.model.util.Elements;
12.10 import javax.lang.model.util.Types;
12.11 @@ -89,4 +90,8 @@
12.12 public /*@NonNull*/ TokenHierarchy<?> getTokenHierarchy() {
12.13 return th;
12.14 }
12.15 +
12.16 + public JavacTask getJavacTask() {
12.17 + return javac.getTask();
12.18 + }
12.19 }
13.1 --- a/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/Javac.java Sat Dec 29 12:34:23 2012 +0100
13.2 +++ b/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/Javac.java Tue Jan 01 17:00:23 2013 +0100
13.3 @@ -44,6 +44,7 @@
13.4 import com.sun.source.tree.CompilationUnitTree;
13.5 import com.sun.source.util.JavacTask;
13.6 import com.sun.tools.javac.api.JavacTaskImpl;
13.7 +import com.sun.tools.javac.util.Abort;
13.8 import java.io.IOException;
13.9 import java.io.InputStream;
13.10 import java.io.OutputStream;
13.11 @@ -63,6 +64,7 @@
13.12 import java.util.Map;
13.13 import java.util.Set;
13.14 import java.util.WeakHashMap;
13.15 +import java.util.concurrent.atomic.AtomicReference;
13.16 import javax.lang.model.element.Modifier;
13.17 import javax.lang.model.element.NestingKind;
13.18 import javax.tools.FileObject;
13.19 @@ -72,7 +74,6 @@
13.20 import javax.tools.JavaFileObject.Kind;
13.21 import javax.tools.SimpleJavaFileObject;
13.22 import javax.tools.StandardLocation;
13.23 -import javax.tools.ToolProvider;
13.24 import org.netbeans.modules.jackpot30.backend.base.SourceRoot;
13.25
13.26 /**
13.27 @@ -94,25 +95,26 @@
13.28 }
13.29
13.30 private final SourceRoot sourceRoot;
13.31 - private final JavacTaskImpl javacTask;
13.32 + private final AtomicReference<JavacTaskImpl> javacTask = new AtomicReference<JavacTaskImpl>();
13.33 private final Map<String, CompilationInfo> path2CUT = new HashMap<String, CompilationInfo>();
13.34
13.35 private Javac(SourceRoot sourceRoot) {
13.36 this.sourceRoot = sourceRoot;
13.37 - FMImpl fm = new FMImpl(sourceRoot.getClassPath());
13.38 - this.javacTask = (JavacTaskImpl) ToolProvider.getSystemJavaCompiler().getTask(null, fm, null, Arrays.asList("-Xjcov", "-proc:none"), null, Collections.<JavaFileObject>emptyList());
13.39 }
13.40
13.41 -
13.42 public CompilationInfo parse(String relativePath) throws IOException, InterruptedException {
13.43 CompilationInfo result = path2CUT.get(relativePath);
13.44
13.45 if (result == null) {
13.46 String content = org.netbeans.modules.jackpot30.source.api.API.readFileContent(sourceRoot.getCategory(), relativePath).replace("\r\n", "\n");
13.47 - Iterable<? extends CompilationUnitTree> cuts = javacTask.parse(new FileObjectImpl(relativePath, content));
13.48 - CompilationUnitTree cut = cuts.iterator().next();
13.49 + CompilationUnitTree cut;
13.50
13.51 - javacTask.analyze(javacTask.enter(Collections.singletonList(cut)));
13.52 + try {
13.53 + cut = doParse(relativePath, content);
13.54 + } catch (Abort a) {
13.55 + javacTask.set(null);
13.56 + cut = doParse(relativePath, content);
13.57 + }
13.58
13.59 path2CUT.put(relativePath, result = new CompilationInfo(this, cut, content));
13.60 }
13.61 @@ -120,8 +122,24 @@
13.62 return result;
13.63 }
13.64
13.65 + private CompilationUnitTree doParse(String relativePath, String content) throws IOException {
13.66 + JavacTaskImpl javac = (JavacTaskImpl) getTask();
13.67 + Iterable<? extends CompilationUnitTree> cuts = javac.parse(new FileObjectImpl(relativePath, content));
13.68 + CompilationUnitTree cut = cuts.iterator().next();
13.69 +
13.70 + javac.analyze(javac.enter(Collections.singletonList(cut)));
13.71 + return cut;
13.72 + }
13.73 +
13.74 public JavacTask getTask() {
13.75 - return javacTask;
13.76 + JavacTaskImpl jti = javacTask.get();
13.77 +
13.78 + if (jti == null) {
13.79 + FMImpl fm = new FMImpl(sourceRoot.getClassPath());
13.80 + javacTask.set(jti = JavacCreator.create(null, fm, null, Arrays.asList("-Xjcov", "-proc:none"), null, Collections.<JavaFileObject>emptyList()));
13.81 + }
13.82 +
13.83 + return jti;
13.84 }
13.85
13.86 private static class FileObjectImpl extends SimpleJavaFileObject {