Anonymous avatar Anonymous committed 0ceea81

More updates to make the no-javac-patch NB compile

Comments (0)

Files changed (1)

 # HG changeset patch
-# Parent 744d8c77a5c360808382af4bff8e3ae4c3f555a7
+# Parent 30f2f146ec8261083ab5478ee860e7bddf591592
 
 diff --git a/java.source/src/org/netbeans/api/java/source/TreeUtilities.java b/java.source/src/org/netbeans/api/java/source/TreeUtilities.java
 --- a/java.source/src/org/netbeans/api/java/source/TreeUtilities.java
 -        JavacParser p = new NBEndPosParser(this, lexer, true, false, endPos, cancelService);
 -        return p;
 -    }
--
++//    @Override
++//    public Parser newParser(CharSequence input, int startPos, Map<JCTree,Integer> endPos) {
++//        Lexer lexer = scannerFactory.newScanner(input, true);
++//        ((Scanner)lexer).seek(startPos);
++//        JavacParser p = new NBEndPosParser(this, lexer, true, false, endPos, cancelService);
++//        return p;
++//    }
+ 
 -    @Override
 -    public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap, boolean partial) {
 -        Lexer lexer = scannerFactory.newScanner(input, keepDocComments);
 -        }
 -        return p;
 -    }
-+//    @Override
-+//    public Parser newParser(CharSequence input, int startPos, Map<JCTree,Integer> endPos) {
-+//        Lexer lexer = scannerFactory.newScanner(input, true);
-+//        ((Scanner)lexer).seek(startPos);
-+//        JavacParser p = new NBEndPosParser(this, lexer, true, false, endPos, cancelService);
-+//        return p;
-+//    }
- 
-     protected static class NBJavacParser extends JavacParser {
+-
+-    protected static class NBJavacParser extends JavacParser {
++    public static class NBJavacParser extends JavacParser {
  
          private final Names names;
          private final CancelService cancelService;
  import com.sun.tools.javadoc.Messager;
  import java.io.File;
  import java.io.IOException;
-@@ -160,8 +160,7 @@
- import org.netbeans.modules.java.source.JavaSourceAccessor;
+@@ -161,7 +161,7 @@
  import org.netbeans.modules.java.source.builder.TreeFactory;
  import org.netbeans.lib.nbjavac.services.CancelService;
--import org.netbeans.lib.nbjavac.services.NBParserFactory;
+ import org.netbeans.lib.nbjavac.services.NBParserFactory;
 -import org.netbeans.lib.nbjavac.services.NBParserFactory.NBEndPosParser;
 +import org.netbeans.lib.nbjavac.services.NBParserFactory.NBJavacParser;
  import org.netbeans.modules.java.source.parsing.FileObjects;
  import org.netbeans.modules.java.source.pretty.ImportAnalysis2;
  import org.netbeans.modules.java.source.transform.ImmutableTreeTranslator;
-@@ -561,7 +560,7 @@
-             ParserFactory factory = ParserFactory.instance(context);
-             ScannerFactory scannerFactory = ScannerFactory.instance(context);
-             Names names = Names.instance(context);
--            Parser parser = new JackpotJavacParser(context, (NBParserFactory) factory, scannerFactory.newScanner(buf, false), false, false, CancelService.instance(context), names);
-+            Parser parser = new JackpotJavacParser(context, factory, scannerFactory.newScanner(buf, false), false, false, CancelService.instance(context), names);
-             if (parser instanceof JavacParser) {
-                 if (pos != null)
-                     pos[0] = new ParserSourcePositions((JavacParser)parser);
-@@ -595,13 +594,13 @@
-             ScannerFactory scannerFactory = ScannerFactory.instance(context);
-             Names names = Names.instance(context);
-             Scanner scanner = scannerFactory.newScanner(buf, false);
--            Parser parser = new JackpotJavacParser(context, (NBParserFactory) factory, scanner, false, false, CancelService.instance(context), names);
-+            Parser parser = new JackpotJavacParser(context, factory, scanner, false, false, CancelService.instance(context), names);
-             if (parser instanceof JavacParser) {
-                 if (pos != null)
+@@ -601,7 +601,7 @@
                      pos[0] = new ParserSourcePositions((JavacParser)parser);
                  JCExpression result = parser.parseExpression();
  
                      return result;
                  }
              }
-@@ -729,12 +728,12 @@
+@@ -729,12 +729,12 @@
          JavaFileObject jfo = FileObjects.memoryFileObject("$", "$", new File("/tmp/$" + count + ".java").toURI(), System.currentTimeMillis(), clazz.toString());
  
          DiagnosticListener<? super JavaFileObject> old = log.getDiagnosticListener();
              
              JCCompilationUnit cut = compiler.parse(jfo);
  
-@@ -764,7 +763,7 @@
+@@ -764,7 +764,7 @@
              log.nerrors = origNErrors;
              log.nwarnings = origNWarnings;
              log.deferDiagnostics = origDeferDiagnostic;
          }
      }
  
-@@ -1227,28 +1226,30 @@
+@@ -1227,28 +1227,30 @@
          }
      }
  
 +    private static class JackpotJavacParser extends NBJavacParser {
  
          private final Context ctx;
--        public JackpotJavacParser(Context ctx, NBParserFactory fac,
 +        private final com.sun.tools.javac.util.Name dollar;
-+        public JackpotJavacParser(Context ctx, ParserFactory fac,
+         public JackpotJavacParser(Context ctx, NBParserFactory fac,
                           Lexer S,
                           boolean keepDocComments,
                           boolean keepLineMap,
  
                      return new ModifiersWildcard(name, F.Ident(name));
                  }
-@@ -1257,14 +1258,13 @@
+@@ -1257,14 +1259,13 @@
              return super.modifiersOpt(partial);
          }
  
  
                      return new VariableWildcard(ctx, name, F.Ident(name));
                  }
-@@ -1275,35 +1275,20 @@
+@@ -1275,35 +1276,20 @@
  
          @Override
          protected JCCatch catchClause() {
                  }
              }
              return super.catchClause();
-@@ -1311,24 +1296,18 @@
+@@ -1311,24 +1297,18 @@
  
          @Override
          public com.sun.tools.javac.util.List<JCTree> classOrInterfaceBodyDeclaration(com.sun.tools.javac.util.Name className, boolean isInterface) {
                  }
              }
              return super.classOrInterfaceBodyDeclaration(className, isInterface);
-@@ -1336,7 +1315,7 @@
+@@ -1336,7 +1316,7 @@
          
          @Override
          protected JCExpression checkExprStat(JCExpression t) {
                  if (((IdentifierTree) t).getName().toString().startsWith("$")) {
                      return t;
                  }
-@@ -1346,31 +1325,27 @@
+@@ -1346,31 +1326,27 @@
  
          @Override
          protected JCCase switchBlockStatementGroup() {
              }
  
              return super.switchBlockStatementGroup();
-@@ -1379,15 +1354,14 @@
+@@ -1379,15 +1355,14 @@
  
          @Override
          protected JCTree resource() {
  
                      return F.at(pos).Ident(name);
                  }
-@@ -1397,109 +1371,6 @@
+@@ -1397,109 +1372,6 @@
  
      }
  
      private static final class DummyJFO extends SimpleJavaFileObject {
          private DummyJFO() {
              super(URI.create("dummy.java"), JavaFileObject.Kind.SOURCE);
-@@ -1547,7 +1418,7 @@
+@@ -1547,7 +1419,7 @@
                      IdentifierTree it = (IdentifierTree) mit.getMethodSelect();
  
                      if ("super".equals(it.getName().toString())) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.