Skip to content

Commit 95b8ce0

Browse files
committed
Added support for a GeneratedMethodBridge to support mocking the behaviour of back to back MethodWriter/MethodReader calls, OpenHFT/Chronicle-Wire#228
1 parent 6779a6d commit 95b8ce0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
<modelVersion>4.0.0</modelVersion>
2929
<artifactId>compiler</artifactId>
30-
<version>2.3.7-SNAPSHOT</version>
30+
<version>2.4.0-SNAPSHOT</version>
3131
<packaging>bundle</packaging>
3232

3333
<name>OpenHFT/Java-Runtime-Compiler</name>

src/main/java/net/openhft/compiler/CachedCompiler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,24 @@ Map<String, byte[]> compileFromJava(@NotNull String className,
9191
String filename = className.replaceAll("\\.", '\\' + File.separator) + ".java";
9292
File file = new File(sourceDir, filename);
9393
writeText(file, javaCode);
94+
if (s_standardJavaFileManager == null)
95+
s_standardJavaFileManager = s_compiler.getStandardFileManager(null, null, null);
9496
compilationUnits = s_standardJavaFileManager.getJavaFileObjects(file);
9597

9698
} else {
9799
javaFileObjects.put(className, new JavaSourceFromString(className, javaCode));
98100
compilationUnits = javaFileObjects.values();
99101
}
100102
// reuse the same file manager to allow caching of jar files
103+
List<String> options = Arrays.asList("-g", "-nowarn");
101104
boolean ok = s_compiler.getTask(writer, fileManager, new DiagnosticListener<JavaFileObject>() {
102105
@Override
103106
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
104107
if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
105108
writer.println(diagnostic);
106109
}
107110
}
108-
}, null, null, compilationUnits).call();
111+
}, options, null, compilationUnits).call();
109112
Map<String, byte[]> result = fileManager.getAllBuffers();
110113
if (!ok) {
111114
// compilation error, so we want to exclude this file from future compilation passes

0 commit comments

Comments
 (0)