Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ECJ from 3.12.1 to 3.32.0 #1404

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
JDK_VERSION: 7
JDK 8:
JDK_VERSION: 8
JDK 8 with ECJ:
JDK_VERSION: 8
ECJ: true
JDK 9:
JDK_VERSION: 9
JDK 10:
JDK_VERSION: 10
JDK 11:
JDK_VERSION: 11
JDK 11 with ECJ:
Godin marked this conversation as resolved.
Show resolved Hide resolved
JDK_VERSION: 11
ECJ: true
JDK 12:
JDK_VERSION: 12
JDK 13:
Expand All @@ -31,10 +31,16 @@ jobs:
JDK_VERSION: 16
JDK 17:
JDK_VERSION: 17
JDK 17 with ECJ:
JDK_VERSION: 17
ECJ: true
JDK 18:
JDK_VERSION: 18
JDK 19:
JDK_VERSION: 19
JDK 19 with ECJ:
JDK_VERSION: 19
ECJ: true
JDK 20:
JDK_VERSION: 20
JDK 21:
Expand Down
8 changes: 3 additions & 5 deletions org.jacoco.build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -934,19 +934,17 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>eclipse</compilerId>
<source>1.8</source>
<target>1.8</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
<version>3.32.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.8.1</version>
<version>2.8.5</version>
</dependency>
</dependencies>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*******************************************************************************/
package org.jacoco.core.test.validation.java14;

import org.jacoco.core.test.validation.Source.Line;
import org.jacoco.core.test.validation.ValidationTestBase;
import org.jacoco.core.test.validation.java14.targets.SwitchExpressionsTarget;

Expand All @@ -24,4 +25,20 @@ public SwitchExpressionsTest() {
super(SwitchExpressionsTarget.class);
}

public void assertExhaustiveSwitchExpression(Line line) {
if (isJDKCompiler) {
assertPartlyCovered(line, 1, 3);
} else {
assertFullyCovered(line, 1, 3);
}
}

public void assertExhaustiveSwitchExpressionLastCase(Line line) {
if (isJDKCompiler) {
assertFullyCovered(line);
} else {
assertPartlyCovered(line);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
*******************************************************************************/
package org.jacoco.core.test.validation.java14.targets;

import static org.jacoco.core.test.validation.targets.Stubs.Enum.A;
import static org.jacoco.core.test.validation.targets.Stubs.Enum.B;
import static org.jacoco.core.test.validation.targets.Stubs.Enum.C;
import static org.jacoco.core.test.validation.targets.Stubs.enumA;
import static org.jacoco.core.test.validation.targets.Stubs.i1;
import static org.jacoco.core.test.validation.targets.Stubs.i2;
import static org.jacoco.core.test.validation.targets.Stubs.nop;

import org.jacoco.core.test.validation.targets.Stubs;

/**
* This target exercises switch expressions.
*/
Expand All @@ -31,7 +29,10 @@ public static void main(String[] args) {
multiValueSwitchExpressionWithArrows();
switchExpressionWithArrowsAndYield();
switchExpressionWithYield();
exhaustiveSwitchExpression();

exhaustiveSwitchExpression(Stubs.Enum.A);
exhaustiveSwitchExpression(Stubs.Enum.B);
exhaustiveSwitchExpression(Stubs.Enum.C);

}

Expand Down Expand Up @@ -98,13 +99,13 @@ private static void switchExpressionWithYield() {

}

private static void exhaustiveSwitchExpression() {
private static void exhaustiveSwitchExpression(Stubs.Enum e) {

nop(switch (enumA()) { // assertPartlyCovered(3, 1)
nop(switch (e) { // assertExhaustiveSwitchExpression()
case A -> i1(); // assertFullyCovered()
case B -> i1(); // assertNotCovered()
case C -> i1(); // assertNotCovered()
});
case B -> i1(); // assertFullyCovered()
case C -> i1(); // assertExhaustiveSwitchExpressionLastCase()
}); // assertEmpty()

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*******************************************************************************/
package org.jacoco.core.test.validation.java16;

import org.jacoco.core.test.validation.Source.Line;
import org.jacoco.core.test.validation.ValidationTestBase;
import org.jacoco.core.test.validation.java16.targets.InstanceofTarget;

Expand All @@ -24,4 +25,15 @@ public InstanceofTest() {
super(InstanceofTarget.class);
}

public void assertInstanceof(Line line) {
if (isJDKCompiler) {
assertFullyCovered(line, 0, 2);
} else {
// Upgrade to ECJ version with
// https://github.com/eclipse-jdt/eclipse.jdt.core/commit/3b4c932227240d090904e141a485ba9181a79b67
// will lead to the absence of missed branches
assertFullyCovered(line, 1, 3);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class InstanceofTarget {

private static void ifInstanceof(Object e) {
if (e instanceof String s) { // assertFullyCovered(0, 2)
if (e instanceof String s) { // assertInstanceof()
nop(s);
}
}
Expand Down
6 changes: 5 additions & 1 deletion org.jacoco.doc/docroot/doc/build.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,22 @@ <h2>Compilation and testing with different JDKs</h2>
<li><code>mvn clean verify -Djdk.version=6 -Dbytecode.version=6</code></li>
<li><code>mvn clean verify -Djdk.version=7 -Dbytecode.version=7</code></li>
<li><code>mvn clean verify -Djdk.version=8 -Dbytecode.version=8</code></li>
<li><code>mvn clean verify -Djdk.version=8 -Dbytecode.version=8 -Decj</code></li>
<li><code>mvn clean verify -Djdk.version=9 -Dbytecode.version=9</code></li>
<li><code>mvn clean verify -Djdk.version=10 -Dbytecode.version=10</code></li>
<li><code>mvn clean verify -Djdk.version=11 -Dbytecode.version=11</code></li>
<li><code>mvn clean verify -Djdk.version=11 -Dbytecode.version=11 -Decj</code></li>
Godin marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While Java 11 should now be listed twice: With and without -Decj

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<li><code>mvn clean verify -Djdk.version=12 -Dbytecode.version=12</code></li>
<li><code>mvn clean verify -Djdk.version=13 -Dbytecode.version=13</code></li>
<li><code>mvn clean verify -Djdk.version=14 -Dbytecode.version=14</code></li>
<li><code>mvn clean verify -Djdk.version=15 -Dbytecode.version=15</code></li>
<li><code>mvn clean verify -Djdk.version=16 -Dbytecode.version=16</code></li>
<li><code>mvn clean verify -Djdk.version=17 -Dbytecode.version=17</code></li>
<li><code>mvn clean verify -Djdk.version=17 -Dbytecode.version=17 -Decj</code></li>
<li><code>mvn clean verify -Djdk.version=18 -Dbytecode.version=18</code></li>
<li><code>mvn clean verify -Djdk.version=19 -Dbytecode.version=19</code></li>
<li><code>mvn clean verify -Djdk.version=19 -Dbytecode.version=19 -Decj</code></li>
<li><code>mvn clean verify -Djdk.version=20 -Dbytecode.version=20</code></li>
<li><code>mvn clean verify -Djdk.version=21 -Dbytecode.version=21</code></li>
</ul>


Expand Down