From 7bcc14f620e9bfc7f084cc8e009344e8634c2ee0 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Mon, 8 May 2017 12:34:18 -0700 Subject: [PATCH] Add guard for clone() clone is saying it is protected rather than public and so we need to add a guard to avoid creating accessor for it. --- .../internal/compiler/ast/AccessForInlineVisitor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java index 0755476e9..5bf9946da 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java @@ -23,6 +23,7 @@ import org.aspectj.ajdt.internal.compiler.lookup.InterTypeFieldBinding; import org.aspectj.ajdt.internal.compiler.lookup.InterTypeMethodBinding; import org.aspectj.ajdt.internal.compiler.lookup.PrivilegedFieldBinding; import org.aspectj.ajdt.internal.compiler.lookup.PrivilegedHandler; +import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation; import org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AssertStatement; @@ -44,6 +45,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBin import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.VariableBinding; import org.aspectj.weaver.AjcMemberMaker; import org.aspectj.weaver.ResolvedMember; @@ -123,11 +125,16 @@ public class AccessForInlineVisitor extends ASTVisitor { // send.arguments = AstUtil.insert(new ThisReference(send.sourceStart, send.sourceEnd), send.arguments); MethodBinding superAccessBinding = getSuperAccessMethod(send.binding); AstUtil.replaceMethodBinding(send, superAccessBinding); - } else if (!isPublic(send.binding)) { + } else if (!isPublic(send.binding) && !isCloneMethod(send.binding)) { send.syntheticAccessor = getAccessibleMethod(send.binding, send.actualReceiverType); } } + + private boolean isCloneMethod(MethodBinding binding) { + return (CharOperation.equals(binding.selector, TypeConstants.CLONE)) && + (CharOperation.equals(binding.declaringClass.compoundName, TypeConstants.JAVA_LANG_OBJECT)); + } public void endVisit(AllocationExpression send, BlockScope scope) { if (send.binding == null || !send.binding.isValidBinding()) -- 2.39.5