aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
Commit message (Collapse)AuthorAgeFilesLines
* Minor code cosmeticsAlexander Kriegisch2024-04-131-6/+4
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Further streamline BCExceptionAlexander Kriegisch2024-04-121-40/+6
| | | | | | | | - Improvement: Also add CompilationAndWeavingContext for constructor with causing exception - Remove home-brew stack trace printing, just call super constructors Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Improve stack trace printing in BCExceptionAlexander Kriegisch2024-04-121-7/+10
| | | | | | | | | | | - Bugfix: Flush stream. - Adjust format to more closely resemble JVM format. E.g., do not print the causing exception name twice. - Add TODO, because this whole custom stack trace printing can just go away. The JVM format should do just fine. This commit is merely meant to document the decision to remove the cruft in the next commit. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* New Xlint warning 'arrayCannotBeVoid' when resolving 'void[]'Alexander Kriegisch2024-04-124-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because void arrays are illegal (and nonsensical), now there is a new Xlint warning whenever World.resolve resolves a new 'void[]'. Because in the World class we do not have any source context, no path + line number are logged. The user only sees something like: [warning] arrays cannot have a void type, but found 'void[]' in pointcut [Xlint:arrayCannotBeVoid] Then later, if due to the returned MissingResolvedTypeWithKnownSignature type a joinpoint does not match, there is an additional my/path/MyAspect.aj:42 [warning] advice defined in MyAspect has not been applied [Xlint:adviceDidNotMatch] log line, but not necessarily anywhere near the former one. On the one hand, this is better than nothing. OTOH, comparing the situation with no logging message other than Xlint:adviceDidNotMatch in case of something equally illegal like 'Foo<int>' (primitive generic type parameter), this is actually more than we have in several other situations and might even be regarded as superfluous. In case of multiple 'void[]' cases within a big number of aspects, the same aspect or even the same pointcut, the user would have no clue where exactly to search for it. He would just see multiple log messages without source context. One option would be to set 'arrayCannotBeVoid=ignore' in XlintDefault.properties, so the user would have to explicitly activate it. But IMO, this message should be visible by default. Another option would be to find out how to defer logging the messages until later similarly to BcelWeaver.warnOnUnmatchedAdvice and then to bulk-print them. But in order to achieve that, the information about the existence of any 'void[]' occurrences would have to be stored in a flag similar to BcelAdvice.hasMatchedAtLeastOnce, bloating BcelAdvice for that rare case. Alternatively, each advice pointcut could be heuristically scanned for the literal substring 'void[]', logging the Xlint message if it is found anywhere. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* UnresolvedType.signatureToName: fix '*' case for generic type '?'Alexander Kriegisch2024-04-121-1/+1
| | | | | | | | | | | | | | | | | | In generic type lists, after a '*' in any type parameter list, sometimes the '*' (which should be converted to '?') itself and always the subsequent parameters would be missing from the signature: - '[Pjava/util/Collection<*>;' yielded 'java.util.Collection<>[]', but should be 'java.util.Collection<?>[]' - '[Pjava/util/Map<*Pjava/util/List<[Ljava/lang/Integer;>;>;' yielded 'java.util.Map<?>[]', but should be 'java.util.Map<?,java.util.List<java.lang.Integer[]>>[]' This is now fixed. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* WildTypePattern: match generic type params correctly for array typesAlexander Kriegisch2024-04-121-1/+8
| | | | | | | For array reference types, match type parameters on component type, not on array type itself. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* WildTypePattern.toString: do not parenthesesise generic type listAlexander Kriegisch2024-04-121-1/+1
| | | | | | | | | | | It is unnecessary to represent a pattern list 'A,B,C' as '(A,B,C)'. Not only does it look ugly in a type signature like 'org.acme.Foo<(A,B,C)>', but also is it not valid Java syntax. While the latter might not be strictly necessary in a String representation, it certainly is desirable, if such representations are ever used to generate code or @AspectJ pointcut annotations. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* SignaturePattern.TypePatternVisitor: remove redundant visit methodAlexander Kriegisch2024-04-121-6/+0
| | | | | | | | | Method visit(WildAnnotationTypePattern, Object) used to descend into node.getTypePattern().accept(this, data), which since commit 6585b9ef46 is unnecessary, because WildAnnotationTypePattern::traverse already traverses its type pattern. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* SignaturePattern: minor structural refactoringAlexander Kriegisch2024-04-121-37/+37
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* SignaturePattern: Add exception for meta annotationsAlexander Kriegisch2024-04-121-19/+19
| | | | | | | | | | | | | Upon meta annotation usage in signature patterns, lint warnings like the following were issued during type parameter traversal: does not match because annotation @java.lang.annotation.Inherited has @Target{ElementType.ANNOTATION_TYPE} [Xlint:unmatchedTargetKind] To avoid this, we now heuristically check if we are in a meta annotation situation and, if so, permit it. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Lint: minor structural refactoringAlexander Kriegisch2024-04-121-56/+36
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* UnresolvedType: fix JVM signature conversionAlexander Kriegisch2024-04-122-3/+3
| | | | | | | | | | | | | Fixes #211. Previously, '?' was not converted to '*' in UnresolvedType.nameToSignature, but kept as-is. That is why - falsely - it was necessary to handle the '?' case in UnresolvedType.forSignature at all, reading this kind of bogus signature and creating a type for it in TypeFactory.createTypeFromSignature. This, ironically, led to correct JVM generic type signatures containing '*' not being handled at all. The conversion should now work correctly both ways. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Enable type parameter traversal in exact type patternsAlexander Kriegisch2024-04-129-19/+49
| | | | | | Closes #221 Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.23-SNAPSHOTAlexander Kriegisch2024-03-231-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Release AspectJ 1.9.22Alexander Kriegisch2024-03-231-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Remove Apache Commons from 'lib' module, update remaining dependenciesAlexander Kriegisch2024-03-151-1/+1
| | | | | | | | | | | Of beanutils, collections, digester and logging actually only digester and logging are directly used in AspectJ code. Therefore, remove the unused ones and upgrade the remaining libraries' versions to ones which also have source JARs on Maven Central. This makes downloading sources from GitHub and packaging separate commons.jar and commons-src.zip artifacts superfluous. Hence, we can get rid of them completely. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.22-SNAPSHOTAlexander Kriegisch2024-03-131-1/+1
|
* Release AspectJ 1.9.21.2V1_9_21_2Alexander Kriegisch2024-03-131-1/+1
|
* LangUtil: remove methods like 'is11VMOrGreater', 'is1dot5VMOrGreater'Alexander Kriegisch2024-02-193-3/+3
| | | | | | | | | | Replace them by a uniform method 'isVMGreaterOrEqual(double)', also overloaded for int. This gets rid of one 'AspectJ_JDK_Update' tag. One less place to check and update with each newly supported Java version. :-) Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Globally replace "http:" by "https:" in non-XML filesAlexander Kriegisch2024-02-151-1/+1
| | | | | | | | | Maybe, the XML files and Maven wrapper files will follow. First, let us find out if this breaks the build, maybe some tests are asserting on "http:". But there, the replacement would also have taken place, so probably it just works. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Replace links to https://www.eclipse.org/aspectj/doc/nextAlexander Kriegisch2024-02-151-4/+4
| | | | | | | This part of the website is outdated and will be deleted. Instead, link to ADOCs right in the GitHub repository. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.22-SNAPSHOTAlexander Kriegisch2024-02-141-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Release 1.9.21.1V1_9_21_1Alexander Kriegisch2024-02-141-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Globally replace HTTP links to eclipse.org by HTTPSAlexander Kriegisch2024-01-061-4/+4
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.21.1-SNAPSHOTAlexander Kriegisch2023-12-151-1/+1
| | | | | | | Currently, the situation looks more like a Java 21 maintenance release than directly a Java 22 release. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.22-SNAPSHOTAlexander Kriegisch2023-12-111-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Release AspectJ 1.9.21V1_9_21Alexander Kriegisch2023-12-111-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.21-SNAPSHOT againAlexander Kriegisch2023-12-021-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Release candidate 1.9.21.RC1V1_9_21_RC1Alexander Kriegisch2023-12-021-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version 1.9.21-SNAPSHOTAlexander Kriegisch2023-11-191-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Release milestone 1.9.21.M1V1_9_21_M1Alexander Kriegisch2023-11-191-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Remove old '.cvsignore' filesAlexander Kriegisch2023-09-271-2/+0
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.21-SNAPSHOTAlexander Kriegisch2023-09-041-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* AspectJ release 1.9.20.1Alexander Kriegisch2023-09-041-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* NotTypePattern: Fix matching problem for negated type patternsAlexander Kriegisch2023-08-231-1/+6
| | | | | | | | | | | | | | | The implementation for boolean matchesArray(UnresolvedType type) was buggy. '!String' should match anything but String, no matter if it is an array or not, e.g. int, void, int[], String[], String[][]. '!String[]' should match anything but String[], no matter if it is an array or not, e.g. int, void, int[], String, String[][]. Fixes #257. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix Spring issue 27761Alexander Kriegisch2023-08-211-1/+1
| | | | | | | | | | Fixes spring-projects/spring-framework#27761. Fixes #256. Bridge methods are now ignored in favour of their overriding namesakes during method matching. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Set version to 1.9.21-SNAPSHOTAlexander Kriegisch2023-08-161-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Release 1.9.20V1_9_20Alexander Kriegisch2023-08-161-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add method ArrayReferenceType.equals to fix failing testsAlexander Kriegisch2023-06-261-0/+8
| | | | | | | | | | | This also fixes a bug. Previously, ResolvedType.equals was used for equality check, and in there is a '==' comparison, which does not work for two different ArrayReferenceType instances, even if the component type is the same. Relates to #246. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add null checks for Shadow.getResolvedSignature()Alexander Kriegisch2023-06-131-3/+5
| | | | | | Fixes #243. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add safeguards for And/Or/Not pattern node typesAlexander Kriegisch2023-01-299-15/+30
| | | | | | | | Affects *PointCut, *TypePattern, *AnnotationTypePattern. Relates to #215. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add traverse methods for declare and pattern typesAlexander Kriegisch2023-01-2911-4/+86
| | | | | | Relates to #215. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add traverse methods for pointcut typesAlexander Kriegisch2023-01-2916-0/+130
| | | | | | Relates to #215. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix PointcutRewriterTest, add LogicalPointcutStructure test helper classAlexander Kriegisch2023-01-152-169/+360
| | | | | | | | | | | | | | | | | | | | | | | | | | | After WildTypePattern.hashCode was fixed in the previous commit, PointcutRewriterTest started failing, because in many places it was falsely relying on a specific order of hash codes, which cannot be guaranteed, especially since more instance fields are part of the hash code now in accordance with 'equals'. The new test helper class LogicalPointcutStructure is able to recognise chained '&&' and '||' pointcuts of the same logical nesting level, un-nesting them from the actual pointcut structure and making them comparable, disregarding their order. I.e., something like ((A && B) && C) && D is actually recognised to logically be A && B && C && D and equivalent to e.g. either of D && B && A && C A && B && D && C C && A && D && B This helps to compare rewritten pointcuts, as long as their logical structure has not been altered. Relates to #24. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* WildTypePattern: fix hashCode and toString methodsAlexander Kriegisch2023-01-151-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | Especially 'hashCode' did not correspond to 'equals', disregarding several fields, array dimension information being only one of them. This led to parts of pointcuts being ignored, because they were regarded as duplicates. Example: execution(Foo* *(..)) && !execution(Foo*[] *(..)) Here, the negated pattern was falsely regarded as equal to the first pattern, leading to an "A && !A" situation, i.e. no match at all. Furthermore, 'toString' did not print array strings, i.e. instead of "Foo*[][]" something like "Foo*" was printed. This false information was also present in annotations generated by the weaver. FuzzilyMatchingAspect was adjusted to actually match exactly once, as expected, for the "Foo*" return types, i.e. exclusions for the array return types have been added. Relates to #24. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Improve array matching for all TypePattern subclassesAlexander Kriegisch2023-01-1513-19/+62
| | | | | | Relates to #24. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Handle one- and multi-dimensional array return types correctlyAlexander Kriegisch2023-01-155-6/+33
| | | | | | | | | | Fixes https://github.com/eclipse/org.aspectj/issues/24, both the array return type matching as such as well as matching dimensionality patterns correctly. E.g., 'Foo*[]' is not the same as 'Foo*[][]'. This also works correctly in combination with asterisks, even for primitive types, i.e. 'in*[][]' correctly matches a 2-dimensional array of 'int'. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Simplify if-else in WildTypePattern.matchesExactlyByNameAlexander Kriegisch2023-01-151-5/+1
| | | | | | | | | A simple boolean condition is enough. Loosely relates to https://github.com/eclipse/org.aspectj/issues/24, but actually it is just drive-by cosmetics. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix WildTypePattern.isArrayAlexander Kriegisch2023-01-151-1/+1
| | | | | | | | | The method falsely determined that a one-dimensional array was not an array due to a one-off bug. Relates to https://github.com/eclipse/org.aspectj/issues/24. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Improve code and documentation for #366085 fixAlexander Kriegisch2022-12-281-39/+52
| | | | | | | | | | | This commit is a follow-up for 65f1ec72. The SOURCE retention case is documented now and considered in a few more call sites. The previously already similar code structures in - DeclareAnnotation.ensureAnnotationDiscovered, - DeclareAnnotation.getAnnotationType have both been streamlined and still remain logically in sync. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>