aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src
Commit message (Collapse)AuthorAgeFilesLines
* Remove old '.cvsignore' filesAlexander Kriegisch2023-09-271-2/+0
| | | | 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>
* 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>
* Fix #366085 concerning declared annotations with source retentionAlexander Kriegisch2022-12-211-0/+4
| | | | | | | | | | | | | | | See https://bugs.eclipse.org/bugs/show_bug.cgi?id=366085. See https://stackoverflow.com/q/74618269/1082681. The issue described in the Bugzilla issue is about 'declare @type', but similar issues also existed for 'declare @field', 'declare @method', 'declare @constructor'. This fix is rather superficial and leaves things to be desired, because it is rather hacky and simply ignores errors source retention annotation declarations during weaving. A better fix would drop the corresponding declarations while parsing and also issue compiler warnings in each case. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Cleanup redundant null check before instanceofAndrey Turbanov2022-04-172-2/+2
|
* Reduce 'Object' class usageAndrey Turbanov2022-04-152-9/+9
|
* Remove redundant casts after generics updateAndrey Turbanov2022-04-1216-38/+33
|
* Cleanup redundant type casts, due to too weak variable type declarationAndrey Turbanov2022-02-263-20/+8
|
* Improve annotation style if pointcut handlingAndy Clement2022-01-311-6/+32
| | | | | | | | | This fixes: - negating annotation style if() pointcuts doesn't work - annotation style if() pointcut not able to use a binding that is not exposed Fixes #120,#122
* polish - typoAndy Clement2022-01-311-1/+1
|
* Merge pull request #104 from turbanoff/use_generic_instead_of_raw_typesAndy Clement2022-01-1016-36/+36
|\ | | | | Update org.aspectj.matcher code to use generics.
| * Update org.aspectj.matcher code to use generics.Andrey Turbanov2021-11-2016-36/+36
| | | | | | | | Generics make code more type-safe and allows removing ugly type-casts.
* | Reduce empty array allocationsAndrey Turbanov2021-12-1810-21/+19
| |
* | Merge pull request #103 from turbanoff/redundant_boxingAndy Clement2021-12-131-1/+1
|\ \ | | | | | | Cleanup redundant boxing.
| * | Cleanup redundant boxing.Andrey Turbanov2021-11-201-1/+1
| |/ | | | | | | | | Methods Integer.parseInt/Boolean.parseBoolean should be preferred over Integer.valueOf/Boolean.valueOf/ if final result is primitive. They are generally faster and generate less garbage.
* | Replace more usages of StringBuffer with StringBuilderAndrey Turbanov2021-12-051-3/+3
| |
* | Merge pull request #102 from turbanoff/trim_trailing_whitespacesAndy Clement2021-11-302-4/+4
|\ \ | | | | | | Trim trailing whitespaces.
| * | Trim trailing whitespaces.Andrey Turbanov2021-11-202-4/+4
| |/ | | | | | | | | Trailing whitespaces are useless. Most of code-styles forbids them. Most of editors always trim them on save. I propose to clean up project from trailing whitespaces in all java files at once.
* / Replace uses of StringBuffer with StringBuilder.Andrey Turbanov2021-11-2057-102/+102
|/ | | | StringBuffer is a legacy synchronized class. StringBuilder is a direct replacement to StringBuffer which generally have better performance.
* Upgrade license from CPLv1/EPLv1 to EPLv2Alexander Kriegisch2021-06-04284-2576/+2576
| | | | | | | This was required by the Eclipse team as one precondition for the next release. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix some deprecated Java and JUnit warnings by using newer API callsAlexander Kriegisch2021-03-216-11/+19
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Strip down compiler messages to AspectJ-specific onesAlexander Kriegisch2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | Delete all properties from messages_aspectj.properties which were just copied from Eclipse and basically the same. This not only gets rid of duplicates but also eliminates differences found between upstream and AspectJ strings which were just cause by errors or oversights during manual upgrade. TODO: - Find a way to print the '-X' options as info instead of yielding 'abort', making it seem as if compilation failed and print the usage message to stdErr instead of stdOut. - Eclipse also has misc.usage.warn, not just misc.usage, i.e. usage info specifically for warning options. Make sure that AspectJ uses it consistently. - Find a way to merge AspectJ-specific options into the standard Eclipse usage text instead of completely replacing it, further reducing the need to merge and copy upstream content. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix javadoc references to nonexistent fields, classes, or packagesJerry James2020-09-145-11/+11
|
* Fix misplaced or incorrect javadoc tagsJerry James2020-09-1412-26/+21
|
* Fix misplaced or incorrectly nested HTML tagsJerry James2020-09-148-25/+24
|
* Fix incorrect HTML entities in javadoc commentsJerry James2020-09-1418-48/+48
|
* Remove unnecessary interface modifiersLars Grefer2020-08-1722-388/+388
| | | | Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* polishAndy Clement2020-08-161-7/+6
|
* Merge branch 'master' into feature/collection-performanceAndy Clement2020-08-1516-18/+0
|\
| * Cleanup unused importsLars Grefer2020-08-1616-18/+0
| | | | | | | | Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Weaken Collection declarationsLars Grefer2020-08-152-4/+4
| | | | | | | | | | | | Reports on declarations of Collection variables made by using the collection class as the type, rather than an appropriate interface. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Redundant Collection.addAll() callLars Grefer2020-08-152-4/+2
| | | | | | | | | | | | Reports Collection.addAll() and Map.putAll() calls after instantiation of a collection using a constructor call without arguments. Such constructs can be replaced with a single call to a parametrized constructor which simplifies code. Also for some collections the replacement might be more performant. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Collection.toArray() call styleLars Grefer2020-08-159-12/+12
| | | | | | | | | | | | | | There are two styles to convert a collection to an array: either using a pre-sized array (like c.toArray(new String[c.size()])) or using an empty array (like c.toArray(new String[0]). In older Java versions using pre-sized array was recommended, as the reflection call which is necessary to create an array of proper size was quite slow. However since late updates of OpenJDK 6 this call was intrinsified, making the performance of the empty array version the same and sometimes even better, compared to the pre-sized version. Also passing pre-sized array is dangerous for a concurrent or synchronized collection as a data race is possible between the size and toArray call which may result in extra nulls at the end of the array, if the collection was concurrently shrunk during the operation. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Manual array copyLars Grefer2020-08-153-9/+3
| | | | | | | | | | | | Reports the manual copying of array contents which may be replaced by calls to System.arraycopy(). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Manual array to collection copyLars Grefer2020-08-151-6/+3
|/ | | | | | Reports the copying of array contents to a collection where each element is added individually using a for loop. Such constructs may be replaced by a call to Collection.addAll(Arrays.asList()) or Collections.addAll(). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* Remove checks for old Java VersionsLars Grefer2020-08-135-62/+39
| | | | Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* Use the diamond operator where possibleLars Grefer2020-08-1351-197/+197
| | | | Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* Merge branch 'master' into feature/java5Andy Clement2020-08-121-13/+33
|\