mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
Merge pull request #397 from dicej/master
fix broken interpreter build due to out-of-order class initialization
This commit is contained in:
commit
5a87455e64
@ -1408,8 +1408,20 @@ void writeInitializations(Output* out, Module& module)
|
||||
}
|
||||
}
|
||||
|
||||
void writeJavaInitialization(Output* out, Class* cl)
|
||||
void writeJavaInitialization(Output* out,
|
||||
Class* cl,
|
||||
std::set<Class*>& alreadyInited)
|
||||
{
|
||||
if (alreadyInited.find(cl) != alreadyInited.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
alreadyInited.insert(cl);
|
||||
|
||||
if (cl->super) {
|
||||
writeJavaInitialization(out, cl->super, alreadyInited);
|
||||
}
|
||||
|
||||
out->write("bootJavaClass(t, Gc::");
|
||||
out->write(capitalize(cl->name));
|
||||
out->write("Type, ");
|
||||
@ -1436,10 +1448,11 @@ void writeJavaInitialization(Output* out, Class* cl)
|
||||
|
||||
void writeJavaInitializations(Output* out, Module& module)
|
||||
{
|
||||
std::set<Class*> alreadyInited;
|
||||
for (const auto p : module.classes) {
|
||||
Class* cl = p.second;
|
||||
if (cl->javaName.size()) {
|
||||
writeJavaInitialization(out, cl);
|
||||
writeJavaInitialization(out, cl, alreadyInited);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,12 @@ public class NullPointer {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
((Object) null).getClass();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
throw_(null);
|
||||
throw new RuntimeException();
|
||||
|
Loading…
Reference in New Issue
Block a user