use of com.intellij.uiDesigner.compiler.AsmCodeGenerator in project intellij-community by JetBrains.
the class AsmCodeGeneratorTest method testIdeadev14081.
public void testIdeadev14081() throws Exception {
// NOTE: That doesn't really reproduce the bug as it's dependent on a particular instrumentation sequence used during form preview
// (the nested form is instrumented with a new AsmCodeGenerator instance directly in the middle of instrumentation of the current form)
final String testDataPath = PluginPathManager.getPluginHomePath("ui-designer") + File.separatorChar + "testData" + File.separatorChar + File.separatorChar + "formEmbedding" + File.separatorChar + "Ideadev14081" + File.separatorChar;
AsmCodeGenerator embeddedClassGenerator = initCodeGenerator("Embedded.form", "Embedded", testDataPath);
byte[] embeddedPatchedData = getVerifiedPatchedData(embeddedClassGenerator);
myClassFinder.addClassDefinition("Embedded", embeddedPatchedData);
myNestedFormLoader.registerNestedForm("Embedded.form", testDataPath + "Embedded.form");
AsmCodeGenerator mainClassGenerator = initCodeGenerator("Main.form", "Main", testDataPath);
byte[] mainPatchedData = getVerifiedPatchedData(mainClassGenerator);
/*
FileOutputStream fos = new FileOutputStream("C:\\yole\\FormPreview27447\\MainPatched.class");
fos.write(mainPatchedData);
fos.close();
*/
myClassFinder.addClassDefinition("Main", mainPatchedData);
final Class mainClass = myClassFinder.getLoader().loadClass("Main");
Object instance = mainClass.newInstance();
assert instance != null : mainClass;
}
use of com.intellij.uiDesigner.compiler.AsmCodeGenerator in project intellij-community by JetBrains.
the class AsmCodeGeneratorTest method testIncompatibleTypeField.
public void testIncompatibleTypeField() throws Exception {
AsmCodeGenerator generator = initCodeGenerator("TestIncompatibleTypeField.form", "BindingTest");
assertEquals("Cannot bind: Incompatible types. Cannot assign javax.swing.JPanel to field BindingTest.myStringField", generator.getErrors()[0].getErrorMessage());
}
use of com.intellij.uiDesigner.compiler.AsmCodeGenerator in project intellij-community by JetBrains.
the class AsmCodeGeneratorTest method testPrimitiveField.
public void testPrimitiveField() throws Exception {
AsmCodeGenerator generator = initCodeGenerator("TestPrimitiveField.form", "BindingTest");
assertEquals("Cannot bind: field is of primitive type: BindingTest.myIntField", generator.getErrors()[0].getErrorMessage());
}
use of com.intellij.uiDesigner.compiler.AsmCodeGenerator in project intellij-community by JetBrains.
the class AsmCodeGeneratorTest method testStaticField.
public void testStaticField() throws Exception {
AsmCodeGenerator generator = initCodeGenerator("TestStaticField.form", "BindingTest");
assertEquals("Cannot bind: field is static: BindingTest.myStaticField", generator.getErrors()[0].getErrorMessage());
}
use of com.intellij.uiDesigner.compiler.AsmCodeGenerator in project intellij-community by JetBrains.
the class AsmCodeGeneratorTest method loadAndPatchClass.
private Class loadAndPatchClass(final String formFileName, final String className) throws Exception {
final AsmCodeGenerator codeGenerator = initCodeGenerator(formFileName, className);
byte[] patchedData = getVerifiedPatchedData(codeGenerator);
/*
FileOutputStream fos = new FileOutputStream("C:\\yole\\FormPreview27447\\MainPatched.class");
fos.write(patchedData);
fos.close();
*/
myClassFinder.addClassDefinition(className, patchedData);
return myClassFinder.getLoader().loadClass(className);
}
Aggregations