Skip to content

Commit fdd37c2

Browse files
authored
Merge pull request #691 from NativeScript/pete/pre-commit-formatting
Pre-commit formatting
2 parents bc4741d + 6543918 commit fdd37c2

File tree

180 files changed

+18913
-22994
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+18913
-22994
lines changed

android-metadata-generator/src/src/com/telerik/metadata/Builder.java

+388-387
Large diffs are not rendered by default.

android-metadata-generator/src/src/com/telerik/metadata/ClassDirectory.java

+48-48
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,59 @@
1212
import org.apache.bcel.classfile.ClassParser;
1313

1414
public class ClassDirectory implements ClassMapProvider {
15-
private final String path;
16-
private final Map<String, ClassDescriptor> classMap;
17-
private static final String CLASS_EXT = ".class";
18-
private static final String DEX_EXT = ".dex";
15+
private final String path;
16+
private final Map<String, ClassDescriptor> classMap;
17+
private static final String CLASS_EXT = ".class";
18+
private static final String DEX_EXT = ".dex";
1919

20-
private ClassDirectory(String path) {
21-
this.path = path;
22-
this.classMap = new HashMap<String, ClassDescriptor>();
23-
}
20+
private ClassDirectory(String path) {
21+
this.path = path;
22+
this.classMap = new HashMap<String, ClassDescriptor>();
23+
}
2424

25-
public Map<String, ClassDescriptor> getClassMap() {
26-
return classMap;
27-
}
25+
public Map<String, ClassDescriptor> getClassMap() {
26+
return classMap;
27+
}
2828

29-
public String getPath() {
30-
return path;
31-
}
29+
public String getPath() {
30+
return path;
31+
}
3232

33-
public static ClassDirectory readDirectory(String path) throws IOException {
34-
ClassDirectory dir = new ClassDirectory(path);
35-
readDirectory(dir, path);
36-
return dir;
37-
}
33+
public static ClassDirectory readDirectory(String path) throws IOException {
34+
ClassDirectory dir = new ClassDirectory(path);
35+
readDirectory(dir, path);
36+
return dir;
37+
}
3838

39-
private static void readDirectory(ClassDirectory dir, String path)
40-
throws IOException {
41-
List<File> subDirs = new ArrayList<File>();
42-
File currentDir = new File(path);
43-
for (File file : currentDir.listFiles()) {
44-
if (file.isFile()) {
45-
String name = file.getName();
46-
if (name.endsWith(CLASS_EXT)) {
47-
ClassDescriptor clazz = getClassDescriptor(name, file);
48-
dir.classMap.put(clazz.getClassName(), clazz);
49-
}
50-
} else if (file.isDirectory()) {
51-
subDirs.add(file);
52-
}
53-
}
54-
for (File sd: subDirs) {
55-
readDirectory(dir, sd.getAbsolutePath());
56-
}
57-
}
39+
private static void readDirectory(ClassDirectory dir, String path)
40+
throws IOException {
41+
List<File> subDirs = new ArrayList<File>();
42+
File currentDir = new File(path);
43+
for (File file : currentDir.listFiles()) {
44+
if (file.isFile()) {
45+
String name = file.getName();
46+
if (name.endsWith(CLASS_EXT)) {
47+
ClassDescriptor clazz = getClassDescriptor(name, file);
48+
dir.classMap.put(clazz.getClassName(), clazz);
49+
}
50+
} else if (file.isDirectory()) {
51+
subDirs.add(file);
52+
}
53+
}
54+
for (File sd: subDirs) {
55+
readDirectory(dir, sd.getAbsolutePath());
56+
}
57+
}
5858

59-
private static ClassDescriptor getClassDescriptor(String name, File file) throws IOException {
60-
ClassDescriptor clazz = null;
61-
if (name.endsWith(CLASS_EXT)) {
62-
ClassParser cp = new ClassParser(file.getAbsolutePath());
63-
clazz = new com.telerik.metadata.bcl.ClassInfo(cp.parse());
64-
} else if (name.endsWith(DEX_EXT)) {
65-
// TODO:
66-
}
59+
private static ClassDescriptor getClassDescriptor(String name, File file) throws IOException {
60+
ClassDescriptor clazz = null;
61+
if (name.endsWith(CLASS_EXT)) {
62+
ClassParser cp = new ClassParser(file.getAbsolutePath());
63+
clazz = new com.telerik.metadata.bcl.ClassInfo(cp.parse());
64+
} else if (name.endsWith(DEX_EXT)) {
65+
// TODO:
66+
}
6767

68-
return clazz;
69-
}
68+
return clazz;
69+
}
7070
}

android-metadata-generator/src/src/com/telerik/metadata/ClassMapProvider.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.Map;
66

77
public interface ClassMapProvider {
8-
Map<String, ClassDescriptor> getClassMap();
9-
10-
String getPath();
8+
Map<String, ClassDescriptor> getClassMap();
9+
10+
String getPath();
1111
}

android-metadata-generator/src/src/com/telerik/metadata/ClassRepo.java

+37-37
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,45 @@
66
import java.util.Arrays;
77

88
public class ClassRepo {
9-
private ClassRepo() {
10-
}
9+
private ClassRepo() {
10+
}
1111

12-
private static ArrayList<ClassMapProvider> cachedProviders = new ArrayList<ClassMapProvider>();
12+
private static ArrayList<ClassMapProvider> cachedProviders = new ArrayList<ClassMapProvider>();
1313

14-
public static void addToCache(ClassMapProvider classMapProvider) {
15-
for (String className : classMapProvider.getClassMap().keySet()) {
16-
for (ClassMapProvider cachedProvider : cachedProviders) {
17-
ClassDescriptor clazz = cachedProvider.getClassMap().get(className);
18-
if (clazz != null) {
19-
String errMsg = "Class " + className + " conflict: "
20-
+ classMapProvider.getPath() + " and " + cachedProvider.getPath();
21-
throw new IllegalArgumentException(errMsg);
22-
}
23-
}
24-
}
25-
cachedProviders.add(classMapProvider);
26-
}
14+
public static void addToCache(ClassMapProvider classMapProvider) {
15+
for (String className : classMapProvider.getClassMap().keySet()) {
16+
for (ClassMapProvider cachedProvider : cachedProviders) {
17+
ClassDescriptor clazz = cachedProvider.getClassMap().get(className);
18+
if (clazz != null) {
19+
String errMsg = "Class " + className + " conflict: "
20+
+ classMapProvider.getPath() + " and " + cachedProvider.getPath();
21+
throw new IllegalArgumentException(errMsg);
22+
}
23+
}
24+
}
25+
cachedProviders.add(classMapProvider);
26+
}
2727

28-
public static ClassDescriptor findClass(String className) {
29-
ClassDescriptor clazz = null;
30-
for (ClassMapProvider classMapProvider : cachedProviders) {
31-
clazz = classMapProvider.getClassMap().get(className);
32-
if (clazz != null) {
33-
break;
34-
}
35-
}
36-
return clazz;
37-
}
28+
public static ClassDescriptor findClass(String className) {
29+
ClassDescriptor clazz = null;
30+
for (ClassMapProvider classMapProvider : cachedProviders) {
31+
clazz = classMapProvider.getClassMap().get(className);
32+
if (clazz != null) {
33+
break;
34+
}
35+
}
36+
return clazz;
37+
}
3838

39-
public static String[] getClassNames() {
40-
ArrayList<String> names = new ArrayList<String>();
41-
for (ClassMapProvider classMapProvider : cachedProviders) {
42-
for (String className : classMapProvider.getClassMap().keySet()) {
43-
names.add(className);
44-
}
45-
}
46-
String[] arrClassNames = names.toArray(new String[names.size()]);
47-
Arrays.sort(arrClassNames);
48-
return arrClassNames;
49-
}
39+
public static String[] getClassNames() {
40+
ArrayList<String> names = new ArrayList<String>();
41+
for (ClassMapProvider classMapProvider : cachedProviders) {
42+
for (String className : classMapProvider.getClassMap().keySet()) {
43+
names.add(className);
44+
}
45+
}
46+
String[] arrClassNames = names.toArray(new String[names.size()]);
47+
Arrays.sort(arrClassNames);
48+
return arrClassNames;
49+
}
5050
}

0 commit comments

Comments
 (0)