-
Notifications
You must be signed in to change notification settings - Fork 962
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/release/2.2.6'
# Conflicts: # common.gradle
- Loading branch information
Showing
60 changed files
with
651 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
btrace-compiler/src/test/java/org/openjdk/btrace/compiler/TypeErasureTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.openjdk.btrace.compiler; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.objectweb.asm.ClassReader; | ||
import org.objectweb.asm.util.CheckClassAdapter; | ||
import org.openjdk.btrace.core.SharedSettings; | ||
import org.openjdk.btrace.instr.BTraceProbe; | ||
import org.openjdk.btrace.instr.BTraceProbeFactory; | ||
|
||
import java.io.File; | ||
import java.io.PrintWriter; | ||
import java.io.StringWriter; | ||
import java.net.URL; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
public class TypeErasureTest { | ||
@Test | ||
void testTypeErasure() throws Exception { | ||
URL input = TypeErasureTest.class.getResource("/HistoProbe.java"); | ||
File inputFile = new File(input.toURI()); | ||
Map<String, byte[]> data = | ||
new Compiler(true) | ||
.compile( | ||
inputFile, | ||
new PrintWriter(System.err), | ||
null, | ||
System.getProperty("java.class.path")); | ||
BTraceProbeFactory factory = new BTraceProbeFactory(SharedSettings.GLOBAL); | ||
for (byte[] bytes : data.values()) { | ||
BTraceProbe probe = factory.createProbe(bytes); | ||
verifyCode(probe.getFullBytecode()); | ||
verifyCode(probe.getDataHolderBytecode()); | ||
} | ||
} | ||
|
||
private void verifyCode(byte[] code) { | ||
StringWriter sw = new StringWriter(); | ||
PrintWriter pw = new PrintWriter(sw); | ||
CheckClassAdapter.verify(new ClassReader(code), true, pw); | ||
if (sw.toString().contains("AnalyzerException")) { | ||
System.err.println(sw); | ||
fail(); | ||
} | ||
} | ||
} |
Oops, something went wrong.