private String getType (JType type) { if (!isVisible(type)) return null; return type.getErasedType().getQualifiedSourceName() + ".class"; }
private String getType (JType type) { if (!isVisible(type)) return null; return type.getErasedType().getQualifiedSourceName() + ".class"; }
private void newArrayC () { p("public Object newArray (Type t, int size) {"); p(" if (t != null) {"); SwitchedCodeBlock pc = new SwitchedCodeBlock("t.id"); for (JType type : types) { if (type.getQualifiedSourceName().equals("void")) continue; if (type.getQualifiedSourceName().endsWith("Void")) continue; String arrayType = type.getErasedType().getQualifiedSourceName() + "[size]"; if (arrayType.contains("[]")) { arrayType = type.getErasedType().getQualifiedSourceName(); arrayType = arrayType.replaceFirst("\\[\\]", "[size]") + "[]"; } pc.add(typeNames2typeIds.get(type.getQualifiedSourceName()), "return new " + arrayType + ";"); } pc.print(); p(" }"); p(" throw new RuntimeException(\"Couldn't create array\");"); p("}"); }
private void newArrayC () { p("public Object newArray (Type t, int size) {"); p(" if (t != null) {"); SwitchedCodeBlock pc = new SwitchedCodeBlock("t.id"); for (JType type : types) { if (type.getQualifiedSourceName().equals("void")) continue; if (type.getQualifiedSourceName().endsWith("Void")) continue; String arrayType = type.getErasedType().getQualifiedSourceName() + "[size]"; if (arrayType.contains("[]")) { arrayType = type.getErasedType().getQualifiedSourceName(); arrayType = arrayType.replaceFirst("\\[\\]", "[size]") + "[]"; } pc.add(typeNames2typeIds.get(type.getQualifiedSourceName()), "return new " + arrayType + ";"); } pc.print(); p(" }"); p(" throw new RuntimeException(\"Couldn't create array\");"); p("}"); }
if (types.contains(type.getErasedType())) { nesting--; return; types.add(type.getErasedType()); out(type.getErasedType().getQualifiedSourceName(), nesting); if (fields != null) { for (JField field : fields) { gatherTypes(field.getType().getErasedType(), types); if (methods != null) { for (JMethod m : methods) { gatherTypes(m.getReturnType().getErasedType(), types); if (m.getParameterTypes() != null) { for (JType p : m.getParameterTypes()) { gatherTypes(p.getErasedType(), types);
if (types.contains(type.getErasedType())) { nesting--; return; types.add(type.getErasedType()); out(type.getErasedType().getQualifiedSourceName(), nesting); if (fields != null) { for (JField field : fields) { gatherTypes(field.getType().getErasedType(), types); if (methods != null) { for (JMethod m : methods) { gatherTypes(m.getReturnType().getErasedType(), types); if (m.getParameterTypes() != null) { for (JType p : m.getParameterTypes()) { gatherTypes(p.getErasedType(), types);
for (JParameter p : m.getParameters()) { stub.parameterTypes.add(getType(p.getType())); stub.jnsi += p.getType().getErasedType().getJNISignature(); String paramName = (p.getName() + "__" + p.getType().getErasedType().getJNISignature()).replaceAll( "[/;\\[\\]]", "_"); String paramInstantiation = "new Parameter(\"" + p.getName() + "\", " + getType(p.getType()) + ", \""
for (JParameter p : m.getParameters()) { stub.parameterTypes.add(getType(p.getType())); stub.jnsi += p.getType().getErasedType().getJNISignature(); String paramName = (p.getName() + "__" + p.getType().getErasedType().getJNISignature()).replaceAll( "[/;\\[\\]]", "_"); String paramInstantiation = "new Parameter(\"" + p.getName() + "\", " + getType(p.getType()) + ", \""
private String createTypeGenerator (JType t) { sb.setLength(0); int id = nextTypeId++; typeNames2typeIds.put(t.getErasedType().getQualifiedSourceName(), id); JClassType c = t.isClass(); String name = t.getErasedType().getQualifiedSourceName(); String superClass = null; if (c != null && (isVisible(c.getSuperclass()))) boolean used = false; for (JType i : c.getFlattenedSupertypeHierarchy()) { if (!isVisible(i) || i.equals(t) || "java.lang.Object".equals(i.getErasedType().getQualifiedSourceName())) continue; if (used) assignables += ", "; assignables += i.getErasedType().getQualifiedSourceName() + ".class"; used = true; if (!isVisible(i) || i.equals(t)) continue; if (used) interfaces += ", "; interfaces += i.getErasedType().getQualifiedSourceName() + ".class"; used = true;
private String createTypeGenerator (JType t) { sb.setLength(0); int id = nextTypeId++; typeNames2typeIds.put(t.getErasedType().getQualifiedSourceName(), id); JClassType c = t.isClass(); String name = t.getErasedType().getQualifiedSourceName(); String superClass = null; if (c != null && (isVisible(c.getSuperclass()))) boolean used = false; for (JType i : c.getFlattenedSupertypeHierarchy()) { if (!isVisible(i) || i.equals(t) || "java.lang.Object".equals(i.getErasedType().getQualifiedSourceName())) continue; if (used) assignables += ", "; assignables += i.getErasedType().getQualifiedSourceName() + ".class"; used = true; if (!isVisible(i) || i.equals(t)) continue; if (used) interfaces += ", "; interfaces += i.getErasedType().getQualifiedSourceName() + ".class"; used = true;
/** * Registers a method creator. * * @param returnType return type that this creator handles. * @param creator creator to register */ public void register(JType returnType, AbstractMethodCreator creator) { // TODO: Hacked to get the gwt-trunk for 1.5 building. methodFactories.put(returnType.getErasedType(), creator); }
private static String verboseParams(com.google.gwt.core.ext.typeinfo.JParameter[] params) { StringBuilder b = new StringBuilder(); for (com.google.gwt.core.ext.typeinfo.JParameter param : params) { String name = param.getType().getErasedType().getSimpleSourceName(); name = name.replaceAll("\\[\\]", ""); b.append(name).append('_'); } return b.toString(); }
private static String simplify(final com.google.gwt.core.ext.typeinfo.JParameter[] params) { final StringBuilder b = new StringBuilder(); for (final com.google.gwt.core.ext.typeinfo.JParameter param : params) { b.append(param.getType().getErasedType().getQualifiedSourceName().charAt(0)); } return b.toString(); }
private static String computeInternalSignature(JMethod method) { StringBuffer sb = new StringBuffer(); sb.setLength(0); sb.append(method.getName()); JParameter[] params = method.getParameters(); for (JParameter param : params) { sb.append("/"); JType paramType = param.getType(); sb.append(paramType.getErasedType().getQualifiedSourceName()); } return sb.toString(); }
private static String computeInternalSignature(JMethod method) { StringBuffer sb = new StringBuffer(); sb.setLength(0); sb.append(method.getName()); JParameter[] params = method.getParameters(); for (JParameter param : params) { sb.append("/"); JType paramType = param.getType(); sb.append(paramType.getErasedType().getQualifiedSourceName()); } return sb.toString(); }
/** * Given a JType, return the binary name of the class that is most proximately * assignable to the type. This method will resolve type parameters as well as * wildcard types. */ public static String getQualifiedBaseBinaryName(JType type) { return ensureBaseType(type).getErasedType().getQualifiedBinaryName(); }
/** * Given a JType, return the source name of the class that is most proximately * assignable to the type. This method will resolve type parameters as well as * wildcard types. */ public static String getQualifiedBaseSourceName(JType type) { return ensureBaseType(type).getErasedType().getQualifiedSourceName(); }
/** * Given a JType, return the binary name of the class that is most proximately * assignable to the type. This method will resolve type parameters as well as * wildcard types. */ public static String getQualifiedBaseBinaryName(JType type) { return ensureBaseType(type).getErasedType().getQualifiedBinaryName(); }
@Override public MetaClass getErased() { if (getParameterizedType() == null) { return this; } else { return new GWTClass(oracle, getEnclosedMetaObject().getErasedType(), true); } }
protected <T extends JType> void appendClassArray(final MethodBuffer out, final T[] types, final ReflectionGeneratorContext ctx) { int i = types.length; final String[] names = new String[i]; for (; i-- > 0;) { names[i] = types[i].getErasedType().getQualifiedSourceName(); } final ConstPoolGenerator constPool = ctx.getConstPool(); constPool.arrayOfClasses(ctx.getLogger(), out, names); }