From 58960ca15db38b6d3c90a0028ced0167f48da1dd Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Fri, 25 Jul 2014 13:54:02 -0700 Subject: [PATCH] Removes the --print-converted-sources option because having the JDT AST record the modifications is costly. Change on 2014/07/16 by kstanger ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=71256378 --- doc/man/j2objc.1 | 3 --- .../com/google/devtools/j2objc/Options.java | 7 ------ .../devtools/j2objc/TranslationProcessor.java | 23 ------------------- .../google/devtools/j2objc/J2ObjC.properties | 1 - 4 files changed, 34 deletions(-) diff --git a/doc/man/j2objc.1 b/doc/man/j2objc.1 index a8406e3180..e1063a3713 100644 --- a/doc/man/j2objc.1 +++ b/doc/man/j2objc.1 @@ -105,9 +105,6 @@ Substitute a specified prefix for a package name. .BI \-\-prefixes " file " Specify a properties file with prefix definitions. .TP -\fB\-\-print\-converted\-sources\fR -Print input source files after initial conversion -.TP .BI \-\-strip\-gwt\-incompatible Removes methods that are marked with a GwtIncompatible annotation, unless its value is known to be compatible. diff --git a/translator/src/main/java/com/google/devtools/j2objc/Options.java b/translator/src/main/java/com/google/devtools/j2objc/Options.java index 58822e8470..5eae6e4c36 100644 --- a/translator/src/main/java/com/google/devtools/j2objc/Options.java +++ b/translator/src/main/java/com/google/devtools/j2objc/Options.java @@ -54,7 +54,6 @@ public class Options { private static File outputDirectory = new File("."); private static boolean usePackageDirectories = true; private static String implementationSuffix = ".m"; - private static boolean printConvertedSources = false; private static boolean ignoreMissingImports = false; private static MemoryManagementOption memoryManagementOption = null; private static boolean emitLineDirectives = false; @@ -199,8 +198,6 @@ public static String[] load(String[] args) throws IOException { } else { usage("unsupported language: " + s); } - } else if (arg.equals("--print-converted-sources")) { - printConvertedSources = true; } else if (arg.equals("--ignore-missing-imports")) { ignoreMissingImports = true; } else if (arg.equals("-use-reference-counting")) { @@ -430,10 +427,6 @@ public static String getImplementationFileSuffix() { return implementationSuffix; } - public static boolean printConvertedSources() { - return printConvertedSources; - } - public static boolean ignoreMissingImports() { return ignoreMissingImports; } diff --git a/translator/src/main/java/com/google/devtools/j2objc/TranslationProcessor.java b/translator/src/main/java/com/google/devtools/j2objc/TranslationProcessor.java index c5f9c1364c..26a9001ca0 100644 --- a/translator/src/main/java/com/google/devtools/j2objc/TranslationProcessor.java +++ b/translator/src/main/java/com/google/devtools/j2objc/TranslationProcessor.java @@ -118,8 +118,6 @@ protected void processUnit(String path, String source, CompilationUnit unit, Tim processedFiles.add(relativePath); seenFiles.add(relativePath); - // Needed for saving converted sources. - unit.recordModifications(); applyMutations(unit, ticker); ticker.tick("Tree mutations"); @@ -128,10 +126,6 @@ protected void processUnit(String path, String source, CompilationUnit unit, Tim return; } - if (Options.printConvertedSources()) { - saveConvertedSource(path, source, unit); - } - logger.finest("writing output file(s) to " + Options.getOutputDirectory().getAbsolutePath()); generateObjectiveCSource(path, source, unit, ticker); @@ -396,23 +390,6 @@ private File findFile(String path, String sourcePath) { return null; } - private void saveConvertedSource(String filename, String source, CompilationUnit unit) { - try { - Document doc = new Document(source); - TextEdit edit = unit.rewrite(doc, null); - edit.apply(doc); - File outputFile = new File(Options.getOutputDirectory(), filename); - outputFile.getParentFile().mkdirs(); - Files.write(doc.get(), outputFile, Options.getCharset()); - } catch (MalformedTreeException e) { - throw new AssertionError(e); - } catch (BadLocationException e) { - throw new AssertionError(e); - } catch (IOException e) { - ErrorUtil.error(e.getMessage()); - } - } - private static void loadMappingFiles() { for (String resourceName : Options.getMappingFiles()) { Properties mappings = new Properties(); diff --git a/translator/src/main/resources/com/google/devtools/j2objc/J2ObjC.properties b/translator/src/main/resources/com/google/devtools/j2objc/J2ObjC.properties index 0895351fd0..9f6debd679 100644 --- a/translator/src/main/resources/com/google/devtools/j2objc/J2ObjC.properties +++ b/translator/src/main/resources/com/google/devtools/j2objc/J2ObjC.properties @@ -65,7 +65,6 @@ Other options:\n\ -pluginoptions Comma separated key=value pairs passed to all plugins.\n\ --prefix Substitute a specified prefix for a package name.\n\ --prefixes Specify a properties file with prefix definitions.\n\ - --print-converted-sources Print input source files after initial conversion.\n\ --strip-gwt-incompatible Removes methods that are marked with a GwtIncompatible\ \n annotation, unless its value is known to be compatible.\n\ --strip-reflection Do not generate metadata needed for Java reflection.\n\