Skip to content

Commit a743695

Browse files
Godinmarchof
authored andcommitted
Normalize line endings in Java source files (bazel-contrib#955)
1 parent 674055e commit a743695

File tree

7 files changed

+634
-634
lines changed

7 files changed

+634
-634
lines changed
Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3-
* This program and the accompanying materials are made available under
4-
* the terms of the Eclipse Public License 2.0 which is available at
5-
* http://www.eclipse.org/legal/epl-2.0
6-
*
7-
* SPDX-License-Identifier: EPL-2.0
8-
*
9-
* Contributors:
10-
* Marc R. Hoffmann - initial API and implementation
11-
*
12-
*******************************************************************************/
13-
package org.jacoco.core.internal.analysis.filter;
14-
15-
import java.util.HashSet;
16-
import java.util.Set;
17-
18-
/**
19-
* {@link IFilterContext} mock for unit tests.
20-
*/
21-
public class FilterContextMock implements IFilterContext {
22-
23-
public String className = "Foo";
24-
public String superClassName = "java/lang/Object";
25-
public Set<String> classAnnotations = new HashSet<String>();
26-
public Set<String> classAttributes = new HashSet<String>();
27-
public String sourceFileName = "Foo.java";
28-
public String sourceDebugExtension;
29-
30-
public String getClassName() {
31-
return className;
32-
}
33-
34-
public String getSuperClassName() {
35-
return superClassName;
36-
}
37-
38-
public Set<String> getClassAnnotations() {
39-
return classAnnotations;
40-
}
41-
42-
public Set<String> getClassAttributes() {
43-
return classAttributes;
44-
}
45-
46-
public String getSourceFileName() {
47-
return sourceFileName;
48-
}
49-
50-
public String getSourceDebugExtension() {
51-
return sourceDebugExtension;
52-
}
53-
54-
}
1+
/*******************************************************************************
2+
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3+
* This program and the accompanying materials are made available under
4+
* the terms of the Eclipse Public License 2.0 which is available at
5+
* http://www.eclipse.org/legal/epl-2.0
6+
*
7+
* SPDX-License-Identifier: EPL-2.0
8+
*
9+
* Contributors:
10+
* Marc R. Hoffmann - initial API and implementation
11+
*
12+
*******************************************************************************/
13+
package org.jacoco.core.internal.analysis.filter;
14+
15+
import java.util.HashSet;
16+
import java.util.Set;
17+
18+
/**
19+
* {@link IFilterContext} mock for unit tests.
20+
*/
21+
public class FilterContextMock implements IFilterContext {
22+
23+
public String className = "Foo";
24+
public String superClassName = "java/lang/Object";
25+
public Set<String> classAnnotations = new HashSet<String>();
26+
public Set<String> classAttributes = new HashSet<String>();
27+
public String sourceFileName = "Foo.java";
28+
public String sourceDebugExtension;
29+
30+
public String getClassName() {
31+
return className;
32+
}
33+
34+
public String getSuperClassName() {
35+
return superClassName;
36+
}
37+
38+
public Set<String> getClassAnnotations() {
39+
return classAnnotations;
40+
}
41+
42+
public Set<String> getClassAttributes() {
43+
return classAttributes;
44+
}
45+
46+
public String getSourceFileName() {
47+
return sourceFileName;
48+
}
49+
50+
public String getSourceDebugExtension() {
51+
return sourceDebugExtension;
52+
}
53+
54+
}
Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3-
* This program and the accompanying materials are made available under
4-
* the terms of the Eclipse Public License 2.0 which is available at
5-
* http://www.eclipse.org/legal/epl-2.0
6-
*
7-
* SPDX-License-Identifier: EPL-2.0
8-
*
9-
* Contributors:
10-
* Marc R. Hoffmann - initial API and implementation
11-
*
12-
*******************************************************************************/
13-
package org.jacoco.core.test.validation;
14-
15-
import java.lang.reflect.InvocationTargetException;
16-
17-
/**
18-
* Executes statements against a given Java object instance.
19-
*/
20-
class StatementExecutor implements StatementParser.IStatementVisitor {
21-
22-
private final Object target;
23-
private final Object[] prefixArgs;
24-
25-
StatementExecutor(Object target, Object... prefixArgs) {
26-
this.target = target;
27-
this.prefixArgs = prefixArgs;
28-
}
29-
30-
public void visitInvocation(String ctx, String name, Object... args) {
31-
args = concat(prefixArgs, args);
32-
try {
33-
target.getClass().getMethod(name, getTypes(args)).invoke(target,
34-
args);
35-
} catch (InvocationTargetException e) {
36-
Throwable te = e.getTargetException();
37-
if (te instanceof AssertionError) {
38-
throw (AssertionError) te;
39-
}
40-
throw new RuntimeException("Invocation error (" + ctx + ")", te);
41-
} catch (Exception e) {
42-
throw new RuntimeException("Invocation error (" + ctx + ")", e);
43-
}
44-
}
45-
46-
private static Object[] concat(Object[] a, Object[] b) {
47-
final Object[] result = new Object[a.length + b.length];
48-
System.arraycopy(a, 0, result, 0, a.length);
49-
System.arraycopy(b, 0, result, a.length, b.length);
50-
return result;
51-
}
52-
53-
private static Class<?>[] getTypes(Object[] instances) {
54-
final Class<?>[] classes = new Class[instances.length];
55-
for (int i = 0; i < instances.length; i++) {
56-
Class<? extends Object> c = instances[i].getClass();
57-
if (c == Integer.class) {
58-
// We always use primitive int parameters:
59-
c = Integer.TYPE;
60-
}
61-
classes[i] = c;
62-
}
63-
return classes;
64-
}
65-
66-
}
1+
/*******************************************************************************
2+
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3+
* This program and the accompanying materials are made available under
4+
* the terms of the Eclipse Public License 2.0 which is available at
5+
* http://www.eclipse.org/legal/epl-2.0
6+
*
7+
* SPDX-License-Identifier: EPL-2.0
8+
*
9+
* Contributors:
10+
* Marc R. Hoffmann - initial API and implementation
11+
*
12+
*******************************************************************************/
13+
package org.jacoco.core.test.validation;
14+
15+
import java.lang.reflect.InvocationTargetException;
16+
17+
/**
18+
* Executes statements against a given Java object instance.
19+
*/
20+
class StatementExecutor implements StatementParser.IStatementVisitor {
21+
22+
private final Object target;
23+
private final Object[] prefixArgs;
24+
25+
StatementExecutor(Object target, Object... prefixArgs) {
26+
this.target = target;
27+
this.prefixArgs = prefixArgs;
28+
}
29+
30+
public void visitInvocation(String ctx, String name, Object... args) {
31+
args = concat(prefixArgs, args);
32+
try {
33+
target.getClass().getMethod(name, getTypes(args)).invoke(target,
34+
args);
35+
} catch (InvocationTargetException e) {
36+
Throwable te = e.getTargetException();
37+
if (te instanceof AssertionError) {
38+
throw (AssertionError) te;
39+
}
40+
throw new RuntimeException("Invocation error (" + ctx + ")", te);
41+
} catch (Exception e) {
42+
throw new RuntimeException("Invocation error (" + ctx + ")", e);
43+
}
44+
}
45+
46+
private static Object[] concat(Object[] a, Object[] b) {
47+
final Object[] result = new Object[a.length + b.length];
48+
System.arraycopy(a, 0, result, 0, a.length);
49+
System.arraycopy(b, 0, result, a.length, b.length);
50+
return result;
51+
}
52+
53+
private static Class<?>[] getTypes(Object[] instances) {
54+
final Class<?>[] classes = new Class[instances.length];
55+
for (int i = 0; i < instances.length; i++) {
56+
Class<? extends Object> c = instances[i].getClass();
57+
if (c == Integer.class) {
58+
// We always use primitive int parameters:
59+
c = Integer.TYPE;
60+
}
61+
classes[i] = c;
62+
}
63+
return classes;
64+
}
65+
66+
}

0 commit comments

Comments
 (0)