android layout preview without custom components should work with JDK7

This commit is contained in:
Eugene Kudelevsky
2012-02-20 20:02:20 +04:00
parent 53c0f88f91
commit e0b423bf2b
3 changed files with 27 additions and 2 deletions
@@ -0,0 +1,7 @@
package org.jetbrains.android.uipreview;
/**
* @author Eugene.Kudelevsky
*/
public class IncompatibleClassFileFormatException extends Exception {
}
@@ -181,6 +181,11 @@ class ProjectCallback extends LegacyCallback implements IProjectCallback {
}
return null;
}
catch (UnsupportedClassVersionError e) {
LOG.info(e);
myBrokenClasses.put(className, e);
return null;
}
}
private Object createMockView(String className, Class[] constructorSignature, Object[] constructorArgs)
@@ -331,7 +336,7 @@ class ProjectCallback extends LegacyCallback implements IProjectCallback {
return myBrokenClasses;
}
public void loadAndParseRClass() throws ClassNotFoundException {
public void loadAndParseRClass() throws ClassNotFoundException, IncompatibleClassFileFormatException {
final String className = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Nullable
@Override
@@ -347,7 +352,12 @@ class ProjectCallback extends LegacyCallback implements IProjectCallback {
Class<?> aClass = myLoadedClasses.get(className);
if (aClass == null) {
ProjectClassLoader loader = new ProjectClassLoader(null, myModule);
aClass = loader.loadClass(className);
try {
aClass = loader.loadClass(className);
}
catch (UnsupportedClassVersionError e) {
throw new IncompatibleClassFileFormatException();
}
if (aClass != null) {
myLoadedClasses.put(className, aClass);
}
@@ -93,6 +93,9 @@ public class RenderUtil {
catch (ClassNotFoundException e) {
LOG.debug(e);
}
catch (IncompatibleClassFileFormatException e) {
LOG.debug(e);
}
final RenderResources resolver =
factory.createResourceResolver(facet, config, projectResources, theme.getName(), theme.isProjectTheme());
@@ -159,6 +162,11 @@ public class RenderUtil {
missingRClassMessage = e.getMessage();
missingRClass = true;
}
catch (IncompatibleClassFileFormatException e) {
LOG.debug(e);
missingRClassMessage = "Incompatible R.class file format";
missingRClass = true;
}
final RenderResources resolver =
factory.createResourceResolver(facet, config, projectResources, theme.getName(), theme.isProjectTheme());