32 | *
33 | * @author Dmitry Fazunenko
34 | * @author Sergey Borodin
35 | *
36 | */
37 | public interface FilterSpi extends ServiceProvider {
38 |
39 | /**
40 | * Creates a class member filter.
41 | *
42 | * @return new filter, or null, if not supported
43 | */
44 | public MemberFilter getFilter();
45 | }
46 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/filter/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | /**
26 | *
MemberFilter Service Provider.
Interface for MemberFilter and
27 | * it's default implementations.
MemberFilter allows to select parts of
28 | * coverage data which should be processed in JCov tools.
29 | */
30 | package com.sun.tdk.jcov.filter;
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataBlockCatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.IOException;
29 |
30 | /**
31 | *
32 | * @author Robert Field
33 | */
34 | public class DataBlockCatch extends DataBlock {
35 |
36 | /**
37 | * Creates a new instance of DataBlockCatch
38 | */
39 | public DataBlockCatch(int rootId) {
40 | super(rootId);
41 | }
42 |
43 | public DataBlockCatch(int rootId, int slot, boolean attached, long count) {
44 | super(rootId, slot, attached, count);
45 | }
46 |
47 | /**
48 | * XML Generation
49 | */
50 | public String kind() {
51 | return XmlNames.CATCH;
52 | }
53 |
54 | DataBlockCatch(int rootId, DataInput in) throws IOException {
55 | super(rootId, in);
56 | }
57 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataBlockFallThrough.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.IOException;
29 |
30 | /**
31 | * DataBlockFallThrough
32 | *
33 | * @author Robert Field
34 | */
35 | public class DataBlockFallThrough extends DataBlock {
36 |
37 | public DataBlockFallThrough(int rootId) {
38 | super(rootId);
39 | }
40 |
41 | public DataBlockFallThrough(int rootId, int slot, boolean attached, long count) {
42 | super(rootId, slot, attached, count);
43 | }
44 |
45 | /**
46 | * Does the previous block fall into this one?
47 | */
48 | @Override
49 | public boolean isFallenInto() {
50 | return true;
51 | }
52 |
53 | /**
54 | * XML Generation
55 | */
56 | public String kind() {
57 | return XmlNames.FALL;
58 | }
59 |
60 | DataBlockFallThrough(int rootId, DataInput in) throws IOException {
61 | super(rootId, in);
62 | }
63 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataBlockMethEnter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.IOException;
29 |
30 | /**
31 | * DataBlockMethEnter
32 | *
33 | * @author Robert Field
34 | */
35 | public class DataBlockMethEnter extends DataBlock {
36 |
37 | public DataBlockMethEnter(int rootId) {
38 | super(rootId);
39 | }
40 |
41 | public DataBlockMethEnter(int rootId, int slot, boolean attached, long count) {
42 | super(rootId, slot, attached, count);
43 | }
44 |
45 | /**
46 | * Does the previous block fall into this one? Effectly yes, since this is
47 | * the first block.
48 | */
49 | @Override
50 | public boolean isFallenInto() {
51 | return true;
52 | }
53 |
54 | /**
55 | * XML Generation
56 | */
57 | public String kind() {
58 | return XmlNames.METHENTER;
59 | }
60 |
61 | DataBlockMethEnter(int rootId, DataInput in) throws IOException {
62 | super(rootId, in);
63 | }
64 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataBlockTargetDefault.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.IOException;
29 |
30 | /**
31 | * DataBlockTargetDefault
32 | *
33 | *
34 | * @author Robert Field
35 | */
36 | public class DataBlockTargetDefault extends DataBlockTarget {
37 |
38 | /**
39 | * Creates a new instance of DataBlockTargetDefault
40 | */
41 | public DataBlockTargetDefault(int rootId) {
42 | super(rootId);
43 | }
44 |
45 | public DataBlockTargetDefault(int rootId, int slot, boolean attached, long count) {
46 | super(rootId, slot, attached, count);
47 | }
48 |
49 | /**
50 | * XML Generation
51 | */
52 | public String kind() {
53 | return XmlNames.DEFAULT;
54 | }
55 |
56 | DataBlockTargetDefault(int rootId, DataInput in) throws IOException {
57 | super(rootId, in);
58 | }
59 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataBlockTargetGoto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.IOException;
29 |
30 | /**
31 | * DataBlockTargetGoto
32 | *
33 | *
34 | * @author Robert Field
35 | */
36 | public class DataBlockTargetGoto extends DataBlockTarget {
37 |
38 | public DataBlockTargetGoto(int rootId) {
39 | super(rootId);
40 | }
41 |
42 | public DataBlockTargetGoto(int rootId, int slot, boolean attached, long count) {
43 | super(rootId, slot, attached, count);
44 | }
45 |
46 | /**
47 | * XML Generation
48 | */
49 | public String kind() {
50 | return XmlNames.TG;
51 | }
52 |
53 | DataBlockTargetGoto(int rootId, DataInput in) throws IOException {
54 | super(rootId, in);
55 | }
56 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataBranchCond.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.IOException;
29 |
30 | /**
31 | * DataBranchCond
32 | *
33 | *
34 | *
35 | * @author Robert Field
36 | */
37 | public class DataBranchCond extends DataBranch {
38 |
39 | public DataBranchCond(int rootId, int bciFromStart, int bciFromEnd) {
40 | super(rootId, bciFromStart, bciFromEnd);
41 | }
42 |
43 | DataBlockTarget branchTargetFallThrough() {
44 | return getBranchTargets().get(1);
45 | }
46 |
47 | DataBlockTarget branchTargetJump() {
48 | return getBranchTargets().get(0);
49 | }
50 |
51 | /**
52 | * XML Generation
53 | */
54 | public String kind() {
55 | return XmlNames.BRANCH;
56 | }
57 |
58 | DataBranchCond(int rootId, DataInput in) throws IOException {
59 | super(rootId, in);
60 | }
61 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataBranchGoto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.IOException;
29 |
30 | /**
31 | * DataBranchGoto
32 | *
33 | *
34 | * @author Robert Field
35 | */
36 | public class DataBranchGoto extends DataBranch {
37 |
38 | public DataBranchGoto(int rootId, int bciFromStart, int bciFromEnd) {
39 | super(rootId, bciFromStart, bciFromEnd);
40 | }
41 |
42 | DataBlockTarget branchTarget() {
43 | return getBranchTargets().get(0);
44 | }
45 |
46 | /**
47 | * XML Generation
48 | */
49 | public String kind() {
50 | return XmlNames.GOTO;
51 | }
52 |
53 | DataBranchGoto(int rootId, DataInput in) throws IOException {
54 | super(rootId, in);
55 | }
56 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/DataExit.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | import java.io.DataInput;
28 | import java.io.DataOutput;
29 | import java.io.IOException;
30 | import java.util.Iterator;
31 |
32 | /**
33 | * DataExit
34 | *
35 | *
36 | * @author Robert Field
37 | */
38 | public abstract class DataExit extends LocationConcrete {
39 |
40 | DataExit(int rootId, int bciStart, int bciEnd) {
41 | super(rootId, bciStart, bciEnd);
42 | }
43 |
44 | public abstract Iterator getIterator();
45 |
46 | void writeObject(DataOutput out) throws IOException {
47 | super.writeObject(out);
48 | }
49 |
50 | DataExit(int rootId, DataInput in) throws IOException {
51 | super(rootId, in);
52 | }
53 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/InstrumentationPlugin.java:
--------------------------------------------------------------------------------
1 | package com.sun.tdk.jcov.instrument;
2 |
3 | import java.nio.file.Path;
4 |
5 | public interface InstrumentationPlugin {
6 | /**
7 | * Called after all instrumentation is complete.
8 | *
9 | * @throws Exception should some
10 | */
11 | void instrumentationComplete() throws Exception;
12 |
13 | /**
14 | * For the instrumented code to work independently (i.e. without adding additional classes to the classpath), some
15 | * classes can be "implanted" into the instrumented code.
16 | *
17 | * @return Path containing the classes to be implanted. Must be in a form which can be added to Java classpath.
18 | */
19 | //TODO perhaps this can return a list of classes to be implanted
20 | Path runtime() throws Exception;
21 |
22 | /**
23 | * Name of a package which contains code, that will be called from the instrumented
24 | * code. Such package may need to be exported from a module.
25 | *
26 | * @return package name
27 | */
28 | String collectorPackage();
29 | }
30 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/Modifiers.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument;
26 |
27 | public interface Modifiers {
28 | boolean isPublic();
29 |
30 | boolean isPrivate();
31 |
32 | boolean isProtected();
33 |
34 | boolean isAbstract();
35 |
36 | boolean isFinal();
37 |
38 | boolean isSynthetic();
39 |
40 | boolean isStatic();
41 |
42 | boolean isInterface();
43 |
44 | boolean isSuper();
45 |
46 | boolean isNative();
47 |
48 | boolean isDeprecated();
49 |
50 | boolean isSynchronized();
51 |
52 | boolean isVolatile();
53 |
54 | boolean isBridge();
55 |
56 | boolean isVarargs();
57 |
58 | boolean isTransient();
59 |
60 | boolean isStrict();
61 |
62 | boolean isAnnotation();
63 |
64 | boolean isEnum();
65 |
66 | int access();
67 |
68 | /**
69 | * This method is only a part of the contract to support deprecated methods.
70 | * @param code
71 | * @return
72 | * @see DataClass#hasModifier(int)
73 | * @see DataField#hasModifier(int)
74 | * @see DataMethod#hasModifier(int)
75 | */
76 | @Deprecated
77 | boolean is(int code);
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/asm/ASMInstrumentationPlugin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.asm;
26 |
27 | import com.sun.tdk.jcov.instrument.InstrumentationPlugin;
28 | import org.objectweb.asm.MethodVisitor;
29 |
30 | /**
31 | * SPI class which allows to do additional instrumentation, in addition to instrumentation performed by JCov by default.
32 | * @author Alexander (Shura) Ilin.
33 | */
34 | public interface ASMInstrumentationPlugin extends InstrumentationPlugin {
35 | /**
36 | * Supplies a MethodVisitor to perform additional instrumentation.
37 | * @return A valid method visitor. If no instrumentation needed, must return visitor
argument.
38 | */
39 | MethodVisitor methodVisitor(int access, String owner, String name, String desc, MethodVisitor visitor);
40 | }
41 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/asm/ASMUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.asm;
26 |
27 | import org.objectweb.asm.Opcodes;
28 |
29 | public class ASMUtils {
30 | /**
31 | * The ASM API version that should be used by jcov.
32 | */
33 | public static final int ASM_API_VERSION = Opcodes.ASM9;
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/asm/FieldAnnotationVisitor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.asm;
26 |
27 | import com.sun.tdk.jcov.instrument.DataField;
28 | import com.sun.tdk.jcov.util.Utils;
29 | import org.objectweb.asm.AnnotationVisitor;
30 | import org.objectweb.asm.Attribute;
31 | import org.objectweb.asm.FieldVisitor;
32 |
33 | /**
34 | * Field visitor collecting runtime annotations
35 | *
36 | * @author Dmitry Fazunenko
37 | */
38 | class FieldAnnotationVisitor extends FieldVisitor {
39 |
40 | final DataField field;
41 | final FieldVisitor fv;
42 |
43 | FieldAnnotationVisitor(final FieldVisitor fv, final DataField field) {
44 | super(ASMUtils.ASM_API_VERSION, fv);
45 | this.fv = fv;
46 | this.field = field;
47 | }
48 |
49 | public void visitAttribute(Attribute arg0) {
50 | fv.visitAttribute(arg0);
51 | }
52 |
53 | public void visitEnd() {
54 | fv.visitEnd();
55 | }
56 |
57 | public AnnotationVisitor visitAnnotation(String anno, boolean b) {
58 | field.addAnnotation(anno);
59 | return fv.visitAnnotation(anno, b);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/asm/MethodAnnotationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.asm;
26 |
27 | import com.sun.tdk.jcov.instrument.DataMethod;
28 | import com.sun.tdk.jcov.util.Utils;
29 | import org.objectweb.asm.AnnotationVisitor;
30 | import org.objectweb.asm.MethodVisitor;
31 |
32 | /**
33 | * Class that does nothing but collects runtime annotations
34 | *
35 | * @author Dmitry Fazunenko
36 | */
37 | class MethodAnnotationAdapter extends MethodVisitor {
38 |
39 | final DataMethod meth;
40 |
41 | @Override
42 | public AnnotationVisitor visitAnnotation(String anno, boolean b) {
43 | meth.addAnnotation(anno);
44 | return super.visitAnnotation(anno, b);
45 | }
46 |
47 | MethodAnnotationAdapter(final MethodVisitor mv,
48 | final DataMethod method) {
49 | super(ASMUtils.ASM_API_VERSION, mv);
50 | this.meth = method;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/asm/OffsetLabel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.asm;
26 |
27 | import org.objectweb.asm.Label;
28 |
29 | /**
30 | * OffsetLabel
31 | *
32 | * @author Robert Field
33 | */
34 | class OffsetLabel extends Label {
35 |
36 | int originalOffset;
37 | boolean realLabel;
38 |
39 | OffsetLabel(int originalOffset) {
40 | this.originalOffset = originalOffset;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | /**
26 | * Package containing product structure information as well as it's coverage
27 | * data.
28 | */
29 | package com.sun.tdk.jcov.instrument;
30 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/reader/DataAnnotatedStAX.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.reader;
26 |
27 | import com.sun.tdk.jcov.data.FileFormatException;
28 | import com.sun.tdk.jcov.instrument.DataAnnotated;
29 | import javax.xml.stream.XMLStreamException;
30 | import javax.xml.stream.XMLStreamReader;
31 |
32 | /**
33 | *
34 | * @author Sergey Borodin
35 | */
36 | public class DataAnnotatedStAX implements Reader {
37 |
38 | private DataAnnotated anno;
39 | private XMLStreamReader parser;
40 |
41 | public void readData(Object dest) throws FileFormatException {
42 | anno = (DataAnnotated) dest;
43 | try {
44 | readData();
45 | } catch (XMLStreamException ex) {
46 | throw new FileFormatException(ex);
47 | }
48 | }
49 |
50 | void readData() throws XMLStreamException {
51 | }
52 |
53 | public void setReaderFactory(ReaderFactory r) {
54 | parser = ((ReaderFactoryStAX) r).parser;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/reader/DataExitSimpleStAX.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.reader;
26 |
27 | import com.sun.tdk.jcov.data.FileFormatException;
28 | import javax.xml.stream.XMLStreamException;
29 | import javax.xml.stream.XMLStreamReader;
30 |
31 | /**
32 | *
33 | * @author Sergey Borodin
34 | */
35 | public class DataExitSimpleStAX implements Reader {
36 |
37 | private XMLStreamReader parser;
38 |
39 | public void readData(Object dest) throws FileFormatException {
40 | try {
41 | readData();
42 | } catch (XMLStreamException ex) {
43 | throw new FileFormatException(ex);
44 | }
45 | }
46 |
47 | void readData() throws XMLStreamException {
48 | // super.readDataFrom(parser, refs, mode);
49 | parser.nextTag(); //end exit
50 | }
51 |
52 | public void setReaderFactory(ReaderFactory r) {
53 | parser = ((ReaderFactoryStAX) r).parser;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/reader/Reader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.reader;
26 |
27 | import com.sun.tdk.jcov.data.FileFormatException;
28 |
29 | /**
30 | *
31 | * @author Sergey Borodin
32 | */
33 | public interface Reader {
34 |
35 | public void readData(Object dest) throws FileFormatException;
36 |
37 | public void setReaderFactory(ReaderFactory r);
38 | }
39 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/reader/ReaderFactoryStAX.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.reader;
26 |
27 | import com.sun.tdk.jcov.data.FileFormatException;
28 | import java.io.InputStream;
29 | import javax.xml.stream.XMLInputFactory;
30 | import javax.xml.stream.XMLStreamException;
31 | import javax.xml.stream.XMLStreamReader;
32 |
33 | /**
34 | *
35 | * @author Sergey Borodin
36 | */
37 | public class ReaderFactoryStAX extends ReaderFactory {
38 |
39 | protected XMLStreamReader parser;
40 |
41 | @Override
42 | void setDataSource(InputStream is) throws FileFormatException {
43 | XMLInputFactory factory = XMLInputFactory.newInstance();
44 |
45 | try {
46 | factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
47 | factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
48 | parser = factory.createXMLStreamReader(is);
49 | } catch (XMLStreamException ex) {
50 | throw new FileFormatException(ex);
51 | }
52 | }
53 |
54 | @Override
55 | String getReadersSuffix() {
56 | return "StAX";
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/instrument/reader/RootReader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.reader;
26 |
27 | import com.sun.tdk.jcov.data.FileFormatException;
28 |
29 | /**
30 | *
31 | * @author Sergey Borodin
32 | */
33 | public interface RootReader extends Reader {
34 |
35 | public void readHeader(Object dest) throws FileFormatException;
36 | }
37 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/logging.properties:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 | #
4 | # This code is free software; you can redistribute it and/or modify it
5 | # under the terms of the GNU General Public License version 2 only, as
6 | # published by the Free Software Foundation. Oracle designates this
7 | # particular file as subject to the "Classpath" exception as provided
8 | # by Oracle in the LICENSE file that accompanied this code.
9 | #
10 | # This code is distributed in the hope that it will be useful, but WITHOUT
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 | # version 2 for more details (a copy is included in the LICENSE file that
14 | # accompanied this code).
15 | #
16 | # You should have received a copy of the GNU General Public License version
17 | # 2 along with this work; if not, write to the Free Software Foundation,
18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 | #
20 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 | # or visit www.oracle.com if you need additional information or have any
22 | # questions.
23 |
24 | handlers=com.sun.tdk.jcov.util.Utils$LoggerHandlerDelegator
25 | java.util.logging.ConsoleHandler.level=FINER
26 | java.util.logging.ConsoleHandler.formatter=com.sun.tdk.jcov.tools.LoggingFormatter
27 | java.util.logging.FileHandler.level=FINER
28 | java.util.logging.FileHandler.formatter=com.sun.tdk.jcov.tools.LoggingFormatter
29 | .level=WARNING
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | /**
26 | * JCov tools accessible from CLI and by API.
JCov consists of a
27 | * number of tools used to prepare classes for coverage collection, collection
28 | * itself and post-collection proccessign. Every tool can be accessed from the
29 | * command line ("java -jar ") as well as from API.
It's
30 | * possible to create custom tools extending JCovCMDTool class.
31 | */
32 | package com.sun.tdk.jcov;
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/processing/DataProcessorSPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.processing;
26 |
27 | import com.sun.tdk.jcov.tools.ServiceProvider;
28 |
29 | /**
30 | * This interface defines the Service Provider Interface (SPI) for the
31 | * DataProcessorFactory
class.
32 | *
33 | * @author Dmitry Fazunenko
34 | */
35 | public interface DataProcessorSPI extends ServiceProvider {
36 |
37 | /**
38 | * Creates a data processor.
39 | *
40 | * @return new data processor
41 | */
42 | public DataProcessor getDataProcessor();
43 | }
44 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/processing/DefaultDataProcessorSPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.processing;
26 |
27 | import com.sun.tdk.jcov.tools.EnvHandler;
28 | import com.sun.tdk.jcov.tools.EnvServiceProvider;
29 |
30 | /**
31 | * Provider of DataProcessor used by default.
32 | *
33 | * @author Dmitry Fazunenko
34 | */
35 | public class DefaultDataProcessorSPI implements DataProcessorSPI, EnvServiceProvider {
36 |
37 | public DataProcessor getDataProcessor() {
38 | return new CombinerDataProcessor();
39 | }
40 |
41 | public void extendEnvHandler(final EnvHandler handler) {
42 | }
43 |
44 | public int handleEnv(EnvHandler handler) {
45 | return 0;
46 | }
47 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/processing/ProcessingException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.processing;
26 |
27 | /**
28 | * Exception signaling a problem happened while data processing.
29 | *
30 | * @author Dmitry Fazunenko
31 | */
32 | public class ProcessingException extends Exception {
33 |
34 | public ProcessingException(String message) {
35 | super(message);
36 | }
37 |
38 | public ProcessingException(String message, Throwable cause) {
39 | super(message, cause);
40 | }
41 |
42 | public ProcessingException(Throwable cause) {
43 | super(cause);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/processing/StubSpi.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.processing;
26 |
27 | import com.sun.tdk.jcov.tools.EnvHandler;
28 |
29 | /**
30 | * Stub implementation of DataProcessorFactorySpi
31 | *
32 | * @author Dmitry Fazunenko
33 | */
34 | public class StubSpi implements DataProcessorSPI {
35 |
36 | /**
37 | * @return Data processor returning input data unmodified
38 | */
39 | public DataProcessor getDataProcessor() {
40 | return DataProcessor.STUB;
41 | }
42 |
43 | public void extendEnvHandler(final EnvHandler handler) {
44 | }
45 |
46 | public int handleEnv(EnvHandler handler) {
47 | return 0;
48 | }
49 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/processing/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | /**
26 | *
DataProcessor Service Provider
Interface for DataProcessor and
27 | * it's default implementations.
DataProcessor allows to pre-process
28 | * (modify) coverage structure before it's processing in tools.
29 | */
30 | package com.sun.tdk.jcov.processing;
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/AncFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report;
26 |
27 |
28 | import com.sun.tdk.jcov.instrument.DataBlock;
29 | import com.sun.tdk.jcov.instrument.DataClass;
30 | import com.sun.tdk.jcov.instrument.DataMethod;
31 |
32 | /**
33 | * @author Alexey Fedorchenko
34 | */
35 | public interface AncFilter {
36 |
37 | public boolean accept(DataClass clz);
38 |
39 | public boolean accept(DataClass clz, DataMethod m);
40 |
41 | public boolean accept(DataMethod m, DataBlock b);
42 |
43 | public String getAncReason();
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/AncFilterFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report;
26 |
27 | import java.util.Collection;
28 |
29 | /**
30 | * Implementations of this interface are responsible for mapping short names provided with {@code ancdf} options to
31 | * AncFilter instances. Instances of this interface are discovered through {@code ServiceLoader} API.
32 | */
33 | public interface AncFilterFactory {
34 | /**
35 | * Creates an instance of {@code AncFilter} identified by a short name.
36 | * @param shortName
37 | * @return {@code AncFilter} or null, if {@code shortName} does not correspond to any filter supported by this factory.
38 | */
39 | AncFilter instantiate(String shortName);
40 |
41 | /**
42 | * Instantiases all supported {@code AncFilter}s, which could be instanciated without additional information,
43 | * such as parameters of {@code ParameterizedAncFilter}
44 | * @return
45 | */
46 | Collection instantiateAll();
47 | }
48 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ParameterizedAncFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report;
26 |
27 | /**
28 | * This interface represents an ability to pass a string parameter. Syntax of using default parameterized filters:
29 | * java ... RepGen -ancdf <filter>:<parameter>
30 | */
31 | public interface ParameterizedAncFilter extends AncFilter {
32 | /**
33 | * Sets filter parameter specified in the command line.
34 | * @param parameter
35 | * @throws Exception
36 | */
37 | void setParameter(String parameter) throws Exception;
38 | }
39 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ReportGeneratorSPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report;
26 |
27 | import com.sun.tdk.jcov.tools.ServiceProvider;
28 |
29 | /**
30 | * Service provider for creating custom reports
31 | *
32 | * @author Andrey Titov
33 | */
34 | public interface ReportGeneratorSPI extends ServiceProvider {
35 |
36 | /**
37 | * @param formatName Name of the format specified by user (eg "-format
38 | * html")
39 | * @return custom report by name (eg "java -jar jcov.jar repgen -type myrep"
40 | * where "myrep" is name for a custom report)
41 | */
42 | public ReportGenerator getReportGenerator(String formatName);
43 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/Test.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report;
26 |
27 | /**
28 | * @author Dmitry Fazunenko
29 | * @author Alexey Fedorchenko
30 | */
31 | public interface Test {
32 |
33 | public String getTestOwner();
34 |
35 | public String getTestName();
36 | }
37 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ancfilters/CatchANCFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.ancfilters;
26 |
27 | import com.sun.tdk.jcov.instrument.DataBlock;
28 | import com.sun.tdk.jcov.instrument.DataClass;
29 | import com.sun.tdk.jcov.instrument.DataMethod;
30 | import com.sun.tdk.jcov.instrument.XmlNames;
31 | import com.sun.tdk.jcov.report.AncFilter;
32 |
33 | /**
34 | * @author Alexey Fedorchenko
35 | */
36 | public class CatchANCFilter implements AncFilter {
37 |
38 | @Override
39 | public boolean accept(DataClass clz) {
40 | return false;
41 | }
42 |
43 | @Override
44 | public boolean accept(DataClass clz, DataMethod m) {
45 | return false;
46 | }
47 |
48 | @Override
49 | public boolean accept(DataMethod m, DataBlock b) {
50 | if (b.kind() != null && b.kind().equals(XmlNames.CATCH)){
51 | return true;
52 | }
53 | return false;
54 | }
55 |
56 | @Override
57 | public String getAncReason() {
58 | return "Catch block filter";
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ancfilters/DefaultAncFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.ancfilters;
26 |
27 | import com.sun.tdk.jcov.report.AncFilter;
28 |
29 | /**
30 | * @author Alexey Fedorchenko
31 | */
32 | public interface DefaultAncFilter extends AncFilter {
33 |
34 | public String getFilterName();
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ancfilters/DeprecatedANCFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.ancfilters;
26 |
27 | import com.sun.tdk.jcov.instrument.DataBlock;
28 | import com.sun.tdk.jcov.instrument.DataClass;
29 | import com.sun.tdk.jcov.instrument.DataMethod;
30 | import com.sun.tdk.jcov.report.AncFilter;
31 |
32 | /**
33 | * @author Alexey Fedorchenko
34 | */
35 | public class DeprecatedANCFilter implements AncFilter {
36 |
37 | @Override
38 | public boolean accept(DataClass clz) {
39 | return false;
40 | }
41 |
42 | @Override
43 | public boolean accept(DataClass clz, DataMethod m) {
44 |
45 | if (m.getModifiers().isDeprecated()){
46 | return true;
47 | }
48 |
49 | return false;
50 | }
51 |
52 | @Override
53 | public boolean accept(DataMethod m, DataBlock b) {
54 | return false;
55 | }
56 |
57 | @Override
58 | public String getAncReason() {
59 | return "Deprecated method filter";
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ancfilters/EmptyANCFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.ancfilters;
26 |
27 | import com.sun.tdk.jcov.instrument.DataBlock;
28 | import com.sun.tdk.jcov.instrument.DataClass;
29 | import com.sun.tdk.jcov.instrument.DataMethod;
30 | import com.sun.tdk.jcov.report.AncFilter;
31 |
32 | /**
33 | * @author Alexey Fedorchenko
34 | */
35 | public class EmptyANCFilter implements AncFilter {
36 |
37 | @Override
38 | public boolean accept(DataClass clz) {
39 | return false;
40 | }
41 |
42 | @Override
43 | public boolean accept(DataClass clz, DataMethod m) {
44 |
45 | if (m.getBlocks().size() == 1
46 | && m.getBlocks().get(0).startBCI() == 0
47 | && m.getBlocks().get(0).startBCI() == m.getBlocks().get(0).endBCI()){
48 | return true;
49 | }
50 |
51 | return false;
52 | }
53 |
54 | @Override
55 | public boolean accept(DataMethod m, DataBlock b) {
56 | return false;
57 | }
58 |
59 | @Override
60 | public String getAncReason() {
61 | return "Empty method filter";
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ancfilters/SyntheticANCFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.ancfilters;
26 |
27 | import com.sun.tdk.jcov.instrument.DataBlock;
28 | import com.sun.tdk.jcov.instrument.DataClass;
29 | import com.sun.tdk.jcov.instrument.DataMethod;
30 | import com.sun.tdk.jcov.report.AncFilter;
31 |
32 | /**
33 | * @author Alexey Fedorchenko
34 | */
35 | public class SyntheticANCFilter implements AncFilter {
36 |
37 | @Override
38 | public boolean accept(DataClass clz) {
39 | return false;
40 | }
41 |
42 | @Override
43 | public boolean accept(DataClass clz, DataMethod m) {
44 |
45 | if (m.getModifiers().isSynthetic()){
46 | return true;
47 | }
48 |
49 | return false;
50 | }
51 |
52 | @Override
53 | public boolean accept(DataMethod m, DataBlock b) {
54 | return false;
55 | }
56 |
57 | @Override
58 | public String getAncReason() {
59 | return "Synthetic method filter";
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/ancfilters/ToStringANCFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.ancfilters;
26 |
27 | import com.sun.tdk.jcov.instrument.DataBlock;
28 | import com.sun.tdk.jcov.instrument.DataClass;
29 | import com.sun.tdk.jcov.instrument.DataMethod;
30 | import com.sun.tdk.jcov.report.AncFilter;
31 |
32 | /**
33 | * @author Alexey Fedorchenko
34 | */
35 | public class ToStringANCFilter implements AncFilter {
36 |
37 | @Override
38 | public boolean accept(DataClass clz) {
39 | return false;
40 | }
41 |
42 | @Override
43 | public boolean accept(DataClass clz, DataMethod m) {
44 |
45 | if (m.getName() != null
46 | && m.getName().equals("toString")
47 | && m.getVmSignature().startsWith("()")){
48 |
49 | return true;
50 | }
51 |
52 | return false;
53 | }
54 |
55 | @Override
56 | public boolean accept(DataMethod m, DataBlock b) {
57 | return false;
58 | }
59 |
60 | @Override
61 | public String getAncReason() {
62 | return "toString() method filter";
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/javap/JavapClassReader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.javap;
26 |
27 | import java.io.PrintWriter;
28 | import java.util.NoSuchElementException;
29 | import java.util.spi.ToolProvider;
30 |
31 | import static java.util.spi.ToolProvider.findFirst;
32 |
33 | public class JavapClassReader {
34 | public static void read(String filePath, String jarPath, PrintWriter pw) {
35 | int rc = 0;
36 | try {
37 | ToolProvider javap = findFirst("javap").orElseThrow();
38 | if (jarPath == null) {
39 | rc = javap.run(pw, new PrintWriter(System.err), "-c", "-p", filePath);
40 | } else {
41 | rc = javap.run(pw, new PrintWriter(System.err), "-c", "-p", "-classpath", jarPath, filePath);
42 | }
43 | } catch (NoSuchElementException ex) {
44 | System.err.println("Cannot find the javap tool");
45 | }
46 | if (rc != 0) {
47 | System.err.println("Usage: java -cp jcov.jar com.sun.tdk.jcov.RepGen -javap path_to_classes " +
48 | "-o path_to_javap_output path_to_result.xml");
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/javap/JavapCodeLine.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.javap;
26 |
27 | /**
28 | * Codeline of the javap output for classfile. This line could be covered or
29 | * not.
30 | *
31 | * @author Alexey Fedorchenko
32 | */
33 | public class JavapCodeLine extends JavapLine {
34 |
35 | private int codeNumber;
36 | private boolean visited;
37 |
38 | public int getCodeNumber() {
39 | return codeNumber;
40 | }
41 |
42 | public void setCodeNumber(int number) {
43 | codeNumber = number;
44 | }
45 |
46 | public void setVisited(boolean value) {
47 | visited = value;
48 | }
49 |
50 | public boolean isVisited() {
51 | return visited;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/report/javap/JavapLine.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.javap;
26 |
27 | /**
28 | * Line of the javap output for classfile
29 | *
30 | * @author Alexey Fedorchenko
31 | */
32 | public class JavapLine {
33 |
34 | private int lineNumber;
35 | private String line;
36 |
37 | public int getLineNumber() {
38 | return lineNumber;
39 | }
40 |
41 | public String getTextLine() {
42 | return line;
43 | }
44 |
45 | public void setLineNumber(int number) {
46 | lineNumber = number;
47 | }
48 |
49 | public void setTextLine(String textLine) {
50 | line = textLine;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/runtime/JCovSaver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.runtime;
26 |
27 | /**
28 | *
29 | * @author Leonid Mesnik
30 | */
31 | public interface JCovSaver {
32 |
33 | public void saveResults();
34 | }
35 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/runtime/SaverDecorator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.runtime;
26 |
27 | /**
28 | *
29 | * @author Andrey Titov
30 | */
31 | public interface SaverDecorator extends JCovSaver {
32 |
33 | public void init(JCovSaver saver);
34 | }
35 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/tools/JcovVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.tools;
26 |
27 | /**
28 | *
29 | * @author Andrey Titov
30 | */
31 | public class JcovVersion {
32 |
33 | public static String jcovVersion = "DEV";
34 | public static String jcovBuildNumber = "DEV";
35 | public static String jcovMilestone = "DEV";
36 |
37 | public static String getJcovVersion() {
38 | return "DEV";
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/tools/OneElemIterator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.tools;
26 |
27 | import java.util.Iterator;
28 | import java.util.NoSuchElementException;
29 |
30 | /**
31 | *
32 | * @author Sergey Borodin
33 | */
34 | public class OneElemIterator implements Iterator {
35 |
36 | private E e;
37 | private boolean hasNext;
38 |
39 | public OneElemIterator(E e) {
40 | this.e = e;
41 | hasNext = true;
42 | }
43 |
44 | public boolean hasNext() {
45 | return hasNext;
46 | }
47 |
48 | public E next() {
49 | if (hasNext) {
50 | hasNext = false;
51 | return e;
52 | } else {
53 | throw new NoSuchElementException();
54 | }
55 | }
56 |
57 | public void remove() {
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/tools/ServiceProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.tools;
26 |
27 | /**
28 | *
29 | * @author Andrey Titov
30 | */
31 | public interface ServiceProvider {
32 | }
--------------------------------------------------------------------------------
/src/classes/com/sun/tdk/jcov/tools/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | /**
26 | * Utility classes for creating custom tools.
27 | */
28 | package com.sun.tdk.jcov.tools;
--------------------------------------------------------------------------------
/test/unit/com/sun/tdk/jcov/instrument/instr/UserCode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.instr;
26 |
27 | public class UserCode {
28 | private static int count = 0;
29 | public static void main(String[] args) {
30 | if(args[0].equals("-")) count--;
31 | else if(args[0].equals("+")) count++;
32 | System.out.println("User code is running.");
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/unit/com/sun/tdk/jcov/instrument/jreinstr/Code.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.jreinstr;
26 |
27 | import javax.swing.JFrame;
28 |
29 | public class Code {
30 | public static void main(String[] args) {
31 | new JFrame();
32 | System.out.println("User code has been executed.");
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/unit/com/sun/tdk/jcov/instrument/plugin/FieldsClass.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.plugin;
26 |
27 | /**
28 | * This is a test class which is instrumented during the test.
29 | */
30 | public class FieldsClass {
31 | int field1;
32 | String field2 = "";
33 |
34 | public void setField1(int field1) {
35 | this.field1 = field1;
36 | }
37 |
38 | public void setField2(String field2) {
39 | this.field2 = field2;
40 | }
41 |
42 | public static void main(String[] args) {
43 | FieldsClass ac = new FieldsClass();
44 | ac.field1 = 1;
45 | ac.field2 = "one";
46 | ac.setField1(2);
47 | ac.setField2("two");
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/test/unit/com/sun/tdk/jcov/instrument/plugin/jreinstr/Collect.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.instrument.plugin.jreinstr;
26 |
27 | import java.lang.module.ModuleDescriptor;
28 |
29 | public class Collect {
30 | //this is called from the test to test that the necessary changes has been done by the instarumentation
31 | public static void main(String[] args) {
32 | Object.class.getModule().getDescriptor().exports().stream().filter(e -> !e.isQualified())
33 | .map(ModuleDescriptor.Exports::source)
34 | .forEach(System.out::println);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/test/unit/com/sun/tdk/jcov/report/BasicUserCode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report;
26 |
27 | public class BasicUserCode {
28 | public static void main(String[] args) {
29 | if (args.length % 2 == 0)
30 | System.out.println("even");
31 | else
32 | System.out.println("odd");
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/unit/com/sun/tdk/jcov/report/RecordContainer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report;
26 |
27 | public class RecordContainer {
28 | public record Point(int x, int y) {}
29 | public static void main(String[] args) {
30 | System.out.println(new Point(0, 0).x);
31 | System.out.println(new Point(0, 0).y);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/test/unit/com/sun/tdk/jcov/report/ancfilters/BuiltInAncFiltersTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 | package com.sun.tdk.jcov.report.ancfilters;
26 |
27 | import com.sun.tdk.jcov.report.AncFilter;
28 | import com.sun.tdk.jcov.report.AncFilterFactory;
29 | import org.testng.annotations.Test;
30 |
31 | import java.util.Collection;
32 |
33 | import static org.testng.Assert.assertTrue;
34 |
35 | public class BuiltInAncFiltersTest {
36 | static final AncFilterFactory factory = new BuiltInAncFilters();
37 | @Test
38 | public void testInstantiate() {
39 | assertTrue(factory.instantiate("setter") instanceof SetterANCFilter);
40 | assertTrue(factory.instantiate("getter") instanceof GetterANCFilter);
41 | }
42 | @Test
43 | public void testInstantiateAll() {
44 | Collection filters = factory.instantiateAll();
45 | assertTrue(filters.stream().anyMatch(f -> f instanceof CatchANCFilter));
46 | assertTrue(filters.stream().anyMatch(f -> f instanceof DeprecatedANCFilter));
47 | assertTrue(filters.stream().noneMatch(f -> f instanceof ListANCFilter));
48 | }
49 | }
50 |
--------------------------------------------------------------------------------