This commit is contained in:
Alexey Andreev 2017-02-10 23:05:54 +03:00
commit da3802d9c5
2 changed files with 6 additions and 4 deletions

View File

@ -33,6 +33,8 @@ public final class Platform {
private Platform() {
}
private static boolean newInstancePrepared;
@InjectedBy(PlatformGenerator.class)
public static native PlatformObject getPlatformObject(Object obj);
@ -85,7 +87,10 @@ public final class Platform {
public static native int nextObjectId();
public static <T> T newInstance(PlatformClass cls) {
if (!newInstancePrepared) {
prepareNewInstance();
newInstancePrepared = true;
}
return newInstanceImpl(cls);
}

View File

@ -117,9 +117,6 @@ public class PlatformGenerator implements Generator, Injector, DependencyPlugin
.appendMethodBody(method.getReference()).append(";").softNewLine();
}
}
writer.appendMethodBody(Platform.class, "newInstance", PlatformClass.class, Object.class).ws().append('=').ws()
.appendMethodBody(Platform.class, "newInstanceImpl", PlatformClass.class, Object.class)
.append(";").softNewLine();
}
private void generateNewInstance(GeneratorContext context, SourceWriter writer) throws IOException {