A hackaround for newly introduced NBParserFactory - may not be correct in the long term (because the main sources are not parsed by the NB-enhanced parser).
1.1 --- a/cmdline/compiler/nbproject/project.xml Wed Jul 04 08:16:46 2012 +0200
1.2 +++ b/cmdline/compiler/nbproject/project.xml Thu Jul 05 23:44:17 2012 +0200
1.3 @@ -25,6 +25,14 @@
1.4 </run-dependency>
1.5 </dependency>
1.6 <dependency>
1.7 + <code-name-base>org.netbeans.lib.nbjavac</code-name-base>
1.8 + <build-prerequisite/>
1.9 + <compile-dependency/>
1.10 + <run-dependency>
1.11 + <implementation-version/>
1.12 + </run-dependency>
1.13 + </dependency>
1.14 + <dependency>
1.15 <code-name-base>org.netbeans.libs.javacapi</code-name-base>
1.16 <build-prerequisite/>
1.17 <compile-dependency/>
2.1 --- a/cmdline/compiler/src/org/netbeans/modules/jackpot30/compiler/HintsAnnotationProcessingImpl.java Wed Jul 04 08:16:46 2012 +0200
2.2 +++ b/cmdline/compiler/src/org/netbeans/modules/jackpot30/compiler/HintsAnnotationProcessingImpl.java Thu Jul 05 23:44:17 2012 +0200
2.3 @@ -44,9 +44,11 @@
2.4 import com.sun.source.util.Trees;
2.5 import com.sun.tools.javac.api.JavacTrees;
2.6 import com.sun.tools.javac.jvm.Gen;
2.7 +import com.sun.tools.javac.parser.ParserFactory;
2.8 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
2.9 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
2.10 import com.sun.tools.javac.util.Context;
2.11 +import com.sun.tools.javac.util.Context.Key;
2.12 import com.sun.tools.javac.util.Log;
2.13 import com.sun.tools.javac.util.Options;
2.14 import java.io.File;
2.15 @@ -73,6 +75,7 @@
2.16 import org.netbeans.api.java.classpath.ClassPath;
2.17 import org.netbeans.api.java.source.ClasspathInfo;
2.18 import org.netbeans.api.java.source.CompilationInfoHack;
2.19 +import org.netbeans.lib.nbjavac.services.NBParserFactory;
2.20 import org.netbeans.modules.jackpot30.compiler.AbstractHintsAnnotationProcessing.Reporter;
2.21 import org.netbeans.spi.java.classpath.support.ClassPathSupport;
2.22 import org.openide.filesystems.FileUtil;
2.23 @@ -146,6 +149,10 @@
2.24 ClassPath source = computeClassPath(s, StandardLocation.SOURCE_PATH);
2.25 Trees trees = JavacTrees.instance(c);
2.26 final Log log = Log.instance(c);
2.27 + final Key<ParserFactory> key = ParserFactoryKeyAccessor.getContextKey();
2.28 + ParserFactory origParserFactory = c.get(key);
2.29 + c.put(key, (ParserFactory) null);
2.30 + NBParserFactory.preRegister(c);
2.31
2.32 try {
2.33 TreePath elTree = trees.getPath(type);
2.34 @@ -178,6 +185,9 @@
2.35 p.finish();
2.36 }
2.37 }
2.38 +
2.39 + c.put(key, (ParserFactory) null);
2.40 + c.put(key, origParserFactory);
2.41 }
2.42 }
2.43
2.44 @@ -241,6 +251,14 @@
2.45
2.46 }
2.47
2.48 + private static final class ParserFactoryKeyAccessor extends ParserFactory {
2.49 + ParserFactoryKeyAccessor() {
2.50 + super(null);
2.51 + }
2.52 + public static Key<ParserFactory> getContextKey() {
2.53 + return parserFactoryKey;
2.54 + }
2.55 + }
2.56
2.57
2.58 static {
3.1 --- a/cmdline/compiler/test/unit/src/org/netbeans/modules/jackpot30/compiler/HintsAnnotationProcessingTestBase.java Wed Jul 04 08:16:46 2012 +0200
3.2 +++ b/cmdline/compiler/test/unit/src/org/netbeans/modules/jackpot30/compiler/HintsAnnotationProcessingTestBase.java Thu Jul 05 23:44:17 2012 +0200
3.3 @@ -120,7 +120,10 @@
3.4 options.add("-source");
3.5 options.add("1.5");
3.6 options.add("-Xjcov");
3.7 - options.addAll(extraOptions);
3.8 +
3.9 + for (String eo : extraOptions) {
3.10 + options.add(eo.replace("${workdir}", workDir.getAbsolutePath()));
3.11 + }
3.12
3.13 reallyRunCompiler(workDir, options.toArray(new String[0]));
3.14 }