From a5c0fc936fbbe65f31339395aa8e369ffda7b136 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Fri, 24 Aug 2018 17:49:44 -0700 Subject: [PATCH] 537825: Remove FINAL for cflow related class elements for Java 9+ --- .../org/aspectj/weaver/AjcMemberMaker.java | 5 +-- .../weaver/patterns/CflowPointcut.java | 11 ++---- .../org/aspectj/weaver/patterns/PerCflow.java | 2 +- .../systemtest/ajc192/Ajc192Tests.java | 12 ++++++ .../org/aspectj/systemtest/ajc192/ajc192.xml | 37 +++++++++++++++++++ .../org/aspectj/systemtest/apt/AptTests.java | 8 ++-- 6 files changed, 59 insertions(+), 16 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/AjcMemberMaker.java b/org.aspectj.matcher/src/org/aspectj/weaver/AjcMemberMaker.java index 1870eb501..b8e3043c5 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/AjcMemberMaker.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/AjcMemberMaker.java @@ -9,13 +9,10 @@ * Contributors: * PARC initial implementation * ******************************************************************/ - package org.aspectj.weaver; import java.lang.reflect.Modifier; -//import org.aspectj.weaver.ResolvedType.Name; - /** * The AjcMemberMaker is responsible for creating the representations of methods/fields/etc that are placed in both aspects and * affected target types. It uses the NameMangler class to create the actual names that will be used. @@ -69,7 +66,7 @@ public class AjcMemberMaker { } public static ResolvedMember perCflowField(UnresolvedType declaringType) { - return new ResolvedMemberImpl(Member.FIELD, declaringType, PUBLIC_STATIC_FINAL, NameMangler.PERCFLOW_FIELD_NAME, + return new ResolvedMemberImpl(Member.FIELD, declaringType, PUBLIC_STATIC, NameMangler.PERCFLOW_FIELD_NAME, CFLOW_STACK_TYPE.getSignature()); } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java index ed66dc0d5..a83236e5c 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java @@ -64,9 +64,6 @@ public class CflowPointcut extends Pointcut { pointcutKind = CFLOW; } - /** - * @return Returns true is this is a cflowbelow pointcut - */ public boolean isCflowBelow() { return isBelow; } @@ -230,8 +227,8 @@ public class CflowPointcut extends Pointcut { } else { // Create a counter field in the aspect - localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC - | Modifier.FINAL, NameMangler.cflowCounter(xcut), UnresolvedType.forName(NameMangler.CFLOW_COUNTER_TYPE) + localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC, + NameMangler.cflowCounter(xcut), UnresolvedType.forName(NameMangler.CFLOW_COUNTER_TYPE) .getSignature()); // Create type munger to add field to the aspect @@ -294,8 +291,8 @@ public class CflowPointcut extends Pointcut { localCflowField = (ResolvedMember) field; } else { - localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC - | Modifier.FINAL, NameMangler.cflowStack(xcut), UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE) + localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC, + NameMangler.cflowStack(xcut), UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE) .getSignature()); // System.out.println("adding field to: " + inAspect + " field " // + cflowField); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java index 901c494a6..1ad834e06 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java @@ -88,7 +88,7 @@ public class PerCflow extends PerClause { return ret; } - Member cflowStackField = new ResolvedMemberImpl(Member.FIELD, inAspect, Modifier.STATIC | Modifier.PUBLIC | Modifier.FINAL, + Member cflowStackField = new ResolvedMemberImpl(Member.FIELD, inAspect, Modifier.PUBLIC | Modifier.STATIC, UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE), NameMangler.PERCFLOW_FIELD_NAME, UnresolvedType.NONE); World world = inAspect.getWorld(); diff --git a/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java b/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java index 989d74b2d..0629294db 100644 --- a/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java @@ -21,6 +21,18 @@ import junit.framework.Test; */ public class Ajc192Tests extends XMLBasedAjcTestCase { + public void testCflowFinal() { + runTest("no final on cflow elements"); + } + + public void testAroundAdvice_AnnoStyle() { + runTest("around advice"); + } + + public void testAroundAdvice_CodeStyle() { + runTest("around advice - 2"); + } + public void testPTW_nonPrivileged() { runTest("ptw"); } diff --git a/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml b/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml index 13e0ae9c1..5eb7fcbbb 100644 --- a/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml +++ b/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml @@ -2,6 +2,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/src/org/aspectj/systemtest/apt/AptTests.java b/tests/src/org/aspectj/systemtest/apt/AptTests.java index bf9c53916..14de6b12f 100644 --- a/tests/src/org/aspectj/systemtest/apt/AptTests.java +++ b/tests/src/org/aspectj/systemtest/apt/AptTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Contributors + * Copyright (c) 2014,2018 Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,12 +10,12 @@ *******************************************************************************/ package org.aspectj.systemtest.apt; -import junit.framework.Test; -import org.aspectj.apache.bcel.classfile.Method; +import java.io.File; + import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.util.LangUtil; -import java.io.File; +import junit.framework.Test; /** * Annotation processing tool tests. -- 2.39.5