Skip to content

Commit

Permalink
Removed unused unused method, field and local variables in translator.
Browse files Browse the repository at this point in the history
	Change on 2018/04/10 by tball <[email protected]>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192315197
  • Loading branch information
tomball committed Apr 17, 2018
1 parent 3b5bfc4 commit 319effd
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ private class RewriteContext {

private final FunctionalExpression node;
private final TypeElement lambdaType;
private final TypeMirror typeMirror;
private final ExecutablePair descriptor;
private TypeDeclaration typeDecl;
private GeneratedExecutableElement implElement;
Expand All @@ -84,7 +83,6 @@ private class RewriteContext {
private RewriteContext(FunctionalExpression node) {
this.node = node;
lambdaType = node.getTypeElement();
typeMirror = node.getTypeMirror();
descriptor = node.getDescriptor();
createTypeDeclaration();
createImplementation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.devtools.j2objc.translate;

import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.devtools.j2objc.ast.AbstractTypeDeclaration;
import com.google.devtools.j2objc.ast.AnnotationTypeDeclaration;
import com.google.devtools.j2objc.ast.Assignment;
Expand Down Expand Up @@ -60,7 +58,6 @@
import com.google.j2objc.annotations.AutoreleasePool;
import com.google.j2objc.annotations.Weak;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.lang.model.element.ExecutableElement;
Expand Down Expand Up @@ -238,34 +235,6 @@ public boolean visit(QualifiedName node) {
return true;
}

private ListMultimap<Integer, VariableDeclarationFragment> rewriteExtraDimensions(
List<VariableDeclarationFragment> fragments) {
// Removes extra dimensions on variable declaration fragments and creates extra field
// declaration nodes if necessary.
// eg. "int i1, i2[], i3[][];" becomes "int i1; int[] i2; int[][] i3".
ListMultimap<Integer, VariableDeclarationFragment> newDeclarations = null;
int masterDimensions = -1;
Iterator<VariableDeclarationFragment> iter = fragments.iterator();
while (iter.hasNext()) {
VariableDeclarationFragment frag = iter.next();
int dimensions = frag.getExtraDimensions();
if (masterDimensions == -1) {
masterDimensions = dimensions;
} else if (dimensions != masterDimensions) {
if (newDeclarations == null) {
newDeclarations = LinkedListMultimap.create();
}
VariableDeclarationFragment newFrag = new VariableDeclarationFragment(
frag.getVariableElement(), TreeUtil.remove(frag.getInitializer()));
newDeclarations.put(dimensions, newFrag);
iter.remove();
} else {
frag.setExtraDimensions(0);
}
}
return newDeclarations;
}

/**
* Verify, update property attributes. Accessor methods are not checked since a
* property annotation may apply to separate variables in a field declaration, so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public void testDuplicateTypeName() throws IOException {
addSourceFile("package bar.foo; public interface A {}", "bar/foo/A.java");
options.getPackagePrefixes().addPrefix("foo.bar", "XX");
options.getPackagePrefixes().addPrefix("bar.foo", "XX");
String s = translateSourceFile(
translateSourceFile(
"package foo.bar; interface B extends bar.foo.A {} public class A implements B {}",
"foo.bar.A", "foo/bar/A.m");
assertTrue(ErrorUtil.getErrorMessages().contains("Duplicate type name found in XXA->XXB->XXA"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
package com.google.devtools.j2objc.translate;

import com.google.devtools.j2objc.GenerationTest;
import com.google.devtools.j2objc.ast.CompilationUnit;
import com.google.devtools.j2objc.util.ErrorUtil;

import java.io.IOException;

/**
Expand All @@ -41,9 +39,7 @@ public void testBadNativeCodeBlock() throws IOException {
}

public void testBadNativeCodeBlock_badEndDelimiter() throws IOException {
CompilationUnit unit = maybeCompileType(
"Example", "public class Example { native void test() /*-[ ]*/; }");

maybeCompileType("Example", "public class Example { native void test() /*-[ ]*/; }");
assertTrue(ErrorUtil.getErrorMessages()
.contains("Error finding OCNI closing delimiter for OCNI comment at line 1"));
}
Expand Down

0 comments on commit 319effd

Please sign in to comment.