Skip to content

Commit

Permalink
Add support for Java 11 and 12 class files with "preview features" (#743
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Godin authored and marchof committed Aug 20, 2018
1 parent 0484d9d commit 6bbb012
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,29 @@ public void should_detect_java_11() throws IOException {
assertContent();
}

@Test
public void should_detect_java_11_with_preview_features()
throws IOException {
initData(0xCA, 0xFE, 0xBA, 0xBE, 0xFF, 0xFF, 0x00, 0x37);
assertEquals(ContentTypeDetector.CLASSFILE, detector.getType());
assertContent();
}

@Test
public void should_detect_java_12() throws IOException {
initData(0xCA, 0xFE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x38);
assertEquals(ContentTypeDetector.CLASSFILE, detector.getType());
assertContent();
}

@Test
public void should_detect_java_12_with_preview_features()
throws IOException {
initData(0xCA, 0xFE, 0xBA, 0xBE, 0xFF, 0xFF, 0x00, 0x38);
assertEquals(ContentTypeDetector.CLASSFILE, detector.getType());
assertContent();
}

@Test
public void testMachObjectFile() throws IOException {
initData(0xCA, 0xFE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x02);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ private static int determineType(final InputStream in) throws IOException {
case Opcodes.V9:
case BytecodeVersion.V10:
case Opcodes.V11:
case Opcodes.V11 | Opcodes.V_PREVIEW_EXPERIMENTAL:
case Opcodes.V12:
case Opcodes.V12 | Opcodes.V_PREVIEW_EXPERIMENTAL:
return CLASSFILE;
}
}
Expand Down
9 changes: 5 additions & 4 deletions org.jacoco.doc/docroot/doc/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ <h2>Snapshot Build @qualified.bundle.version@ (@build.date@)</h2>

<h3>New Features</h3>
<ul>
<li>Experimental support for Java 11 class files
(GitHub <a href="https://github.com/jacoco/jacoco/issues/719">#719</a>).</li>
<li>Experimental support for Java 12 class files
(GitHub <a href="https://github.com/jacoco/jacoco/issues/738">#738</a>).</li>
<li>Experimental support for Java 11 and Java 12 class files, including
JEP 12 "preview features"
(GitHub <a href="https://github.com/jacoco/jacoco/issues/719">#719</a>,
<a href="https://github.com/jacoco/jacoco/issues/738">#738</a>,
<a href="https://github.com/jacoco/jacoco/issues/743">#743</a>).</li>
<li>Branches and instructions generated by javac 11 for try-with-resources
statement are filtered out
(GitHub <a href="https://github.com/jacoco/jacoco/issues/669">#669</a>).</li>
Expand Down

0 comments on commit 6bbb012

Please sign in to comment.