/** * TODO(scottb): move to UnifyAst and only for non-abstract classes. */ private void implementGetClass(JDeclaredType type) { JMethod method = type.getMethods().get(2); assert ("getClass".equals(method.getName())); SourceInfo info = method.getSourceInfo(); if ("com.google.gwt.lang.Array".equals(type.getName())) { /* * Don't implement, fall through to Object.getClass(). Array emulation code * in com.google.gwt.lang.Array invokes Array.getClass() and expects to get the * class literal for the actual runtime type of the array (e.g. Foo[].class) and * not Array.class. */ type.getMethods().remove(2); } else { implementMethod(method, new JClassLiteral(info, type)); } }
@Override public void endVisit(ClassLiteralAccess x, BlockScope scope) { try { SourceInfo info = makeSourceInfo(x); JType type = typeMap.get(x.targetType); push(new JClassLiteral(info, type)); } catch (Throwable e) { throw translateException(x, e); } }
arg = new JClassLiteral(type.getSourceInfo(), type);
classLiteral = new JClassLiteral(info.makeChild(), cur); final List<JExpression> dims = Lists.addAll(sizedDims, emptyDims); final JNewArray newArr = new JNewArray(info, (JArrayType)type, dims, null, classLiteral); return new JMethodCall(info, null, registerArray, newArr, new JClassLiteral(info.makeChild(), type));
cur = ((JArrayType) cur).getElementType(); classLit = new JClassLiteral(info.makeChild(), cur); return new JMethodCall(info, null, registerArray, newArr, new JClassLiteral(info.makeChild(), arrayType));
while (cur instanceof JArrayType) { JClassLiteral classLit = new JClassLiteral(info.makeChild(), cur); classLiterals = Lists.add(classLiterals, classLit); cur = ((JArrayType) cur).getElementType();
call.addArg(new JClassLiteral(methodSource.makeChild(SourceOrigin.UNKNOWN), asType)); JExpression invoke = MagicClassInjector.injectMagicClass(logger, call, magicClass, context, ast); if (invoke != null)
call.addArg(new JClassLiteral(methodSource .makeChild(SourceOrigin.UNKNOWN), asType)); final JExpression invoke = MagicClassInjector.injectMagicClass(logger,
cur = arrayType; while (cur instanceof JArrayType) { JClassLiteral classLit = new JClassLiteral(info.makeChild(), cur); classLits = Lists.add(classLits, classLit); cur = ((JArrayType) cur).getElementType();