Skip to content

Commit c1062c2

Browse files
committed
Move inner class to standalone
- Newer linter versions won't load it... - See: https://code.google.com/p/android/issues/detail?id=210052
1 parent 218a4fc commit c1062c2

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

src/main/java/com/monits/linters/InstanceStateDetector.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import java.util.ArrayList;
1717
import java.util.Collections;
18-
import java.util.Comparator;
1918
import java.util.HashMap;
2019
import java.util.HashSet;
2120
import java.util.Iterator;
@@ -147,6 +146,7 @@ public void checkCall(final ClassContext context, final ClassNode classNode, fin
147146
*
148147
* @return The methods that have a bundle as param
149148
*/
149+
@SuppressWarnings("unchecked")
150150
@Nonnull
151151
private Set<MethodNode> checkMethodCall(@Nonnull final ClassContext context, @Nonnull final ClassNode classNode,
152152
@Nonnull final MethodNode methodToIterate, @Nonnull final MethodNode saveRestoreMethod,
@@ -156,12 +156,7 @@ private Set<MethodNode> checkMethodCall(@Nonnull final ClassContext context, @No
156156
if (methodToIterate.localVariables != null) {
157157
// We are sorting 'methodToIterate.localVariables' because the index of the each item is always
158158
// a position of the Local Variable Table, but sometimes those index do not match with the position.
159-
Collections.sort(methodToIterate.localVariables, new Comparator<LocalVariableNode>() {
160-
@Override
161-
public int compare(final LocalVariableNode o1, final LocalVariableNode o2) {
162-
return o1.index - o2.index;
163-
}
164-
});
159+
Collections.sort(methodToIterate.localVariables, new LocalVariableNodeComparator());
165160
}
166161

167162
final AbstractInsnNode[] instructions = methodToIterate.instructions.toArray();
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Copyright 2010 - 2016 - Monits
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5+
* file except in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under
10+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
* ANY KIND, either express or implied. See the License for the specific language governing
12+
* permissions and limitations under the License.
13+
*/
14+
package com.monits.linters;
15+
16+
import java.util.Comparator;
17+
18+
import org.objectweb.asm.tree.LocalVariableNode;
19+
20+
/**
21+
* Comparator for LocalVariableNode
22+
*
23+
* @author jmsotuyo
24+
*/
25+
public class LocalVariableNodeComparator implements Comparator<LocalVariableNode> {
26+
27+
@Override
28+
public int compare(final LocalVariableNode o1, final LocalVariableNode o2) {
29+
return o1.index - o2.index;
30+
}
31+
}

0 commit comments

Comments
 (0)