public class ExtensionTransformer
extends com.sun.tools.javac.tree.TreeTranslator
| Modifier and Type | Method and Description |
|---|---|
static Object |
assignStructuralIdentity(Object obj,
Class iface) |
static Object |
constructProxy(Object root,
Class iface) |
TypeProcessor |
getTypeProcessor() |
static Object |
invokeUnhandled(Object thiz,
Class proxiedIface,
String name,
Class returnType,
Class[] paramTypes,
Object[] args)
Facilitates ICallHandler where the receiver of the method call structurally implements a method,
but the association of the structural interface with the receiver is lost.
|
void |
visitApply(com.sun.tools.javac.tree.JCTree.JCMethodInvocation tree)
Replace all extension method call-sites with static calls to extension methods
|
void |
visitClassDef(com.sun.tools.javac.tree.JCTree.JCClassDecl tree) |
void |
visitIdent(com.sun.tools.javac.tree.JCTree.JCIdent tree)
Erase all structural interface type literals to Object
|
void |
visitLambda(com.sun.tools.javac.tree.JCTree.JCLambda tree) |
void |
visitMethodDef(com.sun.tools.javac.tree.JCTree.JCMethodDecl tree)
Issue errors/warnings if an extension method violates extension method grammar or conflicts with an existing method
|
void |
visitSelect(com.sun.tools.javac.tree.JCTree.JCFieldAccess tree)
Erase all structural interface type literals to Object
|
void |
visitTypeCast(com.sun.tools.javac.tree.JCTree.JCTypeCast tree) |
translate, translate, translateAnnotations, translateCases, translateCatchers, translateTypeParams, translateVarDefs, visitAnnotatedType, visitAnnotation, visitAssert, visitAssign, visitAssignop, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitConditional, visitContinue, visitDoLoop, visitErroneous, visitExec, visitForeachLoop, visitForLoop, visitIf, visitImport, visitIndexed, visitLabelled, visitLetExpr, visitLiteral, visitModifiers, visitNewArray, visitNewClass, visitParens, visitReference, visitReturn, visitSkip, visitSwitch, visitSynchronized, visitThrow, visitTopLevel, visitTree, visitTry, visitTypeApply, visitTypeArray, visitTypeBoundKind, visitTypeIdent, visitTypeIntersection, visitTypeParameter, visitTypeTest, visitTypeUnion, visitUnary, visitVarDef, visitWhileLoop, visitWildcardpublic TypeProcessor getTypeProcessor()
public void visitIdent(com.sun.tools.javac.tree.JCTree.JCIdent tree)
visitIdent in class com.sun.tools.javac.tree.TreeTranslatorpublic void visitLambda(com.sun.tools.javac.tree.JCTree.JCLambda tree)
visitLambda in class com.sun.tools.javac.tree.TreeTranslatorpublic void visitSelect(com.sun.tools.javac.tree.JCTree.JCFieldAccess tree)
visitSelect in class com.sun.tools.javac.tree.TreeTranslatorpublic void visitTypeCast(com.sun.tools.javac.tree.JCTree.JCTypeCast tree)
visitTypeCast in class com.sun.tools.javac.tree.TreeTranslatorpublic void visitApply(com.sun.tools.javac.tree.JCTree.JCMethodInvocation tree)
visitApply in class com.sun.tools.javac.tree.TreeTranslatorpublic void visitClassDef(com.sun.tools.javac.tree.JCTree.JCClassDecl tree)
visitClassDef in class com.sun.tools.javac.tree.TreeTranslatorpublic void visitMethodDef(com.sun.tools.javac.tree.JCTree.JCMethodDecl tree)
visitMethodDef in class com.sun.tools.javac.tree.TreeTranslatorpublic static Object invokeUnhandled(Object thiz, Class proxiedIface, String name, Class returnType, Class[] paramTypes, Object[] args)
Person person = Person.create(); // Person is a JsonTypeManifold interface; the runtime type of person here is really just a Map (or Binding) IMyStructureThing thing = (IMyStructureThing)person; // Extension method[s] satisfying IMyStructureThing on Person make this work e.g., via MyPerosnExt extension methods class thing.foo(); // foo() is an extension method on Person e.g., defined in MyPersonExt, however the runtime type of thing is just a Map (or Binding) thus the Person type identity is lost
Copyright © 2018. All rights reserved.