changeset 42:996f55f99d75

7902258: Only one parametrized ANC filter is allowed simultaneously Reviewed-by: lkuskov
author shurailine
date Fri, 03 Aug 2018 04:01:19 -0700
parents 1ee5a73a950a
children 7ffe29bde4fe
files build/build.xml plugins/simple_methods_anc/test/openjdk/jcov/filter/simplemethods/MainTest.java src/classes/com/sun/tdk/jcov/RepGen.java src/classes/com/sun/tdk/jcov/report/AncFilterFactory.java src/classes/com/sun/tdk/jcov/report/ancfilters/BuiltInAncFilters.java src/classes/com/sun/tdk/jcov/report/ancfilters/CatchANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/DeprecatedANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/EmptyANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/GetterANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/ListANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/SetterANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/SyntheticANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/ThrowANCFilter.java src/classes/com/sun/tdk/jcov/report/ancfilters/ToStringANCFilter.java test/unit/com/sun/tdk/jcov/report/ancfilters/BuiltInAncFiltersTest.java test/unit/com/sun/tdk/jcov/report/ancfilters/ListANCFilterTest.java
diffstat 16 files changed, 247 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/build/build.xml	Tue Jun 05 11:41:42 2018 -0700
+++ b/build/build.xml	Fri Aug 03 04:01:19 2018 -0700
@@ -191,17 +191,9 @@
 
         <mkdir dir="${jcov.classes}/META-INF"/>
         <mkdir dir="${jcov.classes}/META-INF/services"/>
-        <echo file="${jcov.classes}/META-INF/services/com.sun.tdk.jcov.report.ancfilters.DefaultAncFilter"
+        <echo file="${jcov.classes}/META-INF/services/com.sun.tdk.jcov.report.AncFilterFactory"
               append="false">
-            com.sun.tdk.jcov.report.ancfilters.ToStringANCFilter
-            com.sun.tdk.jcov.report.ancfilters.DeprecatedANCFilter
-            com.sun.tdk.jcov.report.ancfilters.EmptyANCFilter
-            com.sun.tdk.jcov.report.ancfilters.CatchANCFilter
-            com.sun.tdk.jcov.report.ancfilters.ThrowANCFilter
-            com.sun.tdk.jcov.report.ancfilters.SyntheticANCFilter
-            com.sun.tdk.jcov.report.ancfilters.GetterANCFilter
-            com.sun.tdk.jcov.report.ancfilters.SetterANCFilter
-            com.sun.tdk.jcov.report.ancfilters.ListANCFilter
+            com.sun.tdk.jcov.report.ancfilters.BuiltInAncFilters
         </echo>
 
         <jar destfile="${build.dir}/jcov.jar" basedir="${jcov.classes}" index="false">
--- a/plugins/simple_methods_anc/test/openjdk/jcov/filter/simplemethods/MainTest.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/plugins/simple_methods_anc/test/openjdk/jcov/filter/simplemethods/MainTest.java	Fri Aug 03 04:01:19 2018 -0700
@@ -99,6 +99,7 @@
                     "file:///a/path"});
     }
 
+    @Test
     public void testNoFilter() throws IOException, URISyntaxException {
         try {
             Scanner.main(new String[]{
@@ -109,4 +110,24 @@
                     .allMatch(f -> e.getMessage().contains(f)), "Incorrect error message: " + e.getMessage());
         }
     }
+
+    @Test
+    public void testTwoFilters() throws IOException, URISyntaxException {
+        String dir = System.getProperty("test.classes");
+        Path setters = Files.createTempFile("setters2_", ".lst");
+        Path getters = Files.createTempFile("getters2_", ".lst");
+        System.out.println("testDir output file: " + setters.toAbsolutePath().toString());
+        System.out.println("testDir output file: " + getters.toAbsolutePath().toString());
+        Scanner.main(new String[]{
+                "--setters", setters.toAbsolutePath().toString(),
+                "--getters", getters.toAbsolutePath().toString(),
+                "file://" + dir
+        });
+        assertTrue(Files.lines(setters).anyMatch(l ->
+                l.equals(SettersTest.class.getName().replace('.', '/') + "#setField(I)V")));
+        assertTrue(Files.lines(getters).anyMatch(l ->
+                l.equals(GettersTest.class.getName().replace('.', '/') + "#getField()I")));
+        Files.delete(setters);
+        Files.delete(getters);
+    }
 }
--- a/src/classes/com/sun/tdk/jcov/RepGen.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/RepGen.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
 import com.sun.tdk.jcov.processing.DataProcessorSPI;
 import com.sun.tdk.jcov.report.AncFilter;
 import com.sun.tdk.jcov.report.ParameterizedAncFilter;
-import com.sun.tdk.jcov.report.ancfilters.DefaultAncFilter;
+import com.sun.tdk.jcov.report.AncFilterFactory;
 import com.sun.tdk.jcov.util.Utils;
 import com.sun.tdk.jcov.data.FileFormatException;
 import com.sun.tdk.jcov.data.Result;
@@ -58,13 +58,13 @@
 import com.sun.tdk.jcov.tools.SPIDescr;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.ServiceLoader;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import static com.sun.tdk.jcov.tools.OptionDescr.*;
 import java.io.File;
 import java.util.Arrays;
-import java.util.ServiceLoader;
 import java.util.List;
 import org.objectweb.asm.Opcodes;
 
@@ -249,33 +249,32 @@
         }
 
         if (ancdeffilters != null) {
-            ServiceLoader<DefaultAncFilter> loader = ServiceLoader.load(DefaultAncFilter.class);
+            ServiceLoader<AncFilterFactory> loader = ServiceLoader.load(AncFilterFactory.class);
             List<AncFilter> defaultANCFiltersList = new ArrayList<AncFilter>();
-            if (ancfiltersClasses != null && ancfiltersClasses.length > 0){
+            if (ancfiltersClasses != null && ancfiltersClasses.length > 0) {
                 defaultANCFiltersList.addAll(Arrays.asList(ancfiltersClasses));
             }
-            if (ancdeffilters.length == 1 && ancdeffilters[0].equals("all")){
-                for (DefaultAncFilter filter : loader) {
-                    if(!(filter instanceof ParameterizedAncFilter))
-                        defaultANCFiltersList.add(filter);
+            if (ancdeffilters.length == 1 && ancdeffilters[0].equals("all")) {
+                for (AncFilterFactory factory : loader) {
+                    defaultANCFiltersList.addAll(factory.instantiateAll());
                 }
-            }
-            else {
+            } else {
                 for (String defaulAncFilter : ancdeffilters) {
                     boolean found = false;
-                    for (DefaultAncFilter filter : loader) {
-                        String filterName, filterParameters;
-                        int separatorPosition = defaulAncFilter.indexOf(ANC_FILTER_PARAMETER_SEPARATOR);
-                        if(separatorPosition > -1) {
-                            filterName = defaulAncFilter.substring(0, separatorPosition);
-                            filterParameters = defaulAncFilter.substring(separatorPosition +
-                                    ANC_FILTER_PARAMETER_SEPARATOR.length());
-                        } else {
-                            filterName = defaulAncFilter;
-                            filterParameters = null;
-                        }
-                        if (filterName.equals(filter.getFilterName())) {
-                            if(filterParameters != null) {
+                    String filterName, filterParameters;
+                    int separatorPosition = defaulAncFilter.indexOf(ANC_FILTER_PARAMETER_SEPARATOR);
+                    if (separatorPosition > -1) {
+                        filterName = defaulAncFilter.substring(0, separatorPosition);
+                        filterParameters = defaulAncFilter.substring(separatorPosition +
+                                ANC_FILTER_PARAMETER_SEPARATOR.length());
+                    } else {
+                        filterName = defaulAncFilter;
+                        filterParameters = null;
+                    }
+                    for (AncFilterFactory factory : loader) {
+                        AncFilter filter = factory.instantiate(filterName);
+                        if (filter != null) {
+                            if (filterParameters != null) {
                                 if (filter instanceof ParameterizedAncFilter) {
                                     try {
                                         ((ParameterizedAncFilter) filter).setParameter(filterParameters);
@@ -293,7 +292,7 @@
                         }
                     }
                     if (!found) {
-                        throw new RuntimeException("There is no default ANC filter for \""+defaulAncFilter+"\" value");
+                        throw new RuntimeException("There is no ANC filter for \"" + defaulAncFilter + "\" value");
                     }
                 }
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/classes/com/sun/tdk/jcov/report/AncFilterFactory.java	Fri Aug 03 04:01:19 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tdk.jcov.report;
+
+import java.util.Collection;
+
+/**
+ * Implementations of this interface are responsible for mapping short names provided with {@code ancdf} options to
+ * AncFilter instances. Instances of this interface are discovered through {@code ServiceLoader} API.
+ */
+public interface AncFilterFactory {
+    /**
+     * Creates an instance of {@code AncFilter} identified by a short name.
+     * @param shortName
+     * @return {@code AncFilter} or null, if {@code shortName} does not correspond to any filter supported by this factory.
+     */
+    AncFilter instantiate(String shortName);
+
+    /**
+     * Instantiases all supported {@code AncFilter}s, which could be instanciated without additional information,
+     * such as parameters of {@code ParameterizedAncFilter}
+     * @return
+     */
+    Collection<AncFilter> instantiateAll();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/BuiltInAncFilters.java	Fri Aug 03 04:01:19 2018 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tdk.jcov.report.ancfilters;
+
+import com.sun.tdk.jcov.report.AncFilter;
+import com.sun.tdk.jcov.report.AncFilterFactory;
+import com.sun.tdk.jcov.report.ParameterizedAncFilter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import java.util.HashMap;
+
+import static java.util.stream.Collectors.toList;
+
+public class BuiltInAncFilters implements AncFilterFactory {
+    private static final Map<String, Class<? extends AncFilter>> filterClasses;
+    static {
+        filterClasses = new HashMap();
+        filterClasses.put("catch", CatchANCFilter.class);
+        filterClasses.put("deprecated", DeprecatedANCFilter.class);
+        filterClasses.put("empty", EmptyANCFilter.class);
+        filterClasses.put("getter", GetterANCFilter.class);
+        filterClasses.put("list", ListANCFilter.class);
+        filterClasses.put("setter", SetterANCFilter.class);
+        filterClasses.put("synthetic", SyntheticANCFilter.class);
+        filterClasses.put("throw", ThrowANCFilter.class);
+        filterClasses.put("toString", ToStringANCFilter.class);
+    }
+    @Override
+    public AncFilter instantiate(String shortName) {
+        try {
+            return filterClasses.get(shortName).newInstance();
+        } catch (InstantiationException|IllegalAccessException e) {
+            throw new RuntimeException("Unable to instantiate filter " + shortName, e);
+        }
+    }
+
+    @Override
+    public Collection<AncFilter> instantiateAll() {
+        List<AncFilter> filters = new ArrayList<>();
+        for(Class<? extends AncFilter> cls : filterClasses.values()) {
+            if(!ParameterizedAncFilter.class.isAssignableFrom(cls)) {
+                try {
+                    filters.add(cls.newInstance());
+                } catch (InstantiationException | IllegalAccessException e) {
+                    throw new RuntimeException("Unable to instantiate filter " + cls.getName(), e);
+                }
+            }
+        }
+        return filters;
+    }
+}
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/CatchANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/CatchANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,11 +28,12 @@
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
 import com.sun.tdk.jcov.instrument.XmlNames;
+import com.sun.tdk.jcov.report.AncFilter;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class CatchANCFilter implements DefaultAncFilter {
+public class CatchANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -56,9 +57,4 @@
     public String getAncReason() {
         return "Catch block filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "catch";
-    }
 }
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/DeprecatedANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/DeprecatedANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,13 @@
 import com.sun.tdk.jcov.instrument.DataBlock;
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
+import com.sun.tdk.jcov.report.AncFilter;
 import org.objectweb.asm.Opcodes;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class DeprecatedANCFilter implements DefaultAncFilter {
+public class DeprecatedANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -58,9 +59,4 @@
     public String getAncReason() {
         return "Deprecated method filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "deprecated";
-    }
 }
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/EmptyANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/EmptyANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,12 @@
 import com.sun.tdk.jcov.instrument.DataBlock;
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
+import com.sun.tdk.jcov.report.AncFilter;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class EmptyANCFilter implements DefaultAncFilter {
+public class EmptyANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -59,9 +60,4 @@
     public String getAncReason() {
         return "Empty method filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "empty";
-    }
 }
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/GetterANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/GetterANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,12 @@
 import com.sun.tdk.jcov.instrument.DataBlock;
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
+import com.sun.tdk.jcov.report.AncFilter;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class GetterANCFilter implements DefaultAncFilter {
+public class GetterANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -61,10 +62,4 @@
     public String getAncReason() {
         return "Getter method filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "getter";
-    }
-
 }
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/ListANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/ListANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -27,6 +27,7 @@
 import com.sun.tdk.jcov.instrument.DataBlock;
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
+import com.sun.tdk.jcov.report.AncFilter;
 import com.sun.tdk.jcov.report.ParameterizedAncFilter;
 
 import java.io.BufferedReader;
@@ -48,7 +49,7 @@
  *     &lt;class-name#&lt&gt;&lt;method-name-andsignature&gt;. Example:  java/lang/String#indexOf(I)I</li>
  * </ul>
  */
-public class ListANCFilter implements DefaultAncFilter, ParameterizedAncFilter {
+public class ListANCFilter implements ParameterizedAncFilter {
 
     private static final String COMMENT_PREFIX = "#";
     private static final String CLASS_METHOD_SEPARATOR = "#";
@@ -110,14 +111,6 @@
      * {@inheritDoc}
      */
     @Override
-    public String getFilterName() {
-        return "list";
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
     public void setParameter(String parameter) throws IOException {
         if(parameter == null)
             throw new IllegalArgumentException("File must not be null for list filter.");
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/SetterANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/SetterANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,12 @@
 import com.sun.tdk.jcov.instrument.DataBlock;
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
+import com.sun.tdk.jcov.report.AncFilter;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class SetterANCFilter implements DefaultAncFilter {
+public class SetterANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -61,9 +62,4 @@
     public String getAncReason() {
         return "Setter method filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "setter";
-    }
 }
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/SyntheticANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/SyntheticANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,13 @@
 import com.sun.tdk.jcov.instrument.DataBlock;
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
+import com.sun.tdk.jcov.report.AncFilter;
 import org.objectweb.asm.Opcodes;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class SyntheticANCFilter implements DefaultAncFilter {
+public class SyntheticANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -58,9 +59,4 @@
     public String getAncReason() {
         return "Synthetic method filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "synthetic";
-    }
 }
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/ThrowANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/ThrowANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,12 @@
 package com.sun.tdk.jcov.report.ancfilters;
 
 import com.sun.tdk.jcov.instrument.*;
+import com.sun.tdk.jcov.report.AncFilter;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class ThrowANCFilter implements DefaultAncFilter {
+public class ThrowANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -61,9 +62,4 @@
     public String getAncReason() {
         return "Throw block filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "throw";
-    }
 }
--- a/src/classes/com/sun/tdk/jcov/report/ancfilters/ToStringANCFilter.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/src/classes/com/sun/tdk/jcov/report/ancfilters/ToStringANCFilter.java	Fri Aug 03 04:01:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,12 @@
 import com.sun.tdk.jcov.instrument.DataBlock;
 import com.sun.tdk.jcov.instrument.DataClass;
 import com.sun.tdk.jcov.instrument.DataMethod;
+import com.sun.tdk.jcov.report.AncFilter;
 
 /**
  * @author Alexey Fedorchenko
  */
-public class ToStringANCFilter implements DefaultAncFilter {
+public class ToStringANCFilter implements AncFilter {
 
     @Override
     public boolean accept(DataClass clz) {
@@ -60,10 +61,4 @@
     public String getAncReason() {
         return "toString() method filter";
     }
-
-    @Override
-    public String getFilterName() {
-        return "toString";
-    }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/com/sun/tdk/jcov/report/ancfilters/BuiltInAncFiltersTest.java	Fri Aug 03 04:01:19 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tdk.jcov.report.ancfilters;
+
+import com.sun.tdk.jcov.report.AncFilter;
+import com.sun.tdk.jcov.report.AncFilterFactory;
+import org.testng.annotations.Test;
+
+import java.util.Collection;
+
+import static org.testng.Assert.assertTrue;
+
+public class BuiltInAncFiltersTest {
+    static final AncFilterFactory factory = new BuiltInAncFilters();
+    @Test
+    public void testInstantiate() {
+        assertTrue(factory.instantiate("setter") instanceof SetterANCFilter);
+        assertTrue(factory.instantiate("getter") instanceof GetterANCFilter);
+    }
+    @Test
+    public void testInstantiateAll() {
+        Collection<AncFilter> filters = factory.instantiateAll();
+        assertTrue(filters.stream().anyMatch(f -> f instanceof CatchANCFilter));
+        assertTrue(filters.stream().anyMatch(f -> f instanceof DeprecatedANCFilter));
+        assertTrue(filters.stream().noneMatch(f -> f instanceof ListANCFilter));
+    }
+}
--- a/test/unit/com/sun/tdk/jcov/report/ancfilters/ListANCFilterTest.java	Tue Jun 05 11:41:42 2018 -0700
+++ b/test/unit/com/sun/tdk/jcov/report/ancfilters/ListANCFilterTest.java	Fri Aug 03 04:01:19 2018 -0700
@@ -148,9 +148,4 @@
     public void testReasonUninitiated() {
         new ListANCFilter().getAncReason();
     }
-
-    @Test
-    public void testGetFilterName() {
-        assertEquals(new ListANCFilter().getFilterName(), "list");
-    }
 }