< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
Print this page
owner::setTypeAttributes,
sym::setTypeAttributes);
boolean init;
! if ((init = (owner.name == names.init)) || owner.name == names.clinit) {
owner = owner.owner;
apportionTypeAnnotations(tree,
init ? owner::getInitTypeAttributes : owner::getClassInitTypeAttributes,
init ? owner::setInitTypeAttributes : owner::setClassInitTypeAttributes,
sym::appendUniqueTypeAttributes);
owner::setTypeAttributes,
sym::setTypeAttributes);
boolean init;
! // TODO - can <vnew> exist in this context?
+ if ((init = names.isInitOrVNew(owner.name)) || owner.name == names.clinit) {
owner = owner.owner;
apportionTypeAnnotations(tree,
init ? owner::getInitTypeAttributes : owner::getClassInitTypeAttributes,
init ? owner::setInitTypeAttributes : owner::setClassInitTypeAttributes,
sym::appendUniqueTypeAttributes);
}
//create the method declaration hoisting the lambda body
JCMethodDecl lambdaDecl = make.MethodDef(make.Modifiers(sym.flags_field),
sym.name,
! make.QualIdent(lambdaType.getReturnType().tsym),
List.nil(),
localContext.syntheticParams,
lambdaType.getThrownTypes() == null ?
List.nil() :
make.Types(lambdaType.getThrownTypes()),
}
//create the method declaration hoisting the lambda body
JCMethodDecl lambdaDecl = make.MethodDef(make.Modifiers(sym.flags_field),
sym.name,
! make.QualIdent(lambdaType.getReturnType().tsym).setType(lambdaType.getReturnType()),
List.nil(),
localContext.syntheticParams,
lambdaType.getThrownTypes() == null ?
List.nil() :
make.Types(lambdaType.getThrownTypes()),
clinits.put(csym, clinit);
}
return clinit;
} else {
//get the first constructor and treat it as the instance init sym
! for (Symbol s : csym.members_field.getSymbolsByName(names.init)) {
return s;
}
}
Assert.error("init not found");
return null;
clinits.put(csym, clinit);
}
return clinit;
} else {
//get the first constructor and treat it as the instance init sym
! Name constructorName = csym.isConcreteValueClass() ? names.vnew : names.init;
+ for (Symbol s : csym.members_field.getSymbolsByName(constructorName)) {
return s;
}
}
Assert.error("init not found");
return null;
* when translating away lambda expressions
*/
private boolean lambdaIdentSymbolFilter(Symbol sym) {
return (sym.kind == VAR || sym.kind == MTH)
&& !sym.isStatic()
! && sym.name != names.init;
}
/**
* This is used to filter out those select nodes that need to be adjusted
* when translating away lambda expressions - at the moment, this is the
* when translating away lambda expressions
*/
private boolean lambdaIdentSymbolFilter(Symbol sym) {
return (sym.kind == VAR || sym.kind == MTH)
&& !sym.isStatic()
! && !names.isInitOrVNew(sym.name);
}
/**
* This is used to filter out those select nodes that need to be adjusted
* when translating away lambda expressions - at the moment, this is the
/** does this functional expression require serialization support? */
boolean isSerializable() {
if (forceSerializable) {
return true;
}
! return types.asSuper(tree.target, syms.serializableType.tsym) != null;
}
/**
* @return Name of the enclosing method to be folded into synthetic
* method name
/** does this functional expression require serialization support? */
boolean isSerializable() {
if (forceSerializable) {
return true;
}
! return types.asSuper(tree.target.referenceProjectionOrSelf(), syms.serializableType.tsym) != null;
}
/**
* @return Name of the enclosing method to be folded into synthetic
* method name
String methodName = name.toString();
if (methodName.equals("<clinit>")) {
methodName = "static";
} else if (methodName.equals("<init>")) {
methodName = "new";
+ } else if (methodName.equals("<vnew>")) {
+ methodName = "vnew";
}
return methodName;
}
}
(!nestmateLambdas && isPrivateInOtherClass()) ||
isProtectedInSuperClassOfEnclosingClassInOtherPackage(tree.sym, owner) ||
!receiverAccessible() ||
(tree.getMode() == ReferenceMode.NEW &&
tree.kind != ReferenceKind.ARRAY_CTOR &&
! (tree.sym.owner.isDirectlyOrIndirectlyLocal() || tree.sym.owner.isInner()));
}
Type generatedRefSig() {
return types.erasure(tree.sym.type);
}
(!nestmateLambdas && isPrivateInOtherClass()) ||
isProtectedInSuperClassOfEnclosingClassInOtherPackage(tree.sym, owner) ||
!receiverAccessible() ||
(tree.getMode() == ReferenceMode.NEW &&
tree.kind != ReferenceKind.ARRAY_CTOR &&
! (tree.sym.owner.isDirectlyOrIndirectlyLocal() || tree.sym.owner.isInner() || tree.sym.owner.isValueClass()));
}
Type generatedRefSig() {
return types.erasure(tree.sym.type);
}
< prev index next >