@Override public boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope scope) { CtInvocation<Object> inv = factory.Core().createInvocation(); inv.setImplicit(explicitConstructor.isImplicitSuper()); inv.setExecutable(references.getExecutableReference(explicitConstructor.binding)); CtTypeReference<?> declaringType = inv.getExecutable().getDeclaringType(); inv.getExecutable().setType(declaringType == null ? null : (CtTypeReference<Object>) declaringType.clone()); context.enter(inv, explicitConstructor); return true; }
public static ExplicitConstructorCall implicitSuperConstructorCall() { return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper); }
private void visitIfNeeded(AbstractMethodDeclaration method) { if (this.localDeclarationVisitor != null && (method.bits & ASTNode.HasLocalType) != 0) { if (method instanceof ConstructorDeclaration) { ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) method; if (constructorDeclaration.constructorCall != null) { constructorDeclaration.constructorCall.traverse(this.localDeclarationVisitor, method.scope); } } if (method.statements != null) { int statementsLength = method.statements.length; for (int i = 0; i < statementsLength; i++) method.statements[i].traverse(this.localDeclarationVisitor, method.scope); } } }
analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments); currentScope); manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo); manageSyntheticAccessIfNecessary(currentScope, flowInfo); return flowInfo; } finally {
return; this.binding = findConstructorBinding(scope, this, receiverType, argumentTypes); if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) { scope.problemReporter().deprecatedMethod(this.binding, this); if (checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked;
@Override public void visitExplicitConstructorCall(ExplicitConstructorCall node) { if (node.isImplicitSuper()) { set(node, (Node)null); return; } if (node.isSuperAccess()) { lombok.ast.SuperConstructorInvocation sup = new lombok.ast.SuperConstructorInvocation(); fillList(node.arguments, sup.rawArguments()); fillList(node.typeArguments, sup.rawConstructorTypeArguments()); sup.astQualifier((lombok.ast.Expression) toTree(node.qualification)); setConversionPositionInfo(sup, "typeArguments", toPosition(node.typeArgumentsSourceStart, node.sourceEnd)); set(node, setPosition(node, sup)); return; } lombok.ast.AlternateConstructorInvocation inv = new lombok.ast.AlternateConstructorInvocation(); fillList(node.arguments, inv.rawArguments()); fillList(node.typeArguments, inv.rawConstructorTypeArguments()); setConversionPositionInfo(inv, "typeArguments", toPosition(node.typeArgumentsSourceStart, node.sourceEnd)); set(node, setPosition(node, inv)); }
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { // if constructor from parameterized type got found, use the original constructor at codegen time MethodBinding codegenBinding = this.binding.original(); // perform some emulation work in case there is some and we are inside a local type only if (this.binding.isPrivate() && this.accessMode != ExplicitConstructorCall.This) { ReferenceBinding declaringClass = codegenBinding.declaringClass; // from 1.4 on, local type constructor can lose their private flag to ease emulation if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) { // constructor will not be dumped as private, no emulation required thus codegenBinding.tagBits |= TagBits.ClearPrivateModifier; } else { this.syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(codegenBinding, isSuperAccess()); currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this); } } } }
if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) { scope.problemReporter().deprecatedMethod(this.binding, this); if (checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked;
generateArguments(this.binding, this.arguments, currentScope, codeStream);
this.constructorCall.generateCode(this.scope, codeStream);
flowInfo = this.constructorCall.analyseCode(this.scope, constructorContext, flowInfo);
currentScope); manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo); manageSyntheticAccessIfNecessary(currentScope, flowInfo); return flowInfo; } finally {
public boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope scope) { CtInvocation<Object> inv = factory.Core().createInvocation(); if (explicitConstructor.isImplicitSuper()) { inv.setImplicit(true); inv.setType(inv.getExecutable().getType()); if (explicitConstructor.genericTypeArguments() != null) { inv.getExecutable().setActualTypeArguments(references.getBoundedTypesReferences(explicitConstructor.genericTypeArguments()));
analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments); currentScope); manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo); manageSyntheticAccessIfNecessary(currentScope, flowInfo); return flowInfo; } finally {
return; this.binding = findConstructorBinding(scope, this, receiverType, argumentTypes); if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) { scope.problemReporter().deprecatedMethod(this.binding, this); if (checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked;
@Override public void visitExplicitConstructorCall(ExplicitConstructorCall node) { if (node.isImplicitSuper()) { set(node, (Node)null); return; } if (node.isSuperAccess()) { lombok.ast.SuperConstructorInvocation sup = new lombok.ast.SuperConstructorInvocation(); fillList(node.arguments, sup.rawArguments()); fillList(node.typeArguments, sup.rawConstructorTypeArguments()); sup.astQualifier((lombok.ast.Expression) toTree(node.qualification)); setConversionPositionInfo(sup, "typeArguments", toPosition(node.typeArgumentsSourceStart, node.sourceEnd)); set(node, setPosition(node, sup)); return; } lombok.ast.AlternateConstructorInvocation inv = new lombok.ast.AlternateConstructorInvocation(); fillList(node.arguments, inv.rawArguments()); fillList(node.typeArguments, inv.rawConstructorTypeArguments()); setConversionPositionInfo(inv, "typeArguments", toPosition(node.typeArgumentsSourceStart, node.sourceEnd)); set(node, setPosition(node, inv)); }
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { // if constructor from parameterized type got found, use the original constructor at codegen time MethodBinding codegenBinding = this.binding.original(); // perform some emulation work in case there is some and we are inside a local type only if (this.binding.isPrivate() && this.accessMode != ExplicitConstructorCall.This) { ReferenceBinding declaringClass = codegenBinding.declaringClass; // from 1.4 on, local type constructor can lose their private flag to ease emulation if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) { // constructor will not be dumped as private, no emulation required thus codegenBinding.tagBits |= TagBits.ClearPrivateModifier; } else { this.syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(codegenBinding, isSuperAccess()); currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this); } } } }
if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) { scope.problemReporter().deprecatedMethod(this.binding, this); if (checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked;
generateArguments(this.binding, this.arguments, currentScope, codeStream);
this.constructorCall.generateCode(this.scope, codeStream);