List of usage examples for com.google.gwt.dev.util Name isInternalName
public static boolean isInternalName(String name)
From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java
License:Apache License
/** * Load the classfile for the given binary name and apply the provided * visitor./*from w w w . j a va2 s . com*/ * * @return <code>true</code> if the visitor was successfully visited */ private boolean visit(ErrorContext logger, String internalName, ClassVisitor visitor) { assert Name.isInternalName(internalName) : "internalName"; logger.spam("Visiting " + internalName); InputStream inputStream = null; try { inputStream = loader.getResourceAsStream(internalName + ".class"); if (inputStream == null) { logger.poison("Could not find class file for " + internalName); return false; } ClassReader reader = new ClassReader(inputStream); reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); return true; } catch (IOException e) { logger.poison("Unable to open " + internalName, e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException ignored) { } } } return false; }
From source file:com.google.web.bindery.requestfactory.server.RequestFactoryJarExtractor.java
License:Apache License
/** * Load the classfile for the given binary name and apply the provided * visitor./*from w ww .j av a 2s . c o m*/ * * @return <code>true</code> if the visitor was successfully visited */ private static boolean visit(ErrorContext logger, Loader loader, String internalName, ClassVisitor visitor) { assert Name.isInternalName(internalName) : "internalName"; logger.spam("Visiting " + internalName); InputStream inputStream = null; try { inputStream = loader.getResourceAsStream(internalName + ".class"); if (inputStream == null) { System.err.println("Could not find class file for " + internalName); logger.poison("Could not find class file for " + internalName); return false; } ClassReader reader = new ClassReader(inputStream); reader.accept(visitor, 0); return true; } catch (IOException e) { logger.poison("Unable to open " + internalName, e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException ignored) { } } } return false; }