aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-11-25 10:40:44 -0800
committerAndy Clement <aclement@pivotal.io>2019-11-25 10:40:44 -0800
commit2704db20ecca12d3bbe514a4f7b84d297937de86 (patch)
tree2938cb6c560d2ea220272af703452ccd096702ca /org.aspectj.ajdt.core
parent41c7347b064093b531b04004d42665582ba0fff0 (diff)
downloadaspectj-2704db20ecca12d3bbe514a4f7b84d297937de86.tar.gz
aspectj-2704db20ecca12d3bbe514a4f7b84d297937de86.zip
Java 13 support
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/core/dom/AjASTFactory.java20
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java32
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java20
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java32
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java24
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java22
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java24
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java34
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjAST.java225
-rw-r--r--org.aspectj.ajdt.core/src/main/resources/org/aspectj/ajdt/ajc/messages.properties2
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java81
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java68
12 files changed, 303 insertions, 281 deletions
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/core/dom/AjASTFactory.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/core/dom/AjASTFactory.java
index 68084e7e4..5ee3cdbbf 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/core/dom/AjASTFactory.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/core/dom/AjASTFactory.java
@@ -1,23 +1,23 @@
/********************************************************************
- * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
+ * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
* Helen Hawkins - iniital version
*******************************************************************/
package org.aspectj.ajdt.core.dom;
import org.aspectj.org.eclipse.jdt.core.dom.AST;
-import org.aspectj.org.eclipse.jdt.core.dom.AjAST;
import org.aspectj.org.eclipse.jdt.core.dom.ASTParser.IASTFactory;
+import org.aspectj.org.eclipse.jdt.core.dom.AjAST;
public class AjASTFactory implements IASTFactory {
- public AST getAST(int level) {
- return AjAST.newAjAST(level);
+ public AST getAST(int level, boolean previewEnabled) {
+ return AjAST.newAjAST(level,previewEnabled);
}
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
index 8db8e6076..2d2dd999c 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * 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
+ * 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
* ******************************************************************/
package org.aspectj.ajdt.internal.compiler.ast;
@@ -50,7 +50,7 @@ import org.aspectj.weaver.UnresolvedType;
/**
* Represents before, after and around advice in an aspect. Will generate a method corresponding to the body of the advice with an
* attribute including additional information.
- *
+ *
* @author Jim Hugunin
*/
public class AdviceDeclaration extends AjMethodDeclaration {
@@ -61,7 +61,7 @@ public class AdviceDeclaration extends AjMethodDeclaration {
public AdviceKind kind; // set during parsing, referenced by Proceed and AsmElementFormatter
private int extraArgumentFlags = 0;
-
+
public int adviceSequenceNumberInType;
public MethodBinding proceedMethodBinding; // set during this.resolveStaments, referenced by Proceed
@@ -146,7 +146,7 @@ public class AdviceDeclaration extends AjMethodDeclaration {
declaredExceptions = new UnresolvedType[0];
for (int i = 0; i < n; i++) {
- Proceed call = (Proceed) proceedCalls.get(i);
+ Proceed call = proceedCalls.get(i);
if (call.inInner) {
// System.err.println("proceed in inner: " + call);
proceedInInners = true;
@@ -183,7 +183,13 @@ public class AdviceDeclaration extends AjMethodDeclaration {
// called by Proceed.resolveType
public int getDeclaredParameterCount() {
// this only works before code generation
- return this.arguments.length - 3 - ((extraArgument == null) ? 0 : 1);
+ if (this.arguments == null) {
+ // Indicates something seriously wrong and a separate error should show the real problem.
+ // (for example duplicate .aj file: https://bugs.eclipse.org/bugs/show_bug.cgi?id=549583)
+ return 0;
+ } else {
+ return this.arguments.length - 3 - ((extraArgument == null) ? 0 : 1);
+ }
// Advice.countOnes(extraArgumentFlags);
}
@@ -240,7 +246,7 @@ public class AdviceDeclaration extends AjMethodDeclaration {
}
AstUtil.generateReturn(returnType, codeStream);
codeStream.recordPositionsFrom(0, 1);
- classFile.completeCodeAttribute(codeAttributeOffset);
+ classFile.completeCodeAttribute(codeAttributeOffset,scope);
attributeNumber++;
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber);
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
index 31a1549ee..deea7f3f4 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
@@ -425,6 +425,8 @@ public class AspectDeclaration extends TypeDeclaration {
return l;
}
+ public static final char[] HAS_ASPECT = "hasAspect".toCharArray();
+
/*
* additionalAttributes allows us to pass some optional attributes we want to attach to the method we generate. Currently this
* is used for inline accessor methods that have been generated to allow private field references or private method calls to be
@@ -464,15 +466,23 @@ public class AspectDeclaration extends TypeDeclaration {
if (codeStream.pcToSourceMapSize == 0) {
codeStream.recordPositionsFrom(0, 1);
}
+ // Seems a dirty hack around some underlying issue...?
+ boolean b2 = CharOperation.equals(methodBinding.selector,HAS_ASPECT) &&
+ ((classFile.produceAttributes & ClassFileConstants.ATTR_STACK_MAP_TABLE) != 0 ? true : false);
+ if (b2) {
+ classFile.produceAttributes &= ~ClassFileConstants.ATTR_STACK_MAP_TABLE;
+ }
boolean b = ((codeStream.generateAttributes & ClassFileConstants.ATTR_VARS) != 0 ? true : false); // pr148693
if (codeStream.maxLocals == 0) {
codeStream.generateAttributes &= ~ClassFileConstants.ATTR_VARS;
}
- classFile.completeCodeAttribute(codeAttributeOffset);
+ classFile.completeCodeAttribute(codeAttributeOffset, md.scope);
if (b) {
codeStream.generateAttributes |= ClassFileConstants.ATTR_VARS;
}
-
+ if (b2) {
+ classFile.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
+ }
attributeNumber++;
classFile.completeMethodInfo(methodBinding, methodAttributeOffset, attributeNumber);
}
@@ -713,14 +723,16 @@ public class AspectDeclaration extends TypeDeclaration {
world.makeMethodBinding(AjcMemberMaker.perTypeWithinGetInstance(typeX)), null);
codeStream.ifnull(noInstanceExists);
codeStream.iconst_1();
- codeStream.goto_(leave);
+ codeStream.ireturn();
+ // codeStream.goto_(leave);
noInstanceExists.place();
codeStream.iconst_0();
leave.place();
goneBang.placeEnd();
codeStream.ireturn();
goneBang.place();
- codeStream.astore_1();
+ //codeStream.astore_1();
+ codeStream.pop();
codeStream.iconst_0();
codeStream.ireturn();
codeStream.locals[0].recordInitializationEndPC(codeStream.position);
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
index 3f8e99494..9b6d7ddcc 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * 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
+ * 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
* ******************************************************************/
package org.aspectj.ajdt.internal.compiler.ast;
@@ -53,10 +53,10 @@ import org.aspectj.weaver.UnresolvedType;
/**
* An inter-type field declaration.
- *
+ *
* returnType encodes the type of the field selector encodes the name statements is null until resolution when it is filled in from
* the initializer
- *
+ *
* @author Jim Hugunin
*/
public class InterTypeFieldDeclaration extends InterTypeDeclaration {
@@ -134,16 +134,16 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
* else if (initialization!=null) { MethodScope initializationScope = this.scope; TypeBinding fieldType = realFieldType;
* TypeBinding initializationType; this.initialization.setExpectedType(fieldType); // needed in case of generic method
* invocation if (this.initialization instanceof ArrayInitializer) {
- *
+ *
* if ((initializationType = this.initialization.resolveTypeExpecting(initializationScope, fieldType)) != null) {
* ((ArrayInitializer) this.initialization).binding = (ArrayBinding) initializationType;
* this.initialization.computeConversion(initializationScope, fieldType, initializationType); } } //
* System.err.println("i=>"+initialization); // System.err.println("sasuages=>"+initialization.resolvedType); //
* //initializationType = initialization.resolveType(initializationScope); //
* System.err.println("scope=>"+initializationScope);
- *
+ *
* else if ((initializationType = this.initialization.resolveType(initializationScope)) != null) {
- *
+ *
* if (fieldType != initializationType) // must call before computeConversion() and typeMismatchError()
* initializationScope.compilationUnitScope().recordTypeConversion(fieldType, initializationType); if
* (this.initialization.isConstantValueOfTypeAssignableToType(initializationType, fieldType) || (fieldType.isBaseType() &&
@@ -203,7 +203,7 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
/*
* public void resolveStatements() { super.resolveStatements();
- *
+ *
* // if (initialization!=null) { // MethodScope initializationScope = this.scope; // TypeBinding fieldType = realFieldType; //
* TypeBinding initializationType; // this.initialization.setExpectedType(fieldType); // needed in case of generic method
* invocation // if (this.initialization instanceof ArrayInitializer) { // // if ((initializationType =
@@ -230,7 +230,7 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
* (this.binding.isFinal()){ // cast from constant actual type to variable type // //
* this.binding.setConstant(this.initialization.constant.castTo((this.binding.returnType.id << 4) +
* this.initialization.constant.typeID())); // // } // // } else { // // this.binding.setConstant(NotAConstant); // }}
- *
+ *
* }
*/
public EclipseTypeMunger build(ClassScope classScope) {
@@ -378,7 +378,7 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
}
AstUtil.generateReturn(binding.returnType, codeStream);
- classFile.completeCodeAttribute(codeAttributeOffset);
+ classFile.completeCodeAttribute(codeAttributeOffset,scope);
attributeNumber++;
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber);
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
index fc0d42154..01e975a63 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * 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
+ * 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
* ******************************************************************/
package org.aspectj.ajdt.internal.compiler.ast;
@@ -52,12 +52,12 @@ import org.aspectj.weaver.UnresolvedType;
/**
* An inter-type method declaration.
- *
+ *
* @author Jim Hugunin
*/
public class InterTypeMethodDeclaration extends InterTypeDeclaration {
public InterTypeMethodDeclaration(CompilationResult result, TypeReference onType) {
- super(result, onType);
+ super(result, onType);
}
@Override
@@ -103,7 +103,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
if (!Modifier.isStatic(declaredModifiers)) {
this.arguments = AstUtil.insert(AstUtil.makeFinalArgument("ajc$this_".toCharArray(), onTypeBinding), this.arguments);
binding.parameters = AstUtil.insert(onTypeBinding, binding.parameters);
-
+
// If the inserted argument is a generic type, we should include the associated type variables to ensure
// the generated signature is correct (it will be checked by eclipse when this type is consumed in binary form).
TypeVariableBinding onTypeTVBs[] = onTypeBinding.typeVariables();
@@ -338,7 +338,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
}
}
}
- classFile.completeCodeAttribute(codeAttributeOffset);
+ classFile.completeCodeAttribute(codeAttributeOffset,scope);
attributeNumber++;
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber);
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
index bcb2a4c97..0f131c62e 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * 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
+ * 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
* ******************************************************************/
package org.aspectj.ajdt.internal.compiler.lookup;
@@ -18,8 +18,8 @@ import java.util.Map;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PlainPackageBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope;
@@ -48,7 +48,7 @@ public class InterTypeScope extends ClassScope {
public String getAnyAliasForTypeVariableBinding(TypeVariableBinding tvb) {
if (usedAliases == null)
return null;
- return (String) usedAliases.get(tvb);
+ return usedAliases.get(tvb);
}
// this method depends on the fact that BinaryTypeBinding extends SourceTypeBinding
@@ -89,7 +89,7 @@ public class InterTypeScope extends ClassScope {
if (aliased > sourceType.typeVariables.length || sourceType.typeVariables.length == 0) {
TypeVariableBinding tvb = new TypeVariableBinding("fake".toCharArray(), null, 0,this.environment());
tvb.superclass = getJavaLangObject();
- tvb.fPackage = new PackageBinding(environment());
+ tvb.fPackage = new PlainPackageBinding(environment());
return tvb;
// error is going to be reported by someone else!
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java
index e48c6cd0f..2e4001e07 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 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:
* Andy Clement promoted member type from AjState
* ******************************************************************/
package org.aspectj.ajdt.internal.core.builder;
@@ -41,9 +41,9 @@ public class CompactTypeStructureRepresentation implements IBinaryType {
char[] genericSignature;
char[] superclassName;
char[][] interfaces;
-
+
char[] enclosingMethod;
-
+
char[][][] missingTypeNames;
// this is the extra state that enables us to be an IBinaryType
@@ -59,7 +59,7 @@ public class CompactTypeStructureRepresentation implements IBinaryType {
IBinaryNestedType[] memberTypes;
IBinaryAnnotation[] annotations;
IBinaryTypeAnnotation[] typeAnnotations;
-
+
public CompactTypeStructureRepresentation(ClassFileReader cfr, boolean isAspect) {
@@ -103,7 +103,7 @@ public class CompactTypeStructureRepresentation implements IBinaryType {
public char[][][] getMissingTypeNames() {
return missingTypeNames;
}
-
+
public char[] getEnclosingTypeName() {
return enclosingTypeName;
}
@@ -115,7 +115,7 @@ public class CompactTypeStructureRepresentation implements IBinaryType {
public char[] getGenericSignature() {
return genericSignature;
}
-
+
public char[] getEnclosingMethod() {
return enclosingMethod;
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java
index b3cb0e2d1..97284639a 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2002 IBM and other 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:
* Palo Alto Research Center, Incorporated (PARC)
* Andy Clement
* ******************************************************************/
@@ -63,9 +63,9 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment {
return new NameEnvironmentAnswer(seenOnPreviousBuild, null);
}
if (this.inflatedClassFilesCache.containsKey(name)) {
- return (NameEnvironmentAnswer) this.inflatedClassFilesCache.get(name);
+ return this.inflatedClassFilesCache.get(name);
} else {
- File fileOnDisk = (File) classesFromName.get(name);
+ File fileOnDisk = classesFromName.get(name);
// System.err.println("find: " + name + " found: " + cf);
if (fileOnDisk == null) {
return null;
@@ -91,7 +91,7 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment {
this.classesFromName = Collections.emptyMap();
this.packageNames.clear();
}
-
+
@Override
public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) {
NameEnvironmentAnswer ret = findType(new String(CharOperation.concatWith(packageName, typeName, '.')));
@@ -140,10 +140,6 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment {
return baseEnvironment.findType(typeName, packageName, moduleName);
}
- @Override
- public char[][] getModulesDeclaringPackage(char[][] parentPackageName, char[] name, char[] moduleName) {
- return baseEnvironment.getModulesDeclaringPackage(parentPackageName, name, moduleName);
- }
@Override
public boolean hasCompilationUnit(char[][] qualifiedPackageName, char[] moduleName, boolean checkCUs) {
@@ -160,4 +156,14 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment {
return baseEnvironment.getAllAutomaticModules();
}
+ @Override
+ public char[][] getModulesDeclaringPackage(char[][] arg0, char[] arg1) {
+ return baseEnvironment.getModulesDeclaringPackage(arg0, arg1);
+ }
+
+ @Override
+ public char[][] listPackages(char[] arg0) {
+ return baseEnvironment.listPackages(arg0);
+ }
+
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjAST.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjAST.java
index 99580a8a6..627922205 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjAST.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjAST.java
@@ -1,11 +1,11 @@
/********************************************************************
- * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
+ * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
* Helen Hawkins - iniital version
*******************************************************************/
package org.aspectj.org.eclipse.jdt.core.dom;
@@ -13,31 +13,28 @@ package org.aspectj.org.eclipse.jdt.core.dom;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.aspectj.org.eclipse.jdt.core.dom.AST;
-import org.aspectj.org.eclipse.jdt.core.dom.BindingResolver;
-import org.aspectj.org.eclipse.jdt.core.dom.DefaultBindingResolver;
public class AjAST extends AST {
/**
* Creates a new AspectJ abstract syntax tree
- * (AST) following the specified set of API rules.
- *
+ * (AST) following the specified set of API rules.
+ *
* @param level the API level; one of the LEVEL constants
* @since 3.0
*/
- private AjAST(int level) {
- super(level);
+ private AjAST(int level,boolean previewEnabled) {
+ super(level,previewEnabled);
}
-
+
/**
* Creates a new AspectJ abstract syntax tree
- * (AST) following the specified set of API rules.
+ * (AST) following the specified set of API rules.
* <p>
* Clients should use this method specifing {@link #JLS3} as the
* AST level in all cases, even when dealing with JDK 1.3 or 1.4..
* </p>
- *
+ *
* @param level the API level; one of the LEVEL constants
* @return new AST instance following the specified set of API rules.
* @exception IllegalArgumentException if:
@@ -46,21 +43,21 @@ public class AjAST extends AST {
* </ul>
* @since 3.0
*/
- public static AjAST newAjAST(int level) {
+ public static AjAST newAjAST(int level,boolean previewEnabled) {
if ((level != AST.JLS2)
&& (level != AST.JLS3)) {
throw new IllegalArgumentException();
}
- return new AjAST(level);
+ return new AjAST(level,previewEnabled);
}
-
+
/**
* Internal method.
* <p>
* This method converts the given internal compiler AST for the given source string
* into a compilation unit. This method is not intended to be called by clients.
* </p>
- *
+ *
* @param level the API level; one of the LEVEL constants
* @param compilationUnitDeclaration an internal AST node for a compilation unit declaration
* @param source the string of the Java compilation unit
@@ -79,12 +76,12 @@ public class AjAST extends AST {
boolean isResolved,
org.aspectj.org.eclipse.jdt.internal.core.CompilationUnit workingCopy,
IProgressMonitor monitor) {
-
- ASTConverter converter =
+
+ ASTConverter converter =
// AspectJ extension - use the factory
- ASTConverter.getASTConverter(options,isResolved,monitor);
+ ASTConverter.getASTConverter(options,isResolved,monitor);
// create a new AjAst - difference between this method in AjAST and AST
- AjAST ast = AjAST.newAjAST(level);
+ AjAST ast = AjAST.newAjAST(level,false);
int savedDefaultNodeFlag = ast.getDefaultNodeFlag();
ast.setDefaultNodeFlag(ASTNode.ORIGINAL);
BindingResolver resolver = null;
@@ -96,17 +93,17 @@ public class AjAST extends AST {
}
ast.setBindingResolver(resolver);
converter.setAST(ast);
-
+
CompilationUnit unit = converter.convert(compilationUnitDeclaration, source);
unit.setLineEndTable(compilationUnitDeclaration.compilationResult.lineSeparatorPositions);
unit.setTypeRoot(workingCopy);
ast.setDefaultNodeFlag(savedDefaultNodeFlag);
return unit;
}
-
+
/**
* Creates an unparented aspect declaration node owned by this AST.
- * The name of the aspect is an unspecified, but legal, name;
+ * The name of the aspect is an unspecified, but legal, name;
* no modifiers; no doc comment; no superclass or superinterfaces;
* an empty body; a null perclause; and is not privileged
* <p>
@@ -117,24 +114,24 @@ public class AjAST extends AST {
* To create a privileged aspect, use this method and then call
* <code>AspectDeclaration.setPrivileged(true)</code>.
* </p>
- *
+ *
* @return a new unparented aspect declaration node
*/
public AspectDeclaration newAspectDeclaration() {
AspectDeclaration result = new AspectDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented ajtype declaration node owned by this AST.
- * The name of the class is an unspecified, but legal, name;
+ * The name of the class is an unspecified, but legal, name;
* no modifiers; no doc comment; no superclass or superinterfaces;
* and an empty body.
* <p>
* To create an aspect, use this method and then call
* <code>AjTypeDeclaration.setAspect(true)</code>.
* </p>
- *
+ *
* @return a new unparented ajtype declaration node
*/
public AjTypeDeclaration newAjTypeDeclaration() {
@@ -144,47 +141,47 @@ public class AjAST extends AST {
/**
* Creates an unparented after advice declaration node owned by this AST.
- * By default, the declaration is for an after advice with no pointcut;
+ * By default, the declaration is for an after advice with no pointcut;
* no doc comment; and no body (as opposed to an empty body).
- *
+ *
* @return a new unparented after advice declaration node
*/
public AfterAdviceDeclaration newAfterAdviceDeclaration() {
AfterAdviceDeclaration result = new AfterAdviceDeclaration(this);
return result;
}
-
+
/**
- * Creates an unparented after returning advice declaration node owned
- * by this AST. By default, the declaration is for an after returning
- * advice with no pointcut; no doc comment; no return value and no
+ * Creates an unparented after returning advice declaration node owned
+ * by this AST. By default, the declaration is for an after returning
+ * advice with no pointcut; no doc comment; no return value and no
* body (as opposed to an empty body).
- *
+ *
* @return a new unparented after returning advice declaration node
*/
public AfterReturningAdviceDeclaration newAfterReturningAdviceDeclaration() {
AfterReturningAdviceDeclaration result = new AfterReturningAdviceDeclaration(this);
return result;
}
-
+
/**
- * Creates an unparented after throwing advice declaration node owned
- * by this AST. By default, the declaration is for an after throwing
- * advice with no pointcut; no doc comment; no throwing value and no
+ * Creates an unparented after throwing advice declaration node owned
+ * by this AST. By default, the declaration is for an after throwing
+ * advice with no pointcut; no doc comment; no throwing value and no
* body (as opposed to an empty body).
- *
+ *
* @return a new unparented after throwing advice declaration node
*/
public AfterThrowingAdviceDeclaration newAfterThrowingAdviceDeclaration() {
AfterThrowingAdviceDeclaration result = new AfterThrowingAdviceDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented before advice declaration node owned by this AST.
- * By default, the declaration is for a before advice with no pointcut;
+ * By default, the declaration is for a before advice with no pointcut;
* no doc comment; and no body (as opposed to an empty body).
- *
+ *
* @return a new unparented before advice declaration node
*/
public BeforeAdviceDeclaration newBeforeAdviceDeclaration() {
@@ -194,21 +191,21 @@ public class AjAST extends AST {
/**
* Creates an unparented around advice declaration node owned by this AST.
- * By default, the declaration is for an around advice with no pointcut;
+ * By default, the declaration is for an around advice with no pointcut;
* no doc comment; no return type; and no body (as opposed to an empty body).
- *
+ *
* @return a new unparented around advice declaration node
*/
public AroundAdviceDeclaration newAroundAdviceDeclaration() {
AroundAdviceDeclaration result = new AroundAdviceDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare at constructor declaration node owned by this AST.
- * By default, the declaration is for a declare annotation with no doc comment;
+ * By default, the declaration is for a declare annotation with no doc comment;
* no pattern node; no annotation name; and no declare kind.
- *
+ *
* @return a new unparented declare at constructor declaration node
* @exception UnsupportedOperationException if this operation is used in
* a JLS2 AST
@@ -217,12 +214,12 @@ public class AjAST extends AST {
DeclareAtConstructorDeclaration result = new DeclareAtConstructorDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare at field declaration node owned by this AST.
- * By default, the declaration is for a declare annotation with no doc comment;
+ * By default, the declaration is for a declare annotation with no doc comment;
* no pattern node; no annotation name; and no declare kind.
- *
+ *
* @return a new unparented declare at field declaration node
* @exception UnsupportedOperationException if this operation is used in
* a JLS2 AST
@@ -231,12 +228,12 @@ public class AjAST extends AST {
DeclareAtFieldDeclaration result = new DeclareAtFieldDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare at method declaration node owned by this AST.
- * By default, the declaration is for a declare annotation with no doc comment;
+ * By default, the declaration is for a declare annotation with no doc comment;
* no pattern node; no annotation name; and no declare kind.
- *
+ *
* @return a new unparented declare at method declaration node
* @exception UnsupportedOperationException if this operation is used in
* a JLS2 AST
@@ -245,12 +242,12 @@ public class AjAST extends AST {
DeclareAtMethodDeclaration result = new DeclareAtMethodDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare at type declaration node owned by this AST.
- * By default, the declaration is for a declare annotation with no doc comment;
+ * By default, the declaration is for a declare annotation with no doc comment;
* no pattern node; no annotation name; and no declare kind.
- *
+ *
* @return a new unparented declare at type declaration node
* @exception UnsupportedOperationException if this operation is used in
* a JLS2 AST
@@ -259,102 +256,102 @@ public class AjAST extends AST {
DeclareAtTypeDeclaration result = new DeclareAtTypeDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare error declaration node owned by this AST.
- * By default, the declaration is for a declare error with no doc comment;
+ * By default, the declaration is for a declare error with no doc comment;
* no pointcut; and no message.
- *
+ *
* @return a new unparented declare error declaration node
*/
public DeclareErrorDeclaration newDeclareErrorDeclaration() {
DeclareErrorDeclaration result = new DeclareErrorDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare parents declaration node owned by this AST.
- * By default, the declaration is for a declare parents which is implements;
+ * By default, the declaration is for a declare parents which is implements;
* with no doc comment; no child type pattern; and no parent type pattern
* <p>
* To create an extends declare parents, use this method and then call
* <code>DeclareParentsDeclaration.setExtends(true)</code>.
* </p>
- *
+ *
* @return a new unparented declare parents declaration node
*/
public DeclareParentsDeclaration newDeclareParentsDeclaration() {
DeclareParentsDeclaration result = new DeclareParentsDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare precedence declaration node owned by this AST.
- * By default, the declaration is for a declare precedence with no doc comment;
+ * By default, the declaration is for a declare precedence with no doc comment;
* and no type pattern list.
- *
+ *
* @return a new unparented declare precedence declaration node
*/
public DeclarePrecedenceDeclaration newDeclarePrecedenceDeclaration() {
DeclarePrecedenceDeclaration result = new DeclarePrecedenceDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare soft declaration node owned by this AST.
- * By default, the declaration is for a declare soft with no doc comment;
+ * By default, the declaration is for a declare soft with no doc comment;
* no pointcut; and no type pattern.
- *
+ *
* @return a new unparented declare soft declaration node
*/
public DeclareSoftDeclaration newDeclareSoftDeclaration() {
DeclareSoftDeclaration result = new DeclareSoftDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented declare warning declaration node owned by this AST.
- * By default, the declaration is for a declare warning with no doc comment;
+ * By default, the declaration is for a declare warning with no doc comment;
* no pointcut; and no message.
- *
+ *
* @return a new unparented declare warning declaration node
*/
public DeclareWarningDeclaration newDeclareWarningDeclaration() {
DeclareWarningDeclaration result = new DeclareWarningDeclaration(this);
return result;
}
-
+
/**
- * Creates a new unparented intertype field declaration node owned by this
- * AST. By default, there are no modifiers, no doc comment, and the base
+ * Creates a new unparented intertype field declaration node owned by this
+ * AST. By default, there are no modifiers, no doc comment, and the base
* type is unspecified (but legal).
- *
+ *
* @return a new unparented intertype field declaration node
*/
public InterTypeFieldDeclaration newInterTypeFieldDeclaration() {
InterTypeFieldDeclaration result = new InterTypeFieldDeclaration(this);
return result;
}
-
+
/**
- * Creates an unparented intertype method declaration node owned by
- * this AST. By default, the declaration is for a method of an
- * unspecified, but legal, name; no modifiers; no doc comment; no
- * parameters; return type void; no extra array dimensions; no
+ * Creates an unparented intertype method declaration node owned by
+ * this AST. By default, the declaration is for a method of an
+ * unspecified, but legal, name; no modifiers; no doc comment; no
+ * parameters; return type void; no extra array dimensions; no
* thrown exceptions; and no body (as opposed to an empty body).
- *
+ *
* @return a new unparented inter type method declaration node
*/
public InterTypeMethodDeclaration newInterTypeMethodDeclaration() {
InterTypeMethodDeclaration result = new InterTypeMethodDeclaration(this);
return result;
}
-
+
/**
* Creates an unparented pointcut declaration node owned by this AST.
- * By default, the declaration is for a pointcut of an unspecified, but
+ * By default, the declaration is for a pointcut of an unspecified, but
* legal, name; no modifiers; no doc comment; and no pointcut designator
- *
+ *
* @return a new unparented pointcut declaration node
*/
public PointcutDeclaration newPointcutDeclaration() {
@@ -366,138 +363,138 @@ public class AjAST extends AST {
* Creates an unparented AndPointcut node owned by this AST.
* By default, the declaration is for an and pointcut with no left
* or right pointcut designators
- *
+ *
* @return a new unparented AndPointcut node
*/
public AndPointcut newAndPointcut() {
AndPointcut result = new AndPointcut(this);
return result;
}
-
+
/**
* Creates an unparented CflowPointcut node owned by this AST.
* By default, the declaration is for a cflow pointcut with no body
* pointcut designator
- *
+ *
* @return a new unparented CflowPointcut node
*/
public CflowPointcut newCflowPointcut() {
CflowPointcut result = new CflowPointcut(this);
return result;
}
-
+
/**
* Creates an unparented NotPointcut node owned by this AST.
* By default, the declaration is for a not pointcut with no body
* pointcut designator
- *
+ *
* @return a new unparented NotPointcut node
*/
public NotPointcut newNotPointcut() {
NotPointcut result = new NotPointcut(this);
return result;
}
-
+
/**
* Creates an unparented OrPointcut node owned by this AST.
* By default, the declaration is for an or pointcut with no left
* or right pointcut designators
- *
+ *
* @return a new unparented OrPointcut node
*/
public OrPointcut newOrPointcut() {
OrPointcut result = new OrPointcut(this);
return result;
}
-
+
/**
* Creates an unparented PerCflow node owned by this AST.
* By default, the declaration is for a percflow with no body
* pointcut designator
- *
+ *
* @return a new unparented percflow node
*/
public PerCflow newPerCflow() {
PerCflow result = new PerCflow(this);
return result;
}
-
+
/**
* Creates an unparented perobject node owned by this AST.
* By default, the declaration is for a perobject with no body
* pointcut designator
- *
+ *
* @return a new unparented perobject node
*/
public PerObject newPerObject() {
PerObject result = new PerObject(this);
return result;
}
-
+
/**
* Creates an unparented pertypewithin node owned by this AST.
* By default, the declaration is for a pertypewithin
- *
+ *
* @return a new unparented pertypewithin node
*/
public PerTypeWithin newPerTypeWithin() {
PerTypeWithin result = new PerTypeWithin(this);
return result;
}
-
+
/**
* Creates an unparented reference pointcut node owned by this AST.
- * By default, the declaration is for a reference pointcut with no
+ * By default, the declaration is for a reference pointcut with no
* name
- *
+ *
* @return a new unparented reference pointcut node
*/
public ReferencePointcut newReferencePointcut() {
ReferencePointcut result = new ReferencePointcut(this);
return result;
}
-
+
/**
* Creates an unparented default pointcut node owned by this AST.
- * By default, the declaration is for a default pointcut with an
+ * By default, the declaration is for a default pointcut with an
* empty detail string.
* <p>
* To edit the detail string, use this method and then call
* <code>DefaultPointcut.setDetail("newString")</code>.
* </p>
- *
+ *
* @return a new unparented default pointcut node
*/
public DefaultPointcut newDefaultPointcut() {
DefaultPointcut result = new DefaultPointcut(this,"");
return result;
}
-
+
/**
* Creates an unparented default type pattern node owned by this AST.
- * By default, the declaration is for a default type pattern with an
+ * By default, the declaration is for a default type pattern with an
* empty detail string.
* <p>
* To edit the detail string, use this method and then call
* <code>DefaultTypePattern.setDetail("newString")</code>.
* </p>
- *
+ *
* @return a new unparented default type pattern node
*/
public DefaultTypePattern newDefaultTypePattern() {
DefaultTypePattern result = new DefaultTypePattern(this,"");
return result;
}
-
+
/**
* Creates an unparented default signature pattern node owned by this AST.
- * By default, the declaration is for a default signature pattern with an
+ * By default, the declaration is for a default signature pattern with an
* empty detail string.
* <p>
* To edit the detail string, use this method and then call
* <code>SignaturePattern.setDetail("newString")</code>.
* </p>
- *
+ *
* @return a new unparented default signature pattern node
*/
public SignaturePattern newSignaturePattern() {
diff --git a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/ajdt/ajc/messages.properties b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/ajdt/ajc/messages.properties
index daf511f9d..24b95f854 100644
--- a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/ajdt/ajc/messages.properties
+++ b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/ajdt/ajc/messages.properties
@@ -5,7 +5,7 @@
org/aspectj/weaver/XlintDefault.properties for the default behavior and a template to copy.
### AspectJ-specific messages
compiler.name = AspectJ Compiler
-compiler.version = Eclipse Compiler #a9ab0710a01b2b(28-Mar-2019), 3.18
+compiler.version = Eclipse Compiler 3106c52cb89aa (29Oct2019) - Java13
compiler.copyright =
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java
index ced2ecd8f..96e71cb7e 100644
--- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java
+++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java
@@ -1,11 +1,11 @@
/********************************************************************
- * Copyright (c) 2006, 2010 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://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
+ * Copyright (c) 2006, 2010 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://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
* Helen Hawkins - initial version
*******************************************************************/
package org.aspectj.tools.ajc;
@@ -15,6 +15,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.aspectj.org.eclipse.jdt.core.SourceRange;
import org.aspectj.org.eclipse.jdt.core.dom.AST;
import org.aspectj.org.eclipse.jdt.core.dom.ASTNode;
import org.aspectj.org.eclipse.jdt.core.dom.ASTParser;
@@ -74,15 +75,14 @@ import org.aspectj.org.eclipse.jdt.core.dom.Type;
import org.aspectj.org.eclipse.jdt.core.dom.TypeCategoryTypePattern;
import org.aspectj.org.eclipse.jdt.core.dom.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.core.dom.TypePattern;
-import org.aspectj.org.eclipse.jdt.core.SourceRange;
/**
* For each AspectJ ASTNode there is a test for:
- *
+ *
* - that a new instance can be created via ajast.newXXX() - that the property descriptors have been set correctly - that the
* get/set methods for the different properties work as expected - that the clone0 method sets the correct properties - that the
* internalStructuralPropertiesForType(int) and internalGetSetXXXProperty(..) methods have been implemented correctly
- *
+ *
* These are all that is required for an ASTNode, except an implementation of the accept0() method which is tested in
* ASTVisitorTest.
*/
@@ -1660,24 +1660,24 @@ public class AjASTTest extends AjASTTestCase {
public void testDeclareParents() {
checkJLS3("class A{}class B{}aspect C {declare parents : A extends B;}", 28, 29);
}
-
-
+
+
/*
- *
- *
+ *
+ *
* START: Test TypePattern nodes introduced in Bugzilla 329268.
- *
- *
+ *
+ *
*/
-
+
public void testDeclareParentsTypePatternNodeSource() {
checkTypePatternSourceRangesJLS3("class A{}class B{}aspect C {declare parents : A extends B;}", new int[][] {{46, 1} , {56, 1 }});
}
-
+
public void testDeclareParentsAnySource() {
checkTypePatternSourceRangesJLS3("class A{}class B{}aspect C {declare parents : * extends B;}", new int[][] {{46, 1} , {56, 1 }});
}
-
+
public void testDeclareParentsAndSource() {
checkTypePatternSourceRangesJLS3(
@@ -1690,7 +1690,7 @@ public class AjASTTest extends AjASTTestCase {
{ 84, 1 } // E
});
}
-
+
public void testDeclareParentsNotSource() {
checkTypePatternSourceRangesJLS3(
@@ -1702,7 +1702,7 @@ public class AjASTTest extends AjASTTestCase {
{ 80, 1 } // E
});
}
-
+
public void testDeclareParentsOrSource() {
checkTypePatternSourceRangesJLS3(
"class A{}class B{}class D{}class E{}aspect C {declare parents : A || B || D extends E;}",
@@ -1714,16 +1714,16 @@ public class AjASTTest extends AjASTTestCase {
{ 84, 1 } // E
});
}
-
+
public void testDeclareParentsAnyWithAnnotationSource() {
checkTypePatternSourceRangesJLS3(
"@interface AnnotationT {}class E{}aspect C {declare parents : (@AnnotationT *) extends E;}",
new int[][] { { 62, 16 },// (@AnnotationT *)
{ 87, 1 } // E
});
-
+
}
-
+
public void testDeclareParentsTypeCategorySource() {
checkTypePatternSourceRangesJLS3(
"class A{}class E{}aspect C {declare parents : A && is(ClassType) extends E;}",
@@ -1789,16 +1789,16 @@ public class AjASTTest extends AjASTTestCase {
"class B{}class E{}aspect C {declare parents : B && !is(EnumType) extends E;}",
TypeCategoryTypePattern.ENUM, "is(EnumType)");
}
-
+
/*
- *
- *
+ *
+ *
* END: Test TypePattern nodes introduced in Bugzilla 329268.
- *
- *
+ *
+ *
*/
-
-
+
+
public void testDeclareWarning() {
checkJLS3("aspect A {pointcut a();declare warning: a(): \"error\";}", 23, 30);
}
@@ -1820,21 +1820,22 @@ public class AjASTTest extends AjASTTestCase {
public void testJavadocCommentForDeclareExists_pr150467() {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource("aspect X {/** I have a doc comment */declare parents : Y implements Z;}".toCharArray());
- parser.setCompilerOptions(Collections.EMPTY_MAP);
+ //parser.setSource("aspect X {/** I have a doc comment */public void foo() {}}".toCharArray());
+ parser.setCompilerOptions(Collections.emptyMap());
parser.setKind(ASTParser.K_COMPILATION_UNIT);
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
- Javadoc javadoc = ((DeclareParentsDeclaration) ((TypeDeclaration) cu.types().get(0)).bodyDeclarations().get(0))
- .getJavadoc();
+ //Javadoc javadoc = ((MethodDeclaration) ((TypeDeclaration) cu.types().get(0)).bodyDeclarations().get(0)).getJavadoc();
+ Javadoc javadoc = ((DeclareParentsDeclaration) ((TypeDeclaration) cu.types().get(0)).bodyDeclarations().get(0)).getJavadoc();
assertNull("expected the doc comment node to be null but it wasn't", javadoc);
assertEquals("expected there to be one comment but found " + cu.getCommentList().size(), 1, cu.getCommentList().size());
}
-
+
protected void assertExpression(String expectedExpression, TypePattern node) {
assertTrue("Expected: " + expectedExpression + ". Actual: " + node.getTypePatternExpression(), node.getTypePatternExpression().equals(expectedExpression));
-
+
}
-
+
protected void assertNodeType(Class<?> expected, TypePattern node) {
assertTrue("Expected " + expected.toString() + ". Actual: " + node.getClass().toString(), node.getClass().equals(expected));
}
@@ -1843,14 +1844,14 @@ public class AjASTTest extends AjASTTestCase {
class TypeCategoryTypeVisitor extends AjASTVisitor {
-
+
private TypeCategoryTypePattern typeCategory = null;
-
+
public boolean visit(TypeCategoryTypePattern node) {
typeCategory = node;
return false;
}
-
+
public TypeCategoryTypePattern getTypeCategoryNode() {
return typeCategory;
}
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
index 8d15cdf8f..45d2f1ad1 100644
--- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
+++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
- * 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:
* Adrian Colyer, Abraham Nevado (lucierna)
* ******************************************************************/
package org.aspectj.tools.ajc;
@@ -47,7 +47,7 @@ import junit.framework.TestCase;
* See the XMLBasedAjcTestCase subclass for TestCase class that can be used to drive compiler tests based on an ajcTests.xml format
* test specification file.
* </p>
- *
+ *
* @see org.aspectj.tools.ajc.AjcTestCase.Message
* @see org.aspectj.tools.ajc.AjcTestCase.MessageSpec
* @see org.aspectj.tools.ajc.AjcTestCase.RunResult
@@ -64,7 +64,7 @@ public abstract class AjcTestCase extends TestCase {
protected Ajc ajc;
// see Ajc and AntSpec
- public static final String DEFAULT_CLASSPATH_ENTRIES =
+ public static final String DEFAULT_CLASSPATH_ENTRIES =
Ajc.outputFolders("bridge","util","loadtime","weaver","asm","testing-client","runtime","org.aspectj.matcher")
// File.pathSeparator + ".." + File.separator + "bridge" + File.separator
// + "bin" + File.pathSeparator + ".." + File.separator + "util" + File.separator + "bin" + File.pathSeparator + ".."
@@ -93,8 +93,8 @@ public abstract class AjcTestCase extends TestCase {
+ "bcel"
+ File.separator
+ "bcel-verifier.jar"
-
- + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "asm" + File.separator + "asm-7.0-beta.renamed.jar"
+
+ + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "asm" + File.separator + "asm-7.2.renamed.jar"
// When the build machine executes the tests, it is using code built into jars rather than code build into
// bin directories. This means for the necessary types to be found we have to put these jars on the classpath:
@@ -128,7 +128,7 @@ public abstract class AjcTestCase extends TestCase {
* <p>
* Message objects are combined in a MessageSpec which can then be passed to the various assertMessage methods.
* </p>
- *
+ *
* @see org.aspectj.tools.ajc.AjcTestCase.MessageSpec
*/
public static class Message {
@@ -324,14 +324,14 @@ public abstract class AjcTestCase extends TestCase {
/**
* Create a message specification to test a CompilationResult for a given set of info, warning, error, and fail messages.
- *
+ *
* @param infos The set of info messages to test for. Specifying a non-null value for this parameter enables info message
* comparison.
* @param warnings The set of warning messages to test for - can pass null to indicate empty set.
* @param errors The set of error messages to test for - can pass null to indicate empty set.
* @param fails The set of fail or abort messages to test for - can pass null to indicate empty set.
*/
- public MessageSpec(List<AjcTestCase.Message> infos, List<AjcTestCase.Message> warnings,
+ public MessageSpec(List<AjcTestCase.Message> infos, List<AjcTestCase.Message> warnings,
List<AjcTestCase.Message> errors, List<AjcTestCase.Message> fails, List<AjcTestCase.Message> weaves) {
if (infos != null) {
this.infos = infos;
@@ -532,7 +532,7 @@ public abstract class AjcTestCase extends TestCase {
/**
* Perform a compilation and return the result.
- *
+ *
* @param baseDir the base directory relative to which all relative paths and directories in the arguments will be interpreted.
* @param args the compiler arguments, as you would specify on the command-line. See the Ajc class for a description of the
* argument processing done in order to run the compilation in a sandbox.
@@ -555,7 +555,7 @@ public abstract class AjcTestCase extends TestCase {
/**
* Indicate whether or not the sandbox should be emptied before the next compile.
- *
+ *
* @see org.aspectj.tools.ajc.Ajc#setShouldEmptySandbox(boolean)
*/
public void setShouldEmptySandbox(boolean empty) {
@@ -582,11 +582,11 @@ public abstract class AjcTestCase extends TestCase {
/**
* Run the given class, and return the result in a RunResult. The program runs with a classpath containing the sandbox
* directory, runtime, testing-client, bridge, and util projects (all used by the Tester class), and any jars in the sandbox.
- *
+ *
* @param args the arguments to pass to the program.
* @param classpath the execution classpath, the sandbox directory, runtime, testing-client, bridge, and util projects will all
* be appended to the classpath, as will any jars in the sandbox.
- * @param runSpec
+ * @param runSpec
*/
public RunResult run(String className, String moduleName, String[] args, String vmargs, final String classpath, String modulepath, boolean useLTW, boolean useFullLTW) {
@@ -615,7 +615,7 @@ public abstract class AjcTestCase extends TestCase {
URLClassLoader sandboxLoader;
ClassLoader parentLoader = getClass().getClassLoader().getParent();
-
+
/* Sandbox -> AspectJ -> Extension -> Bootstrap */
if ( !useFullLTW && useLTW) {
// URLClassLoader testLoader = (URLClassLoader) getClass().getClassLoader();
@@ -633,17 +633,17 @@ public abstract class AjcTestCase extends TestCase {
URL[] sandboxUrls = getURLs(cp.toString());
sandboxLoader = createWeavingClassLoader(sandboxUrls, aspectjLoader);
// sandboxLoader = createWeavingClassLoader(sandboxUrls,testLoader);
- } else if(useFullLTW && useLTW) {
+ } else if(useFullLTW && useLTW) {
if(vmargs == null){
vmargs ="";
}
-
+
File directory = new File (".");
String absPath = directory.getAbsolutePath();
String javaagent= absPath+File.separator+".."+File.separator+"aj-build"+File.separator+"dist"+File.separator+"tools"+File.separator+"lib"+File.separator+"aspectjweaver.jar";
try {
String command ="java " +vmargs+ " -classpath " + cp +" -javaagent:"+javaagent + " " + className ;
-
+
// Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance
ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command));
pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath()));
@@ -651,7 +651,7 @@ public abstract class AjcTestCase extends TestCase {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(exec.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
exec.waitFor();
- lastRunResult = createResultFromBufferReaders(command,stdInput, stdError);
+ lastRunResult = createResultFromBufferReaders(command,stdInput, stdError);
} catch (Exception e) {
System.out.println("Error executing full LTW test: " + e);
e.printStackTrace();
@@ -681,7 +681,7 @@ public abstract class AjcTestCase extends TestCase {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(exec.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
exec.waitFor();
- lastRunResult = createResultFromBufferReaders(command,stdInput, stdError);
+ lastRunResult = createResultFromBufferReaders(command,stdInput, stdError);
} catch (Exception e) {
System.out.println("Error executing module test: " + e);
e.printStackTrace();
@@ -705,7 +705,7 @@ public abstract class AjcTestCase extends TestCase {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(exec.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
exec.waitFor();
- lastRunResult = createResultFromBufferReaders(command,stdInput, stdError);
+ lastRunResult = createResultFromBufferReaders(command,stdInput, stdError);
} catch (Exception e) {
System.out.println("Error executing module test: " + e);
e.printStackTrace();
@@ -718,7 +718,7 @@ public abstract class AjcTestCase extends TestCase {
}
ByteArrayOutputStream baosOut = new ByteArrayOutputStream();
ByteArrayOutputStream baosErr = new ByteArrayOutputStream();
-
+
StringBuffer command = new StringBuffer();
command.append("java -classpath ");
@@ -790,7 +790,7 @@ public abstract class AjcTestCase extends TestCase {
String nextToken =st.nextToken();
arguments.add(nextToken);
}
-
+
return arguments;
}
@@ -799,7 +799,7 @@ public abstract class AjcTestCase extends TestCase {
String line = "";
ByteArrayOutputStream baosOut = new ByteArrayOutputStream();
ByteArrayOutputStream baosErr = new ByteArrayOutputStream();
-
+
PrintWriter stdOutWriter = new PrintWriter(baosOut);
PrintWriter stdErrWriter = new PrintWriter(baosErr);
@@ -814,10 +814,10 @@ public abstract class AjcTestCase extends TestCase {
}
stdErrWriter.flush();
-
+
baosOut.close();
baosErr.close();
-
+
return new RunResult(command.toString(), new String(baosOut.toByteArray()), new String(baosErr.toByteArray()));
}
@@ -902,7 +902,7 @@ public abstract class AjcTestCase extends TestCase {
/**
* Any central pre-processing of args. This supplies aspectjrt.jar if available and classpath not set.
- *
+ *
* @param args the String[] args to fix up
* @return the String[] args to use
*/
@@ -969,7 +969,7 @@ public abstract class AjcTestCase extends TestCase {
/**
* Compare the set of expected messages against the set of actual messages, leaving in missingElements the set of messages that
* were expected but did not occur, and in extraElements the set of messages that occured but were not excpected
- *
+ *
* @param expected the expected messages
* @param actual the actual messages
* @param missingElements the missing messages, when passed in must contain all of the expected messages
@@ -1055,7 +1055,7 @@ public abstract class AjcTestCase extends TestCase {
/*
* (non-Javadoc)
- *
+ *
* @see junit.framework.TestCase#setUp()
*/
@Override
@@ -1066,7 +1066,7 @@ public abstract class AjcTestCase extends TestCase {
/*
* (non-Javadoc)
- *
+ *
* @see junit.framework.TestCase#tearDown()
*/
@Override