private static boolean replaceEnsureClassInitialized(ImplWriter w, MethodInvocation node) { if (!node.getName().getIdentifier().equals("ensureClassInitialized")) { return false; } if (node.arguments().size() != 1 || !(node.arguments().get(0) instanceof TypeLiteral)) { return false; } IMethodBinding mb = node.resolveMethodBinding(); if (!mb.getDeclaringClass().getQualifiedName().equals("sun.misc.Unsafe")) { return false; } TypeLiteral tl = (TypeLiteral) node.arguments().get(0); ITypeBinding tb = tl.getType().resolveBinding(); w.hardDep(tb); w.print(CName.relative(tb, w.type, true) + "::clinit()"); return true; }
public Expression newClassExpr(Type type) { TypeLiteral typeLit = ast.newTypeLiteral(); typeLit.setType(type); return typeLit; }
/* * @see ASTVisitor#visit(TypeLiteral) */ public boolean visit(TypeLiteral node) { node.getType().accept(this); this.fBuffer.append(".class"); // $NON-NLS-1$ return false; }
/* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeLiteral) */ public boolean visit(TypeLiteral node) { PTTypeLiteral ptl = InstantiationFactory.eINSTANCE.createPTTypeLiteral(); ptl.setType(resolver.resolveType(node.getType())); expression = ptl; return false; }
public void endVisit(TypeLiteral node) { expressions.pop(); expressions.push(new VMTypeLiteral(node, node.getType())); }