From 282c5d2d07b013963a94bc94ad3c7331147610b6 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Thu, 28 Nov 2019 10:34:51 -0800 Subject: [PATCH] polish --- .../main/java/org/aspectj/weaver/World.java | 59 +++++++++---------- .../systemtest/ajc193/AllTestsAspectJ193.java | 2 +- .../{Java12Tests.java => Java13Tests.java} | 6 +- 3 files changed, 32 insertions(+), 35 deletions(-) rename tests/src/test/java/org/aspectj/systemtest/ajc193/{Java12Tests.java => Java13Tests.java} (86%) diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java index 644f232ac..af8525315 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java @@ -1,15 +1,15 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). * 2005 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: * PARC initial implementation - * Adrian Colyer, Andy Clement, overhaul for generics, Abraham Nevado + * Adrian Colyer, Andy Clement, overhaul for generics, Abraham Nevado * ******************************************************************/ package org.aspectj.weaver; @@ -55,7 +55,7 @@ import org.aspectj.weaver.tools.TraceFactory; * A World is a collection of known types and crosscutting members. */ public abstract class World implements Dump.INode { - + /** handler for any messages produced during resolution etc. */ private IMessageHandler messageHandler = IMessageHandler.SYSTEM_ERR; @@ -112,10 +112,10 @@ public abstract class World implements Dump.INode { /** The level of the aspectjrt.jar the code we generate needs to run on */ public static final RuntimeVersion RUNTIME_LEVEL_DEFAULT = RuntimeVersion.V1_5; private RuntimeVersion targetAspectjRuntimeLevel = RUNTIME_LEVEL_DEFAULT; - + /** Flags for the new joinpoints that are 'optional': -Xjoinpoints:arrayconstruction -Xjoinpoints:synchronization */ - private boolean optionalJoinpoint_ArrayConstruction = false; - private boolean optionalJoinpoint_Synchronization = false; + private boolean optionalJoinpoint_ArrayConstruction = false; + private boolean optionalJoinpoint_Synchronization = false; private boolean addSerialVerUID = false; @@ -407,7 +407,7 @@ public abstract class World implements Dump.INode { /** * When the world is operating in 1.5 mode, the TypeMap should only contain RAW types and never directly generic types. The RAW * type will contain a reference to the generic type. - * + * * @param type a possibly generic type for which the raw needs creating as it is not currently in the world * @return a type suitable for putting into the world */ @@ -862,7 +862,7 @@ public abstract class World implements Dump.INode { /** * Set the error and warning threashold which can be taken from CompilerOptions (see bug 129282) - * + * * @param errorThreshold * @param warningThreshold */ @@ -968,7 +968,7 @@ public abstract class World implements Dump.INode { public final static String xsetITD_VERSION_DEFAULT = xsetITD_VERSION_2NDGEN; public final static String xsetMINIMAL_MODEL = "minimalModel"; public final static String xsetTARGETING_RUNTIME_1610 = "targetRuntime1_6_10"; - + // This option allows you to prevent AspectJ adding local variable tables - some tools (e.g. dex) may // not like what gets created because even though it is valid, the bytecode they are processing has // unexpected quirks that mean the table entries are violated in the code. See issue: @@ -1065,8 +1065,7 @@ public abstract class World implements Dump.INode { addedSinceLastDemote = new ArrayList(); writtenClasses = new ArrayList(); this.w = w; - memoryProfiling = false;// !w.getMessageHandler().isIgnoring(Message. - // INFO); + memoryProfiling = false;// !w.getMessageHandler().isIgnoring(Message.INFO); } // For testing @@ -1088,7 +1087,7 @@ public abstract class World implements Dump.INode { * expendable map where GC can claim them at some point later. Demotion means: the type is not an aspect, the type is not * java.lang.Object, the type is not primitive and the type is not affected by type mungers in any way. Further refinements * of these conditions may allow for more demotions. - * + * * @return number of types demoted */ public int demote(boolean atEndOfCompile) { @@ -1196,7 +1195,7 @@ public abstract class World implements Dump.INode { * cannot guarantee you are using the type variable in the same way as someone previously working with a similarly named * type variable. So, these do not go into the map: - TypeVariableReferenceType. - ParameterizedType where a member type * variable is involved. - BoundedReferenceType when one of the bounds is a type variable. - * + * * definition: "member type variables" - a tvar declared on a generic method/ctor as opposed to those you see declared on a * generic type. */ @@ -1218,8 +1217,7 @@ public abstract class World implements Dump.INode { } return type; } - // this test should be improved - only avoid putting them in if one - // of the + // this test should be improved - only avoid putting them in if one of the // bounds is a member type variable if (type instanceof BoundedReferenceType) { if (debug) { @@ -1243,12 +1241,11 @@ public abstract class World implements Dump.INode { } // TODO should this be in as a permanent assertion? - if ((type instanceof ReferenceType) && type.getWorld().isInJava5Mode() && (((ReferenceType) type).getDelegate() != null) && type.isGenericType()) { throw new BCException("Attempt to add generic type to typemap " + type.toString() + " (should be raw)"); } - + if (w.isExpendable(type)) { if (useExpendableMap) { @@ -1307,7 +1304,7 @@ public abstract class World implements Dump.INode { /** * Lookup a type by its signature, always look in the real map before the expendable map - */ + */ public ResolvedType get(String key) { checkq(); ResolvedType ret = tMap.get(key); @@ -1628,7 +1625,7 @@ public abstract class World implements Dump.INode { s = p.getProperty(xsetDEBUG_STRUCTURAL_CHANGES_CODE, "false"); forDEBUG_structuralChangesCode = s.equalsIgnoreCase("true"); - + s = p.getProperty(xsetTRANSIENT_TJP_FIELDS,"false"); transientTjpFields = s.equalsIgnoreCase("true"); @@ -1638,9 +1635,9 @@ public abstract class World implements Dump.INode { s = p.getProperty(xsetGENERATE_NEW_LVTS,"true"); generateNewLvts = s.equalsIgnoreCase("true"); if (!generateNewLvts) { - getMessageHandler().handleMessage(MessageUtil.info("[generateNewLvts=false] for methods without an incoming local variable table, do not generate one")); + getMessageHandler().handleMessage(MessageUtil.info("[generateNewLvts=false] for methods without an incoming local variable table, do not generate one")); } - + s = p.getProperty(xsetOPTIMIZED_MATCHING, "true"); optimizedMatching = s.equalsIgnoreCase("true"); if (!optimizedMatching) { @@ -1691,7 +1688,7 @@ public abstract class World implements Dump.INode { ensureAdvancedConfigurationProcessed(); return runMinimalMemory; } - + public boolean isTransientTjpFields() { ensureAdvancedConfigurationProcessed(); return transientTjpFields; @@ -1741,7 +1738,7 @@ public abstract class World implements Dump.INode { /** * Register a new pointcut designator handler with the world - this can be used by any pointcut parsers attached to the world. - * + * * @param designatorHandler handler for the new pointcut */ public void registerPointcutHandler(PointcutDesignatorHandler designatorHandler) { @@ -1783,7 +1780,7 @@ public abstract class World implements Dump.INode { /** * Determine if the named aspect requires a particular type around in order to be useful. The type is named in the aop.xml file * against the aspect. - * + * * @return true if there is a type missing that this aspect really needed around */ public boolean hasUnsatisfiedDependency(ResolvedType aspectType) { @@ -2012,7 +2009,7 @@ public abstract class World implements Dump.INode { /** * Returns the version of ITD that this world wants to create. The default is the new style (2) but in some cases where there * might be a clash, the old style can be used. It is set through the option -Xset:itdVersion=1 - * + * * @return the ITD version this world wants to create - 1=oldstyle 2=new, transparent style */ public int getItdVersion() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java index ddd88372d..f40e44805 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java @@ -18,7 +18,7 @@ public class AllTestsAspectJ193 { public static Test suite() { TestSuite suite = new TestSuite("AspectJ 1.9.3 tests"); suite.addTest(Ajc193Tests.suite()); - suite.addTest(Java12Tests.suite()); + suite.addTest(Java13Tests.suite()); return suite; } } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java similarity index 86% rename from tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java rename to tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java index 9a36d3daf..3b007963f 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java @@ -9,14 +9,14 @@ package org.aspectj.systemtest.ajc193; import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; -import org.aspectj.testing.XMLBasedAjcTestCaseForJava12OrLater; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava13OrLater; import junit.framework.Test; /** * @author Andy Clement */ -public class Java12Tests extends XMLBasedAjcTestCaseForJava12OrLater { +public class Java13Tests extends XMLBasedAjcTestCaseForJava13OrLater { public void testSwitch1() { runTest("switch 1"); @@ -35,7 +35,7 @@ public class Java12Tests extends XMLBasedAjcTestCaseForJava12OrLater { // --- public static Test suite() { - return XMLBasedAjcTestCase.loadSuite(Java12Tests.class); + return XMLBasedAjcTestCase.loadSuite(Java13Tests.class); } @Override -- 2.39.5