Skip to content

Commit

Permalink
Removes unused --no-class-methods and --keep-class-methods flags.
Browse files Browse the repository at this point in the history
	Change on 2015/06/19 by kstanger <kstanger@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=96421101
  • Loading branch information
kstanger committed Jun 22, 2015
1 parent 1fbfafc commit 8672192
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
23 changes: 3 additions & 20 deletions translator/src/main/java/com/google/devtools/j2objc/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public class Options {
private boolean stripReflection = false;
private boolean extractUnsequencedModifications = true;
private boolean docCommentsEnabled = false;
private boolean removeClassMethods = false;
private boolean staticAccessorMethods = false;
private int batchTranslateMaximum = 0;
private List<String> headerMappingFiles = null;
Expand Down Expand Up @@ -322,12 +321,6 @@ private String[] loadInternal(String[] args) throws IOException {
} else if (arg.startsWith(BATCH_PROCESSING_MAX_FLAG)) {
batchTranslateMaximum =
Integer.parseInt(arg.substring(BATCH_PROCESSING_MAX_FLAG.length()));
}
// TODO(kstanger): remove both "class-methods" flags once the behavior is standardized.
else if (arg.equals("--no-class-methods")) {
removeClassMethods = true;
} else if (arg.equals("--keep-class-methods")) {
removeClassMethods = false;
} else if (arg.equals("--static-accessor-methods")) {
staticAccessorMethods = true;
} else if (arg.startsWith("-h") || arg.equals("--help")) {
Expand All @@ -344,17 +337,16 @@ else if (arg.equals("--final-methods-as-functions")
usage("-source requires an argument");
}
// Handle aliasing of version numbers as supported by javac.
if(args[nArg].length() == 1){
if (args[nArg].length() == 1){
sourceVersion = "1." + args[nArg];
}
else{
} else {
sourceVersion = args[nArg];
}
// Make sure that we were passed a valid release version.
if (!VALID_JAVA_VERSIONS.contains(sourceVersion)) {
usage("invalid source release: " + args[nArg]);
}
} else if (arg.equals("-target")) {
} else if (arg.equals("-target")) {
// Dummy out passed target argument, since we don't care about target.
if (++nArg == args.length) {
usage("-target requires an argument");
Expand Down Expand Up @@ -720,15 +712,6 @@ public static void setBatchTranslateMaximum(int max) {
instance.batchTranslateMaximum = max;
}

public static boolean removeClassMethods() {
return instance.removeClassMethods;
}

@VisibleForTesting
public static void setRemoveClassMethods(boolean b) {
instance.removeClassMethods = b;
}

public static boolean shouldMapHeaders() {
return useSourceDirectories() || combineSourceJars();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ Other options:\n\
\n classes and interfaces.\n\
-J<flag> Pass Java <flag>, such as -Xmx1G, to the system runtime.\n\
--mapping <file> Add a method mapping file.\n\
--no-class-methods Don't emit class methods for static Java methods.\
\n (static methods are always converted to functions)\n\
--no-package-directories Generate output files to specified directory, without\
\n creating package sub-directories.\n\
--prefix <package=prefix> Substitute a specified prefix for a package name.\n\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.devtools.j2objc.types;

import com.google.devtools.j2objc.GenerationTest;
import com.google.devtools.j2objc.Options;

import java.io.IOException;

Expand All @@ -35,18 +34,6 @@ public void testVarargsDeclarations() throws IOException {
assertNotInTranslation(translation, "@protocol JavaLangRunnable");
}

// Same as above but with static methods and class methods removed.
public void testVarargsDeclarationsNoClassMethods() throws IOException {
Options.setRemoveClassMethods(true);
String translation = translateSourceFile(
"class Test { static void test1(double... values) {}"
+ " static void test2(Runnable... values) {} }",
"Test", "Test.h");
assertTranslation(translation, "@class IOSDoubleArray");
assertTranslation(translation, "@class IOSObjectArray");
assertNotInTranslation(translation, "@protocol JavaLangRunnable");
}

public void testNoSelfImports() throws IOException {
String translation = translateSourceFile(
"class Test { } class Test2 extends Test { }",
Expand Down

0 comments on commit 8672192

Please sign in to comment.