aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <138671+Godin@users.noreply.github.com>2019-10-07 19:43:42 +0200
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2019-10-07 19:43:42 +0200
commita74369534687d3c040717de327e711886f0086d5 (patch)
tree5cd704db660aa60d329e90c264a32bb3874dc345
parent674055ec1659d3f9dbbc5c7286dd057a5777b42f (diff)
downloadplatform_external_jacoco-a74369534687d3c040717de327e711886f0086d5.tar.gz
platform_external_jacoco-a74369534687d3c040717de327e711886f0086d5.tar.bz2
platform_external_jacoco-a74369534687d3c040717de327e711886f0086d5.zip
Normalize line endings in Java source files (#955)
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/FilterContextMock.java108
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutor.java132
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutorTest.java214
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParser.java266
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParserTest.java282
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java158
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java108
7 files changed, 634 insertions, 634 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/FilterContextMock.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/FilterContextMock.java
index 0f237616..5da7d3e3 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/FilterContextMock.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/FilterContextMock.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * This program and the accompanying materials are made available under
- * the terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.internal.analysis.filter;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * {@link IFilterContext} mock for unit tests.
- */
-public class FilterContextMock implements IFilterContext {
-
- public String className = "Foo";
- public String superClassName = "java/lang/Object";
- public Set<String> classAnnotations = new HashSet<String>();
- public Set<String> classAttributes = new HashSet<String>();
- public String sourceFileName = "Foo.java";
- public String sourceDebugExtension;
-
- public String getClassName() {
- return className;
- }
-
- public String getSuperClassName() {
- return superClassName;
- }
-
- public Set<String> getClassAnnotations() {
- return classAnnotations;
- }
-
- public Set<String> getClassAttributes() {
- return classAttributes;
- }
-
- public String getSourceFileName() {
- return sourceFileName;
- }
-
- public String getSourceDebugExtension() {
- return sourceDebugExtension;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal.analysis.filter;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * {@link IFilterContext} mock for unit tests.
+ */
+public class FilterContextMock implements IFilterContext {
+
+ public String className = "Foo";
+ public String superClassName = "java/lang/Object";
+ public Set<String> classAnnotations = new HashSet<String>();
+ public Set<String> classAttributes = new HashSet<String>();
+ public String sourceFileName = "Foo.java";
+ public String sourceDebugExtension;
+
+ public String getClassName() {
+ return className;
+ }
+
+ public String getSuperClassName() {
+ return superClassName;
+ }
+
+ public Set<String> getClassAnnotations() {
+ return classAnnotations;
+ }
+
+ public Set<String> getClassAttributes() {
+ return classAttributes;
+ }
+
+ public String getSourceFileName() {
+ return sourceFileName;
+ }
+
+ public String getSourceDebugExtension() {
+ return sourceDebugExtension;
+ }
+
+}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutor.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutor.java
index cfb38eec..81f940f8 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutor.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutor.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * This program and the accompanying materials are made available under
- * the terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.test.validation;
-
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Executes statements against a given Java object instance.
- */
-class StatementExecutor implements StatementParser.IStatementVisitor {
-
- private final Object target;
- private final Object[] prefixArgs;
-
- StatementExecutor(Object target, Object... prefixArgs) {
- this.target = target;
- this.prefixArgs = prefixArgs;
- }
-
- public void visitInvocation(String ctx, String name, Object... args) {
- args = concat(prefixArgs, args);
- try {
- target.getClass().getMethod(name, getTypes(args)).invoke(target,
- args);
- } catch (InvocationTargetException e) {
- Throwable te = e.getTargetException();
- if (te instanceof AssertionError) {
- throw (AssertionError) te;
- }
- throw new RuntimeException("Invocation error (" + ctx + ")", te);
- } catch (Exception e) {
- throw new RuntimeException("Invocation error (" + ctx + ")", e);
- }
- }
-
- private static Object[] concat(Object[] a, Object[] b) {
- final Object[] result = new Object[a.length + b.length];
- System.arraycopy(a, 0, result, 0, a.length);
- System.arraycopy(b, 0, result, a.length, b.length);
- return result;
- }
-
- private static Class<?>[] getTypes(Object[] instances) {
- final Class<?>[] classes = new Class[instances.length];
- for (int i = 0; i < instances.length; i++) {
- Class<? extends Object> c = instances[i].getClass();
- if (c == Integer.class) {
- // We always use primitive int parameters:
- c = Integer.TYPE;
- }
- classes[i] = c;
- }
- return classes;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Executes statements against a given Java object instance.
+ */
+class StatementExecutor implements StatementParser.IStatementVisitor {
+
+ private final Object target;
+ private final Object[] prefixArgs;
+
+ StatementExecutor(Object target, Object... prefixArgs) {
+ this.target = target;
+ this.prefixArgs = prefixArgs;
+ }
+
+ public void visitInvocation(String ctx, String name, Object... args) {
+ args = concat(prefixArgs, args);
+ try {
+ target.getClass().getMethod(name, getTypes(args)).invoke(target,
+ args);
+ } catch (InvocationTargetException e) {
+ Throwable te = e.getTargetException();
+ if (te instanceof AssertionError) {
+ throw (AssertionError) te;
+ }
+ throw new RuntimeException("Invocation error (" + ctx + ")", te);
+ } catch (Exception e) {
+ throw new RuntimeException("Invocation error (" + ctx + ")", e);
+ }
+ }
+
+ private static Object[] concat(Object[] a, Object[] b) {
+ final Object[] result = new Object[a.length + b.length];
+ System.arraycopy(a, 0, result, 0, a.length);
+ System.arraycopy(b, 0, result, a.length, b.length);
+ return result;
+ }
+
+ private static Class<?>[] getTypes(Object[] instances) {
+ final Class<?>[] classes = new Class[instances.length];
+ for (int i = 0; i < instances.length; i++) {
+ Class<? extends Object> c = instances[i].getClass();
+ if (c == Integer.class) {
+ // We always use primitive int parameters:
+ c = Integer.TYPE;
+ }
+ classes[i] = c;
+ }
+ return classes;
+ }
+
+}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutorTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutorTest.java
index 7acea650..09a16326 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutorTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementExecutorTest.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * This program and the accompanying materials are made available under
- * the terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.test.validation;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-/**
- * Unit tests for {@link StatementExecutor}.
- */
-public class StatementExecutorTest {
-
- @Rule
- public ExpectedException exception = ExpectedException.none();
-
- private Map<String, List<?>> invocations;
-
- @Before
- public void setup() {
- invocations = new HashMap<String, List<?>>();
- }
-
- @Test
- public void should_prefix_arguments() {
- StatementExecutor executor = new StatementExecutor(this, "Hello",
- "world");
-
- executor.visitInvocation("ctx", "target1", "!");
-
- assertEquals(Arrays.asList("Hello", "world", "!"),
- invocations.get("target1"));
- }
-
- @Test
- public void should_call_method_with_int_argument() {
- StatementExecutor executor = new StatementExecutor(this);
-
- executor.visitInvocation("ctx", "target2", Integer.valueOf(42));
-
- assertEquals(Arrays.asList(Integer.valueOf(42)),
- invocations.get("target2"));
- }
-
- @Test
- public void should_preserve_AssertionError() {
- exception.expect(AssertionError.class);
- exception.expectMessage("Original AssertionError.");
- StatementExecutor executor = new StatementExecutor(this);
-
- executor.visitInvocation("ctx", "target3");
- }
-
- @Test
- public void should_wrap_other_exceptions() {
- exception.expect(RuntimeException.class);
- exception.expectMessage("Invocation error (ctx)");
- StatementExecutor executor = new StatementExecutor(this);
-
- executor.visitInvocation("ctx", "target4");
- }
-
- @Test
- public void should_throw_RuntimeException_when_method_cannot_be_invoked() {
- exception.expect(RuntimeException.class);
- exception.expectMessage("Invocation error (ctx)");
- StatementExecutor executor = new StatementExecutor(this);
-
- executor.visitInvocation("ctx", "doesNotExist");
- }
-
- public void target1(String a, String b, String c) {
- invocations.put("target1", Arrays.asList(a, b, c));
- }
-
- public void target2(int i) {
- invocations.put("target2", Arrays.asList(Integer.valueOf(i)));
- }
-
- public void target3() {
- throw new AssertionError("Original AssertionError.");
- }
-
- public void target4() throws IOException {
- throw new IOException("Original IOException.");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * Unit tests for {@link StatementExecutor}.
+ */
+public class StatementExecutorTest {
+
+ @Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ private Map<String, List<?>> invocations;
+
+ @Before
+ public void setup() {
+ invocations = new HashMap<String, List<?>>();
+ }
+
+ @Test
+ public void should_prefix_arguments() {
+ StatementExecutor executor = new StatementExecutor(this, "Hello",
+ "world");
+
+ executor.visitInvocation("ctx", "target1", "!");
+
+ assertEquals(Arrays.asList("Hello", "world", "!"),
+ invocations.get("target1"));
+ }
+
+ @Test
+ public void should_call_method_with_int_argument() {
+ StatementExecutor executor = new StatementExecutor(this);
+
+ executor.visitInvocation("ctx", "target2", Integer.valueOf(42));
+
+ assertEquals(Arrays.asList(Integer.valueOf(42)),
+ invocations.get("target2"));
+ }
+
+ @Test
+ public void should_preserve_AssertionError() {
+ exception.expect(AssertionError.class);
+ exception.expectMessage("Original AssertionError.");
+ StatementExecutor executor = new StatementExecutor(this);
+
+ executor.visitInvocation("ctx", "target3");
+ }
+
+ @Test
+ public void should_wrap_other_exceptions() {
+ exception.expect(RuntimeException.class);
+ exception.expectMessage("Invocation error (ctx)");
+ StatementExecutor executor = new StatementExecutor(this);
+
+ executor.visitInvocation("ctx", "target4");
+ }
+
+ @Test
+ public void should_throw_RuntimeException_when_method_cannot_be_invoked() {
+ exception.expect(RuntimeException.class);
+ exception.expectMessage("Invocation error (ctx)");
+ StatementExecutor executor = new StatementExecutor(this);
+
+ executor.visitInvocation("ctx", "doesNotExist");
+ }
+
+ public void target1(String a, String b, String c) {
+ invocations.put("target1", Arrays.asList(a, b, c));
+ }
+
+ public void target2(int i) {
+ invocations.put("target2", Arrays.asList(Integer.valueOf(i)));
+ }
+
+ public void target3() {
+ throw new AssertionError("Original AssertionError.");
+ }
+
+ public void target4() throws IOException {
+ throw new IOException("Original IOException.");
+ }
+
+}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParser.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParser.java
index 559eb7b4..2cbdf7a2 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParser.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParser.java
@@ -1,133 +1,133 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * This program and the accompanying materials are made available under
- * the terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.test.validation;
-
-import java.io.IOException;
-import java.io.StreamTokenizer;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Simple parser for Java like method invocation statements. For example:
- *
- * <pre>
- * foo("BAR", 42)
- * </pre>
- *
- * Method parameters can only be String or int literals.
- */
-class StatementParser {
-
- /**
- * Call-back interface for parsed statements.
- */
- public interface IStatementVisitor {
-
- /**
- * Called when a method invocation has been paresed.
- *
- * @param ctx
- * context information for error messages
- * @param name
- * local method name
- * @param args
- * argument values
- */
- void visitInvocation(String ctx, String name, Object... args);
-
- }
-
- /**
- * Parses the given source.
- *
- * @param source
- * source string to parse
- * @param visitor
- * visitor to emit parsed statements
- * @param ctx
- * context information to include in error messages
- */
- public static void parse(String source, IStatementVisitor visitor,
- String ctx) throws IOException {
- new StatementParser(source, visitor, ctx).parse();
- }
-
- private final IStatementVisitor visitor;
- private final StreamTokenizer tokenizer;
- private final String ctx;
-
- private StatementParser(String source, IStatementVisitor visitor,
- String ctx) {
- this.visitor = visitor;
- this.ctx = ctx;
- tokenizer = new StreamTokenizer(new StringReader(source));
- tokenizer.resetSyntax();
- tokenizer.whitespaceChars(' ', ' ');
- tokenizer.whitespaceChars('\t', '\t');
- tokenizer.wordChars('a', 'z');
- tokenizer.wordChars('A', 'Z');
- tokenizer.quoteChar('"');
- tokenizer.parseNumbers();
- }
-
- private void parse() throws IOException {
- while (!accept(StreamTokenizer.TT_EOF)) {
- invocation();
- }
- }
-
- private void invocation() throws IOException {
- final String name = expect(StreamTokenizer.TT_WORD).sval;
- final List<Object> args = new ArrayList<Object>();
- expect('(');
- if (!accept(')')) {
- args.add(argument());
- while (!accept(')')) {
- expect(',');
- args.add(argument());
- }
- }
- visitor.visitInvocation(ctx, name, args.toArray());
- }
-
- private Object argument() throws IOException {
- if (accept(StreamTokenizer.TT_NUMBER)) {
- return Integer.valueOf((int) tokenizer.nval);
- }
- if (accept('"')) {
- return tokenizer.sval;
- }
- throw syntaxError();
- }
-
- private boolean accept(final int type) throws IOException {
- final boolean match = tokenizer.nextToken() == type;
- if (!match) {
- tokenizer.pushBack();
- }
- return match;
- }
-
- private StreamTokenizer expect(final int type) throws IOException {
- if (tokenizer.nextToken() != type) {
- throw syntaxError();
- }
- return tokenizer;
- }
-
- private IOException syntaxError() {
- return new IOException("Invalid syntax (" + ctx + ")");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation;
+
+import java.io.IOException;
+import java.io.StreamTokenizer;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Simple parser for Java like method invocation statements. For example:
+ *
+ * <pre>
+ * foo("BAR", 42)
+ * </pre>
+ *
+ * Method parameters can only be String or int literals.
+ */
+class StatementParser {
+
+ /**
+ * Call-back interface for parsed statements.
+ */
+ public interface IStatementVisitor {
+
+ /**
+ * Called when a method invocation has been paresed.
+ *
+ * @param ctx
+ * context information for error messages
+ * @param name
+ * local method name
+ * @param args
+ * argument values
+ */
+ void visitInvocation(String ctx, String name, Object... args);
+
+ }
+
+ /**
+ * Parses the given source.
+ *
+ * @param source
+ * source string to parse
+ * @param visitor
+ * visitor to emit parsed statements
+ * @param ctx
+ * context information to include in error messages
+ */
+ public static void parse(String source, IStatementVisitor visitor,
+ String ctx) throws IOException {
+ new StatementParser(source, visitor, ctx).parse();
+ }
+
+ private final IStatementVisitor visitor;
+ private final StreamTokenizer tokenizer;
+ private final String ctx;
+
+ private StatementParser(String source, IStatementVisitor visitor,
+ String ctx) {
+ this.visitor = visitor;
+ this.ctx = ctx;
+ tokenizer = new StreamTokenizer(new StringReader(source));
+ tokenizer.resetSyntax();
+ tokenizer.whitespaceChars(' ', ' ');
+ tokenizer.whitespaceChars('\t', '\t');
+ tokenizer.wordChars('a', 'z');
+ tokenizer.wordChars('A', 'Z');
+ tokenizer.quoteChar('"');
+ tokenizer.parseNumbers();
+ }
+
+ private void parse() throws IOException {
+ while (!accept(StreamTokenizer.TT_EOF)) {
+ invocation();
+ }
+ }
+
+ private void invocation() throws IOException {
+ final String name = expect(StreamTokenizer.TT_WORD).sval;
+ final List<Object> args = new ArrayList<Object>();
+ expect('(');
+ if (!accept(')')) {
+ args.add(argument());
+ while (!accept(')')) {
+ expect(',');
+ args.add(argument());
+ }
+ }
+ visitor.visitInvocation(ctx, name, args.toArray());
+ }
+
+ private Object argument() throws IOException {
+ if (accept(StreamTokenizer.TT_NUMBER)) {
+ return Integer.valueOf((int) tokenizer.nval);
+ }
+ if (accept('"')) {
+ return tokenizer.sval;
+ }
+ throw syntaxError();
+ }
+
+ private boolean accept(final int type) throws IOException {
+ final boolean match = tokenizer.nextToken() == type;
+ if (!match) {
+ tokenizer.pushBack();
+ }
+ return match;
+ }
+
+ private StreamTokenizer expect(final int type) throws IOException {
+ if (tokenizer.nextToken() != type) {
+ throw syntaxError();
+ }
+ return tokenizer;
+ }
+
+ private IOException syntaxError() {
+ return new IOException("Invalid syntax (" + ctx + ")");
+ }
+
+}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParserTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParserTest.java
index 90296220..606ebce2 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParserTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StatementParserTest.java
@@ -1,141 +1,141 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * This program and the accompanying materials are made available under
- * the terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.test.validation;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jacoco.core.test.validation.StatementParser.IStatementVisitor;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-/**
- * Unit tests for {@link StatementParser}
- */
-public class StatementParserTest {
-
- private IStatementVisitor visitor;
-
- private List<String> actualInvocations;
- private List<String> expectedInvocations;
-
- @Rule
- public ExpectedException exception = ExpectedException.none();
-
- @Before
- public void setup() {
- actualInvocations = new ArrayList<String>();
- expectedInvocations = new ArrayList<String>();
- visitor = new IStatementVisitor() {
- public void visitInvocation(String ctx, String name,
- Object... args) {
- actualInvocations.add(invocationStr(ctx, name, args));
- }
- };
- }
-
- @After
- public void teardown() {
- assertEquals(expectedInvocations, actualInvocations);
- }
-
- @Test
- public void should_parse_empty_string() throws IOException {
- StatementParser.parse("", visitor, "Foo.java");
- }
-
- @Test
- public void should_parse_invocation_without_params() throws IOException {
- StatementParser.parse("run()", visitor, "Foo.java");
- expectInvocation("Foo.java", "run");
- }
-
- @Test
- public void should_parse_invocation_with_one_int_parameter()
- throws IOException {
- StatementParser.parse("ask(42)", visitor, "Foo.java");
- expectInvocation("Foo.java", "ask", Integer.valueOf(42));
- }
-
- @Test
- public void should_parse_invocation_with_one_string_parameter()
- throws IOException {
- StatementParser.parse("say(\"hello\")", visitor, "Foo.java");
- expectInvocation("Foo.java", "say", "hello");
- }
-
- @Test
- public void should_parse_invocation_with_two_parameters()
- throws IOException {
- StatementParser.parse("add(1000, 234)", visitor, "Foo.java");
- expectInvocation("Foo.java", "add", Integer.valueOf(1000),
- Integer.valueOf(234));
- }
-
- @Test
- public void should_parse_invocation_with_mixed_parameter_types()
- throws IOException {
- StatementParser.parse("mix(1, \"two\", 3)", visitor, "Foo.java");
- expectInvocation("Foo.java", "mix", Integer.valueOf(1), "two",
- Integer.valueOf(3));
- }
-
- @Test
- public void should_parse_multiple_invocations() throws IOException {
- StatementParser.parse("start() stop()", visitor, "Foo.java");
- expectInvocation("Foo.java", "start");
- expectInvocation("Foo.java", "stop");
- }
-
- @Test
- public void should_fail_when_parenthesis_is_missing() throws IOException {
- exception.expect(IOException.class);
- StatementParser.parse("bad(", visitor, "Foo.java");
- }
-
- @Test
- public void should_fail_when_argument1_is_missing() throws IOException {
- exception.expect(IOException.class);
- StatementParser.parse("bad(,2)", visitor, "Foo.java");
- }
-
- @Test
- public void should_fail_when_argument2_is_missing() throws IOException {
- exception.expect(IOException.class);
- StatementParser.parse("bad(1,)", visitor, "Foo.java");
- }
-
- @Test
- public void should_give_context_info_when_parsing_fails()
- throws IOException {
- exception.expect(IOException.class);
- exception.expectMessage("Invalid syntax (Foo.java:32)");
- StatementParser.parse("bad", visitor, "Foo.java:32");
- }
-
- private void expectInvocation(String ctx, String name, Object... args) {
- expectedInvocations.add(invocationStr(ctx, name, args));
- }
-
- private String invocationStr(String ctx, String name, Object... args) {
- return String.format("%s:%s%s", ctx, name, Arrays.asList(args));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jacoco.core.test.validation.StatementParser.IStatementVisitor;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * Unit tests for {@link StatementParser}
+ */
+public class StatementParserTest {
+
+ private IStatementVisitor visitor;
+
+ private List<String> actualInvocations;
+ private List<String> expectedInvocations;
+
+ @Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void setup() {
+ actualInvocations = new ArrayList<String>();
+ expectedInvocations = new ArrayList<String>();
+ visitor = new IStatementVisitor() {
+ public void visitInvocation(String ctx, String name,
+ Object... args) {
+ actualInvocations.add(invocationStr(ctx, name, args));
+ }
+ };
+ }
+
+ @After
+ public void teardown() {
+ assertEquals(expectedInvocations, actualInvocations);
+ }
+
+ @Test
+ public void should_parse_empty_string() throws IOException {
+ StatementParser.parse("", visitor, "Foo.java");
+ }
+
+ @Test
+ public void should_parse_invocation_without_params() throws IOException {
+ StatementParser.parse("run()", visitor, "Foo.java");
+ expectInvocation("Foo.java", "run");
+ }
+
+ @Test
+ public void should_parse_invocation_with_one_int_parameter()
+ throws IOException {
+ StatementParser.parse("ask(42)", visitor, "Foo.java");
+ expectInvocation("Foo.java", "ask", Integer.valueOf(42));
+ }
+
+ @Test
+ public void should_parse_invocation_with_one_string_parameter()
+ throws IOException {
+ StatementParser.parse("say(\"hello\")", visitor, "Foo.java");
+ expectInvocation("Foo.java", "say", "hello");
+ }
+
+ @Test
+ public void should_parse_invocation_with_two_parameters()
+ throws IOException {
+ StatementParser.parse("add(1000, 234)", visitor, "Foo.java");
+ expectInvocation("Foo.java", "add", Integer.valueOf(1000),
+ Integer.valueOf(234));
+ }
+
+ @Test
+ public void should_parse_invocation_with_mixed_parameter_types()
+ throws IOException {
+ StatementParser.parse("mix(1, \"two\", 3)", visitor, "Foo.java");
+ expectInvocation("Foo.java", "mix", Integer.valueOf(1), "two",
+ Integer.valueOf(3));
+ }
+
+ @Test
+ public void should_parse_multiple_invocations() throws IOException {
+ StatementParser.parse("start() stop()", visitor, "Foo.java");
+ expectInvocation("Foo.java", "start");
+ expectInvocation("Foo.java", "stop");
+ }
+
+ @Test
+ public void should_fail_when_parenthesis_is_missing() throws IOException {
+ exception.expect(IOException.class);
+ StatementParser.parse("bad(", visitor, "Foo.java");
+ }
+
+ @Test
+ public void should_fail_when_argument1_is_missing() throws IOException {
+ exception.expect(IOException.class);
+ StatementParser.parse("bad(,2)", visitor, "Foo.java");
+ }
+
+ @Test
+ public void should_fail_when_argument2_is_missing() throws IOException {
+ exception.expect(IOException.class);
+ StatementParser.parse("bad(1,)", visitor, "Foo.java");
+ }
+
+ @Test
+ public void should_give_context_info_when_parsing_fails()
+ throws IOException {
+ exception.expect(IOException.class);
+ exception.expectMessage("Invalid syntax (Foo.java:32)");
+ StatementParser.parse("bad", visitor, "Foo.java:32");
+ }
+
+ private void expectInvocation(String ctx, String name, Object... args) {
+ expectedInvocations.add(invocationStr(ctx, name, args));
+ }
+
+ private String invocationStr(String ctx, String name, Object... args) {
+ return String.format("%s:%s%s", ctx, name, Arrays.asList(args));
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java b/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java
index 5b4c0dcc..d9dda737 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * This program and the accompanying materials are made available under
- * the terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Pack200;
-
-/**
- * Internal wrapper for the weird Pack200 Java API to allow usage with streams.
- */
-public final class Pack200Streams {
-
- /**
- * Unpack a stream in Pack200 format into a stream in JAR/ZIP format.
- *
- * @param input
- * stream in Pack200 format
- * @return stream in JAR/ZIP format
- * @throws IOException
- * in case of errors with the streams
- */
- public static InputStream unpack(final InputStream input)
- throws IOException {
- final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- final JarOutputStream jar = new JarOutputStream(buffer);
- Pack200.newUnpacker().unpack(new NoCloseInput(input), jar);
- jar.finish();
- return new ByteArrayInputStream(buffer.toByteArray());
- }
-
- /**
- * Packs a buffer in JAR/ZIP format into a stream in Pack200 format.
- *
- * @param source
- * source in JAR/ZIP format
- * @param output
- * stream in Pack200 format
- * @throws IOException
- * in case of errors with the streams
- */
- public static void pack(final byte[] source, final OutputStream output)
- throws IOException {
- final JarInputStream jar = new JarInputStream(
- new ByteArrayInputStream(source));
- Pack200.newPacker().pack(jar, output);
- }
-
- private static class NoCloseInput extends FilterInputStream {
- protected NoCloseInput(final InputStream in) {
- super(in);
- }
-
- @Override
- public void close() throws IOException {
- // do not close the underlying stream
- }
- }
-
- private Pack200Streams() {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Pack200;
+
+/**
+ * Internal wrapper for the weird Pack200 Java API to allow usage with streams.
+ */
+public final class Pack200Streams {
+
+ /**
+ * Unpack a stream in Pack200 format into a stream in JAR/ZIP format.
+ *
+ * @param input
+ * stream in Pack200 format
+ * @return stream in JAR/ZIP format
+ * @throws IOException
+ * in case of errors with the streams
+ */
+ public static InputStream unpack(final InputStream input)
+ throws IOException {
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ final JarOutputStream jar = new JarOutputStream(buffer);
+ Pack200.newUnpacker().unpack(new NoCloseInput(input), jar);
+ jar.finish();
+ return new ByteArrayInputStream(buffer.toByteArray());
+ }
+
+ /**
+ * Packs a buffer in JAR/ZIP format into a stream in Pack200 format.
+ *
+ * @param source
+ * source in JAR/ZIP format
+ * @param output
+ * stream in Pack200 format
+ * @throws IOException
+ * in case of errors with the streams
+ */
+ public static void pack(final byte[] source, final OutputStream output)
+ throws IOException {
+ final JarInputStream jar = new JarInputStream(
+ new ByteArrayInputStream(source));
+ Pack200.newPacker().pack(jar, output);
+ }
+
+ private static class NoCloseInput extends FilterInputStream {
+ protected NoCloseInput(final InputStream in) {
+ super(in);
+ }
+
+ @Override
+ public void close() throws IOException {
+ // do not close the underlying stream
+ }
+ }
+
+ private Pack200Streams() {
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java
index b4141e16..93ecf889 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * This program and the accompanying materials are made available under
- * the terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.internal.analysis.filter;
-
-import java.util.Set;
-
-/**
- * Context information provided to filters.
- */
-public interface IFilterContext {
-
- /**
- * @return vm name of the enclosing class
- */
- String getClassName();
-
- /**
- * @return vm name of the super class of the enclosing class
- */
- String getSuperClassName();
-
- /**
- * @return vm names of the class annotations of the enclosing class
- */
- Set<String> getClassAnnotations();
-
- /**
- * @return names of the class attributes
- */
- Set<String> getClassAttributes();
-
- /**
- * @return file name of the corresponding source file or <code>null</code>
- * if not available
- */
- String getSourceFileName();
-
- /**
- * @return value of SourceDebugExtension attribute or <code>null</code> if
- * not available
- */
- String getSourceDebugExtension();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal.analysis.filter;
+
+import java.util.Set;
+
+/**
+ * Context information provided to filters.
+ */
+public interface IFilterContext {
+
+ /**
+ * @return vm name of the enclosing class
+ */
+ String getClassName();
+
+ /**
+ * @return vm name of the super class of the enclosing class
+ */
+ String getSuperClassName();
+
+ /**
+ * @return vm names of the class annotations of the enclosing class
+ */
+ Set<String> getClassAnnotations();
+
+ /**
+ * @return names of the class attributes
+ */
+ Set<String> getClassAttributes();
+
+ /**
+ * @return file name of the corresponding source file or <code>null</code>
+ * if not available
+ */
+ String getSourceFileName();
+
+ /**
+ * @return value of SourceDebugExtension attribute or <code>null</code> if
+ * not available
+ */
+ String getSourceDebugExtension();
+
+}