Skip to content

Commit 4eba443

Browse files
committed
2 parents a02974e + 68f501a commit 4eba443

File tree

6 files changed

+77
-9
lines changed

6 files changed

+77
-9
lines changed

.gitignore

100755100644
Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,52 @@
1+
### How to update
2+
# This is copied from OpenHFT/.gitignore
3+
# update the original and run OpenHFT/update_gitignore.sh
4+
5+
### Compiled class file
16
*.class
27

3-
# Package Files #
8+
### Package Files
49
*.jar
510
*.war
611
*.ear
712

8-
# IntelliJ
13+
### Log file
14+
*.log
15+
16+
### IntelliJ
917
*.iml
1018
*.ipr
1119
*.iws
1220
.idea
21+
.attach_pid*
1322

14-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23+
### Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
1524
hs_err_pid*
1625

17-
# Eclipse
26+
### Maven template
27+
target/
28+
pom.xml.tag
29+
pom.xml.releaseBackup
30+
pom.xml.versionsBackup
31+
pom.xml.next
32+
release.properties
33+
34+
### Eclipse template
35+
*.pydevproject
36+
.metadata
37+
.gradle
38+
bin/
39+
tmp/
40+
*.tmp
41+
*.bak
42+
*.swp
43+
*~.nib
44+
local.properties
1845
.classpath
1946
.project
2047
.settings/
48+
.loadpath
2149

22-
# maven
23-
target
50+
### Queue files
51+
*.cq4t
52+
*.cq4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ you have compiler redefine a class and code already compiled to use the class wi
3939

4040
## Using the CachedCompiler.
4141

42-
In this example, you can configure the compiler to write the files to a speicifc directory when you are in debug mode.
42+
In this example, you can configure the compiler to write the files to a specific directory when you are in debug mode.
4343

4444
private static final CachedCompiler JCC = CompilerUtils.DEBUGGING ?
4545
new CachedCompiler(new File(parent, "src/test/java"), new File(parent, "target/compiled")) :

compiler/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<groupId>net.openhft</groupId>
4040
<artifactId>third-party-bom</artifactId>
4141
<type>pom</type>
42-
<version>3.6.0</version>
42+
<version>3.6.2</version>
4343
<scope>import</scope>
4444
</dependency>
4545

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package mytest;
2+
3+
public interface IntConsumer {
4+
void accept(int num);
5+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package mytest;
2+
3+
import net.openhft.compiler.CompilerUtils;
4+
import org.junit.Test;
5+
6+
import java.net.URL;
7+
import java.net.URLClassLoader;
8+
9+
import static org.junit.Assert.fail;
10+
11+
public class RuntimeCompileTest {
12+
static String code = "package mytest;\n" +
13+
"public class Test implements IntConsumer {\n" +
14+
" public void accept(int num) {\n" +
15+
" if ((byte) num != num)\n" +
16+
" throw new IllegalArgumentException();\n" +
17+
" }\n" +
18+
"}\n";
19+
20+
@Test
21+
public void outOfBounds() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
22+
ClassLoader cl = new URLClassLoader(new URL[0]);
23+
Class aClass = CompilerUtils.CACHED_COMPILER.
24+
loadFromJava(cl, "mytest.Test", code);
25+
IntConsumer consumer = (IntConsumer) aClass.newInstance();
26+
consumer.accept(1); // ok
27+
try {
28+
consumer.accept(128); // no ok
29+
fail();
30+
} catch (IllegalArgumentException expected) {
31+
}
32+
}
33+
}
34+

compiler/src/test/java/net/openhft/compiler/MyIntSupplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.openhft.compiler;
22

33
/*
4-
* Created by peter on 31/12/2016.
4+
* Created by Peter Lawrey on 31/12/2016.
55
*/
66
public interface MyIntSupplier {
77
public int get();

0 commit comments

Comments
 (0)