Skip to content

Commit 2b74b46

Browse files
committed
Merge upstream changes
2 parents 0d4b850 + c2d3193 commit 2b74b46

21 files changed

Lines changed: 1301 additions & 397 deletions

File tree

.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

LICENSE.adoc

Lines changed: 542 additions & 9 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,31 @@ By default it uses the current ClassLoader. It supports nested classes, but oth
99

1010
You can include in your project with
1111

12-
<dependency>
13-
<groupId>net.openhft</groupId>
14-
<artifactId>compiler</artifactId>
15-
<version><!-- The latest version (see above) --></version>
16-
</dependency>
12+
```xml
13+
<dependency>
14+
<groupId>net.openhft</groupId>
15+
<artifactId>compiler</artifactId>
16+
<version><!-- The latest version (see above) --></version>
17+
</dependency>
18+
```
1719

1820
## Simple example
1921

2022
You need a CachedCompiler and access to your JDK's tools.jar.
2123

22-
// dynamically you can call
23-
String className = "mypackage.MyClass";
24-
String javaCode = "package mypackage;\n" +
25-
"public class MyClass implements Runnable {\n" +
26-
" public void run() {\n" +
27-
" System.out.println("\"Hello World\");\n" +
28-
" }\n" +
29-
"}\n";
30-
Class aClass = CompilerUtils.CACHED_COMPILER.loadFromJava(className, javaCode);
31-
Runnable runner = (Runnable) aClass.newInstance();
32-
runner.run();
24+
```java
25+
// dynamically you can call
26+
String className = "mypackage.MyClass";
27+
String javaCode = "package mypackage;\n" +
28+
"public class MyClass implements Runnable {\n" +
29+
" public void run() {\n" +
30+
" System.out.println(\"Hello World\");\n" +
31+
" }\n" +
32+
"}\n";
33+
Class aClass = CompilerUtils.CACHED_COMPILER.loadFromJava(className, javaCode);
34+
Runnable runner = (Runnable) aClass.newInstance();
35+
runner.run();
36+
````
3337

3438
I suggest making you class implement a KnownInterface of your choice as this will allow you to call/manipulate instances of you generated class.
3539

@@ -39,11 +43,13 @@ you have compiler redefine a class and code already compiled to use the class wi
3943

4044
## Using the CachedCompiler.
4145

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

44-
private static final CachedCompiler JCC = CompilerUtils.DEBUGGING ?
45-
new CachedCompiler(new File(parent, "src/test/java"), new File(parent, "target/compiled")) :
46-
CompilerUtils.CACHED_COMPILER;
48+
```java
49+
private static final CachedCompiler JCC = CompilerUtils.DEBUGGING ?
50+
new CachedCompiler(new File(parent, "src/test/java"), new File(parent, "target/compiled")) :
51+
CompilerUtils.CACHED_COMPILER;
52+
```
4753

4854
By selecting the src directory to match where your IDE looks for those files, it will allow your debugger to set into code you have generated at runtime.
4955

compiler/pom.xml

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)